-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Snapshot Interop] Add Logic in Lock Manager to cleanup stale data po…
…st index deletion. Signed-off-by: Harish Bhakuni <[email protected]>
- Loading branch information
Harish Bhakuni
committed
Jul 21, 2023
1 parent
1d3b006
commit 3798261
Showing
7 changed files
with
301 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
...rc/main/java/org/opensearch/index/store/lockmanager/LockManagerForClusterManagerNode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.index.store.lockmanager; | ||
|
||
import org.opensearch.index.store.RemoteBufferedOutputDirectory; | ||
import org.opensearch.index.store.RemoteSegmentStoreDirectory; | ||
import org.opensearch.threadpool.ThreadPool; | ||
|
||
import java.io.IOException; | ||
|
||
public class LockManagerForClusterManagerNode extends RemoteStoreMetadataLockManager { | ||
private final RemoteBufferedOutputDirectory dataDirectory; | ||
private final RemoteBufferedOutputDirectory mdDirectory; | ||
private final ThreadPool threadPool; | ||
|
||
public LockManagerForClusterManagerNode( | ||
RemoteBufferedOutputDirectory dataDirectory, | ||
RemoteBufferedOutputDirectory mdDirectory, | ||
RemoteBufferedOutputDirectory lockDirectory, | ||
ThreadPool threadPool | ||
) { | ||
super(lockDirectory); | ||
this.mdDirectory = mdDirectory; | ||
this.dataDirectory = dataDirectory; | ||
this.threadPool = threadPool; | ||
} | ||
|
||
/* | ||
*/ | ||
|
||
/** | ||
* releases the lock and cleans up remote store directory if there are no more locks. | ||
* this should be called only once index is deleted. | ||
* see https://github.com/opensearch-project/OpenSearch/issues/8469 | ||
* @param lockInfo lock info instance for which lock need to be removed. | ||
* @throws IOException throws if cleanup or releasing of lock fails. | ||
*/ | ||
@Override | ||
public void releaseAndCleanup(LockInfo lockInfo) throws IOException { | ||
release(lockInfo); | ||
RemoteSegmentStoreDirectory.cleanupPostIndexDeletion(threadPool, dataDirectory, mdDirectory, this); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.