From 8618d3624abcdbaa428842a0d7b7bf0d3a3d8e39 Mon Sep 17 00:00:00 2001 From: Simon Willnauer Date: Thu, 11 Sep 2014 11:06:55 +0200 Subject: [PATCH] Add inline comment to prevent confusion --- .../index/gateway/local/LocalIndexShardGateway.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/org/elasticsearch/index/gateway/local/LocalIndexShardGateway.java b/src/main/java/org/elasticsearch/index/gateway/local/LocalIndexShardGateway.java index da6b9bc6259..21de194dbaa 100644 --- a/src/main/java/org/elasticsearch/index/gateway/local/LocalIndexShardGateway.java +++ b/src/main/java/org/elasticsearch/index/gateway/local/LocalIndexShardGateway.java @@ -135,6 +135,11 @@ public class LocalIndexShardGateway extends AbstractIndexShardComponent implemen if (si != null) { if (indexShouldExists) { version = si.getVersion(); + /** + * We generate the translog ID before each lucene commit to ensure that + * we can read the current translog ID safely when we recover. The commits metadata + * therefor contains always the current / active translog ID. + */ if (si.getUserData().containsKey(Translog.TRANSLOG_ID_KEY)) { translogId = Long.parseLong(si.getUserData().get(Translog.TRANSLOG_ID_KEY)); } else {