Adds toString() to snapshot operations in progress

A better toString() is added for snapshot operations in progress in the
cluster state and logging has been increased to help debug
SharedClusterSnapshotRestoreIT tests.
This commit is contained in:
Ali Beyad 2017-03-20 16:45:23 -04:00
parent 6b46334d31
commit ce08594008
4 changed files with 37 additions and 0 deletions

View File

@ -89,6 +89,18 @@ public class RestoreInProgress extends AbstractNamedDiffable<Custom> implements
return entries.hashCode();
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder("RestoreInProgress[");
for (int i = 0; i < entries.size(); i++) {
builder.append(entries.get(i).snapshot().getSnapshotId().getName());
if (i + 1 < entries.size()) {
builder.append(",");
}
}
return builder.append("]").toString();
}
/**
* Restore metadata
*/

View File

@ -150,6 +150,18 @@ public class SnapshotDeletionsInProgress extends AbstractNamedDiffable<Custom> i
return builder;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder("SnapshotDeletionsInProgress[");
for (int i = 0; i < entries.size(); i++) {
builder.append(entries.get(i).getSnapshot().getSnapshotId().getName());
if (i + 1 < entries.size()) {
builder.append(",");
}
}
return builder.append("]").toString();
}
/**
* A class representing a snapshot deletion request entry in the cluster state.
*/

View File

@ -70,6 +70,18 @@ public class SnapshotsInProgress extends AbstractNamedDiffable<Custom> implement
return entries.hashCode();
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder("SnapshotsInProgress[");
for (int i = 0; i < entries.size(); i++) {
builder.append(entries.get(i).snapshot().getSnapshotId().getName());
if (i + 1 < entries.size()) {
builder.append(",");
}
}
return builder.append("]").toString();
}
public static class Entry {
private final State state;
private final Snapshot snapshot;

View File

@ -806,6 +806,7 @@ public class SharedClusterSnapshotRestoreIT extends AbstractSnapshotIntegTestCas
logger.info("--> total number of simulated failures during restore: [{}]", getFailureCount("test-repo"));
}
@TestLogging("org.elasticsearch.snapshots:TRACE,org.elasticsearch.cluster:TRACE")
public void testDataFileCorruptionDuringRestore() throws Exception {
Path repositoryLocation = randomRepoPath();
Client client = client();