Bug 16254 - CTDB database operations can be run against incorrect nodes
Summary: CTDB database operations can be run against incorrect nodes
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: CTDB (show other bugs)
Version: 4.25.0rc*
Hardware: All All
: P5 minor (vote)
Target Milestone: ---
Assignee: Samba release manager
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2026-09-21 12:43 UTC by Martin Schwenke
Modified: 2026-10-03 08:08 UTC (History)
1 user (show)

See Also:


Attachments
Patch for v4-25-test (57.82 KB, patch)
2026-09-30 23:11 UTC, Martin Schwenke
slow: review+
Details
Patch for v4-24-test (11.77 KB, patch)
2026-09-30 23:12 UTC, Martin Schwenke
slow: review+
Details
Patch for v4-23-test (11.77 KB, patch)
2026-09-30 23:14 UTC, Martin Schwenke
slow: review+
Details
Patch for v4-25-test v2 (59.62 KB, patch)
2026-10-01 12:03 UTC, Martin Schwenke
slow: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Schwenke 2026-09-21 12:43:49 UTC
There are some corner-case bugs relating to CTDB database operations:

* The transaction code (and the push record code derived from it)
  incorrectly only push records to nodes in the VNN map.  This does
  not take into account active nodes with their lmaster capability
  disabled.  All active nodes need the records pushed to them.

* The persistent database traverse code will not select the local
  node for an efficient traversal if it does not have the lmaster
  capability.  The local node is only selected if it is in the VNN
  map.  It should be selected if it is active.

* For persistent/replicated databases, the "ctdb catdb" function fetches
  the database from each node and does a volatile database style merge.
  This can conceal replicate database bugs.  It should do a local traverse
  or use the same logic as the above traverse code.
Comment 1 Martin Schwenke 2026-09-22 03:45:51 UTC
I'm not planning to fix "ctdb catdb ..." as part of this bug.

"ctdb cattdb ..." can be used to test this issue the pushing to
non-lmaster active nodes.  So, there is no real urgency to fix
catdb, since it is just tool weirdness rather than underlying
database breakage.

Fixing catdb requires some thought about whether:

* The current behaviour is sane
* A local traverse should be used
* The best node should be selected for a traverse
Comment 2 Martin Schwenke 2026-09-24 03:17:54 UTC
There are also several issues in the "ctdb pushrecord" command
and some of the code used to implement it.  Let's fix these here
a couple parts of the fix are related.
Comment 3 Samba QA Contact 2026-09-30 15:57:04 UTC
This bug was referenced in samba master:

792942b7e9cfb51dac3ec1c406f40570098d429c
6420aba887c09590bbd46706b0a8ebdd4b848a96
65d55e410bc217e8ba02c7194a53412366dc8443
a8b99d264b87d96fe4af377ac127e64920d9ad1f
f2fba08c1d7fc616ded2690b10ebefe86a17a5c0
7e1bc53dd9e7f4677a0b0a758d80d1780a18362d
ac2bf232aca9966c551bb02f6c8120b62b938ccd
9fb6267aaed48f7400d1c14c721b53572662e85e
a34ecddd44080144d11af68eff62fc2b14a0e725
508b04c3dae960e59593dcc56517eb5d3b9172d8
b124f9dc29b297756438520cb06c505a78bdb926
7c976de907a7871992bd26dc212b2112ce2c8745
87c7f950c1cb5c1c40917089c338ae2b3634d1a1
4421df999e474a77d84b1162443cab6778ac5986
acae3df63ca495d871bf6a1a252c125c87a494f1
5bf2f9e7d6d087467ab8025dea6b72334a375400
22daa1d18f9e6c24ae7773106bf19520b126b097
Comment 4 Martin Schwenke 2026-09-30 23:11:27 UTC
Created attachment 19251 [details]
Patch for v4-25-test

Cherry picks cleanly.  Builds without problems.  Smoke tested with the 2 new tests.
Comment 5 Martin Schwenke 2026-09-30 23:12:20 UTC
Created attachment 19252 [details]
Patch for v4-24-test

