Browse Source

Gateway: added trace logging to translog recovery logic

Enabled it in SimpleRecoveryLocalGatewayTests
Boaz Leskes 11 years ago
parent
commit
7d80db7c2c

+ 3 - 0
src/main/java/org/elasticsearch/index/gateway/local/LocalIndexShardGateway.java

@@ -238,6 +238,7 @@ public class LocalIndexShardGateway extends AbstractIndexShardComponent implemen
                     in = stream.openInput(recoveringTranslogFile);
                 } catch (TruncatedTranslogException e) {
                     // file is empty or header has been half-written and should be ignored
+                    logger.trace("ignoring truncation exception, the translog is either empty or half-written ([])", e.getMessage());
                 }
                 while (true) {
                     if (in == null) {
@@ -251,9 +252,11 @@ public class LocalIndexShardGateway extends AbstractIndexShardComponent implemen
                         operation = stream.read(in);
                     } catch (EOFException e) {
                         // ignore, not properly written the last op
+                        logger.trace("ignoring translog EOF exception, the last operation was not properly written", e.getMessage());
                         break;
                     } catch (IOException e) {
                         // ignore, not properly written last op
+                        logger.trace("ignoring translog IO exception, the last operation was not properly written", e.getMessage());
                         break;
                     }
                     try {

+ 1 - 1
src/test/java/org/elasticsearch/gateway/local/SimpleRecoveryLocalGatewayTests.java

@@ -54,7 +54,7 @@ import static org.hamcrest.Matchers.*;
  */
 @ClusterScope(numDataNodes = 0, scope = Scope.TEST)
 @Slow
-@TestLogging("index.shard.service:TRACE")
+@TestLogging("index.shard.service:TRACE,index.gateway.local:TRACE")
 public class SimpleRecoveryLocalGatewayTests extends ElasticsearchIntegrationTest {
 
     private ImmutableSettings.Builder settingsBuilder() {