mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcd-dump-logs: Print full confState as json for debugging purposes.
This commit is contained in:
parent
768da490ed
commit
aa6597384b
@ -18,6 +18,7 @@ import (
|
|||||||
"bufio"
|
"bufio"
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
|
"encoding/json"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
@ -88,8 +89,12 @@ and output a hex encoded line of binary for each input line`)
|
|||||||
case nil:
|
case nil:
|
||||||
walsnap.Index, walsnap.Term = snapshot.Metadata.Index, snapshot.Metadata.Term
|
walsnap.Index, walsnap.Term = snapshot.Metadata.Index, snapshot.Metadata.Term
|
||||||
nodes := genIDSlice(snapshot.Metadata.ConfState.Voters)
|
nodes := genIDSlice(snapshot.Metadata.ConfState.Voters)
|
||||||
fmt.Printf("Snapshot:\nterm=%d index=%d nodes=%s\n",
|
confstateJson, err := json.Marshal(snapshot.Metadata.ConfState)
|
||||||
walsnap.Term, walsnap.Index, nodes)
|
if err != nil {
|
||||||
|
confstateJson = []byte(fmt.Sprintf("confstate err: %v", err))
|
||||||
|
}
|
||||||
|
fmt.Printf("Snapshot:\nterm=%d index=%d nodes=%s confstate=%s\n",
|
||||||
|
walsnap.Term, walsnap.Index, nodes, confstateJson)
|
||||||
case snap.ErrNoSnapshot:
|
case snap.ErrNoSnapshot:
|
||||||
fmt.Printf("Snapshot:\nempty\n")
|
fmt.Printf("Snapshot:\nempty\n")
|
||||||
default:
|
default:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user