check if the commit point has a size at all, if not, not flushed yet, its ok
This commit is contained in:
parent
f4a7887fe1
commit
b8fa68f97a
|
@ -108,15 +108,19 @@ public abstract class BlobStoreGateway extends SharedStorageGateway {
|
|||
}
|
||||
|
||||
public CommitPoint findCommitPoint(String index, int shardId) throws IOException {
|
||||
ImmutableBlobContainer container = blobStore.immutableBlobContainer(BlobStoreIndexGateway.shardPath(basePath, index, shardId));
|
||||
BlobPath path = BlobStoreIndexGateway.shardPath(basePath, index, shardId);
|
||||
ImmutableBlobContainer container = blobStore.immutableBlobContainer(path);
|
||||
ImmutableMap<String, BlobMetaData> blobs = container.listBlobs();
|
||||
List<CommitPoint> commitPointsList = Lists.newArrayList();
|
||||
for (String name : blobs.keySet()) {
|
||||
if (name.startsWith("commit-")) {
|
||||
for (BlobMetaData md : blobs.values()) {
|
||||
if (md.length() == 0) { // a commit point that was not flushed yet...
|
||||
continue;
|
||||
}
|
||||
if (md.name().startsWith("commit-")) {
|
||||
try {
|
||||
commitPointsList.add(CommitPoints.fromXContent(container.readBlobFully(name)));
|
||||
commitPointsList.add(CommitPoints.fromXContent(container.readBlobFully(md.name())));
|
||||
} catch (Exception e) {
|
||||
logger.warn("failed to read commit point [{}]", e, name);
|
||||
logger.warn("failed to read commit point at path {} with name [{}]", e, path, md.name());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue