发明名称 ONLINE INDEX REBUILDING METHOD AND APPARATUS
摘要 The present disclosure discloses an online index rebuilding method and apparatus, where the method includes: receiving an online index rebuilding request; adding a schema shared lock to a data table corresponding to an identifier of the data table; obtaining a latch and obtaining a structure control right of the data table; reserving storage space of a shadow index for an original index, allocating an entry address of the shadow index, and adding the entry address of the shadow index to a root page of the data table; releasing the latch; building the shadow index in the storage space of the shadow index; updating an index entry address on the root page of the data table to the entry address of the shadow index after the latch is obtained again; and releasing the latch obtained again and the schema shared lock. Therefore, efficiency of online index rebuilding is improved.
申请公布号 US2017109384(A1) 申请公布日期 2017.04.20
申请号 US201615394242 申请日期 2016.12.29
申请人 HUAWEI TECHNOLOGIES CO., LTD. 发明人 ZHU Zhongchu;YAO Li;WU Kesong
分类号 G06F17/30 主分类号 G06F17/30
代理机构 代理人
主权项 1. An online index rebuilding apparatus, comprising: at least one processor; and a memory coupled to the at least one processor and storing program for execution by the at least one processor, wherein the at least one processor is configured to invoke the program stored in the memory to: receive an online index rebuilding request, wherein the online index rebuilding request comprises an identifier of a data table;add, according to the online index rebuilding request, a schema shared lock to the data table corresponding to the identifier of the data table;obtain a latch and obtain a structure control right of the data table by using the latch;after the latch is obtained: reserve storage space of a shadow index for an original index of the data table;allocate an entry address of the shadow index; andadd the entry address of the shadow index to a root page of the data table;release the latch after the entry address of the shadow index is added to the root page of the data table;build the shadow index in the storage space of the shadow index according to data of the original index;obtain the latch again after the shadow index is built in the storage space of the shadow index;update an index entry address on the root page of the data table to the entry address of the shadow index after the latch is obtained again; andrelease the latch obtained again and the schema shared lock after the index entry address on the root page of the data table is updated to the entry address of the shadow index.
地址 Shenzhen CN