@@ -956,16 +956,15 @@ type BulkVersionEdit struct {
956956 AddedFileBacking map [base.DiskFileNum ]* FileBacking
957957 RemovedFileBacking []base.DiskFileNum
958958
959- // AddedTablesByFileNum maps file number to table metadata for all added
960- // sstables from accumulated version edits. AddedTablesByFileNum is only
961- // populated if set to non-nil by a caller. It must be set to non-nil when
962- // replaying version edits read from a MANIFEST (as opposed to VersionEdits
963- // constructed in-memory). While replaying a MANIFEST file,
964- // VersionEdit.DeletedFiles map entries have nil values, because the on-disk
965- // deletion record encodes only the file number. Accumulate uses
966- // AddedTablesByFileNum to correctly populate the BulkVersionEdit's Deleted
967- // field with non-nil *TableMetadata.
968- AddedTablesByFileNum map [base.FileNum ]* TableMetadata
959+ // AllAddedTables maps table number to table metadata for all added sstables
960+ // from accumulated version edits. AllAddedTables is only populated if set to
961+ // non-nil by a caller. It must be set to non-nil when replaying version edits
962+ // read from a MANIFEST (as opposed to VersionEdits constructed in-memory).
963+ // While replaying a MANIFEST file, VersionEdit.DeletedFiles map entries have
964+ // nil values, because the on-disk deletion record encodes only the file
965+ // number. Accumulate uses AllAddedTables to correctly populate the
966+ // BulkVersionEdit's Deleted field with non-nil *TableMetadata.
967+ AllAddedTables map [base.FileNum ]* TableMetadata
969968
970969 // MarkedForCompactionCountDiff holds the aggregated count of files
971970 // marked for compaction added or removed.
@@ -1042,10 +1041,10 @@ func (b *BulkVersionEdit) Accumulate(ve *VersionEdit) error {
10421041
10431042 if m == nil {
10441043 // m is nil only when replaying a MANIFEST.
1045- if b .AddedTablesByFileNum == nil {
1044+ if b .AllAddedTables == nil {
10461045 return errors .Errorf ("deleted file L%d.%s's metadata is absent and bve.AddedByFileNum is nil" , df .Level , df .FileNum )
10471046 }
1048- m = b .AddedTablesByFileNum [df .FileNum ]
1047+ m = b .AllAddedTables [df .FileNum ]
10491048 if m == nil {
10501049 return base .CorruptionErrorf ("pebble: file deleted L%d.%s before it was inserted" , df .Level , df .FileNum )
10511050 }
@@ -1112,8 +1111,8 @@ func (b *BulkVersionEdit) Accumulate(ve *VersionEdit) error {
11121111 b .AddedTables [nf .Level ] = make (map [base.FileNum ]* TableMetadata )
11131112 }
11141113 b .AddedTables [nf .Level ][nf .Meta .FileNum ] = nf .Meta
1115- if b .AddedTablesByFileNum != nil {
1116- b .AddedTablesByFileNum [nf .Meta .FileNum ] = nf .Meta
1114+ if b .AllAddedTables != nil {
1115+ b .AllAddedTables [nf .Meta .FileNum ] = nf .Meta
11171116 }
11181117 if nf .Meta .MarkedForCompaction {
11191118 b .MarkedForCompactionCountDiff ++
0 commit comments