Skip to content

SPOC-442: Use NULL for unknown local_origin instead of -1#352

Merged
mason-sharp merged 1 commit intov5_STABLEfrom
task/SPOC-442/unknown-origin
Feb 19, 2026
Merged

SPOC-442: Use NULL for unknown local_origin instead of -1#352
mason-sharp merged 1 commit intov5_STABLEfrom
task/SPOC-442/unknown-origin

Conversation

@rasifr
Copy link
Member

@rasifr rasifr commented Feb 18, 2026

SPOC-442: Use NULL for unknown local_origin instead of -1

When the origin of a local tuple cannot be determined (e.g., data loaded
via pg_dump, frozen transactions, or truncated commit timestamps), store
NULL in spock.resolutions.local_origin instead of the value 0
(InvalidRepOriginId).

Also change conflict log messages to print "unknown" instead of the
origin ID when the origin is InvalidRepOriginId or not available.

Bug fixes found during testing:

  • Fixed off-by-one error in spock_conflict_row_to_json() calls that were
    incorrectly passing &nulls[7] instead of &nulls[8] for local_tuple,
    and &nulls[11] instead of &nulls[12] for remote_tuple. This was
    overwriting the local_origin NULL flag.

Includes test case (014_pgdump_restore_conflict.pl) that reproduces the
pg_dump/restore scenario where rows have no replication origin tracking,
verifying that:

  • Conflicts are logged with local_origin = NULL
  • Resolution is apply_remote (correct behavior)
  • Data converges correctly despite conflicts

When the origin of a local tuple cannot be determined (e.g., data loaded
via pg_dump, frozen transactions, or truncated commit timestamps), store
NULL in spock.resolutions.local_origin instead of the value 0
(InvalidRepOriginId).

Also change conflict log messages to print "unknown" instead of the
origin ID when the origin is InvalidRepOriginId or not available.

Bug fixes found during testing:
- Fixed off-by-one error in spock_conflict_row_to_json() calls that were
  incorrectly passing &nulls[7] instead of &nulls[8] for local_tuple,
  and &nulls[11] instead of &nulls[12] for remote_tuple. This was
  overwriting the local_origin NULL flag.

Includes test case (014_pgdump_restore_conflict.pl) that reproduces the
pg_dump/restore scenario where rows have no replication origin tracking,
verifying that:
- Conflicts are logged with local_origin = NULL
- Resolution is apply_remote (correct behavior)
- Data converges correctly despite conflicts
@coderabbitai
Copy link

coderabbitai bot commented Feb 18, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch task/SPOC-442/unknown-origin

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@mason-sharp mason-sharp merged commit 7970dc2 into v5_STABLE Feb 19, 2026
12 of 18 checks passed
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.

2 participants

Comments