add a list of files that exists in the index to the failure

This commit is contained in:
Shay Banon 2013-03-04 18:15:06 -08:00
parent d609571897
commit 1ed07c1794
1 changed files with 9 additions and 2 deletions

View File

@ -49,6 +49,7 @@ import java.io.EOFException;
import java.io.File; import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
/** /**
@ -103,9 +104,15 @@ public class LocalIndexShardGateway extends AbstractIndexShardComponent implemen
SegmentInfos si = null; SegmentInfos si = null;
try { try {
si = Lucene.readSegmentInfos(indexShard.store().directory()); si = Lucene.readSegmentInfos(indexShard.store().directory());
} catch (IOException e) { } catch (Exception e) {
String files = "_unknown_";
try {
files = Arrays.toString(indexShard.store().directory().listAll());
} catch (Exception e1) {
// ignore
}
if (indexShouldExists && indexShard.store().indexStore().persistent()) { if (indexShouldExists && indexShard.store().indexStore().persistent()) {
throw new IndexShardGatewayRecoveryException(shardId(), "shard allocated for local recovery (post api), should exists, but doesn't", e); throw new IndexShardGatewayRecoveryException(shardId(), "shard allocated for local recovery (post api), should exists, but doesn't, current files: " + files, e);
} }
} }
if (si != null) { if (si != null) {