@@ -531,7 +531,7 @@ func (r *rebuilder) Run(ctx context.Context) error {
531
531
WithCompression (options .None ).
532
532
WithEventLogging (false ).
533
533
WithLogRotatesToFlush (10 ).
534
- WithMaxCacheSize (50 )
534
+ WithMaxCacheSize (50 ) // TODO(Aman): Disable cache altogether
535
535
tmpDB , err := badger .OpenManaged (dbOpts )
536
536
if err != nil {
537
537
return errors .Wrap (err , "error opening temp badger for reindexing" )
@@ -546,9 +546,15 @@ func (r *rebuilder) Run(ctx context.Context) error {
546
546
// We set it to 1 in case there are no keys found and NewStreamAt is called with ts=0.
547
547
var counter uint64 = 1
548
548
549
+ // Todo(Aman): Replace TxnWriter with WriteBatch. While we do that we should ensure that
550
+ // WriteBatch has a mechanism for throttling. Also, find other places where TxnWriter
551
+ // could be replaced with WriteBatch in the code
552
+ // Todo(Aman): Replace TxnWriter with WriteBatch. While we do that we should ensure that
553
+ // WriteBatch has a mechanism for throttling. Also, find other places where TxnWriter
554
+ // could be replaced with WriteBatch in the code.
549
555
tmpWriter := NewTxnWriter (tmpDB )
550
556
stream := pstore .NewStreamAt (r .startTs )
551
- stream .LogPrefix = fmt .Sprintf ("Rebuilding index for predicate %s:" , r .attr )
557
+ stream .LogPrefix = fmt .Sprintf ("Rebuilding index for predicate %s (1/2) :" , r .attr )
552
558
stream .Prefix = r .prefix
553
559
stream .KeyToList = func (key []byte , itr * badger.Iterator ) (* bpb.KVList , error ) {
554
560
// We should return quickly if the context is no longer valid.
@@ -619,7 +625,7 @@ func (r *rebuilder) Run(ctx context.Context) error {
619
625
620
626
writer := NewTxnWriter (pstore )
621
627
tmpStream := tmpDB .NewStreamAt (counter )
622
- tmpStream .LogPrefix = fmt .Sprintf ("Rebuilding index for predicate %s:" , r .attr )
628
+ tmpStream .LogPrefix = fmt .Sprintf ("Rebuilding index for predicate %s (2/2) :" , r .attr )
623
629
tmpStream .KeyToList = func (key []byte , itr * badger.Iterator ) (* bpb.KVList , error ) {
624
630
l , err := ReadPostingList (key , itr )
625
631
if err != nil {
0 commit comments