-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added version-specific OpenSearchWorkCoordinators
Signed-off-by: Chris Helma <[email protected]>
- Loading branch information
Showing
11 changed files
with
302 additions
and
88 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
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
90 changes: 90 additions & 0 deletions
90
...org/opensearch/migrations/bulkload/version_os_2_11/OpenSearchWorkCoordinator_OS_2_11.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,90 @@ | ||
package org.opensearch.migrations.bulkload.version_os_2_11; | ||
|
||
import java.time.Clock; | ||
import java.util.function.Consumer; | ||
|
||
import org.opensearch.migrations.bulkload.workcoordination.AbstractedHttpClient; | ||
import org.opensearch.migrations.bulkload.workcoordination.OpenSearchWorkCoordinator; | ||
|
||
import com.fasterxml.jackson.databind.JsonNode; | ||
|
||
public class OpenSearchWorkCoordinator_OS_2_11 extends OpenSearchWorkCoordinator { | ||
public OpenSearchWorkCoordinator_OS_2_11( | ||
AbstractedHttpClient httpClient, | ||
long tolerableClientServerClockDifferenceSeconds, | ||
String workerId | ||
) { | ||
super(httpClient, tolerableClientServerClockDifferenceSeconds, workerId); | ||
} | ||
|
||
public OpenSearchWorkCoordinator_OS_2_11( | ||
AbstractedHttpClient httpClient, | ||
long tolerableClientServerClockDifferenceSeconds, | ||
String workerId, | ||
Clock clock | ||
) { | ||
super(httpClient, tolerableClientServerClockDifferenceSeconds, workerId, clock); | ||
} | ||
|
||
|
||
public OpenSearchWorkCoordinator_OS_2_11( | ||
AbstractedHttpClient httpClient, | ||
long tolerableClientServerClockDifferenceSeconds, | ||
String workerId, | ||
Clock clock, | ||
Consumer<WorkItemAndDuration> workItemConsumer | ||
) { | ||
super(httpClient, tolerableClientServerClockDifferenceSeconds, workerId, clock, workItemConsumer); | ||
} | ||
|
||
protected String getCoordinationIndexSettingsBody(){ | ||
return "{\n" | ||
+ " \"settings\": {\n" | ||
+ " \"index\": {" | ||
+ " \"number_of_shards\": 1,\n" | ||
+ " \"number_of_replicas\": 1\n" | ||
+ " }\n" | ||
+ " },\n" | ||
+ " \"mappings\": {\n" | ||
+ " \"properties\": {\n" | ||
+ " \"" + EXPIRATION_FIELD_NAME + "\": {\n" | ||
+ " \"type\": \"long\"\n" | ||
+ " },\n" | ||
+ " \"" + COMPLETED_AT_FIELD_NAME + "\": {\n" | ||
+ " \"type\": \"long\"\n" | ||
+ " },\n" | ||
+ " \"leaseHolderId\": {\n" | ||
+ " \"type\": \"keyword\",\n" | ||
+ " \"norms\": false\n" | ||
+ " },\n" | ||
+ " \"status\": {\n" | ||
+ " \"type\": \"keyword\",\n" | ||
+ " \"norms\": false\n" | ||
+ " },\n" | ||
+ " \"" + SUCCESSOR_ITEMS_FIELD_NAME + "\": {\n" | ||
+ " \"type\": \"keyword\",\n" | ||
+ " \"norms\": false\n" | ||
+ " }\n" | ||
+ " }\n" | ||
+ " }\n" | ||
+ "}\n"; | ||
} | ||
|
||
protected String getPathForUpdates(String workItemId) { | ||
return INDEX_NAME + "/_update/" + workItemId; | ||
} | ||
|
||
protected String getPathForGets(String workItemId) { | ||
return INDEX_NAME + "/_doc/" + workItemId; | ||
} | ||
|
||
protected String getPathForSearches() { | ||
return INDEX_NAME + "/_search"; | ||
} | ||
|
||
protected int getTotalHitsFromSearchResponse(JsonNode searchResponse) { | ||
return searchResponse.path("hits").path("total").path("value").asInt(); | ||
} | ||
|
||
|
||
} |
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.