Skip to content

Commit

Permalink
add logs
Browse files Browse the repository at this point in the history
  • Loading branch information
udpatil committed Nov 16, 2023
1 parent a7571ae commit de87d52
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions store/multiversion/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ func (s *Store) GetIterateset(index int) Iterateset {
}

// CollectIteratorItems implements MultiVersionStore. It will return a memDB containing all of the keys present in the multiversion store within the iteration range prior to (exclusive of) the index.
func (s *Store) CollectIteratorItems(index int) *db.MemDB {
func (s *Store) CollectIteratorItems(index int, logger log.Logger) *db.MemDB {
sortedItems := db.NewMemDB()

// get all writeset keys prior to index
Expand All @@ -250,6 +250,7 @@ func (s *Store) CollectIteratorItems(index int) *db.MemDB {
}
indexedWriteset := writesetAny.([]string)
// TODO: do we want to exclude keys out of the range or just let the iterator handle it?
logger.Info("Logging sorted keys from writeset index", "index", i, "length", len(indexedWriteset), "keys", indexedWriteset)
for _, key := range indexedWriteset {
// TODO: inefficient because (logn) for each key + rebalancing? maybe theres a better way to add to a tree to reduce rebalancing overhead
sortedItems.Set([]byte(key), []byte{})
Expand All @@ -260,7 +261,7 @@ func (s *Store) CollectIteratorItems(index int) *db.MemDB {

func (s *Store) validateIterator(index int, tracker iterationTracker, logger log.Logger) bool {
// collect items from multiversion store
sortedItems := s.CollectIteratorItems(index)
sortedItems := s.CollectIteratorItems(index, logger)
// add the iterationtracker writeset keys to the sorted items
for key := range tracker.writeset {
sortedItems.Set([]byte(key), []byte{})
Expand Down

0 comments on commit de87d52

Please sign in to comment.