Skip to content

Commit 28f2724

Browse files
committed
Fix cleanup due to bug in Datafusion Reader not releasing catalog snapshot
Signed-off-by: Mohit Godwani <[email protected]>
1 parent ad3eb7c commit 28f2724

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

plugins/engine-datafusion/src/main/java/org/opensearch/datafusion/search/DatafusionReader.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ public void incRef() {
7878
*/
7979
public void decRef() {
8080
readerHandle.close();
81+
if (readerHandle.getRefCount() == 0) {
82+
releaseCatalogSnapshot();
83+
}
8184
}
8285

8386
/**
@@ -91,6 +94,10 @@ public int getRefCount() {
9194
@Override
9295
public void close() {
9396
readerHandle.close();
97+
releaseCatalogSnapshot();
98+
}
99+
100+
private void releaseCatalogSnapshot() {
94101
try {
95102
if (catalogSnapshotRef != null)
96103
catalogSnapshotRef.close();

0 commit comments

Comments
 (0)