Skip to content

Commit 8d5f462

Browse files
committed
use same path structure as dump command
1 parent c77ae92 commit 8d5f462

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

versiondb/client/dump.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -375,14 +375,21 @@ func DumpVersionDBChangeSetCmd(defaultStores []string) *cobra.Command {
375375
}
376376

377377
for _, storeKey := range stores {
378+
// Create store directory
379+
storeDir := filepath.Join(outDir, storeKey)
380+
if err := os.MkdirAll(storeDir, os.ModePerm); err != nil {
381+
return err
382+
}
383+
378384
for version := startVersion; version < endVersion; version++ {
379385
it, err := versionDB.IteratorAtVersion(storeKey, nil, nil, &version)
380386
if err != nil {
381387
return err
382388
}
383389

384-
fmt.Printf("begin dumping versiondb changeset %s at version %d\n", storeKey, version)
385-
kvsFile := filepath.Join(outDir, fmt.Sprintf("%s-%d", storeKey, version))
390+
fmt.Printf("begin store %s version %d\n", storeKey, version)
391+
// Use same path structure as dump command: <outDir>/<storeName>/block-<version>
392+
kvsFile := filepath.Join(storeDir, fmt.Sprintf("block-%d", version))
386393
fpKvs, err := createFile(kvsFile)
387394
if err != nil {
388395
return err
@@ -417,7 +424,7 @@ func DumpVersionDBChangeSetCmd(defaultStores []string) *cobra.Command {
417424
if err != nil {
418425
return err
419426
}
420-
fmt.Printf("finish dumping versiondb changeset %s at version %d\n", storeKey, version)
427+
fmt.Printf(" Wrote %d changes\n", len(changeset.Pairs))
421428
}
422429
}
423430
return nil

0 commit comments

Comments
 (0)