From c569c7bc237f11b23fe47c98a20a1c5cb36751cb Mon Sep 17 00:00:00 2001 From: Stanislav Chzhen Date: Fri, 10 Feb 2023 16:19:35 +0300 Subject: [PATCH] fix mutex --- internal/querylog/querylogfile.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/querylog/querylogfile.go b/internal/querylog/querylogfile.go index f46e15cd622..23e750faa31 100644 --- a/internal/querylog/querylogfile.go +++ b/internal/querylog/querylogfile.go @@ -155,6 +155,9 @@ func (l *queryLog) periodicRotate() { // checkAndRotate rotates log files if those are older than the specified // rotation interval. func (l *queryLog) checkAndRotate() { + l.lock.Lock() + defer l.lock.Unlock() + oldest, err := l.readFileFirstTimeValue() if err != nil && !errors.Is(err, os.ErrNotExist) { log.Error("querylog: reading oldest record for rotation: %s", err)