fix: sometime meta-ver file lost

This commit is contained in:
Alex Duan 2023-09-19 18:53:12 +08:00
parent dfff811ca9
commit 30c24eb8c6
1 changed files with 8 additions and 5 deletions

View File

@ -109,11 +109,14 @@ class VNode :
# load config
tdLog.info(f' meta-ver file={metaFile}')
if metaFile != "":
try:
jsonVer = jsonFromFile(metaFile)
metaNode = jsonVer["meta"]
self.snapVer = int(metaNode["snapshotVer"])
self.firstVer = int(metaNode["firstVer"])
self.lastVer = int(metaNode["lastVer"])
except Exception as e:
tdLog.info(f' read json file except.')
# sort with startVer
self.walFiles = sorted(self.walFiles, key=lambda x : x.startVer, reverse=True)