You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by "Jason Brown (JIRA)" <ji...@apache.org> on 2017/10/03 15:44:00 UTC
[jira] [Commented] (CASSANDRA-13321) Add a checksum component for
the sstable metadata (-Statistics.db) file
[ https://issues.apache.org/jira/browse/CASSANDRA-13321?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16189881#comment-16189881 ]
Jason Brown commented on CASSANDRA-13321:
-----------------------------------------
Coming back to this after a long time I agree with the decision to simplify the solution for adding checksums, and the most recent branch satisfies that.
A few small comments:
- on the serialize path, call {{DataOutputBuffer@getData()}} instead of {{DataOutputBuffer#toByteArray}} as the latter allocates a new buffer and copies, whereas the former just hands over it's backing byte array from the {{ByteBuffer}}.
- {{Hashing.md5()}} - we *could* choose to swap to some other, more lighter weight algo from guava'a {{Hasher}}, but as this code path is called very infrequently it's probably not worth bikeshedding
- on the deserialize path, you build up the {{lengths}} map in the first {{for}} loop. Then in the second {{for}} loop, you determine the {{size}} to read from the {{in}} stream. Admittedly, it took me some staring at that {{if}} to figure out what exactly it was doing. While correct, it might be friendlier for code reading if we add the length for the {{lastType}} to the map after the first {{for}} loop completes - then you won't need the {{if}} branching in the second loop.
Beyond these nits, I'm +1. Nice work simplifying this patch to the minimal work required.
> Add a checksum component for the sstable metadata (-Statistics.db) file
> -----------------------------------------------------------------------
>
> Key: CASSANDRA-13321
> URL: https://issues.apache.org/jira/browse/CASSANDRA-13321
> Project: Cassandra
> Issue Type: Improvement
> Reporter: Marcus Eriksson
> Assignee: Marcus Eriksson
> Fix For: 4.x
>
>
> Since we keep important information in the sstable metadata file now, we should add a checksum component for it. One danger being if a bit gets flipped in repairedAt we could consider the sstable repaired when it is not.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cassandra.apache.org
For additional commands, e-mail: commits-help@cassandra.apache.org