@ -481,16 +481,20 @@ Status MemTableList::TryInstallMemtableFlushResults(
// We piggyback the information of earliest log file to keep in the
// We piggyback the information of earliest log file to keep in the
// manifest entry for the last file flushed.
// manifest entry for the last file flushed.
edit_list . back ( ) - > SetMinLogNumberToKeep ( min_wal_number_to_keep ) ;
edit_list . back ( ) - > SetMinLogNumberToKeep ( min_wal_number_to_keep ) ;
} else {
min_wal_number_to_keep =
PrecomputeMinLogNumberToKeepNon2PC ( vset , * cfd , edit_list ) ;
}
}
std : : unique_ptr < VersionEdit > wal_deletion ;
std : : unique_ptr < VersionEdit > wal_deletion ;
if ( vset - > db_options ( ) - > track_and_verify_wals_in_manifest ) {
if ( vset - > db_options ( ) - > track_and_verify_wals_in_manifest ) {
wal_deletion . reset ( new VersionEdit ) ;
if ( ! vset - > db_options ( ) - > allow_2pc ) {
wal_deletion - > DeleteWalsBefore ( min_wal_number_to_keep ) ;
min_wal_number_to_keep =
edit_list . push_back ( wal_deletion . get ( ) ) ;
PrecomputeMinLogNumberToKeepNon2PC ( vset , * cfd , edit_list ) ;
}
if ( min_wal_number_to_keep >
vset - > GetWalSet ( ) . GetMinWalNumberToKeep ( ) ) {
wal_deletion . reset ( new VersionEdit ) ;
wal_deletion - > DeleteWalsBefore ( min_wal_number_to_keep ) ;
edit_list . push_back ( wal_deletion . get ( ) ) ;
}
}
}
const auto manifest_write_cb = [ this , cfd , batch_count , log_buffer ,
const auto manifest_write_cb = [ this , cfd , batch_count , log_buffer ,
@ -754,10 +758,12 @@ Status InstallMemtableAtomicFlushResults(
min_wal_number_to_keep =
min_wal_number_to_keep =
PrecomputeMinLogNumberToKeepNon2PC ( vset , cfds , edit_lists ) ;
PrecomputeMinLogNumberToKeepNon2PC ( vset , cfds , edit_lists ) ;
}
}
wal_deletion . reset ( new VersionEdit ) ;
if ( min_wal_number_to_keep > vset - > GetWalSet ( ) . GetMinWalNumberToKeep ( ) ) {
wal_deletion - > DeleteWalsBefore ( min_wal_number_to_keep ) ;
wal_deletion . reset ( new VersionEdit ) ;
edit_lists . back ( ) . push_back ( wal_deletion . get ( ) ) ;
wal_deletion - > DeleteWalsBefore ( min_wal_number_to_keep ) ;
+ + num_entries ;
edit_lists . back ( ) . push_back ( wal_deletion . get ( ) ) ;
+ + num_entries ;
}
}
}
// Mark the version edits as an atomic group if the number of version edits
// Mark the version edits as an atomic group if the number of version edits