Repository navigation
Conversation
2ec06f4 to
50b1a87
Compare
| if len(b.items) == 0 { | ||
| return "" | ||
| } | ||
| return "PlanetScale binary logs expired before Fivetran could read the latest changes for the following table(s): " + |
There was a problem hiding this comment.
We can change the message here
return "PlanetScale binary logs expired before Fivetran could read the latest changes for the following table(s): " +
joinLimited(b.items) + ". " +
"An automatic historical re-sync has been initiated. No action is needed."
There was a problem hiding this comment.
good call, took your wording as is
fixed in 1b96e7c
|
|
||
| func joinLimited(items []string) string { | ||
| if len(items) <= maxAlertItems { | ||
| return strings.Join(items, ", ") |
There was a problem hiding this comment.
Minor question: was the intention to cap the total number of stale shards at 20? Currently, all shards for one keyspace are joined into a single item before joinLimited is called, so the limit applies to keyspaces rather than shards. For example, one keyspace with 25 stale shards would display all 25. This is probably not a blocker given typical shard counts, but the behavior differs from the PR description.
There was a problem hiding this comment.
you're right, the cap was on keyspaces since the shards got joined per keyspace first
StaleShardsWarningMessage now caps the total number of shards across keyspaces, so one keyspace with 25 shards shows 20 and "and 5 more"
fixed in 1b96e7c
| // Send at most one combined Warning for every table/shard whose cursor was | ||
| // reset because binlogs expired during this sync (no-op if none, or if it | ||
| // was already flushed before raising a Task). | ||
| if fErr := logger.FlushBinlogExpirationWarning(); fErr != nil { |
There was a problem hiding this comment.
This Warning is flushed even when s.handle() returns an error. For example, binlog expiry may be recorded, historical sync may subsequently fail, and the connector would still send “No action is required” before returning a gRPC error. Should we only flush the success/no-action Warning when err == nil, or use different wording when the sync is failing?
There was a problem hiding this comment.
agreed, Handle now only flushes the binlog Warning when the sync succeeds
the trade-off is the affected tables are only kept in memory, so a failed sync won't show the Warning at all
the re-sync still recovers next sync though: either the reset cursor was already checkpointed, or binlogs are still expired and it gets reset again
the flush before a Task stays as it was
fixed in 1b96e7c
|
@mcrauwel Have added few comments, please check! Also, I have answered all the open questions in the slack thread. If the connector sends a Task and also returns a gRPC error, does Fivetran retry or alert twice? Are checkpoints sent right before a Task persisted? What exactly does error_code: BINLOG_EXPIRATION_ERROR (fix(binlog-error): trigger the resync from connector whenever binlog expire error occurs to make MAR free #73) trigger: a MAR-free re-sync, a truncate or soft delete, a dashboard notice? Does it need to be on the final checkpoint? Can the same mechanism be used for reshards and schema changes? Does Fivetran already show something when a re-sync starts automatically after binlog expiry? If so, the binlog Warning is redundant. |
…ed sync - Binlog expiry Warning now ends with "An automatic historical re-sync has been initiated. No action is needed." - Stale-shards Warning caps the total number of shards listed (20), across keyspaces, instead of the number of keyspaces. - Only flush the binlog expiry Warning when the sync succeeds, so a failing sync never shows "No action is needed". The historical re-sync still recovers on the next sync. Signed-off-by: Matthias Crauwels <matthias.crauwels@planetscale.com>
Uses the Fivetran Partner SDK user alerts so customers get an actionable message instead of a generic sync failure when a resync or intervention is needed. No proto bump needed: the pinned SDK version already has
TaskandWarninginUpdateResponse.Changes
Tasks (blocking, the sync stops; Fivetran clears them after the next successful sync)
shard provided in VGTID, ..., not found in the ... keyspace), for example after a reshard once the old shards are deleted. Newlib.IsShardNotFoundInVGTIDError.IsVStreamSchemaIncompatibilityError) now raise a Task instead of a bareFailedPrecondition.Updatereturns nil; if sending the Task fails it falls back tocodes.FailedPrecondition.Warnings (non-blocking, dismissible)
show vitess_shards like "%<keyspace>%"query could save shards of another keyspace (e.g.prod_main_sharded/-40as a shard ofprod_main). vtgate rejects these before reading any rows, so no data was affected.StateFromRequestnow drops saved shard entries containing/that aren't inListShards, logs them, and sends one Warning per sync.Customer-facing text
Re-sync required: shard "<shard>" no longer exists in PlanetScale keyspace "<keyspace>" (for example after a reshard), so incremental replication cannot resume for the tables in this keyspace. To fix this, go to the connection's Settings tab in Fivetran and click "Resync all data".Re-sync required: a schema change on table "<table>" in PlanetScale keyspace "<keyspace>" (for example a column added in the middle of the table, or a dropped or renamed column) prevents incremental replication from continuing. To fix this, go to the connection's Settings tab in Fivetran and click "Resync all data".PlanetScale removed stale shard references left in this connection's sync state by an older connector version (keyspace <ks>: <shards>). These references never contained data. No action or re-sync is needed.PlanetScale binary logs expired before Fivetran could read the latest changes for the following table(s): <ks.table (shard s)>, .... An automatic historical re-sync has been initiated. No action is needed.The binlog Warning lists at most 20 table/shard entries and the stale-shards Warning at most 20 shards (across keyspaces), each followed by "and N more". Re-sync is connection-level only for this connector today.
Tests
New tests for every Task and Warning path (
alerts_test.go,types_test.go,sync_test.go);TestVStreamSchemaIncompatibilityReturnsFailedPreconditionis now...RaisesResyncTask.go vet ./cmd/... ./lib/...andgo test ./cmd/... ./lib/...pass.Open questions for Fivetran
error_code: BINLOG_EXPIRATION_ERROR(fix(binlog-error): trigger the resync from connector whenever binlog expire error occurs to make MAR free #73) trigger: a MAR-free re-sync, a truncate or soft delete, a dashboard notice? Does it need to be on the final checkpoint?