diff --git a/inline_verifier.go b/inline_verifier.go index be2c8422..552c88e6 100644 --- a/inline_verifier.go +++ b/inline_verifier.go @@ -242,8 +242,8 @@ const ( MismatchColumnMissingOnTarget mismatchType = "column missing on target" MismatchRowMissingOnSource mismatchType = "row missing on source" MismatchRowMissingOnTarget mismatchType = "row missing on target" - MismatchContentDifference mismatchType = "content difference" - MismatchChecksumDifference mismatchType = "rows checksum difference" + MismatchColumnValueDifference mismatchType = "column value difference" + MismatchRowChecksumDifference mismatchType = "rows checksum difference" ) type InlineVerifierMismatches struct { @@ -491,7 +491,7 @@ func formatMismatches(mismatches map[string]map[string][]InlineVerifierMismatche } } - return messageBuf.String(), incorrectTables + return messageBuf.String(), incorrectTables } func (v *InlineVerifier) VerifyDuringCutover() (VerificationResult, error) { @@ -613,13 +613,13 @@ func (v *InlineVerifier) compareHashes(source, target map[uint64][]byte) map[uin sourceHash, exists := source[paginationKey] if !exists { mismatchSet[paginationKey] = InlineVerifierMismatches{ - Pk: paginationKey, - MismatchType: MismatchRowMissingOnSource, + Pk: paginationKey, + MismatchType: MismatchRowMissingOnSource, } } else if !bytes.Equal(sourceHash, targetHash) { mismatchSet[paginationKey] = InlineVerifierMismatches{ Pk: paginationKey, - MismatchType: MismatchChecksumDifference, + MismatchType: MismatchRowChecksumDifference, SourceChecksum: string(sourceHash), TargetChecksum: string(targetHash), } @@ -630,8 +630,8 @@ func (v *InlineVerifier) compareHashes(source, target map[uint64][]byte) map[uin _, exists := target[paginationKey] if !exists { mismatchSet[paginationKey] = InlineVerifierMismatches{ - Pk: paginationKey, - MismatchType: MismatchRowMissingOnTarget, + Pk: paginationKey, + MismatchType: MismatchRowMissingOnTarget, } } } @@ -639,7 +639,6 @@ func (v *InlineVerifier) compareHashes(source, target map[uint64][]byte) map[uin return mismatchSet } - func compareDecompressedData(source, target map[uint64]map[string][]byte) map[uint64]InlineVerifierMismatches { mismatchSet := map[uint64]InlineVerifierMismatches{} @@ -648,8 +647,8 @@ func compareDecompressedData(source, target map[uint64]map[string][]byte) map[ui if !exists { // row missing on source mismatchSet[paginationKey] = InlineVerifierMismatches{ - Pk: paginationKey, - MismatchType: MismatchRowMissingOnSource, + Pk: paginationKey, + MismatchType: MismatchRowMissingOnSource, } continue } @@ -669,7 +668,7 @@ func compareDecompressedData(source, target map[uint64]map[string][]byte) map[ui mismatchSet[paginationKey] = InlineVerifierMismatches{ Pk: paginationKey, - MismatchType: MismatchContentDifference, + MismatchType: MismatchColumnValueDifference, MismatchColumn: colName, SourceChecksum: hex.EncodeToString(sourceChecksum[:]), TargetChecksum: hex.EncodeToString(targetChecksum[:]), @@ -684,8 +683,8 @@ func compareDecompressedData(source, target map[uint64]map[string][]byte) map[ui if !exists { // row missing on target mismatchSet[paginationKey] = InlineVerifierMismatches{ - Pk: paginationKey, - MismatchType: MismatchRowMissingOnTarget, + Pk: paginationKey, + MismatchType: MismatchRowMissingOnTarget, } continue } diff --git a/inline_verifier_test.go b/inline_verifier_test.go index 61c922f2..1db37362 100644 --- a/inline_verifier_test.go +++ b/inline_verifier_test.go @@ -31,8 +31,8 @@ func TestCompareDecompressedDataContentDifference(t *testing.T) { assert.Equal(t, map[uint64]InlineVerifierMismatches{ 1: { - Pk: 1, - MismatchType: MismatchContentDifference, + Pk: 1, + MismatchType: MismatchColumnValueDifference, MismatchColumn: "name", SourceChecksum: "e356a972989f87a1531252cfa2152797", TargetChecksum: "81b8a1b77068d06e1c8190825253066f", @@ -67,7 +67,7 @@ func TestFormatMismatch(t *testing.T) { "default": { "users": { InlineVerifierMismatches{ - Pk: 1, + Pk: 1, MismatchType: MismatchRowMissingOnSource, }, }, @@ -84,18 +84,18 @@ func TestFormatMismatches(t *testing.T) { "default": { "users": { InlineVerifierMismatches{ - Pk: 1, + Pk: 1, MismatchType: MismatchRowMissingOnSource, }, InlineVerifierMismatches{ - Pk: 5, + Pk: 5, MismatchType: MismatchRowMissingOnTarget, }, }, "posts": { InlineVerifierMismatches{ - Pk: 9, - MismatchType: MismatchContentDifference, + Pk: 9, + MismatchType: MismatchColumnValueDifference, MismatchColumn: string("title"), SourceChecksum: "boo", TargetChecksum: "aaa", @@ -103,8 +103,8 @@ func TestFormatMismatches(t *testing.T) { }, "attachments": { InlineVerifierMismatches{ - Pk: 7, - MismatchType: MismatchContentDifference, + Pk: 7, + MismatchType: MismatchColumnValueDifference, MismatchColumn: string("name"), SourceChecksum: "boo", TargetChecksum: "aaa", @@ -114,6 +114,6 @@ func TestFormatMismatches(t *testing.T) { } message, tables := formatMismatches(mismatches) - assert.Equal(t, string("cutover verification failed for: default.attachments [PKs: 7 (type: content difference, source: boo, target: aaa, column: name) ] default.posts [PKs: 9 (type: content difference, source: boo, target: aaa, column: title) ] default.users [PKs: 1 (type: row missing on source) 5 (type: row missing on target) ] "), message) + assert.Equal(t, string("cutover verification failed for: default.attachments [PKs: 7 (type: column value difference, source: boo, target: aaa, column: name) ] default.posts [PKs: 9 (type: column value difference, source: boo, target: aaa, column: title) ] default.users [PKs: 1 (type: row missing on source) 5 (type: row missing on target) ] "), message) assert.Equal(t, []string{string("default.attachments"), string("default.posts"), string("default.users")}, tables) } diff --git a/test/integration/inline_verifier_test.rb b/test/integration/inline_verifier_test.rb index 89cc1029..82ce7aef 100644 --- a/test/integration/inline_verifier_test.rb +++ b/test/integration/inline_verifier_test.rb @@ -73,7 +73,7 @@ def test_different_compressed_data_is_detected_inline_with_batch_writer assert_equal ["#{DEFAULT_DB}.#{DEFAULT_TABLE}"], incorrect_tables expected_message = "cutover verification failed for: gftest.test_table_1 "\ - "[PKs: 1 (type: content difference, source: 389101948d1694a3bbfb904f57ae845c, target: 4594bb26f2f93c5c60328df6c86a0846, column: data) ] " + "[PKs: 1 (type: column value difference, source: 389101948d1694a3bbfb904f57ae845c, target: 4594bb26f2f93c5c60328df6c86a0846, column: data) ] " assert_equal expected_message, ghostferry.error_lines.last["msg"] end