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.
@@ -38,10 +38,15 @@ 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:
+ // 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`)
@@ -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) {
