Skip to content

Commit

Permalink
Added changelog, updated Integ Test.
Browse files Browse the repository at this point in the history
Signed-off-by: Harsh Jain <harshjai@amazon.com>
  • Loading branch information
Harsh Jain committed Mar 25, 2023
1 parent c13bd58 commit 8cfcbfe
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Add node repurpose command for search nodes ([#6517](https://github.com/opensearch-project/OpenSearch/pull/6517))
- [Segment Replication] Apply backpressure when replicas fall behind ([#6563](https://github.com/opensearch-project/OpenSearch/pull/6563))
- [Segment Replication] Add new cluster setting to set replication strategy by default for all indices in cluster. ([#6791](https://github.com/opensearch-project/OpenSearch/pull/6791))
- [Searchable Snapshot] Deleted the cache path on index deletion. ([#6830](https://github.com/opensearch-project/OpenSearch/pull/6830))

### Dependencies
- Bump `org.apache.logging.log4j:log4j-core` from 2.18.0 to 2.20.0 ([#6490](https://github.com/opensearch-project/OpenSearch/pull/6490))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -559,22 +559,30 @@ public void testCacheFilesAreClosedAfterUse() throws Exception {
// The local cache files should be closed by deleting the restored index
deleteIndicesAndEnsureGreen(client, restoredIndexName);

logger.info("--> validate all the cache files are closed");
logger.info("--> validate all the cache files are closed or cache file path is deleted");
// Get path of cache files
final NodeEnvironment nodeEnv = internalCluster().getInstance(NodeEnvironment.class);
Path fileCachePath = nodeEnv.fileCacheNodePath().fileCachePath;
// Find all the files in the path
try (Stream<Path> paths = Files.walk(fileCachePath)) {
paths.filter(Files::isRegularFile).forEach(path -> {
// Testing moving the file to check the file is closed or not.
try {
Files.move(path, path, StandardCopyOption.REPLACE_EXISTING);
} catch (IOException e) {
fail("No exception is expected. The file can't be moved, so it may not be closed.");
}
});
} catch (NoSuchFileException e) {
logger.debug("--> the path for the cache files doesn't exist");

if (Files.exists(fileCachePath)) {
logger.info("--> cache file path exists");
logger.info("--> validate all the cache files are closed");
// Find all the files in the path
try (Stream<Path> paths = Files.walk(fileCachePath)) {
paths.filter(Files::isRegularFile).forEach(path -> {
logger.info("path " + path);
// Testing moving the file to check the file is closed or not.
try {
Files.move(path, path, StandardCopyOption.REPLACE_EXISTING);
} catch (IOException e) {
fail("No exception is expected. The file can't be moved, so it may not be closed.");
}
});
} catch (NoSuchFileException e) {
logger.debug("--> the path for the cache files doesn't exist");
}
} else {
logger.info("--> validated that the cache file path doesn't exist");
}
}
}

0 comments on commit 8cfcbfe

Please sign in to comment.