Merge pull request #11911 from s1monw/no_utf_uuid
Don't convert possibly corrupted bytes to UTF-8
This commit is contained in:
commit
2dfd6df369
|
@ -233,8 +233,9 @@ public abstract class TranslogReader implements Closeable, Comparable<TranslogRe
|
||||||
BytesRef ref = new BytesRef(len);
|
BytesRef ref = new BytesRef(len);
|
||||||
ref.length = len;
|
ref.length = len;
|
||||||
headerStream.read(ref.bytes, ref.offset, ref.length);
|
headerStream.read(ref.bytes, ref.offset, ref.length);
|
||||||
if (ref.utf8ToString().equals(translogUUID) == false) {
|
BytesRef uuidBytes = new BytesRef(translogUUID);
|
||||||
throw new TranslogCorruptedException("expected shard UUID [" + translogUUID + "] but got: [" + ref.utf8ToString() + "] this translog file belongs to a different translog");
|
if (uuidBytes.bytesEquals(ref) == false) {
|
||||||
|
throw new TranslogCorruptedException("expected shard UUID [" + uuidBytes + "] but got: [" + ref + "] this translog file belongs to a different translog");
|
||||||
}
|
}
|
||||||
return new ImmutableTranslogReader(channelReference.getGeneration(), channelReference, ref.length + CodecUtil.headerLength(TranslogWriter.TRANSLOG_CODEC) + RamUsageEstimator.NUM_BYTES_INT, checkpoint.offset, checkpoint.numOps);
|
return new ImmutableTranslogReader(channelReference.getGeneration(), channelReference, ref.length + CodecUtil.headerLength(TranslogWriter.TRANSLOG_CODEC) + RamUsageEstimator.NUM_BYTES_INT, checkpoint.offset, checkpoint.numOps);
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in New Issue