Skip to content

Commit

Permalink
Picking away.
Browse files Browse the repository at this point in the history
And incorporating changes from: vitessio/vitess#14280

Signed-off-by: Matt Lord <mattalord@gmail.com>
  • Loading branch information
mattlord committed Oct 15, 2023
1 parent a1ab620 commit 094fe5f
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 24 deletions.
14 changes: 7 additions & 7 deletions content/en/docs/19.0/reference/vreplication/migrate.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,16 @@ on working with external Vitess clusters.

#### Differences Between Migrate and MoveTables

`Migrate` has separate semantics and behaviors from `MoveTables`:
[`Migrate`](../../../reference/programs/vtctldclient/vtctldclient_migrate/) has separate semantics and behaviors from [`MoveTables`](../../../reference/programs/vtctldclient/vtctldclient_movetables/):

* `MoveTables` migrates data from one keyspace to another, within the same Vitess cluster; `Migrate` functions between two separated Vitess clusters.
* `MoveTables` erases the source data upon completion by default; Migrate keeps the source data intact.
* There are flags available in MoveTables to change the default behavior in regards to the source data.
* `MoveTables` sets up routing rules and reverse replication, allowing for rollback prior to completion.
* Switching read/write traffic is not meaningful in the case of `Migrate`, as the Source is in a different cluster.
* [`MoveTables`](../../../reference/programs/vtctldclient/vtctldclient_movetables/) migrates data from one keyspace to another, within the same Vitess cluster; [`Migrate`](../../../reference/programs/vtctldclient/vtctldclient_migrate/) functions between two separate Vitess clusters.
* [`MoveTables`](../../../reference/programs/vtctldclient/vtctldclient_movetables/) erases the source data upon completion by default; Migrate keeps the source data intact.
* There are flags available in [`MoveTables`](../../../reference/programs/vtctldclient/vtctldclient_movetables/) to change the default behavior in regards to the source data.
* [`MoveTables`](../../../reference/programs/vtctldclient/vtctldclient_movetables/) sets up routing rules and reverse replication, allowing for rollback prior to completion.
* Switching read/write traffic is not meaningful in the case of [`Migrate`](../../../reference/programs/vtctldclient/vtctldclient_migrate/), as the Source is in a different cluster.
* Switching traffic requires the Target to have the ability to create vreplication streams (in the `_vt` database) on the Source;
this may not always be possible on production systems.
* Not all `MoveTables` options work with `Migrate`; for example [`Progress`](../progress) is unavailable with `Migrate`.
* Not all [`MoveTables`](../../../reference/programs/vtctldclient/vtctldclient_movetables/) sub-commands work with [`Migrate`](../../../reference/programs/vtctldclient/vtctldclient_migrate/); for example `SwitchTraffic` and `ReverseTraffic` are unavailable with [`Migrate`](../../../reference/programs/vtctldclient/vtctldclient_migrate/).


### Parameters
Expand Down
2 changes: 1 addition & 1 deletion content/en/docs/19.0/reference/vreplication/movetables.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Action must be one of the following: `create`, `show`, `status`, `switchtraffic`
#### Status
<div class="cmd">

[`status`](../../../reference/programs/vtctldclient/vtctldclient_movetables/vtctldclient_movetables_status/) (or `progress`) reports the progress of a workflow by showing the percentage of data copied across targets, if workflow is in copy state, and the replication lag between the target and the source once the copy phase is completed.
[`status`](../../../reference/programs/vtctldclient/vtctldclient_movetables/vtctldclient_movetables_status/) (or `progress`) reports the progress of a workflow by showing the percentage of data copied across targets, if workflow is in copy state, and the replication lag between the target and the source once the copy phase is completed. It also shows the current state of traffic for the tables involved in the workflow.

It is too expensive to get real-time row counts of tables, using _count(*)_, say. So we use the statistics available in the `information_schema` to approximate copy progress. This data can be significantly off (up to 50-60%) depending on the utilization of the underlying mysql server resources. You can manually run `ANALYZE TABLE` to update the statistics if so desired.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ use `Show` or `Progress`

```bash
vtctldclient MoveTables --target-keyspace commerce --workflow legacy2commerce show
vtctldclient MoveTables --target-keyspace commerce --workflow legacy2commerce progress
vtctldclient MoveTables --target-keyspace commerce --workflow legacy2commerce status
```

You can alternatively use the [`Workflow show`](../../../reference/programs/vtctldclient/vtctldclient_workflow/vtctldclient_workflow_show/) command to get the details as well.
Expand Down
9 changes: 5 additions & 4 deletions content/en/docs/19.0/user-guides/migration/move-tables.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,10 @@ be copied faithfully to the new copy of these tables in the `customer` keyspace.

## Monitoring Progress (Optional)

