Physrep fail copy on recovery - #6114
Conversation
roborivers
left a comment
There was a problem hiding this comment.
Cbuild submission: Success ✓.
Regression testing: Success ✓.
The first 10 failing tests are:
sc_truncate_multiddl_generated [db unavailable at finish] **quarantined**
sc_truncate [db unavailable at finish]
abort_copy_on_recovery [db unavailable at finish]
sc_resume_logicalsc_generated **quarantined**
sc_resume
cdb2jdbc
cldeadlock
noresetgen
consumer_non_atomic_default_consumer_generated **quarantined**
sc_downgrade [timeout] **quarantined**
738efde to
6c10a3d
Compare
roborivers
left a comment
There was a problem hiding this comment.
Cbuild submission: Success ✓.
Regression testing: Success ✓.
The first 10 failing tests are:
comdb2sys_pagesize_generated [db unavailable at finish]
sc_resume_logicalsc_generated **quarantined**
cdb2jdbc
consumer_non_atomic_default_consumer_generated **quarantined**
sc_downgrade [timeout] **quarantined**
phys_rep_tiered_nosource_generated [timeout]
phys_rep_tiered_firstfile_generated [timeout]
phys_rep_tiered [timeout]
6c10a3d to
1701846
Compare
roborivers
left a comment
There was a problem hiding this comment.
Cbuild submission: Error ⚠.
Regression testing: Success ✓.
The first 10 failing tests are:
osql_cleanup [failed with core dumped]
cdb2jdbc
ssl_san
consumer_non_atomic_default_consumer_generated **quarantined**
ssl_set_cmd
ssl_prefer
ssl_dbname
sc_downgrade [timeout] **quarantined**
phys_rep_tiered_firstfile_generated [timeout]
phys_rep_tiered_nosource_generated [timeout]
eadc085 to
1d06d94
Compare
roborivers
left a comment
There was a problem hiding this comment.
Cbuild submission: Error ⚠.
Regression testing: Success ✓.
The first 10 failing tests are:
abort_copy_on_recovery [db unavailable at finish]
cdb2jdbc
reco-ddlk-sql **quarantined**
consumer_non_atomic_default_consumer_generated **quarantined**
sc_downgrade [timeout] **quarantined**
phys_rep_tiered [timeout]
phys_rep_tiered_firstfile_generated [timeout]
phys_rep_tiered_nosource_generated [timeout]
roborivers
left a comment
There was a problem hiding this comment.
Cbuild submission: Error ⚠.
Regression testing: Success ✓.
The first 10 failing tests are:
sc_resume_logicalsc_generated **quarantined**
cdb2jdbc
consumer_non_atomic_default_consumer_generated **quarantined**
sc_downgrade [timeout] **quarantined**
truncatesc_offline_generated [timeout] **quarantined**
19f65f8 to
cfd4fa3
Compare
roborivers
left a comment
There was a problem hiding this comment.
Cbuild submission: Error ⚠.
Regression testing: Success ✓.
The first 10 failing tests are:
sc_resume_logicalsc_generated **quarantined**
cdb2jdbc
consumer_non_atomic_default_consumer_generated **quarantined**
sc_downgrade [timeout] **quarantined**
roborivers
left a comment
There was a problem hiding this comment.
Cbuild submission: Error ⚠.
Regression testing: Success ✓.
The first 10 failing tests are:
cdb2jdbc
consumer_non_atomic_default_consumer_generated **quarantined**
sc_downgrade [timeout] **quarantined**
truncatesc_offline_generated [timeout] **quarantined**
comdb2ar reads data files live; it tolerates forward page writes but not recovery that rewinds the log (__log_vtruncate), which silently corrupts the archive. Make copy and recovery mutually exclusive: a new logdelete4 appsock holds recoverlk and the bdb lock in read mode for the copy's duration (bdb before recoverlk, matching recovery's order, so no deadlock), polls to yield if an exclusive op waits, and reports ok/aborted via a copy_complete handshake so comdb2ar discards a doomed copy. comdb2ar negotiates logdelete4 then falls back to logdelete3/2 on an "unknown command" reply; a handshake timeout instead means the server is busy draining a recovery, so it fails hard rather than downgrade to an unprotected copy. debug_block_comdb2ar is gated to v4 for the test. Signed-off-by: Mark Hannum <mhannum@bloomberg.net>
Holds a logdelete4 copy via debug_block_comdb2ar, forces a rewind with sys.cmd.truncate_time, and verifies comdb2ar aborts non-zero; also checks a clean copy still succeeds. Runs with online_recovery on and off. Plus: a stalled v4 handshake must fail hard, not silently downgrade to logdelete3. Signed-off-by: Mark Hannum <mhannum@bloomberg.net>
cfd4fa3 to
8c35d3c
Compare
roborivers
left a comment
There was a problem hiding this comment.
Cbuild submission: Success ✓.
Regression testing: Success ✓.
The first 10 failing tests are:
cdb2jdbc
reco-ddlk-sql **quarantined**
consumer_non_atomic_default_consumer_generated **quarantined**
sc_downgrade [timeout] **quarantined**
Abort a copy when recovery could rewind pages during it
A copy (
copycomdb2/comdb2ar, via thelogdeleteappsock) can be silently corrupted if recovery rewinds the log while the copy is in progress — routine on a physical replicant that truncates to resync, and on a normal replicant that connects to a new master.Make the copy and recovery mutually exclusive, and fail the copy (rather than stall it) when recovery needs to run. A new
logdelete4appsock has the copy holdrecoverlkand the bdb lock in read mode for its duration; when recovery (or a node upgrade/downgrade) waits on either, the handler releases the locks and marks the copy aborted. Acopy_completehandshake reportsok/aborted, andcomdb2ardiscards the archive (non-zero exit) on anything butok.What changed
bdb/rep.c,bdb/bdb_api.h:bdb_readlock_recovery/bdb_unlock_recoverywrappers overrecoverlk.plugins/logdelete: newlogdelete4appsock (read-lock hold, poll-and-yield,copy_complete);logdelete/2/3unchanged.tools/comdb2ar: negotiatelogdelete4(fallback to3/2), addLogHolder::copy_ok(), failserialise_databasewhen it returns false.Compatibility
Safe either direction: a new
comdb2arfalls back tologdelete3/2against an old DB, and an oldcomdb2aruseslogdelete3against a new DB. Full protection needs both sides new. Companion client PR: comdb2arlogdelete4-fail-copy-on-recovery.Testing
tests/abort_copy_on_recovery.testforces a rewind during a held copy and asserts it aborts, under bothonline_recoveryon and off, plus a no-recovery run that still succeeds.🤖 Generated with Claude Code