Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#24545] docdb: fix segfault caused by re-packing when packed row is …
…disabled Summary: If ysql_enable_packed_row is turned off, and there are packed rows existing in DB, compaction may hit segfault with the following stack: ``` [m-1] *** SIGSEGV (@0x0) received by PID 120292 (TID 0x7f9c4a653700) from PID 0; stack trace: *** [m-1] @ 0x7f9c527ae697 google::(anonymous namespace)::FailureSignalHandler() [m-1] @ 0x7f9c509e1d10 (unknown) [m-1] @ 0x7f9c534c7082 yb::dockv::RowPackerBase::NextColumnId() [m-1] @ 0x7f9c5639dd46 yb::docdb::(anonymous namespace)::PackedRowData::ProcessColumn() [m-1] @ 0x7f9c563a3dfa yb::docdb::(anonymous namespace)::DocDBCompactionFeed::Feed() [m-1] @ 0x7f9c56014067 rocksdb::CompactionJob::ProcessKeyValueCompaction() [m-1] @ 0x7f9c56015182 rocksdb::CompactionJob::Run() [m-1] @ 0x7f9c5603ff63 rocksdb::DBImpl::BackgroundCompaction() [m-1] @ 0x7f9c5604b6f0 rocksdb::DBImpl::BackgroundCallCompaction() [m-1] @ 0x7f9c56069cca rocksdb::DBImpl::CompactionTask::DoRun() [m-1] @ 0x7f9c5605c4ff rocksdb::DBImpl::ThreadPoolTask::Run() [m-1] @ 0x7f9c52ad13db yb::(anonymous namespace)::PriorityThreadPoolWorker::Run() [m-1] @ 0x7f9c52acda1d std::_Function_handler<>::_M_invoke() [m-1] @ 0x7f9c52b1f845 yb::Thread::SuperviseThread() [m-1] @ 0x7f9c509d71ca start_thread [m-1] @ 0x7f9c506328d3 __GI___clone ``` The root cause is that the packer is not initialized when packed row is disabled. But if there exists packed rows, it will still re-pack the rows with the new columns or new schema, which can cause segfault. This diff is to ensure packer is created when re-packing the old rows, the packed_row_version of the old row will be used to initialize the new row packer. Jira: DB-13579 Test Plan: PackingVersion/PgPackedRowTest.DisableRepack*/* Reviewers: sergei Reviewed By: sergei Subscribers: yql, ybase, qhu Differential Revision: https://phorge.dev.yugabyte.com/D39264
- Loading branch information