forked from TrueCloudLab/frostfs-node
[#1024] blobovnicza: Copy data on iterate
DB value is only valid while the tx is alive. But handler may to run something in other goroutine. Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
57466594fb
commit
e3d9dd6ee8
1 changed files with 2 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
|||
package blobovnicza
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"math"
|
||||
|
@ -158,7 +159,7 @@ func (b *Blobovnicza) Iterate(ctx context.Context, prm IteratePrm) (IterateRes,
|
|||
}
|
||||
|
||||
if !prm.withoutData {
|
||||
elem.data = v
|
||||
elem.data = bytes.Clone(v)
|
||||
}
|
||||
|
||||
return prm.handler(elem)
|
||||
|
|
Loading…
Reference in a new issue