mirror of https://github.com/apache/cassandra
Merge branch 'cassandra-3.11' into trunk
This commit is contained in:
commit
243c371f48
|
|
@ -278,6 +278,7 @@
|
|||
* RateBasedBackPressure unnecessarily invokes a lock on the Guava RateLimiter (CASSANDRA-14163)
|
||||
* Fix wildcard GROUP BY queries (CASSANDRA-14209)
|
||||
Merged from 3.0:
|
||||
* Fix potential IndexOutOfBoundsException with counters (CASSANDRA-14167)
|
||||
* Always close RT markers returned by ReadCommand#executeLocally() (CASSANDRA-14515)
|
||||
* Reverse order queries with range tombstones can cause data loss (CASSANDRA-14513)
|
||||
* Fix regression of lagging commitlog flush log message (CASSANDRA-14451)
|
||||
|
|
|
|||
|
|
@ -692,6 +692,9 @@ public class CounterContext
|
|||
*/
|
||||
public void updateDigest(Hasher hasher, ByteBuffer context)
|
||||
{
|
||||
// context can be empty due to the optimization from CASSANDRA-10657
|
||||
if (!context.hasRemaining())
|
||||
return;
|
||||
ByteBuffer dup = context.duplicate();
|
||||
dup.position(context.position() + headerLength(context));
|
||||
HashingUtils.updateBytes(hasher, dup);
|
||||
|
|
|
|||
|
|
@ -27,14 +27,16 @@ import org.junit.BeforeClass;
|
|||
import org.junit.Test;
|
||||
|
||||
import org.apache.cassandra.SchemaLoader;
|
||||
import org.apache.cassandra.net.MessagingService;
|
||||
import org.apache.cassandra.schema.ColumnMetadata;
|
||||
import org.apache.cassandra.db.rows.BTreeRow;
|
||||
import org.apache.cassandra.db.rows.BufferCell;
|
||||
import org.apache.cassandra.db.rows.Cell;
|
||||
import org.apache.cassandra.db.rows.Cells;
|
||||
import org.apache.cassandra.db.context.CounterContext;
|
||||
import org.apache.cassandra.db.rows.Row;
|
||||
import org.apache.cassandra.exceptions.ConfigurationException;
|
||||
import org.apache.cassandra.schema.KeyspaceParams;
|
||||
import org.apache.cassandra.serializers.AsciiSerializer;
|
||||
import org.apache.cassandra.utils.*;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
|
@ -280,4 +282,24 @@ public class CounterCellTest
|
|||
|
||||
Assert.assertEquals(hasher1.hash(), hasher2.hash());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDigestWithEmptyCells() throws Exception
|
||||
{
|
||||
// For DB-1881
|
||||
ColumnFamilyStore cfs = Keyspace.open(KEYSPACE1).getColumnFamilyStore(COUNTER1);
|
||||
|
||||
ColumnMetadata emptyColDef = cfs.metadata().getColumn(ByteBufferUtil.bytes("val2"));
|
||||
BufferCell emptyCell = BufferCell.live(emptyColDef, 0, ByteBuffer.allocate(0));
|
||||
|
||||
Row.Builder builder = BTreeRow.unsortedBuilder(0);
|
||||
builder.newRow(Clustering.make(AsciiSerializer.instance.serialize("test")));
|
||||
builder.addCell(emptyCell);
|
||||
Row row = builder.build();
|
||||
|
||||
Hasher hasher = HashingUtils.CURRENT_HASH_FUNCTION.newHasher();
|
||||
row.digest(hasher);
|
||||
assertNotNull(hasher.hash());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue