Skip to content

Commit

Permalink
Side-step pending deletes check (#30571)
Browse files Browse the repository at this point in the history
When we split/shrink an index we open several IndexWriter instances
causeing file-deletes to be pending on windows. This subsequently fails
when we open an IW to bootstrap the index history due to pending deletes.
This change sidesteps the check since we know our history goes forward
in terms of files and segments.

Closes #30416
  • Loading branch information
s1monw authored May 15, 2018
1 parent 098b3b7 commit b50cf3c
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,8 @@ setup:
---
"Split from 1 to N":
- skip:
# when re-enabling uncomment the below skips
version: "all"
reason: "AwaitsFix'ing, see https://github.com/elastic/elasticsearch/issues/30503"
# version: " - 6.3.99"
# reason: expects warnings that pre-6.4.0 will not send
version: " - 6.99.99"
reason: Automatic preparation for splitting was added in 7.0.0
features: "warnings"
- do:
indices.create:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
---
"Split index ignores target template mapping":
- skip:
# when re-enabling uncomment the below skips
version: "all"
reason: "AwaitsFix'ing, see https://github.com/elastic/elasticsearch/issues/30503"
# version: " - 6.3.99"
# reason: expects warnings that pre-6.4.0 will not send
version: " - 6.3.99"
reason: expects warnings that pre-6.4.0 will not send
features: "warnings"

# create index
Expand Down
15 changes: 13 additions & 2 deletions server/src/main/java/org/elasticsearch/index/store/Store.java
Original file line number Diff line number Diff line change
Expand Up @@ -731,13 +731,13 @@ static final class StoreDirectory extends FilterDirectory {

private final Logger deletesLogger;

StoreDirectory(Directory delegateDirectory, Logger deletesLogger) throws IOException {
StoreDirectory(Directory delegateDirectory, Logger deletesLogger) {
super(delegateDirectory);
this.deletesLogger = deletesLogger;
}

@Override
public void close() throws IOException {
public void close() {
assert false : "Nobody should close this directory except of the Store itself";
}

Expand All @@ -759,6 +759,17 @@ private void innerClose() throws IOException {
public String toString() {
return "store(" + in.toString() + ")";
}

@Override
public boolean checkPendingDeletions() throws IOException {
if (super.checkPendingDeletions()) {
deletesLogger.warn("directory has still pending deletes");
}
// we skip this check since our IW usage always goes forward.
// we still might run into situations where we have pending deletes ie. in shrink / split case
// and that will cause issues on windows since we open multiple IW instance one after another during the split/shrink recovery
return false;
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import org.apache.lucene.search.SortField;
import org.apache.lucene.search.SortedSetSelector;
import org.apache.lucene.search.SortedSetSortField;
import org.apache.lucene.util.LuceneTestCase.AwaitsFix;
import org.elasticsearch.Version;
import org.elasticsearch.action.admin.cluster.reroute.ClusterRerouteResponse;
import org.elasticsearch.action.admin.cluster.state.ClusterStateRequest;
Expand Down Expand Up @@ -77,7 +76,6 @@
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThanOrEqualTo;

@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/30416")
public class ShrinkIndexIT extends ESIntegTestCase {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.apache.lucene.search.SortedSetSelector;
import org.apache.lucene.search.SortedSetSortField;
import org.apache.lucene.search.join.ScoreMode;
import org.apache.lucene.util.LuceneTestCase;
import org.elasticsearch.Version;
import org.elasticsearch.action.admin.cluster.state.ClusterStateRequest;
import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
Expand Down Expand Up @@ -81,7 +80,6 @@
import static org.hamcrest.Matchers.greaterThanOrEqualTo;


@LuceneTestCase.AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/30416")
public class SplitIndexIT extends ESIntegTestCase {

@Override
Expand Down

0 comments on commit b50cf3c

Please sign in to comment.