Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -407,12 +407,6 @@ public void updateShardState(final ShardRouting newRouting,

if (state == IndexShardState.POST_RECOVERY && newRouting.active()) {
assert currentRouting.active() == false : "we are in POST_RECOVERY, but our shard routing is active " + currentRouting;
// we want to refresh *before* we move to internal STARTED state
try {
getEngine().refresh("cluster_state_started");
} catch (Exception e) {
logger.debug("failed to refresh due to move to cluster wide started", e);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, that error handling!

}

if (newRouting.primary() && currentRouting.isRelocationTarget() == false) {
replicationTracker.activatePrimaryMode(getEngine().getLocalCheckpointTracker().getCheckpoint());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1170,14 +1170,14 @@ public void testShardStats() throws IOException {

public void testRefreshMetric() throws IOException {
IndexShard shard = newStartedShard();
assertThat(shard.refreshStats().getTotal(), equalTo(3L)); // refresh on: finalize, end of recovery and on starting shard
assertThat(shard.refreshStats().getTotal(), equalTo(2L)); // refresh on: finalize and end of recovery
long initialTotalTime = shard.refreshStats().getTotalTimeInMillis();
// check time advances
for (int i = 1; shard.refreshStats().getTotalTimeInMillis() == initialTotalTime; i++) {
indexDoc(shard, "test", "test");
assertThat(shard.refreshStats().getTotal(), equalTo(3L + i - 1));
assertThat(shard.refreshStats().getTotal(), equalTo(2L + i - 1));
shard.refresh("test");
assertThat(shard.refreshStats().getTotal(), equalTo(3L + i));
assertThat(shard.refreshStats().getTotal(), equalTo(2L + i));
assertThat(shard.refreshStats().getTotalTimeInMillis(), greaterThanOrEqualTo(initialTotalTime));
}
long refreshCount = shard.refreshStats().getTotal();
Expand Down