Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
Signed-off-by: jiefenghuang <[email protected]>
  • Loading branch information
jiefenghuang committed Dec 12, 2024
1 parent 4146212 commit 43f6c1e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
12 changes: 8 additions & 4 deletions pkg/meta/load_dump_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,9 @@ func TestLoadDumpV2(t *testing.T) {
engines := map[string][]string{
"sqlite3": {"sqlite3://dev.db", "sqlite3://dev2.db"},
// "mysql": {"mysql://root:@/dev", "mysql://root:@/dev2"},
"redis": {"redis://127.0.0.1:6379/2", "redis://127.0.0.1:6379/3"},
"tikv": {"tikv://127.0.0.1:2379/jfs-load-dump-1", "tikv://127.0.0.1:2379/jfs-load-dump-2"},
"redis": {"redis://127.0.0.1:6379/2", "redis://127.0.0.1:6379/3"},
"badger": {"badger://" + path.Join(t.TempDir(), "jfs-load-duimp-testdb-bk1"), "badger://" + path.Join(t.TempDir(), "jfs-load-duimp-testdb-bk2")},
// "tikv": {"tikv://127.0.0.1:2379/jfs-load-dump-1", "tikv://127.0.0.1:2379/jfs-load-dump-2"},
}

for name, addrs := range engines {
Expand Down Expand Up @@ -461,9 +462,9 @@ func testSecretAndTrash(t *testing.T, addr, addr2 string) {
if m2.GetFormat().EncryptKey != m.GetFormat().EncryptKey {
t.Fatalf("encrypt key not valid: %s", m2.GetFormat().EncryptKey)
}

testDumpV2(t, m, "sqlite-non-secret.dump", &DumpOption{Threads: 10, KeepSecret: false})
m2.Reset()
m2.Shutdown()

m2 = testLoadV2(t, addr2, "sqlite-non-secret.dump")
if m2.GetFormat().EncryptKey != "removed" {
t.Fatalf("encrypt key not valid: %s", m2.GetFormat().EncryptKey)
Expand All @@ -485,6 +486,9 @@ func testSecretAndTrash(t *testing.T, addr, addr2 string) {
if cnt != len(trashs) {
t.Fatalf("trash count: %d != %d", cnt, len(trashs))
}

m.Shutdown()
m2.Shutdown()
}

/*
Expand Down
3 changes: 3 additions & 0 deletions pkg/meta/tkv_bak.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ func (m *kvMeta) dump(ctx Context, opt *DumpOption, ch chan<- *dumpedResult) err
m.dumpDirStat,
}
ts := m.client.config("startTS")
if ts == nil && m.Name() == "tikv" {
return errors.New("failed to get startTS, which is required for TiKV to ensure consistency")
}
if ts != nil {
logger.Infof("dump kv with startTS: %d", ts.(uint64))
ctx.WithValue(txSessionKey{}, ts)
Expand Down

0 comments on commit 43f6c1e

Please sign in to comment.