fix recovery status when all index got reused

This commit is contained in:
kimchy 2010-08-19 22:46:58 +03:00
parent 7437acfcea
commit a5c5f65da5
3 changed files with 8 additions and 1 deletions

View File

@ -171,6 +171,9 @@ public class GatewayRecoveryStatus {
public int indexRecoveryProgress() {
if (recoveredIndexSize == 0) {
if (indexSize == reusedIndexSize) {
return 100;
}
return 0;
}
return (int) (((double) recoveredIndexSize) / expectedRecoveredIndexSize().bytes() * 100);

View File

@ -160,6 +160,9 @@ public class PeerRecoveryStatus {
public int indexRecoveryProgress() {
if (recoveredIndexSize == 0) {
if (indexSize == reusedIndexSize) {
return 100;
}
return 0;
}
return (int) (((double) recoveredIndexSize) / expectedRecoveredIndexSize().bytes() * 100);

View File

@ -540,6 +540,7 @@ public abstract class BlobStoreIndexShardGateway extends AbstractIndexShardCompo
if (storeMd != null && storeMd.md5().equals(virtualMd.md5())) {
numberOfExistingFiles++;
existingTotalSize += virtualMd.sizeInBytes();
totalSize += virtualMd.sizeInBytes();
if (logger.isTraceEnabled()) {
logger.trace("not_recovering [{}], exists in local store and has same md5 [{}]", virtualMd.name(), virtualMd.md5());
}
@ -564,7 +565,7 @@ public abstract class BlobStoreIndexShardGateway extends AbstractIndexShardCompo
recoveryStatus.index().files(numberOfFiles, totalSize, numberOfExistingFiles, existingTotalSize);
if (logger.isTraceEnabled()) {
logger.trace("recovering_files [{}] with total_size [{}], reusing_files [{}] with total_size [{}]", numberOfFiles, new ByteSizeValue(totalSize), numberOfExistingFiles, new ByteSizeValue(existingTotalSize));
logger.trace("recovering_files [{}] with total_size [{}], reusing_files [{}] with reused_size [{}]", numberOfFiles, new ByteSizeValue(totalSize), numberOfExistingFiles, new ByteSizeValue(existingTotalSize));
}
final CountDownLatch latch = new CountDownLatch(filesToRecover.size());