<ChunkInRecovery>openChunks failed

<ChunkInRecovery>openChunks failed on '/f_zhubi/20200922/1_201', chunk d0a516b9-6127-7c8e-48bd-316d31c4372b is in RECOVERING state
如何解决呢?

Usage: dropPartition(dbHandle, partitionPaths, [tableName], [forceDelete]). forceDelete can't be set to true when a table is specified.

请先 登录 后评论

3 个回答

Juntao Wang

先重启一下节点,然后运行

select * from getClusterChunksStatus() where state != 'COMPLETE'

看一下是否还有chunk is in RECOVERING state


下面是一个修复的例子:

场景:single mode部署,发现某个chunk分区Recovery状态,数据无法导入。系统重启后无法恢复。

分析://选取某一个版本对比master和datanode的版本号

rcChunks = select * from getClusterChunksStatus() where state!="COMPLETE"
select * from getAllChunks() where chunkId in rcChunks.chunkId //观察版本情况

发现master版本号高于datanode版本号

修复方法:利用correctChunkVersion函数强行将master版本号与datanode拉平。

for(chunk in rcChunks.chunkId){
  correctChunkVersion(chunk, "local8848")
}
请先 登录 后评论
Boye

如果想dropDatabase,可以先强制删除Recovery分区:

dbName="/stocks_orderbook"
fileCond=dbName + "%"
t=exec substr(file,strlen(dbName)) from rpc(getControllerAlias(),getClusterChunksStatus) where file like fileCond, state != "COMPLETE"
dropPartition(database("dfs:/"+dbName),t,,true)
上例中,数据库名为dfs://stocks_orderbook,请根据实际情况修改。若执行成功,再用dropDatabase删除数据库。

请先 登录 后评论
wale

1.30.19和2.00.7版本ops模块提供了以下函数:



/* *
*  @ brief  Force delete the recovering partition.
*  @ param  
*  dbPath is the absolute path of the folder where the database is stored
*  tableName is the name of dfs table, required if chunkGranularity is TABLE
*  @ return NULL
*  @ sample usage  dropRecoveringPartitions("dfs://compoDB")
*/


def dropRecoveringPartitions(dbPath , tableName=""){
    db=database(dbPath)
    if(db.schema().chunkGranularity=="TABLE"){
    	if (isNull(tableName) or tableName=="")
    		throw "Please input the table name"
    }

    dbName = substr(dbPath, 5)
    partitions = exec substr(file, strlen(dbName))
                        from rpc(getControllerAlias(), getClusterChunksStatus)
                        where  like(file,  dbName + "%"), state != "COMPLETE"
    if(db.schema().chunkGranularity=="TABLE")                       
        dropPartition(db, partitions, tableName, true)
    else
        dropPartition(db, partitions, , true)
}
请先 登录 后评论