]> source.dussan.org Git - gitea.git/commit
Help to recover from corrupted levelqueue (#24912)
authorwxiaoguang <wxiaoguang@gmail.com>
Mon, 29 May 2023 02:52:32 +0000 (10:52 +0800)
committerGitHub <noreply@github.com>
Mon, 29 May 2023 02:52:32 +0000 (10:52 +0800)
commit84c8ab9fd109145d04d0c58cadd46160f1ee9263
treeeebfb67c7414bae68b08ba3adca2dbb1f68a61cc
parent8faf9465b3913137d3470151a678857c319625a5
Help to recover from corrupted levelqueue (#24912)

gitea.com experienced the corrupted LevelQueue bug again.

I think the problem is clear now: if the keys in LevelDB went
out-of-sync, the LevelQueue itself doesn't have the ability to recover,
eg:

* LevelQueue.Len() reports 100
* LevelQueue.LPop() reports ErrNotFound = errors.New("no key found")

So it needs to dive into the LevelDB to remove all keys to recover the
corrupted LevelQueue.

More comments are in TestCorruptedLevelQueue.
modules/queue/base_levelqueue.go
modules/queue/base_levelqueue_common.go
modules/queue/base_levelqueue_test.go
modules/queue/base_levelqueue_unique.go
modules/queue/lqinternal/lqinternal.go [new file with mode: 0644]