mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
tools/etcd-dump-logs: Fixed default values for -entry-type flag
The tool takes default values but it was not visible which default values were taken. Added default values in proper place, and added a newline at the end of output.
This commit is contained in:
parent
14624b7d64
commit
4e551d06ed
@ -38,16 +38,21 @@ import (
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
const (
|
||||
defaultEntryTypes string = "Normal,ConfigChange"
|
||||
)
|
||||
|
||||
func main() {
|
||||
snapfile := flag.String("start-snap", "", "The base name of snapshot file to start dumping")
|
||||
index := flag.Uint64("start-index", 0, "The index to start dumping")
|
||||
entrytype := flag.String("entry-type", "", `If set, filters output by entry type. Must be one or more than one of:
|
||||
ConfigChange, Normal, Request, InternalRaftRequest,
|
||||
IRRRange, IRRPut, IRRDeleteRange, IRRTxn,
|
||||
IRRCompaction, IRRLeaseGrant, IRRLeaseRevoke, IRRLeaseCheckpoint`)
|
||||
// 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:
|
||||
ConfigChange, Normal, Request, InternalRaftRequest,
|
||||
IRRRange, IRRPut, IRRDeleteRange, IRRTxn,
|
||||
IRRCompaction, IRRLeaseGrant, IRRLeaseRevoke, IRRLeaseCheckpoint`)
|
||||
streamdecoder := flag.String("stream-decoder", "", `The name of an executable decoding tool, the executable must process
|
||||
hex encoded lines of binary input (from etcd-dump-logs)
|
||||
and output a hex encoded line of binary for each input line`)
|
||||
hex encoded lines of binary input (from etcd-dump-logs)
|
||||
and output a hex encoded line of binary for each input line`)
|
||||
|
||||
flag.Parse()
|
||||
|
||||
@ -279,12 +284,6 @@ func evaluateEntrytypeFlag(entrytype string) []EntryFilter {
|
||||
"IRRLeaseCheckpoint": {passIRRLeaseCheckpoint},
|
||||
}
|
||||
filters := make([]EntryFilter, 0)
|
||||
if len(entrytypelist) == 0 {
|
||||
filters = append(filters, passInternalRaftRequest)
|
||||
filters = append(filters, passRequest)
|
||||
filters = append(filters, passUnknownNormal)
|
||||
filters = append(filters, passConfChange)
|
||||
}
|
||||
for _, et := range entrytypelist {
|
||||
if f, ok := validRequest[et]; ok {
|
||||
filters = append(filters, f...)
|
||||
@ -373,7 +372,7 @@ func listEntriesType(entrytype string, streamdecoder string, ents []raftpb.Entry
|
||||
}
|
||||
}
|
||||
|
||||
fmt.Printf("\nEntry types (%s) count is : %d", entrytype, cnt)
|
||||
fmt.Printf("\nEntry types (%s) count is : %d\n", entrytype, cnt)
|
||||
}
|
||||
|
||||
func parseDecoderOutput(decoderoutput string) (string, string) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user