mirror of https://github.com/apache/cassandra
Fix (de)serialization of WaitingOn into cache
This commit is contained in:
parent
a324003c59
commit
266986b5a2
|
|
@ -823,8 +823,6 @@ public class AccordKeyspace
|
|||
addCellIfModified(CommandsColumns.promised_ballot, Command::promised, AccordKeyspace::serializeTimestamp, builder, timestampMicros, nowInSeconds, original, command);
|
||||
addCellIfModified(CommandsColumns.accepted_ballot, Command::acceptedOrCommitted, AccordKeyspace::serializeTimestamp, builder, timestampMicros, nowInSeconds, original, command);
|
||||
|
||||
// TODO review this is just to work around Truncated not being committed but having a status after committed
|
||||
// so status claims it is committed.
|
||||
if (command.isStable() && !command.isTruncated())
|
||||
{
|
||||
Command.Committed committed = command.asCommitted();
|
||||
|
|
@ -1292,7 +1290,7 @@ public class AccordKeyspace
|
|||
|
||||
try
|
||||
{
|
||||
return WaitingOnSerializer.deserialize(deps, new DataInputBuffer(bytes, false));
|
||||
return WaitingOnSerializer.deserialize(deps, bytes);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -102,17 +102,23 @@ public class WaitingOnSerializer
|
|||
public static WaitingOn deserialize(Deps deps, ByteBuffer in) throws IOException
|
||||
{
|
||||
int length = (deps.txnIdCount() + 63) / 64;
|
||||
ImmutableBitSet waitingOnCommit = deserialize(length, in);
|
||||
ImmutableBitSet waitingOnApply = deserialize(length, in);
|
||||
ImmutableBitSet appliedOrInvalidated = deserialize(length, in);
|
||||
int position = in.position();
|
||||
ImmutableBitSet waitingOnCommit = deserialize(position, length, in);
|
||||
position += length*8;
|
||||
ImmutableBitSet waitingOnApply = deserialize(position, length, in);
|
||||
position += length*8;
|
||||
ImmutableBitSet appliedOrInvalidated = deserialize(position, length, in);
|
||||
return new WaitingOn(deps, waitingOnCommit, waitingOnApply, appliedOrInvalidated);
|
||||
}
|
||||
|
||||
private static ImmutableBitSet deserialize(int length, ByteBuffer in)
|
||||
private static ImmutableBitSet deserialize(int position, int length, ByteBuffer in)
|
||||
{
|
||||
long[] bits = new long[length];
|
||||
for (int i = 0 ; i < length ; ++i)
|
||||
bits[i] = in.getLong();
|
||||
{
|
||||
bits[i] = in.getLong(position);
|
||||
position += 8;
|
||||
}
|
||||
return ImmutableBitSet.SerializationSupport.construct(bits);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue