File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change 8
8
"math/rand"
9
9
"os"
10
10
"path/filepath"
11
+ "runtime"
11
12
"testing"
12
13
"time"
13
14
)
@@ -69,6 +70,9 @@ func TestLogFileGC(t *testing.T) {
69
70
func destroyDB (db * RoseDB ) {
70
71
if db != nil {
71
72
_ = db .Close ()
73
+ if runtime .GOOS == "windows" {
74
+ time .Sleep (time .Millisecond * 100 )
75
+ }
72
76
err := os .RemoveAll (db .opts .DBPath )
73
77
if err != nil {
74
78
logger .Errorf ("destroy db err: %v" , err )
Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ package rosedb
2
2
3
3
import (
4
4
"bytes"
5
- "encoding/binary"
6
5
"errors"
7
6
"github.com/flower-corp/rosedb/logfile"
8
7
"github.com/flower-corp/rosedb/logger"
@@ -331,8 +330,7 @@ func (db *RoseDB) StrLen(key []byte) int {
331
330
if err != nil {
332
331
return 0
333
332
}
334
-
335
- return binary .Size (val )
333
+ return len (val )
336
334
}
337
335
338
336
// Count returns the total number of keys of String.
You can’t perform that action at this time.
0 commit comments