mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-01 00:19:11 +00:00
Fix: If dangling_timeout was set to 0 and auto_import_dangled
was set to yes, dangling indices were deleted by mistake, because a RemoveDanglingIndices runnable was added to every dangling indices, without considering the auto_import_dangled setting.
This commit is contained in:
parent
cbced948c4
commit
69ac838259
@ -287,7 +287,10 @@ public class LocalGatewayMetaState extends AbstractComponent implements ClusterS
|
||||
}
|
||||
final IndexMetaData indexMetaData = loadIndexState(indexName);
|
||||
if (indexMetaData != null) {
|
||||
if (danglingTimeout.millis() == 0) {
|
||||
if(autoImportDangled.shouldImport()){
|
||||
logger.info("[{}] dangling index, exists on local file system, but not in cluster metadata, auto import to cluster state [{}]", indexName, autoImportDangled);
|
||||
danglingIndices.put(indexName, new DanglingIndex(indexName, null));
|
||||
} else if (danglingTimeout.millis() == 0) {
|
||||
logger.info("[{}] dangling index, exists on local file system, but not in cluster metadata, timeout set to 0, deleting now", indexName);
|
||||
try {
|
||||
nodeEnv.deleteIndexDirectorySafe(new Index(indexName));
|
||||
|
@ -339,6 +339,7 @@ public class LocalGatewayIndexStateTests extends ElasticsearchIntegrationTest {
|
||||
public void testDanglingIndicesAutoImportYes() throws Exception {
|
||||
Settings settings = settingsBuilder()
|
||||
.put("gateway.type", "local").put("gateway.local.auto_import_dangled", "yes")
|
||||
.put("gateway.local.dangling_timeout", randomIntBetween(0, 120))
|
||||
.build();
|
||||
logger.info("--> starting two nodes");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user