[#635] Use internal key type when deleting from badger wc
All checks were successful
DCO action / DCO (pull_request) Successful in 2m48s
Build / Build Components (1.21) (pull_request) Successful in 4m59s
Build / Build Components (1.20) (pull_request) Successful in 5m5s
Vulncheck / Vulncheck (pull_request) Successful in 4m55s
Tests and linters / Staticcheck (pull_request) Successful in 6m51s
Tests and linters / Tests (1.21) (pull_request) Successful in 7m21s
Tests and linters / Tests (1.20) (pull_request) Successful in 7m53s
Tests and linters / Lint (pull_request) Successful in 8m35s
Tests and linters / Tests with -race (pull_request) Successful in 9m57s

Signed-off-by: Alejandro Lopez <a.lopez@yadro.com>
This commit is contained in:
Alejandro Lopez 2023-08-22 10:51:42 +03:00
parent dc3bc08c07
commit 345a1a69a2
2 changed files with 3 additions and 3 deletions

View file

@ -173,7 +173,7 @@ func (c *cache) workerFlushSmall() {
continue continue
} }
c.deleteFromDB([]string{objectCore.AddressOf(obj).EncodeToString()}) c.deleteFromDB([]internalKey{addr2key(objectCore.AddressOf(obj))})
} }
} }

View file

@ -58,7 +58,7 @@ func (c *cache) openStore(readOnly bool) error {
return nil return nil
} }
func (c *cache) deleteFromDB(keys []string) []string { func (c *cache) deleteFromDB(keys []internalKey) []internalKey {
if len(keys) == 0 { if len(keys) == 0 {
return keys return keys
} }
@ -67,7 +67,7 @@ func (c *cache) deleteFromDB(keys []string) []string {
var errorIndex int var errorIndex int
for errorIndex = range keys { for errorIndex = range keys {
if err := wb.Delete([]byte(keys[errorIndex])); err != nil { if err := wb.Delete(keys[errorIndex][:]); err != nil {
break break
} }
} }