Skip to content

Check physrep SP rcodes and prevent topology cycles - #6404

Open
markhannum wants to merge 4 commits into
bloomberg:mainfrom
markhannum:physrep-register-cycle
Open

markhannum wants to merge 4 commits into
bloomberg:mainfrom
markhannum:physrep-register-cycle

Conversation

@markhannum

Copy link
Copy Markdown
Contributor

The physrep metadb stored procedures ignored their own rcodes, and register_replicant could recurse forever on a cycle in comdb2_physrep_connections, hanging registration.

  • Check rcodes in the physrep SPs and retry verify errors; other failures return -201
  • Check the final rcode of metadb calls in db/phys_rep.c
  • Never offer a node its own subtree; update_registry refuses a link to self or a descendant with -202, and the replicant skips that source (forward and reverse connections)
  • Cap the topology walk at 32 tiers

SP prototypes and output columns are unchanged. Tests without a metadb now override the registry-writing SPs with no-ops, as they already do for register_replicant.

New test physrep_metadb_sp. Passed: phys_rep, phys_rep_tiered (+ firstfile/nosource), physrep_ignore_table, physrep_cksum_anchor, nophyswrite, log_trigger, truncatesc, protobuf_connectmsg_physrep_check, plus phys_rep_tiered with main replicants/branch metadb and the reverse.

Signed-off-by: Mark Hannum mhannum@bloomberg.net

@markhannum
markhannum force-pushed the physrep-register-cycle branch 2 times, most recently from a1826f9 to a80e16a Compare October 24, 2026 01:17

@roborivers roborivers left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cbuild submission: Success ✓.
Regression testing: Success ✓.

@markhannum
markhannum force-pushed the physrep-register-cycle branch from a80e16a to 8b5a6c2 Compare October 24, 2026 14:08

@roborivers roborivers left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cbuild submission: Success ✓.
Regression testing: Success ✓.

The physrep SPs and phys_rep.c ignored failures, so a failed reset_nodes
looked successful and the replicant registered against stale topology.
Retry verify errors in the SPs and return and log any other failure.

Signed-off-by: Mark Hannum <mhannum@bloomberg.net>
physrep_metadb_sp runs the SPs against the test db as the metadb: a
verify error is retried and any other failure is returned.

Signed-off-by: Mark Hannum <mhannum@bloomberg.net>
register_replicant skips the requester and its subtree; update_registry
refuses such a link with -202 and the replicant skips that source. Both
walks stop at 32 tiers so a cycle elsewhere cannot hang them.

Signed-off-by: Mark Hannum <mhannum@bloomberg.net>
Cover a node linking to itself or any descendant, a sibling sharing a
source, and cycles elsewhere in the topology for both SPs.

Signed-off-by: Mark Hannum <mhannum@bloomberg.net>
@markhannum
markhannum force-pushed the physrep-register-cycle branch from 8b5a6c2 to 71d66f8 Compare October 24, 2026 22:07

@roborivers roborivers left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cbuild submission: Success ✓.
Regression testing: Success ✓.

This branch has not been deployed

No deployments
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