Skip to content

Commit

Permalink
Add CHANGELOG
Browse files Browse the repository at this point in the history
Signed-off-by: Naveen Tatikonda <navtat@amazon.com>
  • Loading branch information
naveentatikonda committed Aug 9, 2023
1 parent cc502fa commit 22f36a3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased 2.x](https://github.com/opensearch-project/k-NN/compare/2.9...2.x)
### Features
* Add Clear Cache API ([#740](https://github.com/opensearch-project/k-NN/pull/740))
### Enhancements
* Enabled the IVF algorithm to work with Filters of K-NN Query. [#1013](https://github.com/opensearch-project/k-NN/pull/1013)
### Bug Fixes
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/org/opensearch/knn/index/KNNIndexShard.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
public class KNNIndexShard {
private IndexShard indexShard;
private NativeMemoryCacheManager nativeMemoryCacheManager;
private static final String INDEX_SHARD_CLEAR_CACHE_SEARCHER = "knn-clear-cache";

private static Logger logger = LogManager.getLogger(KNNIndexShard.class);

Expand Down Expand Up @@ -117,10 +118,11 @@ public void clearCache() {
indexAllocation = indexAllocationOptional.get();
indexAllocation.writeLock();
logger.info("[KNN] Evicting index from cache: [{}]", indexName);
try (Engine.Searcher searcher = indexShard.acquireSearcher("knn-clear-cache")) {
try (Engine.Searcher searcher = indexShard.acquireSearcher(INDEX_SHARD_CLEAR_CACHE_SEARCHER)) {
getAllEnginePaths(searcher.getIndexReader()).forEach((key, value) -> nativeMemoryCacheManager.invalidate(key));
} catch (IOException ex) {
logger.error("[KNN] Failed to evict index from cache: [{}]", indexName);
logger.error(ex.getMessage());
throw new RuntimeException(ex);
} finally {
indexAllocation.writeUnlock();
Expand Down

0 comments on commit 22f36a3

Please sign in to comment.