| 216 | } |
| 217 | |
| 218 | Status TupleCacheNode::VerifyAndMoveDebugCache(RuntimeState* state) { |
| 219 | DCHECK(debug_dump_text_writer_ref_ != nullptr); |
| 220 | DCHECK(ExecEnv::GetInstance()->tuple_cache_mgr()->DebugDumpEnabled()); |
| 221 | DCHECK(TupleCacheVerificationEnabled(state)); |
| 222 | if (debug_dump_text_writer_->IsEmpty()) { |
| 223 | return Status::OK(); |
| 224 | } |
| 225 | string ref_file_path = debug_dump_text_writer_ref_->GetPath(); |
| 226 | string dump_file_path = debug_dump_text_writer_->GetPath(); |
| 227 | bool passed = false; |
| 228 | |
| 229 | DCHECK(!ref_file_path.empty()); |
| 230 | DCHECK(!dump_file_path.empty()); |
| 231 | |
| 232 | VLOG_FILE << "Verify debug tuple cache file ref_file_path: " << ref_file_path |
| 233 | << " and dump_file_path: " << dump_file_path |
| 234 | << " with cache key:" << combined_key_; |
| 235 | |
| 236 | // Fast path to verify the cache. |
| 237 | Status verify_status = |
| 238 | TupleTextFileUtil::VerifyDebugDumpCache(dump_file_path, ref_file_path, &passed); |
| 239 | if (verify_status.ok() && !passed) { |
| 240 | // Slow path to compare all rows in an order-insensitive way if the files are not the |
| 241 | // same. |
| 242 | verify_status = TupleTextFileUtil::VerifyRows(dump_file_path, ref_file_path); |
| 243 | passed = verify_status.ok(); |
| 244 | } |
| 245 | |
| 246 | // Move or clear the file after verification. |
| 247 | MoveDebugCache(passed, debug_dump_text_writer_ref_); |
| 248 | MoveDebugCache(passed, debug_dump_text_writer_); |
| 249 | return verify_status; |
| 250 | } |
| 251 | |
| 252 | // Helper function to generate the unique id based on fragment instance id and node id. |
| 253 | static string GenerateFragmentNodeId( |
nothing calls this directly
no test coverage detected