[SNAPSHOT] Reset missing file hash instead of existing hash
Commit e8a1f2598b504183c1a3f2e60363ceaa0d4b298e introduced a regression where the already existing hash was replaced instead of the missing.
This commit is contained in:
parent
21f6bc84fa
commit
76657251e0
|
@ -624,7 +624,8 @@ public class BlobStoreIndexShardRepository extends AbstractComponent implements
|
|||
try (final InputStream stream = new PartSliceStream(blobContainer, fileInfo)) {
|
||||
BytesRefBuilder builder = new BytesRefBuilder();
|
||||
Store.MetadataSnapshot.hashFile(builder, stream, fileInfo.length());
|
||||
BytesRef hash = metadata.hash();
|
||||
BytesRef hash = fileInfo.metadata().hash(); // reset the file infos metadata hash
|
||||
assert hash.length == 0;
|
||||
hash.bytes = builder.bytes();
|
||||
hash.offset = 0;
|
||||
hash.length = builder.length();
|
||||
|
|
|
@ -591,8 +591,9 @@ public class Store extends AbstractIndexShardComponent implements CloseableIndex
|
|||
final int len = (int)Math.min(1024 * 1024, size); // for safety we limit this to 1MB
|
||||
fileHash.grow(len);
|
||||
fileHash.setLength(len);
|
||||
Streams.readFully(in, fileHash.bytes(), 0, len);
|
||||
assert fileHash.length() == len;
|
||||
final int readBytes = Streams.readFully(in, fileHash.bytes(), 0, len);
|
||||
assert readBytes == len : Integer.toString(readBytes) + " != " + Integer.toString(len);
|
||||
assert fileHash.length() == len : Integer.toString(fileHash.length()) + " != " + Integer.toString(len);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue