mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-17 10:25:15 +00:00
Use physical name to compare files from snapshot metadata
The comparison and read code in the BlobStoreIndexShardRepository used the physicalName and Name in reverse order. This caused SnapshotBackwardsCompatibilityTest to fail. This reverts commit 636af40da1ae22d5b7c8a81435987768e9cc3ac9
This commit is contained in:
parent
ee46c3cd3f
commit
5453c08f50
@ -694,11 +694,13 @@ public class BlobStoreIndexShardRepository extends AbstractComponent implements
|
||||
*/
|
||||
private static final void maybeRecalculateMetadataHash(ImmutableBlobContainer blobContainer, FileInfo fileInfo, Store.MetadataSnapshot snapshot) throws IOException {
|
||||
final StoreFileMetaData metadata;
|
||||
if (fileInfo != null && (metadata = snapshot.get(fileInfo.name())) != null) {
|
||||
if (fileInfo != null && (metadata = snapshot.get(fileInfo.physicalName())) != null) {
|
||||
if (metadata.hash().length > 0 && fileInfo.metadata().hash().length == 0) {
|
||||
// we have a hash - check if our repo has a hash too otherwise we have
|
||||
// to calculate it.
|
||||
byte[] bytes = blobContainer.readBlobFully(fileInfo.physicalName());
|
||||
final byte[] bytes = blobContainer.readBlobFully(fileInfo.name());
|
||||
assert bytes != null;
|
||||
assert bytes.length == fileInfo.length() : bytes.length + " != " + fileInfo.length();
|
||||
final BytesRef spare = new BytesRef(bytes);
|
||||
Store.MetadataSnapshot.hashFile(fileInfo.metadata().hash(), spare);
|
||||
}
|
||||
|
@ -39,10 +39,13 @@ import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.*;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertAcked;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertHitCount;
|
||||
import static org.elasticsearch.test.hamcrest.ElasticsearchAssertions.assertNoFailures;
|
||||
import static org.hamcrest.Matchers.equalTo;
|
||||
import static org.hamcrest.Matchers.greaterThan;
|
||||
import static org.hamcrest.Matchers.lessThan;
|
||||
|
||||
@Ignore
|
||||
public class SnapshotBackwardsCompatibilityTest extends ElasticsearchBackwardsCompatIntegrationTest {
|
||||
|
||||
@Test
|
||||
|
Loading…
x
Reference in New Issue
Block a user