diff options
author | Yu Zhang <yuzhangyu@fb.com> | 2024-08-20 09:19:52 -0700 |
---|---|---|
committer | Facebook GitHub Bot <facebook-github-bot@users.noreply.github.com> | 2024-08-20 09:19:52 -0700 |
commit | 81d52bdc1a9962b5e40dec409b6566dec8ef9b73 (patch) | |
tree | e43ccdf3339374054a15f97d78cf2ad1b14bbf4b /db | |
parent | d223d34bf36fe7619cae0c506c476df0534d5cf6 (diff) |
Fix UDT in memtable only assertions (#12946)
Summary:
Empty memtables can be legitimately created and flushed, for example by error recovery flush attempts:
https://github.com/facebook/rocksdb/blame/273b3eadf0ad06acaaeaf30efc35be5ab7588a9c/db/db_impl/db_impl_compaction_flush.cc#L2309-L2312
This check is updated to be considerate of this.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/12946
Reviewed By: hx235
Differential Revision: D61492477
Pulled By: jowlyzhang
fbshipit-source-id: 7d16fcaea457948546072f85b3650fd1cc24f9db
Diffstat (limited to 'db')
-rw-r--r-- | db/column_family.cc | 3 | ||||
-rw-r--r-- | db/flush_job.cc | 5 |
2 files changed, 8 insertions, 0 deletions
diff --git a/db/column_family.cc b/db/column_family.cc index b17571254..06e2b4365 100644 --- a/db/column_family.cc +++ b/db/column_family.cc @@ -1652,6 +1652,9 @@ bool ColumnFamilyData::ShouldPostponeFlushToRetainUDT( } for (const Slice& table_newest_udt : imm()->GetTablesNewestUDT(max_memtable_id)) { + if (table_newest_udt.empty()) { + continue; + } assert(table_newest_udt.size() == full_history_ts_low.size()); // Checking the newest UDT contained in MemTable with ascending ID up to // `max_memtable_id`. Return immediately on finding the first MemTable that diff --git a/db/flush_job.cc b/db/flush_job.cc index e874d81ff..44fe86c78 100644 --- a/db/flush_job.cc +++ b/db/flush_job.cc @@ -1156,6 +1156,11 @@ void FlushJob::GetEffectiveCutoffUDTForPickedMemTables() { // Find the newest user-defined timestamps from all the flushed memtables. for (MemTable* m : mems_) { Slice table_newest_udt = m->GetNewestUDT(); + // Empty memtables can be legitimately created and flushed, for example + // by error recovery flush attempts. + if (table_newest_udt.empty()) { + continue; + } if (cutoff_udt_.empty() || ucmp->CompareTimestamp(table_newest_udt, cutoff_udt_) > 0) { if (!cutoff_udt_.empty()) { |