@@ -50,6 +50,7 @@ type sstableT struct {
5050 filter key
5151 count int64
5252 verbose bool
53+ blobMode string
5354}
5455
5556func newSSTable (
@@ -121,6 +122,8 @@ inclusive-inclusive range specified by --start and --end.
121122
122123 s .Check .Flags ().Var (
123124 & s .fmtKey , "key" , "key formatter" )
125+ s .Check .Flags ().StringVar (
126+ & s .blobMode , "blob-mode" , "none" , "blob value formatter" )
124127 s .Layout .Flags ().Var (
125128 & s .fmtKey , "key" , "key formatter" )
126129 s .Layout .Flags ().Var (
@@ -139,6 +142,8 @@ inclusive-inclusive range specified by --start and --end.
139142 & s .filter , "filter" , "only output records with matching prefix or overlapping range tombstones" )
140143 s .Scan .Flags ().Int64Var (
141144 & s .count , "count" , 0 , "key count for scan (0 is unlimited)" )
145+ s .Scan .Flags ().StringVar (
146+ & s .blobMode , "blob-mode" , "none" , "blob value formatter" )
142147
143148 return s
144149}
@@ -163,10 +168,17 @@ func (s *sstableT) runCheck(cmd *cobra.Command, args []string) {
163168 s .fmtKey .setForComparer (r .Properties .ComparerName , s .comparers )
164169 s .fmtValue .setForComparer (r .Properties .ComparerName , s .comparers )
165170
166- // TODO(jackson): Adjust to support two modes: one that surfaces the raw
171+ var blobContext sstable.TableBlobContext
172+ switch ConvertToBlobRefMode (s .blobMode ) {
173+ case BlobRefModePrint :
174+ blobContext = sstable .DebugHandlesBlobContext
175+ default :
176+ blobContext = sstable .AssertNoBlobHandles
177+ }
178+ // TODO(annie): Adjust to support two modes: one that surfaces the raw
167179 // blob value handles, and one that fetches the blob values from blob
168180 // files uncovered by scanning the directory entries. See #4448.
169- iter , err := r .NewIter (sstable .NoTransforms , nil , nil , sstable . AssertNoBlobHandles )
181+ iter , err := r .NewIter (sstable .NoTransforms , nil , nil , blobContext )
170182 if err != nil {
171183 fmt .Fprintf (stderr , "%s\n " , err )
172184 return
@@ -334,10 +346,17 @@ func (s *sstableT) runScan(cmd *cobra.Command, args []string) {
334346 prefix = fmt .Sprintf ("%s: " , path )
335347 }
336348
337- // TODO(jackson): Adjust to support two modes: one that surfaces the raw
349+ var blobContext sstable.TableBlobContext
350+ switch ConvertToBlobRefMode (s .blobMode ) {
351+ case BlobRefModePrint :
352+ blobContext = sstable .DebugHandlesBlobContext
353+ default :
354+ blobContext = sstable .AssertNoBlobHandles
355+ }
356+ // TODO(annie): Adjust to support two modes: one that surfaces the raw
338357 // blob value handles, and one that fetches the blob values from blob
339358 // files uncovered by scanning the directory entries. See #4448.
340- iter , err := r .NewIter (sstable .NoTransforms , nil , s .end , sstable . AssertNoBlobHandles )
359+ iter , err := r .NewIter (sstable .NoTransforms , nil , s .end , blobContext )
341360 if err != nil {
342361 fmt .Fprintf (stderr , "%s%s\n " , prefix , err )
343362 return
0 commit comments