Only check last directory when discovering checkpoint number (#5756)

* Only check last directory when discovering checkpoint number

Signed-off-by: Devin Trejo <dtrejo@palantir.com>

* Comments for checkpointNum

Signed-off-by: Devin Trejo <dtrejo@palantir.com>
This commit is contained in:
Devin Trejo 2019-07-15 12:53:58 -04:00 committed by Tom Wilkie
parent 3cde8a9941
commit d77f2aa29c

View File

@ -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)
}