Internal: when corruption strikes, don't create exceptions with circular references

Closes #8331
This commit is contained in:
Robert Muir 2014-11-03 14:16:55 -05:00
parent a6d7742cb5
commit 3c720730c9

View File

@ -230,13 +230,10 @@ public class RecoverySource extends AbstractComponent {
if ((corruptIndexException = ExceptionsHelper.unwrap(e, CorruptIndexException.class)) != null) {
if (store.checkIntegrity(md) == false) { // we are corrupted on the primary -- fail!
logger.warn("{} Corrupted file detected {} checksum mismatch", shard.shardId(), md);
CorruptIndexException current = corruptedEngine.get();
if (current != null || corruptedEngine.compareAndSet(null, corruptIndexException)) {
current = corruptedEngine.get();
assert current != null;
current.addSuppressed(e);
if (corruptedEngine.compareAndSet(null, corruptIndexException) == false) {
// if we are not the first exception, add ourselves as suppressed to the main one:
corruptedEngine.get().addSuppressed(e);
}
} else { // corruption has happened on the way to replica
RemoteTransportException exception = new RemoteTransportException("File corruption occured on recovery but checksums are ok", null);
exception.addSuppressed(e);