Skip to content

Commit

Permalink
iter
Browse files Browse the repository at this point in the history
  • Loading branch information
jpountz committed Apr 20, 2015
1 parent b73db06 commit e5da1df
Showing 1 changed file with 5 additions and 5 deletions.
Expand Up @@ -76,7 +76,7 @@ public IndexShardGateway(ShardId shardId, @IndexSettings Settings indexSettings,
this.indexService = indexService;
this.indexShard = indexShard;

this.waitForMappingUpdatePostRecovery = indexSettings.getAsTime("index.gateway.wait_for_mapping_update_post_recovery", TimeValue.timeValueSeconds(30));
this.waitForMappingUpdatePostRecovery = indexSettings.getAsTime("index.gateway.wait_for_mapping_update_post_recovery", TimeValue.timeValueMinutes(15));
syncInterval = indexSettings.getAsTime("index.gateway.sync", TimeValue.timeValueSeconds(5));
if (syncInterval.millis() > 0) {
this.indexShard.translog().syncOnEachOperation(false);
Expand Down Expand Up @@ -164,7 +164,7 @@ public void recover(boolean indexShouldExists, RecoveryState recoveryState) thro

private void validateMappingUpdate(final String type, Mapping update) {
final CountDownLatch latch = new CountDownLatch(1);
final Throwable[] error = new Throwable[1];
final AtomicReference<Throwable> error = new AtomicReference<>();
mappingUpdatedAction.updateMappingOnMaster(indexService.index().name(), indexService.indexUUID(), type, update, new MappingUpdatedAction.MappingUpdateListener() {
@Override
public void onMappingUpdate() {
Expand All @@ -174,7 +174,7 @@ public void onMappingUpdate() {
@Override
public void onFailure(Throwable t) {
latch.countDown();
error[0] = t;
error.set(t);
}
});
cancellableThreads.execute(new CancellableThreads.Interruptable() {
Expand All @@ -184,8 +184,8 @@ public void run() throws InterruptedException {
if (latch.await(waitForMappingUpdatePostRecovery.millis(), TimeUnit.MILLISECONDS) == false) {
logger.debug("waited for mapping update on master for [{}], yet timed out", type);
} else {
if (error[0] != null) {
throw new IndexShardGatewayRecoveryException(shardId, "Failed to propagate mappings on master post recovery", error[0]);
if (error.get() != null) {
throw new IndexShardGatewayRecoveryException(shardId, "Failed to propagate mappings on master post recovery", error.get());
}
}
} catch (InterruptedException e) {
Expand Down

0 comments on commit e5da1df

Please sign in to comment.