mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-23 04:03:49 +00:00
Sequence in to mdbx (#1370)
This commit is contained in:
parent
068463dff4
commit
ccd1ad5832
@ -359,8 +359,21 @@ func toMdbx(ctx context.Context, from, to string) error {
|
||||
if b.Flags&dbutils.DupSort != 0 && !b.AutoDupSortKeysConversion {
|
||||
appendFunc = c.(ethdb.CursorDupSort).AppendDup
|
||||
}
|
||||
if b.Flags&dbutils.DupFixed != 0 && !b.AutoDupSortKeysConversion {
|
||||
appendFunc = c.(ethdb.CursorDupSort).AppendDup
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// migrate bucket sequences to native mdbx implementation
|
||||
currentID, err := srcTx.Sequence(name, 0)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = dstTx.Sequence(name, currentID+1)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
err := dstTx.Commit(context.Background())
|
||||
|
@ -719,6 +719,10 @@ func (tx *lmdbTx) Sequence(bucket string, amount uint64) (uint64, error) {
|
||||
currentV = binary.BigEndian.Uint64(v)
|
||||
}
|
||||
|
||||
if amount == 0 {
|
||||
return currentV, nil
|
||||
}
|
||||
|
||||
newVBytes := make([]byte, 8)
|
||||
binary.BigEndian.PutUint64(newVBytes, currentV+amount)
|
||||
err = c.Put([]byte(bucket), newVBytes)
|
||||
|
Loading…
Reference in New Issue
Block a user