Can you clarify what it means to rename root index trees ? The simple solution which immediately comes to me is
1) write logical record on index creation - on reading it create an index during logical recovery 2) write logical record on index deletion - on reading it delete an index during logical recovery and start background clearing task with real root pages. Will it work for you ? вт, 6 июл. 2021 г. в 12:27, ткаленко кирилл <tkalkir...@yandex.ru>: > Hello everyone! > > Currently, dropping indexes consists of the following steps (based on > SchemaAbstractDiscoveryMessage's): > > Step 1: Removing the index from the SQL engine and starting > DurableBackgroundCleanupIndexTreeTask, which removes the index trees in the > background; > Step 1.1: DurableBackgroundCleanupIndexTreeTask is added to the > metaStorage and removed after successful completion at the next checkpoint. > > Step 2: Removing the index from the cache configuration and persist it. > > Problems: > > 1)We add and immediately delete the index, a checkpoint does not happen > and the node crashes, after restarting > DurableBackgroundCleanupIndexTreeTask will not be able to complete and will > periodically restart due to the fact that it saves > DurableBackgroundCleanupIndexTreeTask#rootPages (root pages of index trees) > that have not appeared; > > 2)After adding a DurableBackgroundCleanupIndexTreeTask node crashes, after > restarting the node, the task will clean the index trees and there will be > errors when using the index; > > 3)etc. > > Suggested solution: > > Rename the root index trees and write about this with a logical entry in > the WAL and do this at the first start of > DurableBackgroundCleanupIndexTreeTask. > Thus, if we find the renamed root pages in task 1, we can clear the index > trees to the end, otherwise the task can be completed. > Also, if we find that rename pages are present, and the step 2 has not > been completed, then we can start rebuilding the indexes. > > WDYT? > -- Best regards, Alexei Scherbakov