Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
7f829bf
HDDS-10389
ArafatKhan2198 Feb 18, 2024
1276b14
Added license to the newly added classes
ArafatKhan2198 Feb 18, 2024
9b8b7b7
Removed unecessary instances from injector
ArafatKhan2198 Feb 18, 2024
4f60c61
Fixed checkstyle and findBugs
ArafatKhan2198 Feb 18, 2024
7e0838c
Added prefix based searching for FSO open keys
ArafatKhan2198 Mar 9, 2024
0dacee3
Gave a more structured search response
ArafatKhan2198 Mar 10, 2024
e64ec04
Added flags to include fso and non-fso key list
ArafatKhan2198 Mar 10, 2024
4dec798
Added more UT's
ArafatKhan2198 Mar 12, 2024
2be4136
Fixed the left out review comments
ArafatKhan2198 Mar 13, 2024
bf8e661
Added more changes and newer tests
ArafatKhan2198 Mar 13, 2024
12a540d
Minor changes
ArafatKhan2198 Mar 13, 2024
f692c66
Made review changes
ArafatKhan2198 Mar 17, 2024
61f3725
Did a bit of code refactoring
ArafatKhan2198 Mar 17, 2024
57ccc8e
Made review comments
ArafatKhan2198 Mar 20, 2024
132ed90
Adjusted the exception handling
ArafatKhan2198 Mar 20, 2024
dd61d74
Merge branch 'master' into HDDS-10389
ArafatKhan2198 Apr 30, 2024
fee245e
Removed the volumeID and bucketID initilisation from inside the loop …
ArafatKhan2198 May 6, 2024
9aa436f
Fixed the test cases and added new ones
ArafatKhan2198 May 19, 2024
47d9e7e
Did some refactoring
ArafatKhan2198 May 19, 2024
0eff02a
Merge branch 'master' into HDDS-10389
ArafatKhan2198 May 19, 2024
55f0e9e
Fixed merge conflict
ArafatKhan2198 May 19, 2024
a29befc
Added last key to response and limiting the search starting from Buck…
ArafatKhan2198 May 21, 2024
4ba887f
Fixed checkstyle issues
ArafatKhan2198 May 21, 2024
0999c2a
Added pagination logic
ArafatKhan2198 May 21, 2024
da9c468
Fixed bugs and checkstyle
ArafatKhan2198 May 21, 2024
8b984a2
Fixed checkstyle issues
ArafatKhan2198 May 22, 2024
2a57d5d
Made review comments on excpeitons thrown
ArafatKhan2198 May 27, 2024
80b0b3f
Merge branch 'master' into HDDS-10389
ArafatKhan2198 May 27, 2024
124773f
Added changes to accomodate key level search
ArafatKhan2198 May 28, 2024
55d0f89
Added more tests to the search endpoint and fixes issues with key lev…
ArafatKhan2198 May 29, 2024
ab4e22c
Fixed checksytle issues
ArafatKhan2198 May 30, 2024
2149e09
Fixed javadoc and added one more test case
ArafatKhan2198 May 30, 2024
e6ff273
Improved Java doc
ArafatKhan2198 Jul 16, 2024
4a09ffc
Made changes to javadoc
ArafatKhan2198 Jul 17, 2024
ec272c4
Removed unwanted file
ArafatKhan2198 Jul 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,16 @@ private ReconConstants() {
public static final int DISK_USAGE_TOP_RECORDS_LIMIT = 30;
public static final String DEFAULT_OPEN_KEY_INCLUDE_NON_FSO = "false";
public static final String DEFAULT_OPEN_KEY_INCLUDE_FSO = "false";
public static final String DEFAULT_START_PREFIX = "/";
public static final String DEFAULT_FETCH_COUNT = "1000";
public static final String DEFAULT_KEY_SIZE = "0";
public static final String DEFAULT_BATCH_NUMBER = "1";
public static final String RECON_QUERY_BATCH_PARAM = "batchNum";
public static final String RECON_QUERY_PREVKEY = "prevKey";
public static final String RECON_OPEN_KEY_INCLUDE_NON_FSO = "includeNonFso";
public static final String RECON_OPEN_KEY_INCLUDE_FSO = "includeFso";
public static final String RECON_OPEN_KEY_DEFAULT_SEARCH_LIMIT = "1000";
public static final String RECON_OPEN_KEY_SEARCH_DEFAULT_PREV_KEY = "";
public static final String RECON_QUERY_FILTER = "missingIn";
public static final String PREV_CONTAINER_ID_DEFAULT_VALUE = "0";
public static final String PREV_DELETED_BLOCKS_TRANSACTION_ID_DEFAULT_VALUE =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.TimeZone;
import java.util.Date;
import java.util.Set;
import java.util.ArrayList;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
Expand Down Expand Up @@ -569,6 +570,54 @@ public static long convertToEpochMillis(String dateString, String dateFormat, Ti
}
}

