Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VDiff: Improve row diff handling in report #16618

Merged
merged 10 commits into from
Aug 27, 2024

Conversation

mattlord
Copy link
Contributor

@mattlord mattlord commented Aug 20, 2024

Description

The sample row diffs in the vdiff show --verbose --format=json report — when row differences were found between the source and target — were too often unhelpful. The reasons being:

  1. The column values were truncated pretty aggressively, which often meant that you could not see the actual differences in values between the source and target
  2. The PK values were also truncated (when not using the --only-pks flag), meaning that you could not examine the row manually on the source and target to determine the difference(s)
  3. You could not affect the truncation behavior

This PR addresses these issues as follows:

  • We add a vdiff create flag called --row-diff-column-truncate-at which allows you to control the truncation behavior (defaults to 128 chars and you can specify a value < 1 to avoid any truncation)
    • This is a create flag rather than a show flag because we build the row diffs as we perform the actual diff of the given table, storing the results as we go along in the sidecar DB's _vt.vdiff_table table
  • We always include the PK columns first in the row output, and we never truncate those columns
    • So this part is now the same with and without --only-pks

Related Issue(s)

Checklist

Copy link
Contributor

vitess-bot bot commented Aug 20, 2024

Review Checklist

Hello reviewers! 👋 Please follow this checklist when reviewing this Pull Request.

General

  • Ensure that the Pull Request has a descriptive title.
  • Ensure there is a link to an issue (except for internal cleanup and flaky test fixes), new features should have an RFC that documents use cases and test cases.

Tests

  • Bug fixes should have at least one unit or end-to-end test, enhancement and new features should have a sufficient number of tests.

Documentation

  • Apply the release notes (needs details) label if users need to know about this change.
  • New features should be documented.
  • There should be some code comments as to why things are implemented the way they are.
  • There should be a comment at the top of each new or modified test to explain what the test does.

New flags

  • Is this flag really necessary?
  • Flag names must be clear and intuitive, use dashes (-), and have a clear help text.

If a workflow is added or modified:

  • Each item in Jobs should be named in order to mark it as required.
  • If the workflow needs to be marked as required, the maintainer team must be notified.

Backward compatibility

  • Protobuf changes should be wire-compatible.
  • Changes to _vt tables and RPCs need to be backward compatible.
  • RPC changes should be compatible with vitess-operator
  • If a flag is removed, then it should also be removed from vitess-operator and arewefastyet, if used there.
  • vtctl command output order should be stable and awk-able.

@vitess-bot vitess-bot bot added NeedsBackportReason If backport labels have been applied to a PR, a justification is required NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsIssue A linked issue is missing for this Pull Request NeedsWebsiteDocsUpdate What it says labels Aug 20, 2024
@mattlord mattlord added Type: Enhancement Logical improvement (somewhere between a bug and feature) Component: VReplication and removed NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsWebsiteDocsUpdate What it says NeedsIssue A linked issue is missing for this Pull Request NeedsBackportReason If backport labels have been applied to a PR, a justification is required labels Aug 20, 2024
@github-actions github-actions bot added this to the v21.0.0 milestone Aug 20, 2024
@mattlord mattlord force-pushed the vdiff_rowdiff_truncation branch 3 times, most recently from 75bb05c to 35bf533 Compare August 20, 2024 02:27
Copy link

codecov bot commented Aug 20, 2024

Codecov Report

Attention: Patch coverage is 21.95122% with 32 lines in your changes missing coverage. Please review.

Project coverage is 68.98%. Comparing base (538dd4c) to head (a9117da).
Report is 16 commits behind head on main.

Files Patch % Lines
go/vt/vttablet/tabletmanager/vdiff/report.go 0.00% 20 Missing ⚠️
go/vt/vttablet/tabletmanager/vdiff/table_differ.go 0.00% 10 Missing ⚠️
...d/vtctldclient/command/vreplication/vdiff/vdiff.go 50.00% 1 Missing ⚠️
...vt/vttablet/tabletmanager/vdiff/workflow_differ.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16618      +/-   ##
==========================================
- Coverage   68.98%   68.98%   -0.01%     
==========================================
  Files        1562     1562              
  Lines      200690   200692       +2     
==========================================
- Hits       138449   138443       -6     
- Misses      62241    62249       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Signed-off-by: Matt Lord <[email protected]>
I was seeing occasional panics with:

panic: close of closed channel
goroutine XXX [running]:
vitess.io/vitess/go/vt/binlog/binlogplayer.(*MockDBClient).ExecuteFetch(0xc000282070, {0xc00005d020, 0x24}, 0x1?)

Signed-off-by: Matt Lord <[email protected]>
@mattlord mattlord marked this pull request as ready for review August 20, 2024 18:30
Signed-off-by: Matt Lord <[email protected]>
Signed-off-by: Matt Lord <[email protected]>
@mattlord mattlord merged commit 9e9128b into vitessio:main Aug 27, 2024
132 checks passed
@mattlord mattlord deleted the vdiff_rowdiff_truncation branch August 27, 2024 14:40
mattlord added a commit to vitessio/website that referenced this pull request Aug 27, 2024
* Update generated docs

Signed-off-by: Matt Lord <[email protected]>

* Update hugo config for new version

Signed-off-by: Matt Lord <[email protected]>

* Rebuild again

Signed-off-by: Matt Lord <[email protected]>

* Manual update

Signed-off-by: Matt Lord <[email protected]>

* Revert "Update hugo config for new version"

This reverts commit 9eeaf47.

Signed-off-by: Matt Lord <[email protected]>

---------

Signed-off-by: Matt Lord <[email protected]>
venkatraju pushed a commit to slackhq/vitess that referenced this pull request Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: VReplication Type: Enhancement Logical improvement (somewhere between a bug and feature)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: Add VDiff command flag for controlling row content in diff report
3 participants