mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
tools: Add -wal-dir flag on etcd-dump-logs to make it compatible with ETCD_WAL_DIR variable (#13672)
This commit is contained in:
parent
950a47504e
commit
b6a2d2d48a
@ -13,7 +13,9 @@ Usage:
|
|||||||
- data_dir/member/wal/0000000000000000-0000000000000000.wal
|
- data_dir/member/wal/0000000000000000-0000000000000000.wal
|
||||||
|
|
||||||
Flags:
|
Flags:
|
||||||
|
-wal-dir string
|
||||||
|
If set, dumps WAL from the informed path, rather than following the
|
||||||
|
standard 'data_dir/member/wal/' location
|
||||||
-entry-type string
|
-entry-type string
|
||||||
If set, filters output by entry type. Must be one or more than one of:
|
If set, filters output by entry type. Must be one or more than one of:
|
||||||
ConfigChange, Normal, Request, InternalRaftRequest,
|
ConfigChange, Normal, Request, InternalRaftRequest,
|
||||||
|
@ -45,6 +45,7 @@ const (
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
snapfile := flag.String("start-snap", "", "The base name of snapshot file to start dumping")
|
snapfile := flag.String("start-snap", "", "The base name of snapshot file to start dumping")
|
||||||
|
waldir := flag.String("wal-dir", "", "If set, dumps WAL from the informed path, rather than following the standard 'data_dir/member/wal/' location")
|
||||||
index := flag.Uint64("start-index", 0, "The index to start dumping")
|
index := flag.Uint64("start-index", 0, "The index to start dumping")
|
||||||
// Default entry types are Normal and ConfigChange
|
// Default entry types are Normal and ConfigChange
|
||||||
entrytype := flag.String("entry-type", defaultEntryTypes, `If set, filters output by entry type. Must be one or more than one of:
|
entrytype := flag.String("entry-type", defaultEntryTypes, `If set, filters output by entry type. Must be one or more than one of:
|
||||||
@ -103,7 +104,12 @@ and output a hex encoded line of binary for each input line`)
|
|||||||
fmt.Println("Start dumping log entries from snapshot.")
|
fmt.Println("Start dumping log entries from snapshot.")
|
||||||
}
|
}
|
||||||
|
|
||||||
w, err := wal.OpenForRead(zap.NewExample(), walDir(dataDir), walsnap)
|
wd := *waldir
|
||||||
|
if wd == "" {
|
||||||
|
wd = walDir(dataDir)
|
||||||
|
}
|
||||||
|
|
||||||
|
w, err := wal.OpenForRead(zap.NewExample(), wd, walsnap)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Failed opening WAL: %v", err)
|
log.Fatalf("Failed opening WAL: %v", err)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user