Skip to content

box: delete .inprogress files from wal_dir#12247

Open
LevKats wants to merge 1 commit intotarantool:masterfrom
LevKats:gh-12081-delete-xlog-inprogress-custom-wal-dir
Open

box: delete .inprogress files from wal_dir#12247
LevKats wants to merge 1 commit intotarantool:masterfrom
LevKats:gh-12081-delete-xlog-inprogress-custom-wal-dir

Conversation

@LevKats
Copy link
Contributor

@LevKats LevKats commented Jan 28, 2026

In tarantool, each engine maintains its own files including .inprogress. However, .xlog files do not belong to any particular engine and are common. When wal_dir matches memtx_dir, xlogs just happen to be accidentally deleted by memtx engine.

In this patch, the wal_remove_temporary_files function is introduced to delete such common files from wal_dir.

Fixes #12081

NO_DOC=bugfix
NO_CHANGELOG=bugfix

@LevKats LevKats self-assigned this Jan 28, 2026
@LevKats LevKats force-pushed the gh-12081-delete-xlog-inprogress-custom-wal-dir branch from 57a2d7d to d87cac1 Compare January 28, 2026 07:33
@coveralls
Copy link

coveralls commented Jan 28, 2026

Coverage Status

coverage: 87.597% (-0.001%) from 87.598%
when pulling dbb0440 on LevKats:gh-12081-delete-xlog-inprogress-custom-wal-dir
into 033540c
on tarantool:master
.

src/box/wal.c Outdated
wal_remove_temporary_files(void)
{
struct wal_writer *writer = &wal_writer_singleton;
xdir_remove_temporary_files(&writer->wal_dir);
Copy link
Contributor

Choose a reason for hiding this comment

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

I just glanced over wal_writer and it seems to me that writer->wal_dir can be updated from WAL thread. Do I miss something or there is a potential data race here?

Copy link
Contributor Author

@LevKats LevKats Feb 4, 2026

Choose a reason for hiding this comment

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

Fixed. Sorry for long response.

@drewdzzz drewdzzz removed their assignment Jan 28, 2026
In tarantool, each engine maintains its own files including
`.inprogress`. However, `.xlog` files  do not belong to any particular
engine and are common. When `wal_dir` matches `memtx_dir`, xlogs just
happen to be accidentally deleted by memtx engine.

In this patch, the `wal_remove_temporary_files` function is introduced
to delete such common files from `wal_dir`.

Fixes tarantool#12081

NO_DOC=bugfix
NO_CHANGELOG=bugfix
@LevKats LevKats force-pushed the gh-12081-delete-xlog-inprogress-custom-wal-dir branch from d87cac1 to dbb0440 Compare February 4, 2026 06:48
@LevKats LevKats requested a review from drewdzzz February 4, 2026 07:14
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.

Leftover .xlog.inprogress files are not cleared if wal_dir is different from memtx_dir

4 participants