Skip to content

Commit ff34785

Browse files
committed
properly report teh files and size recovered when doing primary local gateway recovery
1 parent 7fc04a4 commit ff34785

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

modules/elasticsearch/src/main/java/org/elasticsearch/index/gateway/local/LocalIndexShardGateway.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,19 @@ public class LocalIndexShardGateway extends AbstractIndexShardComponent implemen
9393
recoveryStatus.index().updateVersion(version);
9494
recoveryStatus.index().time(System.currentTimeMillis() - recoveryStatus.index().startTime());
9595

96+
// since we recover from local, just fill the files and size
97+
try {
98+
int numberOfFiles = 0;
99+
long totalSizeInBytes = 0;
100+
for (String name : indexShard.store().directory().listAll()) {
101+
numberOfFiles++;
102+
totalSizeInBytes += indexShard.store().directory().fileLength(name);
103+
}
104+
recoveryStatus.index().files(numberOfFiles, totalSizeInBytes, numberOfFiles, totalSizeInBytes);
105+
} catch (Exception e) {
106+
// ignore
107+
}
108+
96109
recoveryStatus.translog().startTime(System.currentTimeMillis());
97110
if (version == -1) {
98111
// no translog files, bail

0 commit comments

Comments
 (0)