Mike Percy has posted comments on this change. Change subject: WIP: KUDU-463. Add checksumming to cfile ......................................................................
Patch Set 10: (5 comments) http://gerrit.cloudera.org:8080/#/c/6630/10/src/kudu/cfile/cfile_reader.cc File src/kudu/cfile/cfile_reader.cc: PS10, Line 277: uint8_t footer_scratch[footer_size]; : Slice footer; : : uint32_t checksum_size = sizeof(uint32_t); : uint8_t checksum_scratch[checksum_size]; : Slice checksum; : : // Read both the header and checksum in one call. : // We read the checksum position in case one exists. : // This is done to avoid the need for a follow up read call. : // Read both the data and checksum in one call : vector<ReadResult> results = { : ReadResult { : .result = &checksum, : .scratch = checksum_scratch, : .length = checksum_size, : }, : ReadResult { : .result = &footer, : .scratch = footer_scratch, : .length = footer_size, : } : }; : uint64_t off = file_size_ - kMagicAndLengthSize - footer_size - checksum_size; : RETURN_NOT_OK(block_->ReadV(off, results)); I think it would be a little less obtrusive to have ReadResult construct and own the Slice, the scratch buffer (you could use faststring) and the length and use a constructor like explicit ReadResult(buffer_size) So then instead of all this you could just say uint32_t checksum_size = sizeof(uint32_t); vector<ReadResult> results = { ReadResult(checksum_size), ReadResult(footer_size) }; uint64_t off = file_size_ - kMagicAndLengthSize - footer_size - checksum_size; RETURN_NOT_OK(block_->ReadV(off, &results)); And avoid copying the vector. http://gerrit.cloudera.org:8080/#/c/6630/10/src/kudu/fs/block_manager.h File src/kudu/fs/block_manager.h: PS10, Line 163: vector<ReadResult> nit: Consider making this vector<ReadResult>* perhaps, based on my comments elsewhere http://gerrit.cloudera.org:8080/#/c/6630/10/src/kudu/util/crc.h File src/kudu/util/crc.h: PS10, Line 38: Crc32c Maybe name it RollingCrc32()? Also, needs a unit test. http://gerrit.cloudera.org:8080/#/c/6630/10/src/kudu/util/env_util.cc File src/kudu/util/env_util.cc: PS10, Line 196: n nit: name this req_len ? Line 207: // Calculate the read amount of data Nit: Use punctuation like periods at the end of comment sentences per https://google.github.io/styleguide/cppguide.html#Punctuation,_Spelling_and_Grammar -- To view, visit http://gerrit.cloudera.org:8080/6630 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-MessageType: comment Gerrit-Change-Id: I6756834cd7f27af258797a3654a95244abeb0976 Gerrit-PatchSet: 10 Gerrit-Project: kudu Gerrit-Branch: master Gerrit-Owner: Grant Henke <granthe...@gmail.com> Gerrit-Reviewer: Adar Dembo <a...@cloudera.com> Gerrit-Reviewer: Grant Henke <granthe...@gmail.com> Gerrit-Reviewer: Kudu Jenkins Gerrit-Reviewer: Mike Percy <mpe...@apache.org> Gerrit-Reviewer: Tidy Bot Gerrit-Reviewer: Todd Lipcon <t...@apache.org> Gerrit-HasComments: Yes