-
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.
Add RecoverySourceHandlerFactory for extensibility
Signed-off-by: Ashish Singh <[email protected]>
- Loading branch information
Showing
8 changed files
with
127 additions
and
23 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
server/src/main/java/org/opensearch/indices/recovery/DefaultRecoverySourceHandler.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,31 @@ | ||
/* | ||
* 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.indices.recovery; | ||
|
||
import org.opensearch.index.shard.IndexShard; | ||
import org.opensearch.threadpool.ThreadPool; | ||
|
||
/** | ||
* This handler is used for the peer recovery when there is no remote store available for segments/translogs. TODO - | ||
* Add more details as this is refactored further. | ||
*/ | ||
public class DefaultRecoverySourceHandler extends RecoverySourceHandler { | ||
|
||
public DefaultRecoverySourceHandler( | ||
IndexShard shard, | ||
RecoveryTargetHandler recoveryTarget, | ||
ThreadPool threadPool, | ||
StartRecoveryRequest request, | ||
int fileChunkSizeInBytes, | ||
int maxConcurrentFileChunks, | ||
int maxConcurrentOperations | ||
) { | ||
super(shard, recoveryTarget, threadPool, request, fileChunkSizeInBytes, maxConcurrentFileChunks, maxConcurrentOperations); | ||
} | ||
} |
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
34 changes: 34 additions & 0 deletions
34
server/src/main/java/org/opensearch/indices/recovery/RecoverySourceHandlerFactory.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,34 @@ | ||
/* | ||
* 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.indices.recovery; | ||
|
||
import org.opensearch.index.shard.IndexShard; | ||
|
||
/** | ||
* Factory that supplies {@link RecoverySourceHandler}. | ||
*/ | ||
public class RecoverySourceHandlerFactory { | ||
|
||
public RecoverySourceHandler create( | ||
IndexShard shard, | ||
RecoveryTargetHandler recoveryTarget, | ||
StartRecoveryRequest request, | ||
RecoverySettings recoverySettings | ||
) { | ||
return new DefaultRecoverySourceHandler( | ||
shard, | ||
recoveryTarget, | ||
shard.getThreadPool(), | ||
request, | ||
Math.toIntExact(recoverySettings.getChunkSize().getBytes()), | ||
recoverySettings.getMaxConcurrentFileChunks(), | ||
recoverySettings.getMaxConcurrentOperations() | ||
); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
...c/main/java/org/opensearch/indices/recovery/remotestore/ReplicaRecoverySourceHandler.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,32 @@ | ||
/* | ||
* 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.indices.recovery.remotestore; | ||
|
||
import org.opensearch.index.shard.IndexShard; | ||
import org.opensearch.indices.recovery.RecoverySourceHandler; | ||
import org.opensearch.indices.recovery.RecoveryTargetHandler; | ||
import org.opensearch.indices.recovery.StartRecoveryRequest; | ||
import org.opensearch.threadpool.ThreadPool; | ||
|
||
/** | ||
* This handler is used when peer recovery target is a remote store enabled replica. | ||
*/ | ||
public class ReplicaRecoverySourceHandler extends RecoverySourceHandler { | ||
public ReplicaRecoverySourceHandler( | ||
IndexShard shard, | ||
RecoveryTargetHandler recoveryTarget, | ||
ThreadPool threadPool, | ||
StartRecoveryRequest request, | ||
int fileChunkSizeInBytes, | ||
int maxConcurrentFileChunks, | ||
int maxConcurrentOperations | ||
) { | ||
super(shard, recoveryTarget, threadPool, request, fileChunkSizeInBytes, maxConcurrentFileChunks, maxConcurrentOperations); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
server/src/main/java/org/opensearch/indices/recovery/remotestore/package-info.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,12 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
/** | ||
* Core classes responsible for handling all recovery of remote store enabled shards | ||
*/ | ||
package org.opensearch.indices.recovery.remotestore; |
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