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

Fix calculation of next delay for delayed shard allocation #14765

Merged
merged 1 commit into from Nov 16, 2015

Conversation

ywelsch
Copy link
Contributor

@ywelsch ywelsch commented Nov 15, 2015

Currently the next delay is calculated based on System.currentTimeMillis() but the actual shards to delay based on the last time the GatewayAllocator tried to assign/delay the shard.

This introduces an inconsistency for the case where shards should have been delay-allocated between the GatewayAllocator-based timestamp and System.currentTimeMillis().

Failing test highlighting the issue:

http://build-us-00.elastic.co/job/es_core_master_centos/8512/testReport/junit/org.elasticsearch.cluster.routing/RoutingServiceTests/testDelayedUnassignedScheduleRerouteAfterDelayedReroute/

Relevant lines of log output:

[2015-11-13 19:25:05,559][DEBUG][org.elasticsearch.cluster.routing.allocation] [short_delay][0] failed shard [short_delay][0], node[node3], [R], v[3], s[STARTED], a[id=FBy1b6neT6yNj4McTu6jlg] found in routingNodes, failing it ([reason=NODE_LEFT], at[2015-11-13T18:25:05.559Z], details[node_left[node3]])
[2015-11-13 19:25:05,559][DEBUG][org.elasticsearch.cluster.routing.allocation] [long_delay][0] failed shard [long_delay][0], node[node1], [R], v[3], s[STARTED], a[id=owLPLgX8RB-ssPs-xvQyQg] found in routingNodes, failing it ([reason=NODE_LEFT], at[2015-11-13T18:25:05.559Z], details[node_left[node1]])
[2015-11-13 19:25:05,877][INFO ][org.elasticsearch.cluster.routing] delaying allocation for [2] unassigned shards, next check in [9.6s]

Analysis:
Two shards fail, one with a delay configured to 100ms ([short_delay][0]), the other configured to 10s ([long_delay][0]).
The last line of log shows that 2 shards have been correctly recognised as being delay-unassigned. But, as the last log line has been executed more than 100ms after the node failure, only long_delay is taken into account for calculating the next check.

@bleskes
Copy link
Contributor

bleskes commented Nov 16, 2015

LGTM

Currently the next delay is calculated based on System.currentTimeMillis() but the actual shards to delay based on the last time the GatewayAllocator tried to assign/delay the shard.

This introduces an inconsistency for the case where shards should have been delay-allocated between the GatewayAllocator-based timestamp and System.currentTimeMillis().

Closes elastic#14765
ywelsch pushed a commit that referenced this pull request Nov 16, 2015
Fix calculation of next delay for delayed shard allocation
@ywelsch ywelsch merged commit fb10e59 into elastic:master Nov 16, 2015
ywelsch pushed a commit that referenced this pull request Nov 16, 2015
Currently the next delay is calculated based on System.currentTimeMillis() but the actual shards to delay based on the last time the GatewayAllocator tried to assign/delay the shard.

This introduces an inconsistency for the case where shards should have been delay-allocated between the GatewayAllocator-based timestamp and System.currentTimeMillis().

Closes #14765
ywelsch pushed a commit that referenced this pull request Nov 16, 2015
Currently the next delay is calculated based on System.currentTimeMillis() but the actual shards to delay based on the last time the GatewayAllocator tried to assign/delay the shard.

This introduces an inconsistency for the case where shards should have been delay-allocated between the GatewayAllocator-based timestamp and System.currentTimeMillis().

Closes #14765
ywelsch pushed a commit that referenced this pull request Nov 16, 2015
Currently the next delay is calculated based on System.currentTimeMillis() but the actual shards to delay based on the last time the GatewayAllocator tried to assign/delay the shard.

This introduces an inconsistency for the case where shards should have been delay-allocated between the GatewayAllocator-based timestamp and System.currentTimeMillis().

Closes #14765
ywelsch pushed a commit that referenced this pull request Nov 16, 2015
Currently the next delay is calculated based on System.currentTimeMillis() but the actual shards to delay based on the last time the GatewayAllocator tried to assign/delay the shard.

This introduces an inconsistency for the case where shards should have been delay-allocated between the GatewayAllocator-based timestamp and System.currentTimeMillis().

Closes #14765
@lcawl lcawl added :Distributed/Distributed A catch all label for anything in the Distributed Area. If you aren't sure, use this one. and removed :Allocation labels Feb 13, 2018
@clintongormley clintongormley added :Distributed/Allocation All issues relating to the decision making around placing a shard (both master logic & on the nodes) and removed :Distributed/Distributed A catch all label for anything in the Distributed Area. If you aren't sure, use this one. labels Feb 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Distributed/Allocation All issues relating to the decision making around placing a shard (both master logic & on the nodes) v1.7.4 v2.0.1 v2.1.0 v2.2.0 v5.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants