You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by iv...@apache.org on 2021/05/03 07:29:25 UTC

[lucene] branch main updated: LUCENE-9047: Write checksum as big endian in NRT replicator

This is an automated email from the ASF dual-hosted git repository.

ivera pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/lucene.git


The following commit(s) were added to refs/heads/main by this push:
     new a91bde5  LUCENE-9047: Write checksum as big endian in NRT replicator
a91bde5 is described below

commit a91bde5104809d64a9e0834ca90a03c03021a60f
Author: Ignacio Vera <iv...@apache.org>
AuthorDate: Mon May 3 09:29:16 2021 +0200

    LUCENE-9047: Write checksum as big endian in NRT replicator
---
 .../src/java/org/apache/lucene/replicator/nrt/CopyOneFile.java       | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lucene/replicator/src/java/org/apache/lucene/replicator/nrt/CopyOneFile.java b/lucene/replicator/src/java/org/apache/lucene/replicator/nrt/CopyOneFile.java
index a91fbab..e11a10e 100644
--- a/lucene/replicator/src/java/org/apache/lucene/replicator/nrt/CopyOneFile.java
+++ b/lucene/replicator/src/java/org/apache/lucene/replicator/nrt/CopyOneFile.java
@@ -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();