Skip to content

vinyl: do not log dump if index was dropped#10294

Merged
locker merged 2 commits intotarantool:masterfrom
locker:vy-log-dump-after-gc-fix
Jul 23, 2024
Merged

vinyl: do not log dump if index was dropped#10294
locker merged 2 commits intotarantool:masterfrom
locker:vy-log-dump-after-gc-fix

Conversation

@locker
Copy link
Member

@locker locker commented Jul 22, 2024

An index can be dropped while a memory dump is in progress. If the vinyl garbage collector happens to delete the index from the vylog by the time the memory dump completes, the dump will log an entry for a deleted index, resulting in an error next time we try to recover the vylog, like:

ER_INVALID_VYLOG_FILE: Invalid VYLOG file: Run 2 committed after deletion

or

ER_INVALID_VYLOG_FILE: Invalid VYLOG file: Deleted range 9 has run slices

We already fixed a similar issue with compaction in commit 29e2931. Let's fix this one in exactly the same way: discard the new run without logging it to the vylog on a memory dump completion if the index was dropped while the dump was in progress.

Closes #10277

locker added 2 commits July 22, 2024 17:41
Let's log the new value when an error injection is set in orer to ease
debugging in tests.

NO_DOC=logging
NO_TEST=logging
NO_CHANGELOG=logging
An index can be dropped while a memory dump is in progress. If the vinyl
garbage collector happens to delete the index from the vylog by the time
the memory dump completes, the dump will log an entry for a deleted
index, resulting in an error next time we try to recover the vylog,
like:

```
ER_INVALID_VYLOG_FILE: Invalid VYLOG file: Run 2 committed after deletion
```

or

```
ER_INVALID_VYLOG_FILE: Invalid VYLOG file: Deleted range 9 has run slices
```

We already fixed a similar issue with compaction in commit 29e2931
("vinyl: fix race between compaction and gc of dropped LSM"). Let's fix
this one in exactly the same way: discard the new run without logging it
to the vylog on a memory dump completion if the index was dropped while
the dump was in progress.

Closes tarantool#10277

NO_DOC=bug fix
@locker locker requested a review from a team as a code owner July 22, 2024 16:00
@coveralls
Copy link

Coverage Status

coverage: 87.083% (+0.004%) from 87.079%
when pulling 43926d6 on locker:vy-log-dump-after-gc-fix
into e79982e
on tarantool:master
.

Copy link
Contributor

@mkostoevr mkostoevr left a comment

Choose a reason for hiding this comment

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

LGTM.

The fact the engine marks the LSM as dropped on the index drop comes handy.

@mkostoevr mkostoevr assigned locker and unassigned mkostoevr Jul 22, 2024
@locker locker added the full-ci Enables all tests for a pull request label Jul 22, 2024
@locker locker merged commit ae6a02e into tarantool:master Jul 23, 2024
@locker locker deleted the vy-log-dump-after-gc-fix branch July 23, 2024 07:26
@locker
Copy link
Member Author

locker commented Jul 23, 2024

Cherry-picked to 2.11 and 3.1.

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

Labels

full-ci Enables all tests for a pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Invalid VYLOG file: Deleted range 9 has run slices

4 participants