| 100 | } |
| 101 | |
| 102 | Status TupleTextFileUtil::VerifyRows( |
| 103 | const string& cmp_file_path, const string& ref_file_path) { |
| 104 | ReferenceRowsMap cache; |
| 105 | int64_t ref_row_count = 0; |
| 106 | int64_t cmp_row_count = 0; |
| 107 | { |
| 108 | TupleTextFileReader ref_reader(ref_file_path); |
| 109 | RETURN_IF_ERROR(ref_reader.Open()); |
| 110 | RETURN_IF_ERROR(InsertRowsFromReferenceFile(cache, &ref_reader, &ref_row_count)); |
| 111 | } |
| 112 | // Verify all the rows. |
| 113 | { |
| 114 | TupleTextFileReader cmp_reader(cmp_file_path); |
| 115 | RETURN_IF_ERROR(cmp_reader.Open()); |
| 116 | RETURN_IF_ERROR( |
| 117 | VerifyRowsFromComparisonFile(ref_file_path, cache, &cmp_reader, &cmp_row_count)); |
| 118 | } |
| 119 | |
| 120 | // Verify all the row counts. |
| 121 | if (ref_row_count != cmp_row_count) { |
| 122 | return Status(TErrorCode::TUPLE_CACHE_INCONSISTENCY, |
| 123 | Substitute( |
| 124 | "Row count different. Reference file '$0': '$1', comparison file '$2': '$3'", |
| 125 | ref_file_path + DEBUG_TUPLE_CACHE_BAD_POSTFIX, ref_row_count, |
| 126 | cmp_file_path + DEBUG_TUPLE_CACHE_BAD_POSTFIX, cmp_row_count)); |
| 127 | } |
| 128 | return VerifyRowCount(cache); |
| 129 | } |
| 130 | |
| 131 | static Status ValidateAndOpenFile(const string& path, TupleTextFileReader& reader) { |
| 132 | if (!reader.Open().ok()) { |
nothing calls this directly
no test coverage detected