Skip to content

Conversation

@ibrarahmad
Copy link

Implement preserve-origin feature that maintains original replication origin node ID and timstamp when repairing rows during recovery scenarios. This prevents replication conflicts when the origin node returns to the cluster.

Test Scenario

  • Source Node: n3 (has 70 rows with origin_id=49708, timestamp=2026-01-15 21:17:31)
  • Target Node: n2 (initially empty, needs recovery)
  • Test Rows: IDs 21-25 (sample of 10 recovered rows)
  • Original Origin: node_n1 (origin_id=49708 on n3)
Test Case Row ID Source Timestamp Source Origin Recovered Timestamp Recovered Origin Timestamp Preserved Origin Preserved Both Preserved
WITHOUT Patch
(no --preserve-origin)
21 2026-01-15 21:17:31+05 node_n1 2026-01-15 21:29:XX+05 NULL/different NO NO NO
22 2026-01-15 21:17:31+05 node_n1 2026-01-15 21:29:XX+05 NULL/different NO NO NO
23 2026-01-15 21:17:31+05 node_n1 2026-01-15 21:29:XX+05 NULL/different NO NO NO
24 2026-01-15 21:17:31+05 node_n1 2026-01-15 21:29:XX+05 NULL/different NO NO NO
25 2026-01-15 21:17:31+05 node_n1 2026-01-15 21:29:XX+05 NULL/different NO NO NO
WITH Patch
(--preserve-origin)
21 2026-01-15 21:17:31+05 node_n1 2026-01-15 21:17:31+05 node_n1 YES YES YES
22 2026-01-15 21:17:31+05 node_n1 2026-01-15 21:17:31+05 node_n1 YES YES YES
23 2026-01-15 21:17:31+05 node_n1 2026-01-15 21:17:31+05 node_n1 YES YES YES
24 2026-01-15 21:17:31+05 node_n1 2026-01-15 21:17:31+05 node_n1 YES YES YES
25 2026-01-15 21:17:31+05 node_n1 2026-01-15 21:17:31+05 node_n1 YES YES YES

Ibrar Ahmed and others added 2 commits January 15, 2026 20:03
Implement preserve-origin feature that maintains original replication origin
node ID and LSN when repairing rows during recovery scenarios. This prevents
replication conflicts when the origin node returns to the cluster.
Updated the documentation for the table-repair command to enhance clarity and structure. Improved syntax formatting and added details about options and behavior.
Copy link
Member

@mason-sharp mason-sharp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of comments.

Also, please add tests.

}

// Step 2: Setup xact with LSN and timestamp (BEFORE DML)
if err := task.setupReplicationOriginXact(tx, groupOriginInfo.lsn, groupOriginInfo.commitTS); err != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this setting the timestamp only once for the group, and not each individual row, which may have a different timestamp?

}
}
addNullUpdate(updatesByNode, node1Name, row1, col, val2, sourceRow)
} else if val2 == nil && val1 != nil {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens when each row has NULL on different columns? Do they each end up updating their respective origins to each other?

If so, I am not sure what we should do (perhaps not change?).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants