repchain2.0-update36:修改系统启动时存储检查问题,增加区块文件只有一个区块的处理逻辑。

This commit is contained in:
jiangbuyun 2022-05-31 13:06:25 +08:00
parent 4d45295425
commit 99d559fd17
2 changed files with 24 additions and 16 deletions

View File

@ -184,12 +184,12 @@ system {
storage { storage {
db_type = "LevelDB" #支持数据库的类型LevelDB、RocksDB db_type = "LevelDB" #支持数据库的类型LevelDB、RocksDB
db_path = "./repchaindata/data/leveldbdata" db_path = "./repchaindata/data/leveldbdata"
db_name = "044934755127708189.node7"#"12110107bi45jh675g.node2" db_name = "12110107bi45jh675g.node2"
db_cache_size=48 #数据库读写缓存单位为M db_cache_size=48 #数据库读写缓存单位为M
block_file_type = "localFileSystem" block_file_type = "localFileSystem"
block_file_path = "./repchaindata/data/blockdata" block_file_path = "./repchaindata/data/blockdata"
block_file_name = "044934755127708189.node7"#"12110107bi45jh675g.node2" block_file_name = "12110107bi45jh675g.node2"
file_max_length = 100 #单位为M file_max_length = 100 #单位为M
} }

View File

@ -39,7 +39,7 @@ class verify4Storage(ctx:RepChainSystemContext) {
val first = sr.getBlockHeightInFileFirstBlockByFileNo(i).get val first = sr.getBlockHeightInFileFirstBlockByFileNo(i).get
var last = blockHeight var last = blockHeight
if(i < fno){ if(i < fno){
last = sr.getBlockHeightInFileFirstBlockByFileNo(i+1).get last = sr.getBlockHeightInFileFirstBlockByFileNo(i+1).get - 1
} }
fls(i) = (i,first,last) fls(i) = (i,first,last)
i += 1 i += 1
@ -49,6 +49,13 @@ class verify4Storage(ctx:RepChainSystemContext) {
private def verfiyFileForFileInfo(firstHeigh:Long,lastHeight:Long,sr: BlockSearcher):Boolean={ private def verfiyFileForFileInfo(firstHeigh:Long,lastHeight:Long,sr: BlockSearcher):Boolean={
var r = true var r = true
if(lastHeight == firstHeigh){
if(!verfiyBlockOfFile(firstHeigh,sr)){
r = false
}else{
RepLogger.info(RepLogger.System_Logger, s"自检verfiyBlockOfFile成功检查高度=${firstHeigh}")
}
}else{
val seed = lastHeight-firstHeigh val seed = lastHeight-firstHeigh
breakable( breakable(
for(i<-0 to 9){ for(i<-0 to 9){
@ -61,6 +68,7 @@ class verify4Storage(ctx:RepChainSystemContext) {
RepLogger.info(RepLogger.System_Logger, s"自检verfiyBlockOfFile成功检查高度=${h}") RepLogger.info(RepLogger.System_Logger, s"自检verfiyBlockOfFile成功检查高度=${h}")
} }
}) })
}
r r
} }