Cherry picks cleanly.  Builds without problems.  Smoke tested with the new test.
Comment 6 Martin Schwenke 2026-09-30 23:14:21 UTC
Created attachment 19253 [details]
Patch for v4-23-test

Patch for v4-23-test, if there will be another maintenance release.  The v4-24-test patch applies cleanly to v4-23-test but, given there is a different patch for v4-25-test, it seems least confusing to post a separate patch.

Cherry picks cleanly.  Builds without problems.  Smoke tested with the new test.
Comment 7 Martin Schwenke 2026-10-01 08:17:02 UTC
One extra test fix coming for v4-25-test.
Comment 8 Ralph Böhme 2026-10-01 08:18:37 UTC
Reasigning to Björn for inclusion in 4.25, 4.24 and 4.23.
Comment 9 Ralph Böhme 2026-10-01 08:46:36 UTC
Reassigning to Martin while we wait for the followup fixes to land.
Comment 10 Martin Schwenke 2026-10-01 12:03:25 UTC
Created attachment 19267 [details]
Patch for v4-25-test v2

1 additional commit to fix a test bug.  As per previous version of patch...

Cherry picks cleanly.  Builds without problems.  Smoke tested with the 2 new tests.
Comment 11 Samba QA Contact 2026-10-01 19:30:13 UTC
This bug was referenced in samba v4-23-test:

3813e8e5c83244162c2de2b2f301e0bb3d5581d8
2af8d883ec1997e5bc564d64657726936875db20
6d85060e0c9e338acc1ee63f345fb274e1de9f45
fadbe51df8664299b63c7548e7a720580663637f
4fb9e6bfd18ae799106cb9219846f753d36c4f9e
Comment 12 Samba QA Contact 2026-10-01 19:47:47 UTC
This bug was referenced in samba v4-23-stable (Release samba-4.23.13):

3813e8e5c83244162c2de2b2f301e0bb3d5581d8
2af8d883ec1997e5bc564d64657726936875db20
6d85060e0c9e338acc1ee63f345fb274e1de9f45
fadbe51df8664299b63c7548e7a720580663637f
4fb9e6bfd18ae799106cb9219846f753d36c4f9e
Comment 13 Samba QA Contact 2026-10-02 00:38:04 UTC
This bug was referenced in samba v4-24-test:

37b5184cba3a6e29ea3fa31eab481182746cdf0b
ac2e896c5a2d61cd8f1df9b9b3dd5914a500c7a8
e9f87255c3d575fcb81e52667116d415da5e607c
6906c87444fc4bfd777a178a16f40d81b2377f7f
6550b97465b76b3bded074c5096b4e82d617d4a8
Comment 14 Ralph Böhme 2026-10-02 05:24:17 UTC
Reasigning to Björn for inclusion in 4.25.
Comment 15 Samba QA Contact 2026-10-02 19:38:04 UTC
This bug was referenced in samba v4-25-test:

961fb52db168d450c27bdb5221accbf148410c76
0bc5af0d97ae85d6d052fa936bee791ddb6d55ac
0a8cb0610e77ab4a6efa43d4bdba108382bd033c
ad586f29a99842dbce58f624fb02b0cd5158fce3
0d2d87bd37141757ff88597290808afc9354831a
9a5bb7591cf9b7f4fca131e6cc5832deef9d95b1
71c5ee6ca11d8f1d6003a456cb1d453445650a33
a2793a573628a8129dd791e56e9924545eeb8e03
d455e858b1a98619238f0bccd34bd9fab44f1fd8
97e568beeaa638303bb6a3c0f57888d53bf073d5
1aa831d9c2a39ebb5bbdef7c3283d35e1e2d0e51
9dc132430650bc3a75bb79d216bc52eb06c0af33
2d26150c8fa07f8ba5ea60adf5905d322399e5eb
ac9bf9c62cfaf75833cd64ab059bec861ea926ea
d0a4ec0caebabdc80f73bd0bc0f81dd2b7ff491b
d58bdb549ca6fa8ce5820dd43742ac714aabd4a6
98ac072bb32be3366620857726232e6d0de66578