properly report teh files and size recovered when doing primary local gateway recovery

This commit is contained in:
kimchy 2011-01-13 23:59:35 +02:00
parent 7fc04a4ab6
commit ff347858c5
1 changed files with 13 additions and 0 deletions

View File

@ -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