Browse Source

set timeout for refresh and flush to default

Since #13068 refresh and flush requests go to the primary first and are then replicated.
One difference to before is though that if a shard is  not available (INITIALIZING for example)
we wait a little for an indexing request but for refresh we don't and just give up immediately.
Before, refresh requests were just send to the shards regardless of what their state is.

In tests we sometimes create an index, issue an indexing request, refresh and
then get the document. But we do not wait until all nodes know that all primaries have ben assigned.
Now potentially one node can be one cluster state behind and not know yet that
the shards have ben started. If the refresh is executed through this node then the
refresh request will silently fail on shards that are started already because from
the nodes perspective they are still initializing. As a consequence, documents
that expected to be available in the test are now not.
Example test failures are here: http://build-us-00.elastic.co/job/elasticsearch-20-oracle-jdk7/395/

This commit changes the timeout to 1m (default) to make sure we don't miss shards
when we refresh. This will trigger the same retry mechanism as for indexing requests.
We still have to make a decision if this change of behavior is acceptable.

see #13238
Britta Weber 10 years ago
parent
commit
05b48b904d

+ 1 - 1
core/src/main/java/org/elasticsearch/action/admin/indices/flush/TransportFlushAction.java

@@ -53,7 +53,7 @@ public class TransportFlushAction extends TransportBroadcastReplicationAction<Fl
 
     @Override
     protected ShardFlushRequest newShardRequest(FlushRequest request, ShardId shardId) {
-        return new ShardFlushRequest(request).setShardId(shardId).timeout("0ms");
+        return new ShardFlushRequest(request).setShardId(shardId);
     }
 
     @Override

+ 1 - 1
core/src/main/java/org/elasticsearch/action/admin/indices/refresh/TransportRefreshAction.java

@@ -54,7 +54,7 @@ public class TransportRefreshAction extends TransportBroadcastReplicationAction<
 
     @Override
     protected ReplicationRequest newShardRequest(RefreshRequest request, ShardId shardId) {
-        return new ReplicationRequest(request).setShardId(shardId).timeout("0ms");
+        return new ReplicationRequest(request).setShardId(shardId);
     }
 
     @Override

+ 2 - 0
core/src/test/java/org/elasticsearch/action/support/replication/BroadcastReplicationTests.java

@@ -228,6 +228,7 @@ public class BroadcastReplicationTests extends ESTestCase {
     }
 
     @Test
+    @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/13238")
     public void testTimeoutFlush() throws ExecutionException, InterruptedException {
 
         final String index = "test";
@@ -269,6 +270,7 @@ public class BroadcastReplicationTests extends ESTestCase {
     }
 
     @Test
+    @AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/13238")
     public void testTimeoutRefresh() throws ExecutionException, InterruptedException {
 
         final String index = "test";