/**
* Finds all subdirectories under a parent directory in an FSO bucket. It builds
* a list of paths for these subdirectories. These sub-directories are then used
* to search for open files in the openFileTable.
*
* How it works:
* - Starts from a parent directory identified by parentId.
* - Looks through all child directories of this parent.
* - For each child, it creates a path that starts with volumeID/bucketID/parentId,
* following our openFileTable format.
* - Adds these paths to a list and explores each child further for more subdirectories.
*
* @param parentId The ID of the parent directory from which to start gathering subdirectories.
* @param subPaths The list to which the paths of subdirectories will be added.
* @param volumeID The ID of the volume containing the parent directory.
* @param bucketID The ID of the bucket containing the parent directory.
* @param reconNamespaceSummaryManager The manager used to retrieve NSSummary objects.
* @throws IOException If an I/O error occurs while fetching NSSummary objects.
*/
public static void gatherSubPaths(long parentId, List<String> subPaths,
long volumeID, long bucketID,
ReconNamespaceSummaryManager reconNamespaceSummaryManager)
throws IOException {
// Fetch the NSSummary object for parentId
NSSummary parentSummary =
reconNamespaceSummaryManager.getNSSummary(parentId);
if (parentSummary == null) {
return;
}

Set<Long> childDirIds = parentSummary.getChildDir();
for (Long childId : childDirIds) {
// Fetch the NSSummary for each child directory
NSSummary childSummary =
reconNamespaceSummaryManager.getNSSummary(childId);
if (childSummary != null) {
String subPath =
ReconUtils.constructObjectPathWithPrefix(volumeID, bucketID,
childId);
// Add to subPaths
subPaths.add(subPath);
// Recurse into this child directory
gatherSubPaths(childId, subPaths, volumeID, bucketID,
reconNamespaceSummaryManager);
}
}
}

/**
* Validates volume or bucket names according to specific rules.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TimeZone;
import java.util.function.Predicate;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -1061,7 +1060,8 @@ public Map<String, OmKeyInfo> searchKeysInFSO(ParamInfo paramInfo)
subPaths.add(startPrefixObjectPath);

// Recursively gather all subpaths
gatherSubPaths(parentId, subPaths, Long.parseLong(names[0]), Long.parseLong(names[1]));
ReconUtils.gatherSubPaths(parentId, subPaths, Long.parseLong(names[0]),
Long.parseLong(names[1]), reconNamespaceSummaryManager);
// Iterate over the subpaths and retrieve the files
for (String subPath : subPaths) {
paramInfo.setStartPrefix(subPath);
Expand All @@ -1082,49 +1082,6 @@ public Map<String, OmKeyInfo> searchKeysInFSO(ParamInfo paramInfo)
return matchedKeys;
}

/**
* Finds all subdirectories under a parent directory in an FSO bucket. It builds
* a list of paths for these subdirectories. These sub-directories are then used
* to search for files in the fileTable.
* <p>
* How it works:
* - Starts from a parent directory identified by parentId.
* - Looks through all child directories of this parent.
* - For each child, it creates a path that starts with volumeID/bucketID/parentId,
* following our fileTable format
* - Adds these paths to a list and explores each child further for more subdirectories.
*
* @param parentId The ID of the directory we start exploring from.
* @param subPaths A list where we collect paths to all subdirectories.
* @param volumeID
* @param bucketID
* @throws IOException If there are problems accessing directory information.
*/
private void gatherSubPaths(long parentId, List<String> subPaths,
long volumeID, long bucketID) throws IOException {
// Fetch the NSSummary object for parentId
NSSummary parentSummary =
reconNamespaceSummaryManager.getNSSummary(parentId);
if (parentSummary == null) {
return;
}

Set<Long> childDirIds = parentSummary.getChildDir();
for (Long childId : childDirIds) {
// Fetch the NSSummary for each child directory
NSSummary childSummary =
reconNamespaceSummaryManager.getNSSummary(childId);
if (childSummary != null) {
String subPath =
ReconUtils.constructObjectPathWithPrefix(volumeID, bucketID, childId);
// Add to subPaths
subPaths.add(subPath);
// Recurse into this child directory
gatherSubPaths(childId, subPaths, volumeID, bucketID);
}
}
}


/**
* Converts a startPrefix path into an objectId path for FSO buckets, using IDs.
Expand Down
Loading