| 1211 | } |
| 1212 | |
| 1213 | bool DataCache::Partition::VerifyChecksum(const string& ops_name, const CacheEntry& entry, |
| 1214 | const uint8_t* buffer, int64_t buffer_len) { |
| 1215 | DCHECK(FLAGS_data_cache_checksum); |
| 1216 | DCHECK_GE(buffer_len, entry.len()); |
| 1217 | int64_t checksum = Checksum(buffer, entry.len()); |
| 1218 | if (UNLIKELY(checksum != entry.checksum())) { |
| 1219 | LOG(DFATAL) << Substitute("Checksum mismatch during $0 for file $1 " |
| 1220 | "offset: $2 len: $3 buffer len: $4. Expected $5, Got $6.", ops_name, |
| 1221 | entry.file()->path(), entry.offset(), entry.len(), buffer_len, entry.checksum(), |
| 1222 | checksum); |
| 1223 | return false; |
| 1224 | } |
| 1225 | return true; |
| 1226 | } |
| 1227 | |
| 1228 | DataCache::DataCache( |
| 1229 | std::string config, int32_t num_async_write_threads, bool trace_replay) |