@@ -797,6 +797,7 @@ func (r *Runner) prepareWorkloadSteps(ctx context.Context) error {
797
797
}
798
798
var newFiles []base.DiskFileNum
799
799
blobRefMap := make (map [base.DiskFileNum ]manifest.BlobReferences )
800
+ blobFileMap := make (map [base.BlobFileID ]base.DiskFileNum )
800
801
for _ , nf := range ve .NewTables {
801
802
newFiles = append (newFiles , nf .Meta .TableBacking .DiskFileNum )
802
803
if s .kind == ingestStepKind && (nf .Meta .SmallestSeqNum != nf .Meta .LargestSeqNum || nf .Level != 0 ) {
@@ -806,6 +807,9 @@ func (r *Runner) prepareWorkloadSteps(ctx context.Context) error {
806
807
blobRefMap [nf .Meta .TableBacking .DiskFileNum ] = nf .Meta .BlobReferences
807
808
}
808
809
}
810
+ for _ , bf := range ve .NewBlobFiles {
811
+ blobFileMap [bf .FileID ] = bf .Physical .FileNum
812
+ }
809
813
if previousVersion != nil {
810
814
// previousVersion contains the current version, and so l0Organizer is
811
815
// consistent with it. The subsequent call to currentVersion will
@@ -861,7 +865,7 @@ func (r *Runner) prepareWorkloadSteps(ctx context.Context) error {
861
865
// Load all of the flushed sstables' keys into a batch.
862
866
s .flushBatch = r .d .NewBatch ()
863
867
err := loadFlushedSSTableKeys (s .flushBatch , r .WorkloadFS , r .WorkloadPath ,
864
- newFiles , blobRefMap , provider , r .readerOpts , & flushBufs )
868
+ newFiles , blobRefMap , blobFileMap , provider , r .readerOpts , & flushBufs )
865
869
if err != nil {
866
870
return errors .Wrapf (err , "flush in %q at offset %d" , manifestName , rr .Offset ())
867
871
}
@@ -995,6 +999,13 @@ func findManifestStart(
995
999
return index , info .Size (), nil
996
1000
}
997
1001
1002
+ type blobFileMap map [base.BlobFileID ]base.DiskFileNum
1003
+
1004
+ func (m blobFileMap ) Lookup (fileID base.BlobFileID ) (base.DiskFileNum , bool ) {
1005
+ diskFileNum , ok := m [fileID ]
1006
+ return diskFileNum , ok
1007
+ }
1008
+
998
1009
// loadFlushedSSTableKeys copies keys from the sstables specified by `fileNums`
999
1010
// in the directory specified by `path` into the provided batch. Keys are
1000
1011
// applied to the batch in the order dictated by their sequence numbers within
@@ -1011,6 +1022,7 @@ func loadFlushedSSTableKeys(
1011
1022
path string ,
1012
1023
fileNums []base.DiskFileNum ,
1013
1024
blobRefMap map [base.DiskFileNum ]manifest.BlobReferences ,
1025
+ blobFileMap blobFileMap ,
1014
1026
provider blob.ReaderProvider ,
1015
1027
readOpts sstable.ReaderOptions ,
1016
1028
bufs * flushBuffers ,
@@ -1040,7 +1052,7 @@ func loadFlushedSSTableKeys(
1040
1052
if bf , ok := blobRefMap [fileNum ]; ok {
1041
1053
blobRefs = & bf
1042
1054
}
1043
- vf , blobContext := sstable .LoadValBlobContext (provider , blobRefs )
1055
+ vf , blobContext := sstable .LoadValBlobContext (blobFileMap , provider , blobRefs )
1044
1056
defer func () { _ = vf .Close () }()
1045
1057
iter , err := r .NewIter (sstable .NoTransforms , nil , nil , blobContext )
1046
1058
if err != nil {
0 commit comments