Invalid index marking method, storage medium and computer device
By allowing index page access and prohibiting physical modification in high concurrency situations, and using modification sequence number judgment and atomic operations to record invalid index entries, the problem of inaccurate marking of invalid index entries is solved, and the concurrency and throughput of the database system are improved.
Patent Information
- Application Number
- CN202310389733.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-12
- Publication Date
- 2025-09-12
- Estimated Expiration
- 2043-04-12
AI Technical Summary
When marking invalid index items, the existing technology cannot guarantee the accuracy of marking and the throughput of the database system under high concurrency conditions, resulting in reduced concurrency and throughput impact.
By allowing access to index pages and prohibiting physical modifications, the validity of the modification sequence number of the index page is determined based on the probability of attempting to mark invalid index entries, invalid index entries are found and recorded, and physical modifications are allowed after the search is completed. Atomic operations are used to record the modification sequence number to ensure the accuracy and concurrency of the marking.
It improves the concurrency of index operations, reduces the position changes of invalid index items, avoids concurrency conflicts in the database system, and increases the throughput of the database system.
Smart Images

Figure CN116662355B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to database technology, in particular to an invalid index marking method, storage medium and computer equipment. Background Art
[0002] Currently, data in relational databases can be organized as follows: table data is stored in a heap table format; index data is stored separately, and the physical location of the table data row is stored in the index item of the index leaf node to associate the index with the corresponding data. To improve query efficiency, when the table data obtained through the index item is invalid, the invalid index item can be recorded and marked. In this way, subsequent scans will skip the marked index item and avoid retrieving table data through the invalid index item. However, if other operations in the above process affect the physical organization of the index page, the position of the marked invalid index item will change, resulting in inaccurate marking of the invalid index item. If the entire above process prohibits access to and physical modification of the index page, it will block operations that require changing the physical organization of the index page, reducing concurrency and affecting the throughput of the database system. Summary of the Invention
[0003] One purpose of the present invention is to decide whether to mark invalid index items based on the probability of the index object attempting to mark invalid index items during the process of marking invalid indexes, so as to reduce the conflict of hot index pages under high concurrency, thereby achieving the purpose of improving the concurrency of index operations and increasing the throughput of the database system.
[0004] In particular, the present invention provides a method for marking an invalid index, comprising:
[0005] Allowing access to an index page and prohibiting physical modification of the index page, wherein the index page has multiple index entries, and the index object corresponding to the index page is set with a corresponding probability of attempting to mark an invalid index entry;
[0006] determining whether the modification sequence number of the index page is valid based on the probability of attempting to mark an invalid index entry, and if so, searching for the invalid index entry on the index page and recording the first modification sequence number of the index page;
[0007] When the search for invalid index entries on the index page is completed, physical modification of the index page is allowed;
[0008] Recording invalid index entries found on the index page, and prohibiting physical modification of the index page after recording is completed;
[0009] Recording the second modification serial number of the index page;
[0010] determining whether the recorded invalid index entry of the index page is a final invalid index entry according to the first modification sequence number and the second modification sequence number;
[0011] If so, the final invalid index entry is marked as invalid, and physical modification of the index page is allowed.
[0012] Optionally, recording the first modification number of the index page includes:
[0013] Recording the first modification sequence number using an atomic operation; and / or:
[0014] The recording of the second modification serial number of the index page includes:
[0015] The second modification sequence number is recorded using an atomic operation.
[0016] Optionally, judging whether the modification sequence number of the index page is valid according to the probability of attempting to mark an invalid index entry includes:
[0017] Obtaining a probability threshold according to a preset condition, and determining whether the probability of attempting to mark an invalid index item is greater than the probability threshold;
[0018] If so, the modification serial number of the index page is valid;
[0019] If not, the modification serial number of the index page is invalid.
[0020] Optionally, determining whether the recorded invalid index item of the index page is a final invalid index item according to the first modification serial number and the second modification serial number includes:
[0021] Determine whether the first modification serial number is the same as the second modification serial number; if they are the same, the invalid index item of the recorded index page is the final invalid index item; if they are not the same, abandon the step of marking the final invalid index item as invalid.
[0022] Optionally, after marking the final invalid index item as invalid, the method further includes:
[0023] The second modification sequence number of the index page is modified using an atomic operation.
[0024] Optionally, searching for invalid index items on the index page includes:
[0025] Invalid index entries on the index page are searched by scanning through the index page.
[0026] Optionally, searching for invalid index items on the index page by scanning and traversing the index page includes:
[0027] The index items of the index page are scanned and traversed, and table data of the index items are obtained, and index items corresponding to invalid table data in the table data are recorded as invalid index items.
[0028] Optionally, marking the final invalid index item as invalid includes:
[0029] The final invalid index items are marked as invalid in batches.
[0030] According to another aspect of the present invention, a machine-readable storage medium is provided, on which a machine executable program is stored. When the machine executable program is executed by a processor, it implements any of the above-mentioned methods for marking invalid indexes.
[0031] According to another aspect of the present invention, a computer device is provided, comprising a memory, a processor, and a machine executable program stored in the memory and running on the processor, and the processor implements any of the above-mentioned methods for marking invalid indexes when executing the machine executable program.
[0032] The invalid index marking method provided by the present invention allows access to the index page and prohibits physical modification of the index page, then judges whether the modification number of the index page is valid based on the probability of attempting to mark the invalid index item of the index object, and searches for the invalid index item on the index page if it is valid, and records the first modification number of the index page; when the search for the invalid index item on the search page is completed, the physical modification of the index page is allowed; after the invalid index item is searched for on the index page, the physical modification of the index page is prohibited again, and the second modification number of the index page is recorded; finally, the invalid index item of the index page is determined based on the above-mentioned first modification number and second modification number.
[0033] The invalid index marking method provided by the present invention has some steps that allow access to index pages and prohibit physical modification of index pages. Enabling access to index pages can increase the throughput of the database system, and prohibiting physical modification of index pages can reduce or even prevent changes in the positions of invalid index items when searching for invalid index items on the index page, and when recording the first modification sequence number and the second modification sequence number of the index page, thereby ensuring the accuracy of marking invalid index items on the index page. Furthermore, when the search for invalid index items on the index page is completed, considering that some subsequent steps may be time-consuming, such as the step of recording the invalid index items found on the index page, access to and physical modification of the index page are allowed. Compared to a solution that prohibits access to and physical modification of index pages throughout the entire process, the technical solution of the present invention prohibits physical modification of index pages in only some steps and does not prohibit access to index pages. Therefore, it can minimize the reduction in database concurrency and avoid affecting the throughput of the database system.
[0034] Furthermore, in the invalid index marking method of the present invention, a probability of the index object attempting to mark an invalid index item is also provided, and only when the probability of the index object attempting to mark an invalid index item determines that the modification number of the index page is valid, the invalid index item of the index page will be searched. When the index page is a hot index page, that is, when multiple operations mark the index page as an invalid index, the invalid index item of the index page can be marked only when it is determined that the modification number of the index page is valid, and the marking of the invalid index item of the index page only requires some operations to determine that the modification number of the index page is valid. Therefore, the technical solution of the present invention not only ensures the reliability of marking invalid index items of the index page, but also can reduce overhead, reduce or even avoid conflicts of hot index pages under high concurrency, improve the concurrency of index operations and increase the throughput of the database system.
[0035] Based on the following detailed description of specific embodiments of the present invention in conjunction with the accompanying drawings, those skilled in the art will become more aware of the above and other objects, advantages and features of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Hereinafter, some specific embodiments of the present invention will be described in detail in an exemplary and non-limiting manner with reference to the accompanying drawings. The same reference numerals in the accompanying drawings indicate the same or similar components or parts. It should be understood by those skilled in the art that these drawings are not necessarily drawn to scale. In the accompanying drawings:
[0037] Figure 1 is a schematic flow chart of a method for marking invalid indexes according to one embodiment of the present invention;
[0038] Figure 2is a schematic diagram of marking invalid index items according to another embodiment of the present invention;
[0039] Figure 3 is a schematic flow chart of a method for marking invalid indexes according to another embodiment of the present invention;
[0040] Figure 4 is a schematic diagram of a machine-readable storage medium according to one embodiment of the present invention;
[0041] Figure 5 is a schematic diagram of a computer device according to one embodiment of the present invention. DETAILED DESCRIPTION
[0042] Figure 1 FIG. 1 is a schematic flow chart of a method for marking an invalid index according to an embodiment of the present invention. The method for marking an invalid index may generally include:
[0043] Step S102: Allowing access to the index page and prohibiting physical modification of the index page. This step can also be understood as controlling physical modification of the index page.
[0044] In this embodiment, an index object is correspondingly provided with multiple index pages, and an index page has multiple index items. In addition, the parameter at the index object level has the semantics of the probability of attempting to mark invalid index items for the index object.
[0045] Step S104: judging whether the modification sequence number of the index page is valid based on the probability of attempting to mark an invalid index entry of the index object corresponding to the index page;
[0046] If yes, proceed to step S106;
[0047] If not, the index page is no longer marked as invalid.
[0048] Modifications involving changes to the physical organization of an index page generate a unique identifier for the entire database system. This identifier is generally recorded on the index page at the same time the modification occurs, and the identifier here is also the modification number.
[0049] Step S106: Search for invalid index entries of the index page and record the first modification sequence number of the index page.
[0050] In this embodiment, the first modification sequence number is a sequence number in which no physical organization change occurs to the index page after access to and physical modification of the index page is prohibited.
[0051] Step S108: When the search for invalid index entries on the index page is completed, access and physical modification of the index page are allowed.
[0052] Step S110: Record the invalid index entries found on the index page, and allow access to the index page again and prohibit physical modification of the index page. Recording the invalid index entries found on the index page in this step may involve random I / O and is therefore time-consuming.
[0053] Step S112: Record the second modification serial number of the index page.
[0054] Step S114: determining whether the invalid index entry of the recorded index page is a final invalid index entry according to the first modification sequence number and the second modification sequence number.
[0055] If so, step S116 is executed: the final invalid index entry is marked as invalid, and physical modification of the index page is allowed.
[0056] In this embodiment, access to index pages is permitted while physical modification of index pages is prohibited. The validity of the index page's modification sequence number is determined based on the probability of an index object attempting to mark an invalid index entry. If valid, the invalid index entry on the index page is searched for and the first modification sequence number of the index page is recorded. Upon completion of the search for the invalid index entry on the index page, access to and physical modification of the index page are permitted. After recording the invalid index entry found on the index page, physical modification of the index page is prohibited, and the second modification sequence number of the index page is recorded. Because prohibiting physical modification of the index page reduces or even prevents changes in the position of the invalid index entry, the accuracy of marking the invalid index entry is ensured. Furthermore, once the search for the invalid index entry on the index page is completed, considering that some subsequent steps may be time-consuming, such as recording the invalid index entry found on the index page in step S108, access to and physical modification of the index page are permitted to avoid reducing the concurrency of the database and affecting the throughput of the database system.
[0057] Compared to solutions that completely prohibit access to and physical modification of index pages throughout the entire process, the technical solution of the present invention prohibits physical modification of index pages in only some steps and does not prohibit access to index pages. This minimizes the reduction of database concurrency and the impact on database system throughput. Because this embodiment strikes a good balance between ensuring the accuracy of marking invalid index entries and maintaining database concurrency, it possesses outstanding substantive features and represents a significant advancement.
[0058] Furthermore, in the invalid index marking method of the present embodiment, a probability of the index object attempting to mark an invalid index item is also provided, and only when the modification number of the index page is determined to be valid based on the probability of the index object attempting to mark an invalid index item, will the invalid index item of the index page be searched, thereby reducing the overhead of the database system. When the index page is a hot index page, that is, when multiple operations mark the index page as an invalid index, the invalid index item of the index page can be marked only when the modification number of the index page is determined to be valid, and the marking of the invalid index item of the index page only requires some operations to determine that the modification number of the index page is valid. Therefore, the technical solution of the present invention not only ensures the reliability of marking invalid index items of the index page, but also can reduce the overhead of the database system, reduce or even avoid conflicts of hot index pages under high concurrency, improve the concurrency of index operations, and increase the throughput of the database system.
[0059] In one embodiment of the present invention, the method for recording the first modification sequence number of the index page may include:
[0060] Record the first modification sequence number of the index page using an atomic operation; and / or
[0061] The method for recording the second modification sequence number of the index page may include:
[0062] Use atomic operations to record the second modification sequence number of the index page.
[0063] In this embodiment, atomic operations are used when recording the first and second modification numbers of index pages. Atomic operations are another method for providing concurrent access control. Atomic operations are operations that maintain atomicity during execution. Furthermore, atomic operations do not require locking during execution, achieving lock-free operation. This ensures concurrency control while reducing the impact on system concurrency performance. Therefore, the technical solution of this embodiment can reduce or even avoid concurrency conflicts that arise during the process of recording the first and second modification numbers of a page, thereby further improving the accuracy of invalid index marking.
[0064] In one embodiment of the present invention, a method for determining whether a modification sequence number of an index page is valid based on a probability of an index object attempting to mark an invalid index entry may include:
[0065] Obtain probability threshold according to preset conditions;
[0066] Determine whether the probability of the index object attempting to mark an invalid index entry is greater than the above probability threshold;
[0067] If so, the modification number of the index page is valid; if not, the modification number of the index page is invalid.
[0068] In this embodiment, obtaining the probability threshold based on a preset condition may involve randomly generating the probability threshold using a random function. For example, when multiple operations are performed to mark an index page as invalid, each operation may generate a probability threshold using a random function based on the number of operations, such that the probability threshold generated by at least one operation is no greater than the probability of the index object attempting to mark an invalid index entry. This ensures that the probability of some operations being determined as attempts to mark an index object as invalid is greater than the corresponding probability threshold, thereby ensuring that some operations determine that the index page's modification number is valid while other operations determine that the index page's modification number is invalid. Consequently, only some operations mark the index page's invalid index entry, thereby reducing database system overhead.
[0069] In one embodiment of the present invention, determining whether the invalid index entry of the recorded index page is a final invalid index entry according to the first modification sequence number and the second modification sequence number may include:
[0070] Determine whether the first modification serial number is the same as the second modification serial number;
[0071] If they are the same, the invalid index entry of the recorded index page is the final invalid index entry;
[0072] If not, the step of marking the final invalid index entry as invalid is abandoned.
[0073] In this embodiment, if other operations affect the physical organization of the index page between step S106 and step S112, the position of the marked invalid index item will be changed, that is, the first modification number will be changed, and a different second modification number will be obtained, resulting in inaccurate marking of the invalid index item. Therefore, by determining whether the first modification number is the same as the second modification number, it is possible to accurately determine whether the invalid index item of the recorded index page is the final invalid index item. Specifically, for example, Figure 2 This is a schematic diagram of marking invalid index items according to another embodiment of the present invention; assuming that the index page includes index item 1, the first modification number is 1 (that is, value 1); index item 2, the first modification number is 1 (that is, value 1). Index item 2, the first modification number is 1 (that is, value 1) and the corresponding table data is row 2, the first modification number is 1 (that is, A value 1), the second modification number is 3 (that is, B value 3), the first modification number and the second modification number are different, so index item 2 is valid. Index item 1, the first modification number is 1 (that is, value 1) and the corresponding table data is row 1, the first modification number is 1 (that is, A value 1), the second modification number is 1 (that is, B value 1), the first modification number and the second modification number are the same, so index item 1 is invalid.
[0074] In this embodiment, if the first modification number is different from the second modification number, the invalid index item has changed. If it is still marked, the marking result may be inaccurate. Therefore, the step of marking the final invalid index item as invalid is abandoned.
[0075] In one embodiment of the present invention, after marking the final invalid index item as invalid, the following steps may also be performed:
[0076] Use atomic operations to modify the second modification sequence number of the index page.
[0077] In this embodiment, after the final invalid index entry is marked as invalid, the second modification sequence number of the index page is modified to indicate that the index page has completed the marking of the final invalid index entry, thereby avoiding repeated marking of the index page and avoiding repetitive work.
[0078] Furthermore, by using atomic operations to modify the second modification number of the index page, concurrent conflicts when modifying the second modification number can be reduced or avoided, thereby ensuring the reliability of modifying the second modification number and improving the accuracy of marking invalid index entries in the index page.
[0079] In one embodiment of the present invention, searching for invalid index entries on an index page may include:
[0080] Search for invalid index entries on index pages by scanning through the index pages.
[0081] In this embodiment, invalid index entries on an index page are searched for by scanning through the index page, which can efficiently search for invalid index entries on the index page and save time.
[0082] In one embodiment of the present invention, searching for invalid index entries on an index page by scanning through the index page may include:
[0083] Scan and traverse the index items of the index page, obtain the table data of the index items, and record the index items corresponding to the invalid table data in the table data as invalid index items.
[0084] In this embodiment, when table data uses multi-version concurrency control and multiple versions of data are mixed and stored, some table data may become invalid. For example, multiple versions of data in the same row also correspond to multiple index items. When the old version of the table data becomes invalid, the corresponding index items are also logically invalid. Therefore, the index items corresponding to the invalid table data in the table data are recorded as invalid index items to ensure the accuracy of the obtained invalid index items.
[0085] In one embodiment of the present invention, marking the final invalid index entry as invalid may include:
[0086] Mark eventually invalid index entries in batches as invalid.
[0087] In this embodiment, the final invalid index items are marked as invalid in batches, which realizes batch marking, has high marking efficiency, and is also very simple and convenient.
[0088] Figure 3 FIG. 1 is a schematic flow chart of a method for marking invalid indexes according to another embodiment of the present invention, which may include:
[0089] Step S202: allowing access to the index page and prohibiting physical modification of the index page. This step can also be understood as controlling the physical modification of the index page.
[0090] In this embodiment, an index object is correspondingly provided with multiple index pages, and an index page has multiple index items. In addition, the parameter at the index object level has the semantics of the probability of the index object attempting to mark an invalid index item.
[0091] Step S204: judging whether the modification serial number of the index page is valid according to the probability of attempting to mark an invalid index entry of the index object corresponding to the index page.
[0092] If yes, execute step S206; if no, execute step S208.
[0093] Step S206: Record the first modification sequence number of the index page using an atomic operation.
[0094] Step S208: Record that the modification number of the index page is invalid.
[0095] Step S210: When the search for invalid index entries on the index page is completed, access and physical modification of the index page are allowed.
[0096] Step S212: Record invalid index items found on the index page.
[0097] Step S214: Determine whether the modification serial number of the index page is valid.
[0098] If yes, execute step S216; if no, execute step S226.
[0099] Step S216: Allow access to the index page and prohibit physical modification of the index page.
[0100] Step S218: Record the second modification sequence number of the index page through an atomic operation.
[0101] Step S220: Determine whether the first modification number is the same as the second modification number.
[0102] If yes, go to step S222, if no, go to step S228.
[0103] Step S222: Mark the final invalid index entry as invalid.
[0104] Step S224: Modify the second modification sequence number of the index page through an atomic operation.
[0105] Step S226: Allow access to and physical modification of the index page.
[0106] Step S228: Abandon marking the final invalid index entry as invalid.
[0107] The above embodiments may be combined in any way. According to any one of the above preferred embodiments or a combination of multiple preferred embodiments, the embodiments of the present invention can achieve the following beneficial effects:
[0108] In this embodiment, access to index pages is permitted while physical modification of index pages is prohibited. The validity of the index page's modification sequence number is determined based on the probability of an index object attempting to mark an invalid index entry. If valid, the invalid index entry on the index page is searched for and the first modification sequence number of the index page is recorded. Once the search for the invalid index entry on the index page is complete, access to and physical modification of the index page are permitted. After recording the invalid index entry found on the index page, physical modification of the index page is prohibited, and the second modification sequence number of the index page is recorded. Because prohibiting physical modification of the index page reduces or even prevents changes in the position of the invalid index entry, the accuracy of marking the invalid index entry is ensured. Once the search for the invalid index entry on the index page is complete, considering that some subsequent steps may be time-consuming, such as recording the invalid index entry found on the index page in step S108, access to and physical modification of the index page are permitted to avoid reducing the concurrency of the database and affecting the throughput of the database system.
[0109] Compared to solutions that completely prohibit access to and physical modification of index pages throughout the entire process, the technical solution of the present invention prohibits physical modification of index pages in only some steps and does not prohibit access to index pages. This minimizes the reduction of database concurrency and the impact on database system throughput. Because this embodiment strikes a good balance between ensuring the accuracy of marking invalid index entries and maintaining database concurrency, it possesses outstanding substantive features and represents a significant advancement.
[0110] Furthermore, in the invalid index marking method of the present embodiment, a probability of attempting to mark an invalid index item of the index object is also provided, and only when the modification number of the index page is determined to be valid based on the probability of attempting to mark the invalid index item, the invalid index item of the index page will be searched, thereby reducing the overhead of the database system. When the index page is a hot index page, that is, when multiple operations mark the index page as an invalid index, the invalid index item of the index page can be marked only when the modification number of the index page is determined to be valid, and the marking of the invalid index item of the index page only requires some operations to determine that the modification number of the index page is valid. Therefore, the technical solution of the present invention not only ensures the reliability of marking invalid index items of the index page, but also can reduce the overhead of the database system, reduce or even avoid conflicts of hot index pages under high concurrency, improve the concurrency of index operations, and increase the throughput of the database system.
[0111] This embodiment also provides a machine-readable storage medium and a computer device. Figure 4 is a schematic diagram of a machine-readable storage medium 830 according to one embodiment of the present invention; Figure 5 8 is a schematic diagram of a computer device 900 according to an embodiment of the present invention. A machine-readable storage medium 830 stores a machine-executable program 840 thereon, and when the machine-executable program 840 is executed by a processor, the invalid index marking method according to any of the above embodiments is implemented.
[0112] The computer device 900 may include a memory 920, a processor 910, and a machine executable program 840 stored in the memory 920 and running on the processor 910. When the processor 910 executes the machine executable program 840, the invalid index marking method of any of the above embodiments is implemented.
[0113] It should be noted that the logic and / or steps represented in the flowchart or described in other ways herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be specifically implemented in any machine-readable storage medium for use by an instruction execution system, device or equipment (such as a computer-based system, a system including a processor or other system that can fetch instructions from an instruction execution system, device or equipment and execute instructions), or used in combination with these instruction execution systems, devices or equipment.
[0114] For the purposes of the description of this embodiment, the machine-readable storage medium 830 can be any device that can contain, store, communicate, propagate, or transmit a program for use with an instruction execution system, device, or apparatus or in conjunction with such instruction execution system, device, or apparatus. More specific examples (a non-exhaustive list) of computer-readable media include the following: an electrical connection having one or more wirings (electronic device), a portable computer disk cartridge (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and editable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disc read-only memory (CDROM). In addition, the computer-readable medium 40 can even be paper or other suitable medium on which the program can be printed, since the program can be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting, or processing in other suitable ways as necessary, and then stored in a computer memory.
[0115] It should be understood that each part of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system.
[0116] The computer device 900 can be, for example, a server, a desktop computer, a laptop computer, a tablet computer, or a smartphone. In some examples, the computer device 900 can be a cloud computing node. The computer device 900 can be described in the general context of computer system executable instructions (such as program modules) executed by a computer system. Generally, program modules can include routines, programs, object programs, components, logic, data structures, etc. that perform specific tasks or implement specific abstract data types. The computer device 900 can be implemented in a distributed cloud computing environment where remote processing devices linked via a communication network perform tasks. In a distributed cloud computing environment, program modules can be located on local or remote computing system storage media including storage devices.
[0117] The computer device 900 may include a processor 910 adapted to execute stored instructions, and a memory 920 that provides temporary storage for the instructions during operation. The processor 910 may be a single-core processor, a multi-core processor, a computing cluster, or any number of other configurations. The memory 920 may include random access memory (RAM), read-only memory, flash memory, or any other suitable storage system.
[0118] The processor 910 can be connected to an I / O interface (input / output interface) suitable for connecting the computer device 900 to one or more I / O devices (input / output devices) via a system interconnect (e.g., PCI, PCI-Express, etc.). The I / O devices may include, for example, a keyboard and a pointing device, wherein the pointing device may include a touchpad or a touch screen, etc. The I / O devices may be built-in components of the computer device 900, or may be devices externally connected to the computing device.
[0119] Processor 910 can also be linked to the display interface that is suitable for connecting computer device 900 to display device by system interconnection.Display device can comprise the display screen that is built-in component of computer device 900.Display device can also comprise the computer monitor, television or projector etc. that are externally connected to computer device 900.In addition, network interface controller (network interface controller, NIC) can be suitable for connecting computer device 900 to network by system interconnection.In certain embodiments, NIC can use any suitable interface or protocol (such as Internet Small Computer System Interface etc.) to transmit data.Network can be cellular network, radio network, wide area network (WAN)), local area network (LAN) or Internet etc.Remote device can be connected to computing device by network.
[0120] The flowchart provided in this embodiment is not intended to indicate that the operations of the method will be performed in any particular order, or that all operations of the method are included in all cases. In addition, the method herein may include additional operations. Additional variations may be made to the above method within the scope of the technical ideas provided by the method of this embodiment.
[0121] At this point, those skilled in the art will recognize that, although a number of exemplary embodiments of the present invention have been shown and described in detail herein, many other variations or modifications consistent with the principles of the present invention may be directly determined or derived from the disclosure of the present invention without departing from the spirit and scope of the present invention. Therefore, the scope of the present invention should be understood and deemed to cover all such other variations or modifications.
Claims
1. A method for marking an invalid index, comprising: Allowing access to an index page and prohibiting physical modification of the index page, wherein the index page has multiple index entries, and the index object corresponding to the index page is set with a corresponding probability of attempting to mark an invalid index entry; determining whether the modification sequence number of the index page is valid based on the probability of attempting to mark an invalid index entry, and if so, searching for the invalid index entry on the index page and recording the first modification sequence number of the index page; When the search for invalid index entries on the index page is completed, physical modification of the index page is allowed; Recording invalid index entries found on the index page, and prohibiting physical modification of the index page after recording is completed; Recording the second modification serial number of the index page; determining whether the recorded invalid index entry of the index page is a final invalid index entry according to the first modification sequence number and the second modification sequence number; If so, the final invalid index entry is marked as invalid, and physical modification of the index page is allowed.
2. The method for marking invalid indexes according to claim 1, wherein: The recording of the first modification serial number of the index page includes: Recording the first modification sequence number using an atomic operation; and / or: The recording of the second modification serial number of the index page includes: The second modification sequence number is recorded using an atomic operation.
3. The method for marking invalid indexes according to claim 1, wherein: The determining whether the modification serial number of the index page is valid based on the probability of attempting to mark an invalid index entry includes: Obtaining a probability threshold according to a preset condition, and determining whether the probability of attempting to mark an invalid index item is greater than the probability threshold; If so, the modification serial number of the index page is valid; If not, the modification serial number of the index page is invalid.
4. The method for marking invalid indexes according to claim 1, wherein: The determining, according to the first modification sequence number and the second modification sequence number, whether the recorded invalid index entry of the index page is a final invalid index entry includes: Determining whether the first modification serial number is the same as the second modification serial number; If they are the same, the invalid index item of the recorded index page is the final invalid index item; If they are not the same, the step of marking the final invalid index item as invalid is abandoned.
5. The method for marking invalid indexes according to claim 1, wherein: After marking the final invalid index item as invalid, the method further includes: The second modification sequence number of the index page is modified using an atomic operation.
6. The method for marking invalid indexes according to claim 1, wherein: The searching for invalid index items on the index page includes: Invalid index entries on the index page are searched by scanning through the index page.
7. The method for marking invalid indexes according to claim 6, wherein: The searching for invalid index entries on the index page by scanning through the index page includes: The index items of the index page are scanned and traversed, and table data of the index items are obtained, and index items corresponding to invalid table data in the table data are recorded as invalid index items.
8. The method for marking invalid indexes according to claim 1, wherein: Marking the final invalid index item as invalid includes: The final invalid index items are marked as invalid in batches.
9. A machine-readable storage medium having a machine executable program stored thereon, wherein when the machine executable program is executed by a processor, the method for marking invalid indexes according to any one of claims 1 to 8 is implemented.
10. A computer device comprising a memory, a processor, and a machine executable program stored in the memory and running on the processor, wherein the processor implements the invalid index marking method according to any one of claims 1 to 8 when executing the machine executable program.
Citation Information
Patent Citations
Database data access method, system and device and readable storage medium of computer
CN107832401A
Index processing method, system and device based on ORACLE database and storage medium
CN111581064A