vitessio / vitess

Vitess is a database clustering system for horizontal scaling of MySQL.
http://vitess.io
Apache License 2.0
18.47k stars 2.09k forks source link

VReplication: Support both vindex col def formats when initing target sequences #16862

Open mattlord opened 17 hours ago

mattlord commented 17 hours ago

Description

You can specify the columns which make up a vindex in two ways within the vschema:

  1. The "legacy" way (a simple string):
    "corder": {
      "column_vindexes": [
        {
          "column": "customer_id",
          "name": "hash"
        }
      ],
      "auto_increment": {
        "column": "order_id",
        "sequence": "order_seq"
      }
    },
  2. The "new" way (an array):
    "product": {
      "column_vindexes": [
        {
          "columns": [
            "product_id"
          ],
          "name": "hash"
        }
      ],
      "auto_increment": {
        "column": "product_id",
        "sequence": "product_seq"
      }
    }

The MoveTables target sequence initialization work (added in https://github.com/vitessio/vitess/pull/13656) only supports the legacy way. It needs to be updated to support either.

That's exactly what this PR does. 🙂

I think that we should backport this to v18 because:

  1. That's where this feature was first added via https://github.com/vitessio/vitess/pull/13656
  2. It's a very small and safe change

Related Issue(s)

Checklist

vitess-bot[bot] commented 17 hours ago

Review Checklist

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

General

Tests

Documentation

New flags

If a workflow is added or modified:

Backward compatibility

codecov[bot] commented 17 hours ago

Codecov Report

Attention: Patch coverage is 75.00000% with 5 lines in your changes missing coverage. Please review.

Project coverage is 69.44%. Comparing base (2e2b223) to head (ab83107). Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
go/vt/vtctl/workflow/traffic_switcher.go 75.00% 5 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #16862 +/- ## ========================================== + Coverage 69.43% 69.44% +0.01% ========================================== Files 1571 1571 Lines 203021 203095 +74 ========================================== + Hits 140970 141042 +72 - Misses 62051 62053 +2 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.