mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-03-01 08:29:09 +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);
|
final IndexMetaData indexMetaData = loadIndexState(indexName);
|
||||||
if (indexMetaData != null) {
|
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);
|
logger.info("[{}] dangling index, exists on local file system, but not in cluster metadata, timeout set to 0, deleting now", indexName);
|
||||||
try {
|
try {
|
||||||
nodeEnv.deleteIndexDirectorySafe(new Index(indexName));
|
nodeEnv.deleteIndexDirectorySafe(new Index(indexName));
|
||||||
|
@ -339,6 +339,7 @@ public class LocalGatewayIndexStateTests extends ElasticsearchIntegrationTest {
|
|||||||
public void testDanglingIndicesAutoImportYes() throws Exception {
|
public void testDanglingIndicesAutoImportYes() throws Exception {
|
||||||
Settings settings = settingsBuilder()
|
Settings settings = settingsBuilder()
|
||||||
.put("gateway.type", "local").put("gateway.local.auto_import_dangled", "yes")
|
.put("gateway.type", "local").put("gateway.local.auto_import_dangled", "yes")
|
||||||
|
.put("gateway.local.dangling_timeout", randomIntBetween(0, 120))
|
||||||
.build();
|
.build();
|
||||||
logger.info("--> starting two nodes");
|
logger.info("--> starting two nodes");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user