Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change index setting from read_only_allow_delete to write #311

Merged
merged 1 commit into from
May 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,7 @@ public class GeoIpDataFacade {
private static final Tuple<String, Integer> INDEX_SETTING_REFRESH_INTERVAL = new Tuple<>("index.refresh_interval", -1);
private static final Tuple<String, String> INDEX_SETTING_AUTO_EXPAND_REPLICAS = new Tuple<>("index.auto_expand_replicas", "0-all");
private static final Tuple<String, Boolean> INDEX_SETTING_HIDDEN = new Tuple<>("index.hidden", true);
private static final Tuple<String, Boolean> INDEX_SETTING_READ_ONLY_ALLOW_DELETE = new Tuple<>(
"index.blocks.read_only_allow_delete",
true
);
private static final Tuple<String, Boolean> INDEX_SETTING_BLOCKS_WRITE = new Tuple<>("index.blocks.write", true);
private final ClusterService clusterService;
private final ClusterSettings clusterSettings;
private final Client client;
Expand Down Expand Up @@ -116,8 +113,7 @@ private void freezeIndex(final String indexName) {
client.admin().indices().prepareRefresh(indexName).execute().actionGet(timeout);
client.admin().indices().prepareForceMerge(indexName).setMaxNumSegments(1).execute().actionGet(timeout);
Map<String, Object> settings = new HashMap<>();
settings.put(INDEX_SETTING_READ_ONLY_ALLOW_DELETE.v1(), INDEX_SETTING_READ_ONLY_ALLOW_DELETE.v2());
settings.put(INDEX_SETTING_NUM_OF_REPLICAS.v1(), null);
settings.put(INDEX_SETTING_BLOCKS_WRITE.v1(), INDEX_SETTING_BLOCKS_WRITE.v2());
settings.put(INDEX_SETTING_AUTO_EXPAND_REPLICAS.v1(), INDEX_SETTING_AUTO_EXPAND_REPLICAS.v2());
client.admin()
.indices()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public void testPutGeoIpData_whenValidInput_thenSucceed() {
UpdateSettingsRequest request = (UpdateSettingsRequest) actionRequest;
assertEquals(1, request.indices().length);
assertEquals(index, request.indices()[0]);
assertEquals(true, request.settings().getAsBoolean("index.blocks.read_only_allow_delete", false));
assertEquals(true, request.settings().getAsBoolean("index.blocks.write", false));
assertNull(request.settings().get("index.num_of_replica"));
assertEquals("0-all", request.settings().get("index.auto_expand_replicas"));
return null;
Expand Down