In this example there are only a few rows in the tables, so the `MoveTables` operation only takes seconds. If the tables were large, however, you may need to monitor the progress of the operation. You can get a basic summary of the progress using the [`Progress`](../../../reference/vreplication/movetables/#progress) action:
In this example there are only a few rows in the tables, so the `MoveTables` operation only takes seconds. If the tables were large, however, you may need to monitor the progress of the operation. You can get a basic summary of the progress using the [`status`](../../../reference/vreplication/movetables/#status) action:

```bash
$ vtctldclient MoveTables --target-keyspace customer --workflow commerce2customer progress
$ vtctldclient MoveTables --target-keyspace customer --workflow commerce2customer status --format=json
{
"table_copy_state": {},
"shard_streams": {
Expand All @@ -300,11 +300,12 @@ $ vtctldclient MoveTables --target-keyspace customer --workflow commerce2custome
}
]
}
}
},
"traffic_state": "Reads Not Switched. Writes Not Switched"
}
```

You can get detailed status and progress information using the
You can get more detailed status information using the
[`show`](../../../reference/programs/vtctldclient/vtctldclient_movetables/vtctldclient_movetables_show/) sub-command:

```json
Expand Down
25 changes: 14 additions & 11 deletions content/en/docs/19.0/user-guides/migration/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ tablet so it's recommended to use non-PRIMARY tablets whenever possible to limit
## Monitoring

It's important to properly monitor your VReplication workflows in order to detect any issues. Your primary tools for this are:
- The [`Workflow show`](../../../reference/vreplication/workflow/) command
- The `Progress`/`Show` action (e.g. [`MoveTables -- Progress`](../../../reference/vreplication/movetables/#progress))
- The `show`sub-command (e.g. [`MoveTables show`](../../../reference/vreplication/movetables/#show))
- The `status ` sub-command (e.g. [`MoveTables status`](../../../reference/vreplication/movetables/#status))
- The [VReplication related metrics](../../../reference/vreplication/metrics/)
- Note that in most production systems the tablet endpoints would be scraped and stored in something like [Prometheus](https://prometheus.io) where you can build dashboards and alerting on the data

Expand All @@ -79,10 +79,10 @@ $ vtctldclient ApplyRoutingRules --rules-file=/tmp/routingrules.backup.json
### Stream Never Starts

This can be exhibited in one of two ways:
1. This error is shown in the `Progress`/`Show` action output or the `Workflow show` output: `Error picking tablet: context has expired`
1. This error is shown in the `status`/`show` action output or the `Workflow show` output: `Error picking tablet: context has expired`
2. The stream never starts, which can be seen in the following ways:
1. The `Workflow show` output is showing an empty value in the `Pos` field for the stream
2. The `Progress`/`Show` action output is showing `VStream has not started` for the stream
2. The `status`/`show` action output is showing `VStream has not started` for the stream

When a VReplication workflow starts or restarts the [tablet selection process](../../../reference/vreplication/tablet_selection/)
runs to find a viable source tablet for the stream. The `cells` and `tablet_types` play a key role in this process and
Expand All @@ -97,7 +97,7 @@ progress that you do not wish you lose, you can update the underlying workflow r
values. For example:

```bash
$ vtctldclient MoveTables --target-keyspace customer --workflow commerce2customer progress
$ vtctldclient MoveTables --target-keyspace customer --workflow commerce2customer status --format=json
{
"table_copy_state": {},
"shard_streams": {
Expand All @@ -116,18 +116,19 @@ $ vtctldclient MoveTables --target-keyspace customer --workflow commerce2custome
}
]
}
}
},
"traffic_state": "Reads Not Switched. Writes Not Switched"
}
```

### Workflow Has SQL Errors

We can encounter persistent SQL errors when applying replicated events on the target for a variety of reasons, but
the most common cause is incompatible DDL having been executed against the source table while the workflow is running.
You would see this error in the `Show`/`Progress` or `Workflow show` output. For example:
You would see this error in the `status`/`show` or `Workflow show` output. For example:

```bash
$ vtctldclient MoveTables --target-keyspace customer --workflow commerce2customer progress
$ vtctldclient MoveTables --target-keyspace customer --workflow commerce2customer status --format=json
{
"table_copy_state": {},
"shard_streams": {
Expand All @@ -146,7 +147,8 @@ $ vtctldclient MoveTables --target-keyspace customer --workflow commerce2custome
}
]
}
}
},
"traffic_state": "Reads Not Switched. Writes Not Switched"
}
```

Expand Down Expand Up @@ -176,7 +178,7 @@ The following vreplication streams exist for workflow customer.commerce2customer

id=2 on customer/zone1-200: Status: Running. VStream has not started.

$ vtctldclient MoveTables --target-keyspace customer --workflow commerce2customer progress
$ vtctldclient MoveTables --target-keyspace customer --workflow commerce2customer status --format=json
{
"table_copy_state": {},
"shard_streams": {
Expand All @@ -195,7 +197,8 @@ $ vtctldclient MoveTables --target-keyspace customer --workflow commerce2custome
}
]
}
}
},
"traffic_state": "Reads Not Switched. Writes Not Switched"
}
```

Expand Down

0 comments on commit 094fe5f

Please sign in to comment.