Skip to content

box: fix yielding DDL ordering on WAL failure#12007

Merged
sergepetrenko merged 1 commit intotarantool:masterfrom
Astronomax:gh-11833-two-ddls-on-the-same-space-in-a-row
Feb 12, 2026
Merged

box: fix yielding DDL ordering on WAL failure#12007
sergepetrenko merged 1 commit intotarantool:masterfrom
Astronomax:gh-11833-two-ddls-on-the-same-space-in-a-row

Conversation

@Astronomax
Copy link
Contributor

@Astronomax Astronomax commented Oct 31, 2025

Serialize yielding DDL operations on the same space to avoid reordering of data dictionary updates when the first DDL updated _space/_index in-memory and then failed to write to WAL.

To do so, add internal before_replace triggers for _space and _index that wait for completion of previous yielding alters on the same space before applying the next change.

Closes #11833

NO_DOC=bugfix

@Astronomax Astronomax force-pushed the gh-11833-two-ddls-on-the-same-space-in-a-row branch 4 times, most recently from 83db5d0 to 9cedd19 Compare November 5, 2025 21:24
@Astronomax Astronomax marked this pull request as draft November 8, 2025 08:11
@Astronomax Astronomax linked an issue Nov 8, 2025 that may be closed by this pull request
@Astronomax Astronomax force-pushed the gh-11833-two-ddls-on-the-same-space-in-a-row branch 3 times, most recently from 3f60744 to 3edae3e Compare November 12, 2025 14:14
@coveralls
Copy link

coveralls commented Nov 12, 2025

Coverage Status

coverage: 87.605% (+0.009%) from 87.596%
when pulling 6b1d42e on Astronomax:gh-11833-two-ddls-on-the-same-space-in-a-row
into 47f7cbf
on tarantool:master
.

@Astronomax Astronomax force-pushed the gh-11833-two-ddls-on-the-same-space-in-a-row branch from 3edae3e to 28f0e77 Compare November 12, 2025 14:53
@Astronomax Astronomax changed the title ddl: move yielding part into before_replace triggers two DDL of the same space in a row and WAL failure Nov 12, 2025
@Astronomax Astronomax force-pushed the gh-11833-two-ddls-on-the-same-space-in-a-row branch 4 times, most recently from c604fa0 to 2740e9f Compare November 20, 2025 15:18
@nshy nshy assigned nshy and unassigned nshy Nov 21, 2025
Copy link
Contributor

@drewdzzz drewdzzz left a comment

Choose a reason for hiding this comment

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

I don't like that now we can rollback a transaction when it executes a statement. Also, we have to patch more places to handle already rolled back transactions (applier, for example).

@drewdzzz drewdzzz assigned Astronomax and unassigned drewdzzz Nov 24, 2025
@Astronomax Astronomax force-pushed the gh-11833-two-ddls-on-the-same-space-in-a-row branch 4 times, most recently from 19da1a9 to 89ad3a2 Compare December 25, 2025 13:58
@Astronomax Astronomax force-pushed the gh-11833-two-ddls-on-the-same-space-in-a-row branch 3 times, most recently from 51e5cbc to f31d86f Compare January 12, 2026 13:47
@drewdzzz drewdzzz assigned Astronomax and unassigned drewdzzz Jan 21, 2026
@Astronomax Astronomax requested a review from nshy January 21, 2026 22:00
@Astronomax Astronomax assigned nshy and unassigned Astronomax Jan 21, 2026
@nshy nshy assigned Astronomax and unassigned nshy Jan 23, 2026
@Astronomax Astronomax force-pushed the gh-11833-two-ddls-on-the-same-space-in-a-row branch 3 times, most recently from 3fe14be to ae1dda4 Compare January 29, 2026 09:52
@Astronomax Astronomax requested a review from nshy January 29, 2026 09:54
@Astronomax Astronomax assigned nshy and unassigned Astronomax Jan 29, 2026
@Astronomax
Copy link
Contributor Author

Removed the checks for whether it's a yielding DDL or not from the before_replace triggers. That is, alter_space_wait_not_being_altered is now called in all cases (except when it's not the first statement in a transaction), regardless of whether the on_replace trigger will yield or not. The tests did not fail.

Now we need to make a final decision: do we keep these checks or not? @nshy @drewdzzz WDYT?

@nshy
Copy link
Contributor

nshy commented Feb 5, 2026

Now we need to make a final decision: do we keep these checks or not? @nshy @drewdzzz WDYT?

I'd drop them - code will be more simple and less fragile.

@drewdzzz
Copy link
Contributor

drewdzzz commented Feb 5, 2026

OK, let's drop them.

Serialize yielding DDL operations on the same space to avoid reordering
of data dictionary updates when the first DDL updated _space/_index
in-memory and then failed to write to WAL.

To do so, add internal before_replace triggers for _space and _index that
wait for completion of previous yielding alters on the same space before
applying the next change.

Closes tarantool#11833

NO_DOC=bugfix
@TarantoolBot
Copy link
Collaborator

Backport failed for release/3.2, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin release/3.2
git worktree add -d .worktree/backport/release/3.2/12007 origin/release/3.2
cd .worktree/backport/release/3.2/12007
git switch --create backport/release/3.2/12007
git cherry-pick -x 6e5a97c04913a9e1ec03ff40b2080380f445d15f

@TarantoolBot
Copy link
Collaborator

Backport failed for release/3.3, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin release/3.3
git worktree add -d .worktree/backport/release/3.3/12007 origin/release/3.3
cd .worktree/backport/release/3.3/12007
git switch --create backport/release/3.3/12007
git cherry-pick -x 6e5a97c04913a9e1ec03ff40b2080380f445d15f

@TarantoolBot
Copy link
Collaborator

Successfully created backport PR for release/3.5:

@TarantoolBot
Copy link
Collaborator

Successfully created backport PR for release/3.6:

@TarantoolBot
Copy link
Collaborator

Backport summary

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

Labels

backport/3.2 Automatically create a 3.2 backport PR backport/3.3 Automatically create a 3.3 backport PR backport/3.5 Automatically create a 3.5 backport PR backport/3.6 Automatically create a 3.6 backport PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Assertion on two DDL of the same space in a row and WAL failure

7 participants