You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
returnnil, fmt.Errorf("tree is nil: %w", ErrNotInitalizedTree)
}
// CV Prevent crash on incrVersionReaders if tree.ndb == nil
iftree.ndb==nil {
returnnil, fmt.Errorf("tree.ndb is nil: %w", ErrNotInitalizedTree)
}
The first case, tree == nil, can be handled by (1) declaring the case a programmer error and accepting the panic or (2) by returning an *Exporter whose Next returns ErrorExportDone immediately.
The second case, tree.ndb == nil, signifies an in-memory database which doesn't warrant an error. Why not skip the call to tree.ndb.incrVersionReaders and proceed with the export?
ImmutableTree.Export
could be simplified to return no error.Currently, it has two error cases:
iavl/export.go
Lines 41 to 47 in 64ffc27
The first case,
tree == nil
, can be handled by (1) declaring the case a programmer error and accepting the panic or (2) by returning an*Exporter
whoseNext
returnsErrorExportDone
immediately.The second case,
tree.ndb == nil
, signifies an in-memory database which doesn't warrant an error. Why not skip the call totree.ndb.incrVersionReaders
and proceed with the export?CC @odeke-em
The text was updated successfully, but these errors were encountered: