From d77f2aa29ccf5dbab92e36311d207e4e6c80a19f Mon Sep 17 00:00:00 2001 From: Devin Trejo Date: Mon, 15 Jul 2019 12:53:58 -0400 Subject: [PATCH] Only check last directory when discovering checkpoint number (#5756) * Only check last directory when discovering checkpoint number Signed-off-by: Devin Trejo * Comments for checkpointNum Signed-off-by: Devin Trejo --- storage/remote/wal_watcher.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/storage/remote/wal_watcher.go b/storage/remote/wal_watcher.go index c399c0bac..17cd3b236 100644 --- a/storage/remote/wal_watcher.go +++ b/storage/remote/wal_watcher.go @@ -526,7 +526,8 @@ func (w *WALWatcher) readCheckpoint(checkpointDir string) error { func checkpointNum(dir string) (int, error) { // Checkpoint dir names are in the format checkpoint.000001 - chunks := strings.Split(dir, ".") + // dir may contain a hidden directory, so only check the base directory + chunks := strings.Split(path.Base(dir), ".") if len(chunks) != 2 { return 0, errors.Errorf("invalid checkpoint dir string: %s", dir) }