fixup! Add --raw mode to ./etcd-dump-log

Signed-off-by: Piotr Tabor <ptab@google.com>
dependabot/go_modules/go.uber.org/atomic-1.10.0
Piotr Tabor 2022-12-29 09:52:48 +01:00
parent d79bc3fa7e
commit 8ec3cbc551
3 changed files with 16 additions and 2 deletions

View File

@ -57,7 +57,7 @@ func testRepair(t *testing.T, ents [][]raftpb.Entry, corrupt corruptFunc, expect
require.NoError(t, err)
for _, es := range ents {
assert.NoError(t, w.Save(raftpb.HardState{}, es))
require.NoError(t, w.Save(raftpb.HardState{}, es))
}
offset, err := w.tail().Seek(0, io.SeekCurrent)

View File

@ -67,7 +67,7 @@ func readRaw(lg *zap.Logger, fromIndex *uint64, waldir string, out io.Writer) {
continue
}
if errors.Is(err, io.EOF) {
lg.Info("EOF: All entries were processed")
fmt.Fprintf(out, "EOF: All entries were processed.\n")
break
} else {
lg.Error("Reading failed", zap.Error(err))

View File

@ -1,3 +1,16 @@
// Copyright 2022 The etcd Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package main
import (
@ -51,5 +64,6 @@ Entry: Term:25 Index:31 Data:"\010\032\222K\007\n\005role3"
Entry: Term:26 Index:32 Data:"\010\033\232K\033\n\005role3\022\022\010\001\022\004Keys\032\010RangeEnd"
Entry: Term:27 Index:33 Data:"\010\034\242K\026\n\005role3\022\003key\032\010rangeend"
Entry: Term:27 Index:34 Data:"?"
EOF: All entries were processed.
`, out.String())
}