Skip to content

Commit aa7b3bd

Browse files
committed
chore: Remove replication since bad performance
--story=1
1 parent 0553853 commit aa7b3bd

File tree

8 files changed

+22
-627
lines changed

8 files changed

+22
-627
lines changed

cmd/resharding/main.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ func main() {
5959
shardingdb.WithDbPaths(inputPathList...),
6060
shardingdb.WithShardingFunc(shardingdb.MurmurSharding),
6161
shardingdb.WithLogger(getLogger(logType)),
62-
shardingdb.WithReplication(uint16(replication)),
6362
)
6463
if err != nil {
6564
fmt.Println(err)
@@ -86,7 +85,6 @@ func main() {
8685
shardingdb.WithDbPaths(outputPath...),
8786
shardingdb.WithShardingFunc(shardingdb.MurmurSharding),
8887
shardingdb.WithLogger(getLogger(logType)),
89-
shardingdb.WithReplication(uint16(replication)),
9088
)
9189
if err != nil {
9290
fmt.Println(err)

merged_iter.go

Lines changed: 0 additions & 337 deletions
This file was deleted.

options.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,3 @@ func WithEncryptor(e Encryptor) DbOption {
5858
s.encryptor = e
5959
}
6060
}
61-
62-
func WithReplication(count uint16) DbOption {
63-
return func(s *ShardingDb) {
64-
s.replication = count
65-
}
66-
}

performance_test.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import (
3333
var (
3434
thread = 100
3535
loop = 100
36-
batchSize = 1000
36+
batchSize = 100
3737
valueLength = 200
3838
)
3939

@@ -107,8 +107,8 @@ func TestShardingDbPerformance(t *testing.T) {
107107
}
108108
}
109109

110-
func TestShardingDbReplicationPerformance(t *testing.T) {
111-
pathList := []string{"/data/leveldb", "/data/leveldb1", "/data1/leveldb", "/data1/leveldb1", getTempDir(), getTempDir()}
110+
func TestShardingDbEncryptPerformance(t *testing.T) {
111+
pathList := []string{getTempDir(), getTempDir(), getTempDir(), getTempDir()}
112112
var err error
113113
dbs := make([]LevelDbHandle, len(pathList))
114114
for i := 0; i < len(pathList); i++ {
@@ -123,10 +123,11 @@ func TestShardingDbReplicationPerformance(t *testing.T) {
123123
return
124124
}
125125
}
126-
fmt.Printf("Replication[2] ShardingDb path[%v]", pathList)
126+
fmt.Printf("Encrypt ShardingDb path[%v]", pathList)
127127
//Test shardingdb performance
128-
db, _ := NewShardingDb(WithDbHandles(dbs...), WithReplication(2))
129-
testDbPerformance(t, db, "Replication2ShardingDb")
128+
db, _ := NewShardingDb(WithDbHandles(dbs...),
129+
WithEncryptor(NewAESCryptor([]byte("1234567890123456"))))
130+
testDbPerformance(t, db, "EncryptShardingDb")
130131
db.Close()
131132

132133
//Print every folder size

0 commit comments

Comments
 (0)