mirror of https://github.com/apache/cassandra
fix native cell ByteOrder
patch by bes; reviewed by jbellis and tested by mshuler for CASSANDRA-7201
This commit is contained in:
parent
dd6a229599
commit
e06d74ef53
|
|
@ -18,6 +18,7 @@
|
||||||
package org.apache.cassandra.db;
|
package org.apache.cassandra.db;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
import java.nio.ByteOrder;
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
|
|
||||||
import org.apache.cassandra.config.CFMetaData;
|
import org.apache.cassandra.config.CFMetaData;
|
||||||
|
|
@ -183,7 +184,7 @@ public abstract class AbstractNativeCell extends AbstractCell implements CellNam
|
||||||
public ByteBuffer value()
|
public ByteBuffer value()
|
||||||
{
|
{
|
||||||
long offset = valueStartOffset();
|
long offset = valueStartOffset();
|
||||||
return getByteBuffer(offset, (int) (internalSize() - (postfixSize() + offset)));
|
return getByteBuffer(offset, (int) (internalSize() - (postfixSize() + offset))).order(ByteOrder.BIG_ENDIAN);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int clusteringSizeDelta()
|
private int clusteringSizeDelta()
|
||||||
|
|
@ -291,7 +292,7 @@ public abstract class AbstractNativeCell extends AbstractCell implements CellNam
|
||||||
int cellNamesOffset = nameDeltaOffset(size);
|
int cellNamesOffset = nameDeltaOffset(size);
|
||||||
int startDelta = i == 0 ? 0 : getShort(nameDeltaOffset(i));
|
int startDelta = i == 0 ? 0 : getShort(nameDeltaOffset(i));
|
||||||
int endDelta = i < size - 1 ? getShort(nameDeltaOffset(i + 1)) : valueStartOffset() - cellNamesOffset;
|
int endDelta = i < size - 1 ? getShort(nameDeltaOffset(i + 1)) : valueStartOffset() - cellNamesOffset;
|
||||||
return getByteBuffer(cellNamesOffset + startDelta, endDelta - startDelta);
|
return getByteBuffer(cellNamesOffset + startDelta, endDelta - startDelta).order(ByteOrder.BIG_ENDIAN);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final ThreadLocal<byte[]> BUFFER = new ThreadLocal<byte[]>()
|
private static final ThreadLocal<byte[]> BUFFER = new ThreadLocal<byte[]>()
|
||||||
|
|
|
||||||
|
|
@ -68,11 +68,6 @@ public class NativeCounterCell extends NativeCell implements CounterCell
|
||||||
return getLong(internalSize() - 8);
|
return getLong(internalSize() - 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ByteBuffer value()
|
|
||||||
{
|
|
||||||
return super.value().order(ByteOrder.BIG_ENDIAN);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long total()
|
public long total()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue