Details
Description
In RouterRpcServer, getListing function is handled as two parts:
- Union all partial listings from destination ns + paths
- Append mount points for the dir to be listed
In the case of large dir which is bigger than DFSConfigKeys.DFS_LIST_LIMIT (with default value 1k), the batch listing will be used and the startAfter will be used to define the boundary of each batch listing. However, step 2 here will add existing mount points, which will mess up with the boundary of the batch, thus making the next batch startAfter wrong.
The initial fix is just to append the mount points when there is no more batch query necessary, but this will break the order of returned entries. Therefore more complex logic is added to make sure the order is kept. At the same time the remainingEntries variable inside DirectoryListing is also updated to include the remaining mount points.