Skip to content

Conversation

@tonyxuqqi
Copy link

To debug WAL corruption issues

Qi Xu added 6 commits February 15, 2024 18:54
Signed-off-by: Qi Xu <tonyxuqqi@outlook.com>
Signed-off-by: Qi Xu <tonyxuqqi@outlook.com>
Signed-off-by: Qi Xu <tonyxuqqi@outlook.com>
Signed-off-by: Qi Xu <tonyxuqqi@outlook.com>
Signed-off-by: Qi Xu <tonyxuqqi@outlook.com>
fix
Signed-off-by: Qi Xu <tonyxuqqi@outlook.com>
Qi Xu added 2 commits March 13, 2024 14:16
Signed-off-by: Qi Xu <tonyxuqqi@outlook.com>
Signed-off-by: Qi Xu <tonyxuqqi@outlook.com>
@mittalrishabh
Copy link

@tonyxuqqi What is the WAL recovery mode in tikv ? I guess that it should be kTolerateCorruptedTailRecords.

@mittalrishabh
Copy link

which format is tikv using. Seems like rocksdb wal has two formats : legacy and recycle. Recycle format has more debug information (log number) . https://github.com/facebook/rocksdb/wiki/Write-Ahead-Log-File-Format

Qi Xu added 2 commits March 14, 2024 14:23
Signed-off-by: Qi Xu <tonyxuqqi@outlook.com>
Signed-off-by: Qi Xu <tonyxuqqi@outlook.com>
"Start writing to WAL: [%" PRIu64 " ]",
log_writer->get_log_number());
}
if (log_writer->get_log_number() != logs_.back().number) {
Copy link

Choose a reason for hiding this comment

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

@tonyxuqqi : At the beginning of the write, writer will reference the last WAL only. The race condition happens, while the write is ongoing. We should check this condition after the write.

io_s = WriteToWAL(*merged_batch, log_writer, log_used, &log_size,
log_file_number_size);
log_file_number_size, 1);
if (to_be_cached_state) {
Copy link

Choose a reason for hiding this comment

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

Can you also add a lot when the fsync happens in writeToWAL

io_s = log.writer->file()->Sync(immutable_db_options_.use_fsync);

Qi Xu added 8 commits March 21, 2024 16:46
Signed-off-by: Qi Xu <tonyxuqqi@outlook.com>
Signed-off-by: Qi Xu <tonyxuqqi@outlook.com>
This reverts commit 844300e.
Signed-off-by: Qi Xu <tonyxuqqi@outlook.com>
Signed-off-by: Qi Xu <tonyxuqqi@outlook.com>
Signed-off-by: Qi Xu <tonyxuqqi@outlook.com>
Signed-off-by: Qi Xu <tonyxuqqi@outlook.com>
Signed-off-by: Qi Xu <tonyxuqqi@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants