cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stu Hood" <>
Subject RE: MerkleTree.RowHash maybe a bug.
Date Thu, 11 Nov 2010 17:31:01 GMT
At first glance, this appeared to be a very egregious bug, but the effect is actually minimal:
since the size of the buffer is deterministic based on the size of the data, you will have
equal amounts of excess/junk data for equal rows. Combined with the fact that 0.6 doesn't
reuse these buffers, I don't think we're actually doing any extra repair.

The problem is fixed in 0.7, but I've opened CASSANDRA-1729 to fix it in 0.6, in case we start
reusing row buffers.

Thanks for the report!

-----Original Message-----
From: "Schubert Zhang" <>
Sent: Thursday, November 11, 2010 2:19am
Subject: MerkleTree.RowHash maybe a bug.

Hi JE,


I found the rowHash method uses "row.buffer.getData()" directly.
Since row.buffer.getData()  is a byte[], and there may have some junk bytes
in the end by the buffer, I think we should use the exact length.

        private MerkleTree.RowHash rowHash(CompactedRow row)
            // MerkleTree uses XOR internally, so we want lots of output
bits here
            byte[] rowhash = FBUtilities.hash("SHA-256",
row.key.key.getBytes(), row.buffer.getData());
            return new MerkleTree.RowHash(row.key.token, rowhash);

View raw message