Skip to content

Commit cd95093

Browse files
committed
use same path structure as dump command
1 parent d6fefe5 commit cd95093

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
@@ -373,14 +373,21 @@ func DumpVersionDBChangeSetCmd(defaultStores []string) *cobra.Command {
373373
}
374374

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

382-
fmt.Printf("begin dumping versiondb changeset %s at version %d\n", storeKey, version)
383-
kvsFile := filepath.Join(outDir, fmt.Sprintf("%s-%d", storeKey, version))
388+
fmt.Printf("begin store %s version %d\n", storeKey, version)
389+
// Use same path structure as dump command: <outDir>/<storeName>/block-<version>
390+
kvsFile := filepath.Join(storeDir, fmt.Sprintf("block-%d", version))
384391
fpKvs, err := createFile(kvsFile)
385392
if err != nil {
386393
return err
@@ -415,7 +422,7 @@ func DumpVersionDBChangeSetCmd(defaultStores []string) *cobra.Command {
415422
if err != nil {
416423
return err
417424
}
418-
fmt.Printf("finish dumping versiondb changeset %s at version %d\n", storeKey, version)
425+
fmt.Printf(" Wrote %d changes\n", len(changeset.Pairs))
419426
}
420427
}
421428
return nil

0 commit comments

Comments
 (0)