From ccc2153930981b5cbbe235bf15c722590b014bdf Mon Sep 17 00:00:00 2001 From: lucklove Date: Wed, 31 Mar 2021 18:47:27 +0800 Subject: [PATCH] Fix the issue that checkpoint can't parse large audit log Fix https://github.com/pingcap/tiup/issues/1258 --- pkg/checkpoint/checkpoint.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/checkpoint/checkpoint.go b/pkg/checkpoint/checkpoint.go index 8a2d714cf3..56533ad7b2 100644 --- a/pkg/checkpoint/checkpoint.go +++ b/pkg/checkpoint/checkpoint.go @@ -38,6 +38,9 @@ const ( goroutineKey = contextKey("CHECKPOINT_GOROUTINE") funcKey = "__func__" hashKey = "__hash__" + + // At most 10M for each line in audit log + maxTokenSize = 10 * 1024 * 1024 ) var ( @@ -125,6 +128,7 @@ func NewCheckPoint(r io.Reader) (*CheckPoint, error) { cp := CheckPoint{points: make([]map[string]interface{}, 0)} scanner := bufio.NewScanner(r) + scanner.Buffer(nil, maxTokenSize) for scanner.Scan() { line := scanner.Text() m, err := checkLine(line)