System and method for early removal of tombstone records in a database
By removing tombstones early, the problem of low search efficiency and storage space occupation caused by the accumulation of tombstones in the LSM tree database is solved, and the running speed and storage efficiency of the database are improved.
Patent Information
- Application Number
- CN201980062443.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2018-09-24
- Filing Date
- 2019-09-24
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2039-09-24
AI Technical Summary
The accumulation of tombstones in log-structured merge tree (LSM tree) databases leads to low efficiency of key sorting search, especially in database systems with many short-lived records, resulting in system slowdown and increased storage space usage.
By changing parameters to remove tombstones early, reduce the storage of outdated data in the system, achieve early removal of tombstones from the database structure, avoid expensive pruning operations, and optimize data migration in the physical storage layer.
It improves the reading and writing speed of the system, reduces the storage of outdated data, releases additional storage space, and improves the operating efficiency of the database.
Smart Images

Figure CN112740198B_ABST
Abstract
Description
Background Art
[0001] A data structure is an organization of data that provides various ways to interact with the data stored therein. Data structures can be designed for various purposes, for example, to facilitate efficient searching of data (such as in a binary search tree), to allow efficient storage of sparse data (such as with linked lists), or to provide efficient storage of searchable data (such as with B-trees).
[0002] Data structures utilizing the key-value paradigm accept key-value pairs and are configured to respond to queries for keys. Key-value data structures may include structures such as dictionaries (e.g., mappings, hash maps, etc.) in which keys are stored in lists that link (or contain) corresponding values. Although these structures are useful in memory (e.g., in a main memory or system state memory different from a storage device), the storage representation of these structures in a persistent storage device (e.g., on disk) may be inefficient. Thus, a class of log-based storage structures has been introduced. One embodiment is a log-structured merge tree (LSM tree).
[0003] An LSM tree database can consist of one or more disk-resident immutable layers plus a mutable memory-resident storage layer. When reading from an LSM tree, the reader can read and merge results from all layers. When indexing a new record, the corresponding index entry is added to the mutable memory-resident layer.
[0004] Transactions in an LSM-tree database are stored as immutable versions of a given record. Immutable versions of record content already stored on the system may remain unchanged until the content is deleted from the system (if ever). That is, a received transaction may create a new version of the record content to be stored in the system, rather than changing the record content. Thus, multiple versions of a record (e.g., records with different content) may have the same key except for a transaction identifier (e.g., which may include a transaction number). BRIEF DESCRIPTION OF THE DRAWINGS
[0005] The accompanying drawings, which are included to provide a further understanding of the disclosed subject matter, are incorporated into and constitute a part of this specification. The accompanying drawings also illustrate embodiments of the disclosed subject matter and, together with the detailed description, serve to explain the principles of the embodiments of the disclosed subject matter. No attempt is made to show more details of the structure than are necessary for a basic understanding of the disclosed subject matter and the various ways in which the structure details may be practiced.
[0006] Figure 1 An example database system in accordance with an implementation of the disclosed subject matter is shown.
[0007] Figure 2A series of transactions in a conventional tombstone removal process is shown.
[0008] Figure 3 A series of transactions in a tombstone removal process according to an implementation of the disclosed subject matter is shown.
[0009] Figure 4A An example set of repetitions to be resolved in accordance with implementations of the disclosed subject matter is shown.
[0010] Figure 4B Another example set of repetitions to be resolved in accordance with implementations of the disclosed subject matter is shown.
[0011] Figure 5A Another example set of repetitions to be resolved in accordance with implementations of the disclosed subject matter is shown.
[0012] Figure 5B Another example set of repetitions to be resolved in accordance with implementations of the disclosed subject matter is shown.
[0013] Figure 6 A computer according to an implementation of the disclosed subject matter is shown.
[0014] Figure 7 A network configuration according to an implementation of the disclosed subject matter is shown. DETAILED DESCRIPTION
[0015] Various aspects or features of the disclosure are described with reference to the accompanying drawings, wherein the same reference numerals are used to indicate the same elements throughout the entire text. In this specification, many details are set forth to provide a thorough understanding of the disclosure. However, it should be understood that certain aspects of the disclosure may be practiced without these specific details or with other methods, components, materials, etc. In other examples, known structures and devices are shown in block diagram form to facilitate description of the disclosure.
[0016] The disclosed methods and techniques can be applied to a variety of different database structures. The disclosed subject matter is not limited to a single type of architecture, but for illustrative purposes, the following discussion will describe an implementation using a log structured merge (LSM) tree with key range multi-tenancy. LSM trees are capable of describing data changes with immutable data versions. Key range multi-tenancy allows dynamic binding to servers and can be used to keep data for each tenant separate.
[0017] Immutable records in LSM-tree-based storage can be efficiently deleted by inserting "tombstones" into the storage. A tombstone is a data marker that indicates that the value corresponding to a key has been deleted. For example, a tombstone can be implemented by setting a specified flag value in the record. The purpose of a tombstone is not only to mark the deletion of the associated value, but also to avoid (or postpone) the potentially expensive operation of pruning the value from the tree. Therefore, when a tombstone is encountered during a time-ordered search, the corresponding value is understood to be deleted, even if an outdated version of the key-value pair resides at an older location within the tree.
[0018] Since each version of a physical record in an LSM-tree based storage device is immutable, a record marked for deletion may not actually be deleted for an arbitrarily long period of time extending to days, months, or years. In the technical field of database structure, maintenance, and management, this postponement may be particularly problematic, especially in database systems that utilize tables (e.g., message queue tables) with a large number of short-lived records (where a large number of tombstones may accumulate in a short period of time). When a large number of tombstones accumulate, a key-sorted search in such a table is challenging because a key-sorted search requires reading all tombstones in a given key range, so they may all be ignored.
[0019] The disclosed embodiments solve the technical problem of tombstone accumulation in a database structure by changing parameters and implementing rules that allow early removal of tombstones from the database structure when satisfied. Early removal provides many improvements, such as reducing the storage of obsolete data in the overall system, increasing the speed of the system, and increasing the speed of sequential scans.
[0020] Figure 1 An example system 100 is shown that can be improved by implementing the disclosed tombstone removal process. Immutable versions of data are stored in "extents" on the system 100. An "extent" refers to a storage area, typically contiguous within a storage medium, that can be used to store data. As will be described below, an "extent reference" can be used as a logical reference to a physical extent stored in a physical storage device, and can be used to virtualize access to the physical storage device into one or more "levels" in the storage device, through which data is migrated over time as part of a database maintenance and optimization process.
[0021] The system 100 can be run on a single computing device or multiple connected computing devices. For example, the system 100 can be implemented on a laptop computer, a desktop computer, a single server, a server cluster, a server farm, or a distributed server system, or can be implemented as a virtual computing device or system, or any suitable combination of physical and virtual systems. For simplicity, various parts such as processors, operating systems, and other components of a database management system are not shown.
[0022] System 100 may be part of a computing system and network infrastructure, or may be otherwise connected to a separate computing system and network infrastructure that includes a larger server network (which may include other server systems similar to system 100). In some implementations, system 100 may be Figure 6 The computer 600, the central component 700 and / or the second computer 800 shown in FIG. Figure 7 One or more of the database systems 1200a-1200d shown in .
[0023] The system 100 includes an access layer 105, a virtualization layer 115, and a physical storage layer 127. The access layer 105 may include one or more servers 111, 112, 113, which provide a platform for tenants to host applications and databases on a primary interface and serve as a primary interface for users to interact with the system 100. The access layer 105 may also include a database storage engine 110, which may handle load balancing across the servers 111, 112, 113 and may accept and process requests from computing devices (e.g., Figure 6 6 and / or the second computer 800 shown in FIG. 1 ). For example, the database storage engine 110 may receive a query from a tenant organization and process the query to send a command to the virtualization layer 115. The database storage engine 110 may be any suitable combination of hardware and software on the server system 100 for receiving a query to a database system and obtaining data related to the received query.
[0024] The virtualization layer 115 virtualizes tenant data to provide system services (such as a customized database) to each tenant, which allows the tenant to access only the tenant's own data, even though data from multiple tenants may be stored in the system 100. The virtualization layer may include a disk area reference set 120 and a memory storage device 125. In some implementations, the disk area reference set 120 and the memory storage device 125 may be stored in Figure 6 The central assembly 700 shown in FIG. Figure 7 In the database systems 1200a-1200d shown in .
[0025] The memory storage device 125 stores the initial version of the data before the data is recorded to the disk area in the physical storage layer 127. That is, data transactions such as the insertion of new records or the insertion of tombstones occur at the memory storage device 125 level. Over time, in order to optimize the use of the memory storage device 125, flush operations transfer data from the memory storage device 125 level to the top level disk area 130 in the physical storage level 127, and merge operations transfer data between disk areas 130 as part of database maintenance operations. In virtualization terms, it can therefore be said that newer data resides near the "top" of the tree or at the "upper level" of the database, while older data resides near the "bottom" of the tree or at the "lower level" of the database. However, it should be understood that this terminology is used only as an aid to conceptualization and does not necessarily have any impact on the actual physical location of data relative to each other in the database.
[0026] The disk extent reference set 120 may use metadata from the tenant data to define the location of the disk extent 130 in the physical storage device 127 (e.g., the location where the tenant data may be stored as part of the disk extent 130). The metadata may include, for example, key ranges defining which keys are visible in the disk extent, transaction numbers (referred to herein as "XCNs") indicating the transaction order of records / tombstones in the disk extent 130, and tenant identifier (ID) data associating the disk extent with a given tenant. The disk extent reference set 120 may be implemented using any suitable combination of hardware and software on the server system 100 that is operable to provide functionality for logical references to physical disk extents stored in the physical storage device 127.
[0027] The virtualization layer 115 can receive a query from the database storage engine 110 and find the requested data by checking whether the latest version of the data is in the memory storage device 125 or by referencing the disk area reference set 120 to check whether the latest version of the data has been flushed to the disk area 130 in the physical storage layer 127. The query can be received, for example, from an authorized user associated with at least one tenant of the database system. If the data has been flushed to the physical storage device 127, the virtualization layer 115 can locate the requested data based on the metadata in the disk area reference set 120. That is, the virtualization layer 115 can obtain the data requested by the query from the disk area 130, and can return the data to the database storage engine 110, which can provide the data to, for example, a computing device that transmits the query to the database system.
[0028] The physical storage layer 127 may include immutable data storage devices and may be implemented, for example, as semiconductor memory, a solid-state drive (SSD), a hard drive, optical memory, an optical storage device, or any other suitable physical data storage medium, or some combination thereof. The physical storage layer 127 may implement disk areas 130, which contain immutable versions of tenant data. The physical storage layer 127 may also include a directory 135 to manage the identity and life of disk areas 130 and track data capacity to manage hardware (such as storage devices and servers that can store disk areas).
[0029] Because the data in the physical storage device 127 is immutable, when the system 100 performs a data transaction to modify the stored data, the system 100 creates a new version of the data and inserts it into the memory storage device 125 instead of changing / deleting the content of the already stored data. Therefore, multiple versions of the data disclosed herein (e.g., each version has different content) can have the same key. By marking each transaction with an incremental sequential transaction identifier (XCN), the system 100 uses the same key of the data version to implement changes in stored data. For example, a later version of a record will have a higher XCN than a previous version of the record, and two records will have the same key, but may have different content values.
[0030] When the system 100 performs an operation that requires reading data, the system 100 can perform a search sorted by XCN in time. During the search, when a tombstone is encountered, the system 100 can ignore any previous records with the same key and a lower XCN than the tombstone. That is, even if one or more expired versions of a key-value pair reside at an older location within the disk area 130, the system will act as if the corresponding value is deleted.
[0031] For purposes of describing the disclosed embodiments, it is instructive to compare the disclosed early tombstone removal process with a conventional tombstone removal process. Figure 2 The conventional process of gradually removing tombstones from an LSM-tree based storage system is shown. As previously described, through the dump and merge operations, the data in the system (e.g., records and tombstones) migrates "downward" from the memory storage devices (new data) to the disk areas in the physical storage devices (older data) through the virtual levels. In a conventional LSM-tree based storage system, the tombstone is not removed until it reaches the lowest level of the physical storage device storing the oldest records.
[0032] Figure 2A series of transactions in memory storage 225 and subsequent merge operations to physical storage disk extent 227 are depicted. A record 230 with key KA and transaction number xc10 is inserted into base table row 210, and a corresponding record 235 with key KB and an incrementally higher transaction number xc11 is entered in the secondary index. When record 230 is updated (i.e., in a new transaction), a new record 240 is entered in base table row 210. New record 240 has the same key KA as previous record 230, but also has an updated value (not shown) and the next incremental transaction number xc12. The update prompts the insertion of a tombstone 237 to mark the deletion of secondary index record 235, and the insertion of a new secondary index record 245.
[0033] Over time, multiple updates 250 may occur, resulting in additional tombstones and updated secondary index records 255. Finally, the updated records are marked for deletion with tombstones 260, and corresponding tombstones 265 are added for the corresponding secondary index records. When the system performs a flush operation to push data from the memory storage device 225 to the physical storage disk area 227, the obsolete update records 270 do not need to be forwarded to the physical storage disk area 227. They are discarded and not written forward. However, each of the most recent records, in this case the tombstones (e.g., 260, 237, 265), are forwarded. In this way, tombstones 280 are stored in the disk area 227.
[0034] exist Figure 2 In the dump-purge operation depicted in , even though each of the records in record 280 is a tombstone, in a conventional system, they cannot be discarded. A tombstone essentially blocks or prevents any previous record with the same key as the tombstone from being read by the system. Tombstone 280 cannot be discarded as long as there is any possibility that an additional record with the same key as one of tombstones 280 is still stored somewhere further down the virtual level of the storage device. For example, it is not known whether a previous merge operation from disk area 227 to disk area 229 resulted in record 290 with key KA being written to disk area 229. If record 290 exists in disk area 229, discarding tombstone 280 will make record 290 accessible in the read. For this reason, in a conventional system, tombstones are allowed through the system until they reach the lowest level (i.e., last) disk area in the physical storage device. Only then can the system ensure that there are no previous records that need to be blocked by tombstones.
[0035] Thus, a general merge operation to the target extent is as follows:
[0036] 1) Select the range of records (e.g., based on a time parameter such as XCN)
[0037] 2) Add records with the same key from the range to the duplicate set (buffer) in chronological order
[0038] 3) Keep the latest record R from the duplicate set; keep the remaining duplicate set records as the pruning set
[0039] 4) Discard the trimmed set by not writing those records to the target extent
[0040] 5) If R is a tombstone and the target extent is the lowest level extent in the system, R is discarded; otherwise, R is written to the target extent.
[0041] like Figure 2 As shown in , this merging process may result in an accumulation of tombstones in the physical storage device until the tombstones eventually reach the lowest level disk area, where they can be safely discarded. In many database applications, this result is unfavorable, may have a negative impact on the speed of system operation, and take up storage space that could be used to store content data in other ways. In addition, some database services may quickly generate too many unnecessary tombstones, such as message queue services with short time between insertion and deletion of large numbers of records.
[0042] Figure 3 A computer-implemented process in accordance with the subject matter of the present disclosure is depicted that enables early removal of tombstones from a storage system. When a record 330 is initially inserted into the base row table 310 of the memory storage device 225, the system first checks to ensure that no other active records (i.e., records not marked for deletion) associated with the key KA exist in the system. If no other records are found, the record 330 is marked with an "initial flag" indicating that it is the current first and oldest active record associated with the key KA.
[0043] Thus, in this embodiment, an initial record 330 with key KA and transaction number xc10 is inserted into base table row 310, and a corresponding initial record 335 with key KB and an incrementally higher transaction number xc11 is entered in the secondary index. When record 330 is updated (i.e., given a different value in a new transaction), a new record 340 is entered in base table row 310. New record 340 is an update, not an initial record, because initial record 330 is already associated with key KA. Therefore, the "initial flag" of updated record 340 is left at a value of 0.
[0044] Update record 340 has the same key KA as initial record 330, but also stores an adjusted value (not shown) and the next incremented transaction number xcl2. The update prompt inserts tombstone 337 to mark the deletion of secondary index record 335. Tombstone 337 invalidates (i.e., effectively deletes) initial secondary index record 335. The insertion of new secondary index record 345 is marked by an "initial flag".
[0045] Over time, multiple updates 350 may occur, resulting in additional tombstones and new initial secondary index records 355. Finally, the updated records are marked for deletion with tombstones 360, and corresponding tombstones 365 are added for the corresponding secondary index records.
[0046] In this case, when the system performs a dump purge / merge operation, it is not necessary to carry all obsolete update records 370 forward to the physical storage extent 227, so they are discarded and not written forward. However, unlike conventional systems, the disclosed system can determine whether the remaining tombstones need to be carried forward or can also be discarded. An embodiment of the disclosed merge operation that automatically determines whether a tombstone can be discarded early is as follows:
[0047] 1) Select the range of records (e.g., based on a time parameter such as XCN);
[0048] 2) Add records with the same key from the range to the duplicate set (buffer) in chronological order;
[0049] 3) Keep the latest record R from the duplicate set; keep the remaining duplicate set records as the pruning set;
[0050] 4) If R is a tombstone and the target disk is the lowest level disk in the system, R is discarded;
[0051] 5) If R is a tombstone and the oldest record in the pruned set is the initial record, R is discarded;
[0052] 6) If the pruning set is empty and R is both a tombstone and an initial record, R is discarded;
[0053] 7) discarding the Prune Set record by not writing it to the target extent;
[0054] 8) If R is not discarded and R is not a tombstone, write R to the target extent, inheriting the initial flag setting of the oldest record in the pruning set; and
[0055] 9) If R is not discarded and R is a tombstone, write R to the target disk area and mark it as a tombstone.
[0056] Apply the procedures listed above to Figure 3, the range of selected records can be determined based on records with associated transaction times after the time point T when the scan operation begins. For example, in this case, the range can include transaction numbers (XCN) xc10-xc25. For key KA, the latest record R in the duplicate set is xc24TS KA. The oldest record in the pruned set is xc10 initial KA. Thus, in this example, operation number 5 listed above is triggered and R can be discarded. The operation is applied to the fully specified XCN range, all records in records 370, 380 are discarded, and no records are written to disk area 227.
[0057] Compared to conventional systems, in this case, tombstones can be safely discarded by the currently disclosed system because the disclosed system can accurately determine that tombstones are no longer needed. At the time the initial flag is set (i.e., for records 330, 335, 345, etc.), a scan for additional records using keys KA, KB has already occurred. The initial flag indicates that there are no older active records for keys KA-KF. Therefore, the only records that require tombstones 360, 337 in order to prevent access are all within the range of the duplicate set, and these records will all be discarded in the current merge.
[0058] Thus, the disclosed computer-implemented process embodiments can safely and automatically discard tombstones before they reach the lowest level extent, thereby improving the system by freeing up additional storage space and improving the operating speed of the system.
[0059] Figure 4A , Figure 4B , Figure 5A and Figure 5B Depicts a scenario of duplicate sets that the disclosed computer-implemented process embodiments can resolve in a merge operation. Figure 4A , the newest record R in the duplicate set 400 is a tombstone 410. The pruned set 420 will include the remaining records from the duplicate set 400. The oldest record in the pruned set 420 is an update record 430. In this case, since the oldest record is not marked as an original record and R is not marked as both a tombstone and an original record, the system will keep the tombstone record for the key KA and discard the remaining records unless the target extent is a lowest level extent (in which case both R and the pruned set can be discarded).
[0060] exist Figure 4B , the latest record R in the duplicate set 401 is the updated record 440. The pruned set 450 will include the remaining records from the duplicate set 401. In this case, although the oldest record in the pruned set 450 is the initial record 460, since R is not a tombstone record, the pruned set 450 will be discarded and R will be written to the target disk area marked as the initial record.
[0061] exist Figure 5A , the newest record R in duplicate set 500 is record 510, which is marked as both an initial record and a tombstone. This can occur when a record is inserted and subsequently marked for deletion in the same transaction. The oldest record in pruned set 520 is the updated record 530. Since record 530 is not marked as an initial record, a tombstone record for key KA will be written forward to the target disk area. That is, in this case, although R is also an initial record, the tombstone flag takes precedence in determining which flag to pass forward.
[0062] exist Figure 5B In , the latest record R in the duplicate set 501 is marked as the original record and tombstone again. However, in this case, the oldest record in the pruned set 550 is marked as the original record 560. Therefore, both R and the pruned set 550 can be discarded.
[0063] Implementations of the disclosed subject matter may be implemented in and used with a variety of components and network architectures. Figure 6 600 is an example computer suitable for implementing implementations of the subject matter of the present disclosure. Computer 600 may be a single computer in a network of multiple computers. Figure 6 As shown in FIG. 6 , computer 600 may communicate with a central or distributed component 700 (e.g., a server, a cloud server, a database, a cluster, an application server, etc.). Central component 700 may communicate with one or more other computers (such as a second computer 800), which may include a storage device 810. Second computer 800 may be a server, a cloud server, etc. Storage device 810 may use any suitable combination of any suitable volatile and non-volatile physical storage media, including, for example, hard disk drives, solid-state drives, optical media, flash memory, tape drives, registers, random access memory, etc., or any combination thereof.
[0064] Data (such as the records discussed above) may be stored in any suitable format, for example, in storage device 810, using any suitable file system or storage scheme or hierarchy. For example, storage device 810 may store data using a log structure merge (LSM) tree with multiple levels as described above. Further, if Figure 6 to Figure 7is a multi-tenant system, the storage may be organized into separate log-structured merge trees for each instance of a tenant's database. Alternatively, the contents of all records on a particular server or system may be stored within a single log-structured merge tree, in which case a unique tenant identifier associated with a version of the record may be used to distinguish between the data for each tenant. Recent transactions may be stored at the highest or top level of the tree, while older transactions may be stored at lower levels of the tree. Alternatively, the most recent transaction or version of each record may be stored at the highest level of the tree, while previous versions or previous transactions are stored at lower levels of the tree.
[0065] Information obtained to and / or from central component 700 may be isolated for each computer, such that computer 600 may not share information with computer 800. Alternatively or in addition, computer 600 may communicate directly with second computer 800.
[0066] The computer (e.g., user computer, enterprise computer, etc.) 600 includes a bus 610 that interconnects the major components of the computer 600, such as a central processor 640, memory 670 (typically RAM, but it may also include ROM, flash RAM, etc.), an input / output controller 680, a user display 620 (such as a display or touch screen via a display adapter), a user input interface 660 (which may include one or more controllers and associated user input devices such as a keyboard, mouse, WiFi / cellular radio, touch screen, microphone / speaker, etc. and may be tightly coupled to the I / O controller 680), fixed storage 630 (such as a hard drive, flash memory, Fibre Channel network, SAN device, SCSI device, etc.), and a removable media component 650 operable to control and receive optical disks, flash drives, etc.
[0067] Bus 610 implements data communication between central processor 640 and memory 670, and the memory may include read-only memory (ROM) or flash memory (not shown) and random access memory (RAM) (not shown), as described above. RAM may include main memory where operating system and application programs are loaded. In addition to other codes, ROM or flash memory may include basic input and output system (BIOS), which controls basic hardware operations, such as interaction with peripheral components. Applications resident with computer 600 may be stored on computer-readable media and accessed via computer-readable media, such as hard disk drive (e.g., fixed storage device 630), optical disk drive, floppy disk, or other storage media 650.
[0068] Fixed storage device 630 may be integrated with computer 600, or may be separate and accessed through other interfaces. Network interface 690 may provide a direct connection to a remote server by a telephone link to the Internet via an Internet Service Provider (ISP), or by a direct network link to the Internet via a POP (point of presence) or other technology. Network interface 690 may use wireless technology to provide such a connection, including a digital cellular telephone connection, a cellular digital packet data (CDPD) connection, a digital satellite data connection, etc. For example, network interface 690 may enable a computer to communicate with other computers via one or more local area networks, wide area networks, or other networks, such as Figure 7 as shown in .
[0069] Many other devices or components (not shown) may be connected in a similar manner (e.g., data cache systems, application servers, communication network switches, firewall devices, authentication and / or authorization servers, computer and / or network security systems, etc.). Figure 6 The present disclosure may be practiced with all components shown in . These components may be interconnected in a manner different from that shown. The code implementing the present disclosure may be stored in a computer-readable storage medium such as one or more of the memory 670, the fixed storage device 630, the removable medium 650, or stored in a remote storage location.
[0070] Figure 7 An example network arrangement according to an implementation of the disclosed subject matter is shown. Four separate database systems 1200a-d at different nodes in the network represented by cloud 1202 communicate with each other and with users (not shown) via networking links 1204. Each of the database systems 1200 is operable to host multiple instances of a database, each of which is accessible only to users associated with a specific tenant. Each of the database systems may constitute a computer cluster and a storage area network (not shown), a load balancer and backup servers, and firewalls, other security systems, and authentication systems. Some of the instances at any one of the systems 1200 may be live or production instances that process and submit transactions received from users or from computing elements (not shown) for ingesting and providing data for storage in the instance.
[0071] The database system (e.g., 1200c) may include at least one storage device, such as Figure 6For example, the storage device may include memory 670, fixed storage device 630, removable media 650, storage devices included with central component 700 and / or second computer 800, and / or one or more storage devices associated with one or more of database systems 1200a-1200d.
[0072] In some implementations, Figure 6 to Figure 7 One or more servers shown in the figure may store data in an immutable storage device of at least one storage device (e.g., a storage device associated with the central component 700, the second computer 800, and / or the database system 1200a-1200d) using a log-structured merge tree data structure.
[0073] The system and method of the disclosed subject matter can be used for single-tenant and / or multi-tenant systems. A multi-tenant system can allow different tenants (which can be, for example, users, user groups, or organizations) to access their own records on a server system through software tools or instances on a server system that can be shared between different tenants. The content of each tenant's record can be part of the tenant's database. The content of the records of multiple tenants can all be stored in the same server system, but each tenant can only access the content of the records belonging to or created by the tenant. This can allow the server system to implement multi-tenancy without having to, for example, store the content of each tenant's record separately on a separate server or server system. The database for tenants can be, for example, a relational database, a hierarchical database, or any other suitable database type. All records stored on the server system can be stored in any suitable structure, including, for example, an LSM tree.
[0074] Further, a multi-tenant system may have various tenant instances on a network-distributed server system with a computing system at each node. Each tenant's live or production database instance may have its transactions processed at a specific computer system. The computing system used to process transactions for that instance may also process transactions for other instances of other tenants.
[0075] Some parts of the specific embodiments are presented according to diagrams or symbolic representations of operations on data in a computer memory. These diagrams, descriptions, and representations are usually used by technicians in the field of data processing to most effectively convey the essence of their work to other technicians in the field. The process implemented by the computer is here and generally considered to be a self-consistent sequence of steps that leads to a desired result. These steps are those steps that require physical manipulation of physical quantities. Usually, although not necessarily, these quantities take the form of electrical or magnetic signals that can be stored, transferred, combined, compared, and otherwise manipulated. Mainly for reasons of common use, it has been proven that it is convenient to sometimes refer to these signals as bits, values, elements, symbols, characters, terms, numbers, etc.
[0076] It should be remembered, however, that all of these and similar terms are associated with the appropriate physical quantities and are merely convenient labels applied to these quantities. Unless otherwise stated, as will be apparent from the above discussion, it should be appreciated that discussions throughout this specification using terms such as "write," "read," "receive," "transfer," "modify," "update," "send," etc. refer to actions and processes of a computer system or similar electronic computing device that manipulate and transform data represented as physical (e.g., electronic) quantities within the computer system's registers and memories into other data similarly represented as physical quantities within the computer system's memories or registers or other such information storage, transmission, or display devices.
[0077] More generally, different implementations of the subject matter of the present disclosure may include or be implemented in the form of computer-implemented processes and devices for practicing these processes. Implementations may also be implemented in the form of a computer program product having computer program code of instructions implemented in a non-transitory and / or tangible medium (such as a floppy disk, CD-ROM, hard drive, USB (Universal Serial Bus) drive, or any other machine-readable storage medium), wherein when the computer program code is loaded into a computer and executed by the computer, the computer becomes a device for practicing the implementation of the disclosed subject matter. Implementations may also be implemented in the form of computer program code, whether or not stored in a storage medium, the computer program code is, for example, loaded into a computer and / or executed by a computer, or transmitted through some transmission medium (such as, by wire or cable, by optical fiber, or via electromagnetic radiation), wherein when the computer program code is loaded into a computer and executed by a computer, the computer becomes a device for practicing the implementation of the disclosed subject matter. When implemented on a general-purpose microprocessor, the computer program code segments configure the microprocessor to create specific logic circuits. In some configurations, a set of computer-readable instructions stored on a computer-readable storage medium may be implemented by a general-purpose processor that may transform the general-purpose processor or a device containing the general-purpose processor into a special-purpose device configured to implement or execute the instructions. The implementation may be implemented using hardware, which may include a processor (such as a general-purpose microprocessor and / or an application-specific integrated circuit (ASIC)) that implements all or part of the techniques according to the implementation of the disclosed subject matter in hardware and / or firmware. The processor may be coupled to a memory (such as a RAM, ROM, flash memory, a hard disk, or any other device capable of storing electronic information). The memory may store instructions suitable for execution by the processor to perform the techniques according to the implementation of the disclosed subject matter.
[0078] For the purpose of explanation, the foregoing description has been described with reference to specific embodiments. However, the above illustrative discussion is not intended to be exhaustive or to limit the implementation of the disclosed subject matter to the exact form disclosed. In view of the above teachings, many modifications and variations are possible. These implementations are selected and described in order to explain the principles of the implementation of the disclosed subject matter and its practical application, so that other persons skilled in the art can utilize those implementations and various implementations with various modifications as may be suitable for the specific purpose envisioned.
Claims
1. A computer-implemented method for deleting one or more records from a storage system based on a log structured merge (LSM) tree during a merge operation, comprising: Entering an initial record in a primary index of a virtualization layer of the storage system, and entering a corresponding initial record in a secondary index of the virtualization layer of the storage system; setting an initial flag in the initial record in the primary index of the virtualization layer of the storage system, the initial flag indicating that the initial record is a currently first and earliest active record associated with a first key, the first key not being associated with any other active records; inputting a plurality of update records into the primary index, wherein each update record of the plurality of update records stores a corresponding adjusted value of the initial record; inserting a data deletion marker and a successive corresponding initial record in the secondary index based on inputting each of the plurality of update records into the primary index, wherein each of the data deletion markers marks a previous corresponding initial record in the secondary index to be deleted from the storage system during the merge operation; setting a final data deletion marker in a second record in the primary index of the virtualization layer of the storage system, the second record being associated with the first key, and the final data deletion marker indicating that a value associated with the first key is designated to be deleted from the storage system during the merge operation; selecting a set of one or more records in the virtualization layer of the storage system to be written to an extent of the physical storage layer of the storage system in the merge operation, each record of the one or more records being associated with the first key; Prior to performing the merge operation, discarding the data deletion marker and the final data deletion marker and the second record from the set of one or more records based at least in part on determining that: The initial record having the initial flag set is the oldest record in the set of the one or more records, and The second record having the final data deletion marker set is the latest record in the set of the one or more records; as well as The merge operation is performed to write a remaining set of non-discarded records in the set of one or more records to the disk area of the physical storage layer of the storage system.
2. The computer-implemented method of claim 1, wherein the initial record and the second record are the same record and are the only records in the set. 3 . The method of claim 1 , wherein the set of one or more records are all selected based on having an associated transaction time after a time point T when the scan operation starts.
4. The computer-implemented method of claim 1, further comprising setting an initial flag in the third record when the third record is the oldest record in the set and the merge operation writes the record to the lowest disk area in the storage system.
5. The computer-implemented method of claim 1 , further comprising, before setting the initial flag in the initial record: performing a search in the storage system for an active record having the same key as the initial record; and When the search does not obtain a record stored in the storage system that has the same key as the initial record, the initial flag of the initial record is set.
6. The computer implemented method of claim 5, wherein the searching and determining to set the initial flag in the initial record occurs when the initial record is inserted into the storage system.
7. A computer-implemented method of managing one or more records in a storage system based on a log structured merge (LSM) tree during a merge operation on a target extent, comprising: Select one or more records that fall within the time range; selecting one or more records having the same key from the range of the one or more records to form a repeat set organized in chronological order; Separating the latest record R from the duplication set to form a pruned set from the remaining duplication set records; discarding the trim set by not writing the trim set to the target extent; as well as When R is a tombstone and the oldest record in the pruned set is the initial record, R is discarded by not writing R to the target extent, Wherein a tombstone is a record indicating that a value corresponding to a key associated with the tombstone has been deleted, and an initial record is a record including a designation indicating that when the initial record was inserted, no other active record in the system was associated with the same key associated with the initial record.
8. The method of claim 7, further comprising discarding R by not writing R to the target disk area when R is a tombstone and the target disk area is a lowest level disk area in the system.
9. The method of claim 7, further comprising discarding R when the pruning set is empty and R is both a tombstone and an initial record.
10. The method according to claim 7 further includes writing R to the target disk area designating it as an initial record when R is not discarded and R is not a tombstone and the oldest record in the trim set is an initial record.
