LUCENE-9047: Write checksum as big endian in NRT replicator

This commit is contained in:
Ignacio Vera 2021-05-03 09:29:16 +02:00 committed by GitHub
parent b84e0c272b
commit a91bde5104
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -20,6 +20,7 @@ package org.apache.lucene.replicator.nrt;
import java.io.Closeable;
import java.io.IOException;
import java.util.Locale;
import org.apache.lucene.codecs.CodecUtil;
import org.apache.lucene.store.DataInput;
import org.apache.lucene.store.IOContext;
import org.apache.lucene.store.IndexOutput;
@ -111,7 +112,7 @@ public class CopyOneFile implements Closeable {
// Paranoia: make sure the primary node is not smoking crack, by somehow sending us an
// already corrupted file whose checksum (in its
// footer) disagrees with reality:
long actualChecksumIn = in.readLong();
long actualChecksumIn = CodecUtil.readBELong(in);
if (actualChecksumIn != checksum) {
dest.message(
"file "
@ -122,7 +123,7 @@ public class CopyOneFile implements Closeable {
+ actualChecksumIn);
throw new IOException("file " + name + ": checksum mismatch after file copy");
}
out.writeLong(checksum);
CodecUtil.writeBELong(out, checksum);
bytesCopied += Long.BYTES;
close();