From ff347858c542bd57dd0871faf24dfb5c36a986c3 Mon Sep 17 00:00:00 2001 From: kimchy Date: Thu, 13 Jan 2011 23:59:35 +0200 Subject: [PATCH] properly report teh files and size recovered when doing primary local gateway recovery --- .../index/gateway/local/LocalIndexShardGateway.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/gateway/local/LocalIndexShardGateway.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/gateway/local/LocalIndexShardGateway.java index ee3e5b1951b..73451f25fe3 100644 --- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/gateway/local/LocalIndexShardGateway.java +++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/gateway/local/LocalIndexShardGateway.java @@ -93,6 +93,19 @@ public class LocalIndexShardGateway extends AbstractIndexShardComponent implemen recoveryStatus.index().updateVersion(version); recoveryStatus.index().time(System.currentTimeMillis() - recoveryStatus.index().startTime()); + // since we recover from local, just fill the files and size + try { + int numberOfFiles = 0; + long totalSizeInBytes = 0; + for (String name : indexShard.store().directory().listAll()) { + numberOfFiles++; + totalSizeInBytes += indexShard.store().directory().fileLength(name); + } + recoveryStatus.index().files(numberOfFiles, totalSizeInBytes, numberOfFiles, totalSizeInBytes); + } catch (Exception e) { + // ignore + } + recoveryStatus.translog().startTime(System.currentTimeMillis()); if (version == -1) { // no translog files, bail