don't write checksum file for the segments file, we anyhow recover it and that way the index can be read by pure Lucene code
This commit is contained in:
parent
b5f1a1b49c
commit
f9fb67616d
|
@ -531,7 +531,8 @@ public abstract class BlobStoreIndexShardGateway extends AbstractIndexShardCompo
|
|||
} catch (Exception e) {
|
||||
// no file
|
||||
}
|
||||
if (!fileName.contains("segment") && md != null && fileInfo.isSame(md)) {
|
||||
// we don't compute checksum for segments, so always recover them
|
||||
if (!fileName.startsWith("segments") && md != null && fileInfo.isSame(md)) {
|
||||
numberOfFiles++;
|
||||
totalSize += md.length();
|
||||
numberOfReusedFiles++;
|
||||
|
|
|
@ -100,7 +100,8 @@ public class RecoverySource extends AbstractComponent {
|
|||
StoreFileMetaData md = shard.store().metaData(name);
|
||||
boolean useExisting = false;
|
||||
if (request.existingFiles().containsKey(name)) {
|
||||
if (!name.contains("segment") && md.isSame(request.existingFiles().get(name))) {
|
||||
// we don't compute checksum for segments, so always recover them
|
||||
if (!name.startsWith("segments") && md.isSame(request.existingFiles().get(name))) {
|
||||
response.phase1ExistingFileNames.add(name);
|
||||
response.phase1ExistingFileSizes.add(md.length());
|
||||
existingTotalSize += md.length();
|
||||
|
|
|
@ -233,10 +233,12 @@ public abstract class AbstractStore extends AbstractIndexShardComponent implemen
|
|||
public IndexOutput createOutput(String name, boolean computeChecksum) throws IOException {
|
||||
IndexOutput out = delegate.createOutput(name);
|
||||
// delete the relevant cks file for an existing file, if exists
|
||||
try {
|
||||
delegate.deleteFile(name + ".cks");
|
||||
} catch (Exception e) {
|
||||
// ignore
|
||||
if (filesMetadata.containsKey(name)) {
|
||||
try {
|
||||
delegate.deleteFile(name + ".cks");
|
||||
} catch (Exception e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
synchronized (mutex) {
|
||||
StoreFileMetaData metaData = new StoreFileMetaData(name, -1, -1, null);
|
||||
|
@ -285,25 +287,11 @@ public abstract class AbstractStore extends AbstractIndexShardComponent implemen
|
|||
@Override public void sync(String name) throws IOException {
|
||||
if (sync) {
|
||||
delegate.sync(name);
|
||||
try {
|
||||
if (delegate.fileExists(name + ".cks")) {
|
||||
delegate.sync(name + ".cks");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
//ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override public void forceSync(String name) throws IOException {
|
||||
delegate.sync(name);
|
||||
try {
|
||||
if (delegate.fileExists(name + ".cks")) {
|
||||
delegate.sync(name + ".cks");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
//ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -322,6 +310,10 @@ public abstract class AbstractStore extends AbstractIndexShardComponent implemen
|
|||
if ("segments.gen".equals(name)) {
|
||||
// no need to create checksum for segments.gen since its not snapshot to recovery
|
||||
this.digest = null;
|
||||
} else if (name.startsWith("segments")) {
|
||||
// don't compute checksum for segments files, so pure Lucene can open this directory
|
||||
// and since we, in any case, always recover the segments files
|
||||
this.digest = null;
|
||||
} else {
|
||||
this.digest = Digest.getMd5Digest();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue