Cloud-native object storage for page-based relational databases

By adopting a hybrid solution of block-based storage and cloud object storage in the relational database management system, the problem of compatibility between traditional databases and cloud object storage is solved, data consistency and cost optimization are achieved, and the performance and elasticity of the system are enhanced.

CN114528355BActive Publication Date: 2024-08-27SAP SE
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110942564.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2021-03-10
Filing Date
2021-08-17
Publication Date
2024-08-27
Estimated Expiration
2041-08-17

AI Technical Summary

Technical Problem

When traditional disk-based relational database management systems are deployed on the cloud, they are difficult to be compatible with cloud-based object storage, resulting in data consistency and update problems and high costs.

Method used

Adopting a hybrid solution of block-based storage and cloud object storage, managing page data by generating unique object IDs and block mappings, achieving multi-version consistency control, supporting writing and reading data in cloud object storage, and through the buffer manager and object cache managers optimize performance and throughput.

Benefits of technology

It reduces the cost of the database management system, improves data consistency and system elasticity, enhances compatibility and performance of cloud object storage, and supports frequent snapshot management and near-instant recovery.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114528355B_ABST
    Figure CN114528355B_ABST
Patent Text Reader

Abstract

A system and method include: determining a first logical page number of a first database page to be persisted; identifying a first block mapping page associated with the first logical page number; determining a block number associated with the first logical page number from the first block mapping page; determining that the block number is an object key; in response to determining that the block number is an object key, determining a first object key associated with the first logical page number; and writing the first database page to an object store using the first object key.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] CROSS-REFERENCE TO RELATED APPLICATIONS

[0002] This patent application claims the benefit and priority under 35 U.S.C. §119 to Indian Provisional Patent Application No. 202011050825, filed on November 23, 2020, the entire contents of which are incorporated herein by reference. Background Art

[0003] Software vendors are increasingly moving their products to the cloud, such as Software-as-a-Service (SaaS). Cloud-based implementations provide vendors with elasticity of computing and storage resources, built-in fault tolerance and disaster recovery, and economies of scale. Users of cloud-based implementations benefit from pay-as-you-go pricing models and user experiences that are often preferable to local or on-premises deployments.

[0004] Traditional disk-based relational database management systems are designed to persist data using storage devices that provide strong consistency guarantees. For example, if a transaction writes data to a block on a storage device (e.g., a fixed disk drive) based on a POSIX-compliant file system and then commits, a subsequent transaction that reads that block will retrieve the latest version of the data written to that block. Therefore, deploying such a relational database management system on the cloud requires the use of file system-based cloud storage resources that provide similar strong consistency guarantees. Such resources are expensive, and their use may significantly reduce any cost advantages gained from cloud deployment of the database management system.

[0005] Cloud-based object storage is much cheaper than file system-based cloud storage resources, and can also provide enhanced durability, improved resiliency, and higher throughput. However, cloud-based object storage is not suitable for use with traditional disk-based relational database management systems because cloud-based object storage typically provides eventual but not strong consistency guarantees. In other words, a traditional disk-based relational database management system (using object storage instead of file system-based storage) will eventually provide database clients with the latest version of an updated object, but may provide outdated versions of the object at the same time.

[0006] Additionally, traditional disk-based RDBMSs periodically require in-place updates to persistent database pages. That is, a transaction may need to update a specific version of a database page, in which case the location of the page in the file-based storage system is determined and the page is updated at that location. Not all cloud-based object stores allow updates to stored objects with strong read-write consistency and are therefore incompatible with the page update protocols of traditional disk-based RDBMSs.

[0007] What is needed is a relational database management system that can write data to and read data from an eventually consistent object store. Summary of the invention BRIEF DESCRIPTION OF THE DRAWINGS

[0008] Figure 1 is a block diagram of a page-based relational database management system that provides native block-based storage and cloud object storage in accordance with some embodiments.

[0009] Figure 2 Components of a page-based relational database management system are shown in accordance with some embodiments.

[0010] Figure 3 A paged pool of a database system is shown according to some embodiments.

[0011] Figure 4A and 4B A flow diagram is included of a process for selectively writing database pages to block-based storage or cloud object storage according to some embodiments.

[0012] Figure 5 A paged pool of a database system is shown according to some embodiments.

[0013] Figure 6 Components of a page-based relational database management system are shown in accordance with some embodiments.

[0014] Figure 7 A paged pool of a database system is shown according to some embodiments.

[0015] Figure 8 Components of a page-based relational database management system are shown in accordance with some embodiments.

[0016] Fig. 9 A paged pool of a database system is shown according to some embodiments.

[0017] Fig.10 Components of a page-based relationship management database system are shown according to some embodiments.

[0018] Fig.11 is a block diagram of a page-based distributed relational database management system that provides native block-based storage and cloud object storage, according to some embodiments.

[0019] Fig.12 is a table of events used to describe garbage collection and recovery after a database node crash, according to some embodiments.

[0020] Fig.13is a block diagram of a page-based relational database management system using an object cache manager according to some embodiments.

[0021] Fig.14 is a block diagram illustrating snapshot management according to some embodiments.

[0022] Fig.15 is a block diagram of a cloud implementation according to some embodiments. DETAILED DESCRIPTION

[0023] Some embodiments store data in a distributed consistent database management system including an object store. Embodiments overcome the eventual consistency guarantee of the object store by generating a unique object ID that can be distinguished from the block ID for each page created or modified, and managing page data based on multi-version consistency control and blockmap.

[0024] The operation of some conventional relational database management systems is based on the distinction between the logical (in-memory) representation of a data page and the physical (persistent) representation of the data page. The persistent form and location of the page is transparent to the query engine of the database system, which identifies the page solely based on its logical page number. Page persistence, updates, and retrieval are managed by a buffer manager located between the query engine and the persistent storage device. The buffer manager utilizes a "block map" to maintain a mapping between the logical number of the database page and the block number that indicates the physical block of the file where the database page is stored. The files are located on one or more file-based storage devices (hereinafter referred to as "block storage devices"), and the database pages will be referred to herein as belonging to a file-based database space.

[0025] In addition to the above traditional functions, the embodiments described herein also support database pages that are persisted as objects in a cloud-based object store. These database pages will be referred to herein as belonging to the cloud database space. For these pages, the block map maintains a mapping between the logical number of the database page and the object key of the cloud-based object storing the database page.

[0026] In response to receiving a request to retrieve a logical page, the cache manager navigates the block map in accordance with a typical protocol to identify a block number associated with the logical page. If the block number refers to a physical block stored on a block storage device, the page is retrieved from the block storage device according to the block number. However, if the block number is within a specific reserved numeric range (or exhibits some other pre-specified characteristic), the cache manager determines that the identified block number represents an object key, and retrieves the page from the object storage using the object key.

[0027] Typically, when a new logical page of a file-based database space is to be written to a block storage device, the buffer manager accesses the free list to identify a suitable free physical block, writes the new logical page to the identified block, and updates the block map to identify the block number of the written page. Upon receiving an instruction to persist the update to this logical page, the buffer manager navigates the block map to identify the block number of the corresponding physical page to be written, and updates the physical page in place.

[0028] According to some embodiments, when a new logical page of a cloud database space is to be written, a unique object key is generated and the new logical page is written to the object store using the unique object key. Updates to existing logical pages of a cloud database space cannot be persisted as described above with respect to logical pages of a file-based database space because, unlike files, portions of an object cannot be rewritten. Therefore, in order to persist updates to existing logical pages of a cloud database space, another unique object key is generated and the updated page is written to the object store as an object using the unique object key. Since the physical location of the page has changed, the block map will be updated accordingly, as described below.

[0029] According to the foregoing, free lists are only used in some embodiments to manage the storage of system data structures (which may be stored in block storage devices) and pages of any file-based database space. Since free lists are typically heavyweight data structures and process contention points, reducing reliance on free lists can improve throughput and reduce required processing resources.

[0030] A cloud-based implementation of a database management system according to some embodiments can be distributed, where each database node is a cloud-based server that can be elastically added and removed from the system. As described below, embodiments can provide efficient allocation of object keys in writer nodes, as well as persistence and recovery of these object keys.

[0031] A transaction manager of a database management system according to some embodiments may include a mechanism to track pages stored on an object store that are no longer needed and provide for garbage collection thereof. Due to the reduced cost of maintaining outdated page versions within a cloud-based object store, some embodiments also support frequent and near-instantaneous database snapshots. Furthermore, given the latency of a cloud-based object store, some embodiments may include a read / write cache between a buffer manager and the cloud-based object store.

[0032] Figure 11 is a diagram of a system 100 according to some embodiments. System 100 includes a database management system 110, which can be implemented using one or more computer servers and / or any suitable combination of computing hardware and software. One or more components of system 110 can be remote from each other, and one or more components can be distributed in a cloud computing environment. Such a cloud computing environment can elastically allocate and de-allocate computing (e.g., virtual machines) and storage (e.g., file-based, block-based, object-based) resources depending on demand, cost, and / or other factors.

[0033] Database management system 110 may include any query responsive database system that is or becomes known, including but not limited to a structured query language (i.e., SQL) relational database management system. According to some embodiments, system 100 is a columnar relational database management system designed for online analytical processing (OLAP) workloads and implements multi-version concurrency control (MVCC) using table-level versioning and snapshot isolation.

[0034] Typically, system 110 manages data for database instances stored in block storage devices 120 and object storage 130. Embodiments may use multiple block storage devices and / or object stores. As is known in the art, block storage devices 120 persist system files and database pages belonging to any file-based database space managed by system 110. On the other hand, object storage 130 persists database pages belonging to any cloud-based database space managed by system 110. For example, object storage 130 may include two different object stores provided by two different storage providers. Each object store may be associated with a separate cloud-based database space and may therefore persist database pages for its associated database space. Embodiments may allow users to select storage providers based on price and performance characteristics and move data between different storage providers as needed.

[0035] System 110 executes queries received from client 140. Such queries may include create, read, update, and delete operations associated with data of a database instance. Client 140 may include a server application serving many users, and system 110 may serve many such server applications. According to some embodiments, client 140 is a server application, and both client 140 and system 110 are executed on a cloud platform that provides services thereto. A user may access client 140 via a web-based user portal to the cloud platform.

[0036] The query engine 112 receives queries and requests associated logical pages from the storage subsystem 114. The buffer manager 115 is responsible for locating the correct version of the logical page in the buffer pool 117, or if not in the buffer pool 117, from the persistent storage 120 or 130. As described above, the buffer manager 115 may utilize the block map 116 to determine whether a persistent logical page exists in the storage 120 or 130. When a page is read from the persistent storage 120 or 130, the page is cached in the buffer pool 117. The page may be cached in the buffer pool 117 in a decompressed form.

[0037] In some embodiments, new pages are created in the buffer pool 117. When a transaction modifies a page in the buffer pool 117, it is marked as dirty. The buffer manager 115 maintains a list of all dirty pages associated with active transactions. Before a transaction commits, all dirty pages associated with the transaction are flushed to persistent storage 120 or 130, depending on whether the pages are associated with a file-based database space or a cloud-based database space. Dirty pages can also be flushed from the buffer pool 117 if the buffer manager needs to make room for more recent pages.

[0038] When a dirty page belonging to a cloud-based database space is flushed from the buffer pool 117, the dirty page is stored in the object store 130 using a new unique object key generated by the key generator 118. This unique key is recorded in the block map so that the flushed version of the page can be located in future lookups. The key generator 118 ensures that object keys are never reused and that the appropriate metadata is maintained and restored when the database is restarted.

[0039] Figure 2 The database spaces of a database management system according to some embodiments are shown. A given database instance includes a system database space and one or more user-created (i.e., user) database spaces. The system database space includes a temporary system database space for storing hash tables generated by a query engine, output of a sort run, etc. In a multiplexed system as described below, the temporary system database space is used to share intermediate query results between nodes.

[0040] The main system database space stores a free list 210 and a system catalog. The free list is a bitmap that indicates the availability of allocated blocks across all database spaces in the database instance. For example, a set bit in the free list indicates that the block corresponding to the bit is being used, while a cleared bit indicates that the block corresponding to the bit is available for use. Thus, the free list is used during the writing of a new page to a block storage device (i.e., identifying a free block to which the page will be written and indicating that the block is being used after the page is written to the block) and after a page is deleted and garbage collected from a block storage device (i.e., indicating that the block storing the page is now available for use).

[0041] The identification object 220 is part of the system catalog stored in the system database space. The identification object 220 can point to the root page of the block map corresponding to each user database space of the database instance. The data structures 210 and 220 of the main system database space are stored on a device with strong consistency guarantees (i.e., a block storage device) and can therefore be updated in place.

[0042] A database instance may include one or more user database spaces, each of which may be defined by a user as a file-based database space or a cloud-based database space. Each user database space is associated with a set of corresponding block map objects, wherein each block map object (or block map) has a page tree 230 pointing to the location of persistent pages 240 of the corresponding database space. The block map of the cloud-based database space is associated with a flag or other indicator indicating that any new page created in the database space will be persisted to the cloud object store 250. Thus, as will be described in more detail below, the storage of such new pages includes generating an object key (without reference to the free list 210) and storing the page in the cloud object store 250 using the generated object key.

[0043] Figure 3 The buffer pool 300 stores logical pages based on the cache policy. The buffer pool 300 may store one or more block mapping pages 230 and data pages 240. As described above, a new page is initially created in the buffer pool and is associated with a logical page number.

[0044] When persisting a page corresponding to a logical page number for the first time, the buffer manager identifies the block map associated with the logical page number and includes a pointer identification object 220 pointing to the root page of the identified block map. Next, it is determined whether the block map is associated with a cloud-based database space based on the aforementioned marking. If not, the free list is referenced to determine the block number of the block storage device 260 where the corresponding physical page will be stored. The corresponding physical page is stored at the block number of the block storage device 260, and the appropriate page of the block map is updated to associate the logical page number with the block number as known in the art.

[0045] However, if a block map associated with a logical page number is associated with a cloud-based database space, an object key is generated that serves as the block number associated with the logical page. The corresponding physical page is stored as an object in object store 250 using the object key, and the appropriate page of the block map is updated to associate the logical page number with the block number / object key. For example, a newly created page H is stored as an object in object store 250 using a newly generated object key, and block map page D is updated to associate logical page H with the object key so that persistent page H can be located in the future if necessary.

[0046] According to some embodiments, and to minimize changes to existing formats, the object keys generated for storing cloud objects and the block numbers used to store pages in block storage devices are both 64-bit integers, but belong to different exclusive ranges. For example, the maximum physical block number might be 2. 48 -1, while a larger 64-bit number is reserved for object keys. According to some embodiments, object keys are generated to be strictly monotonically increasing. As described below, this property allows the use of key ranges rather than singleton keys to optimize space and performance during page creation and garbage collection in a multi-node architecture.

[0047] Figure 4A and 4B A flow chart of a process 400 for selectively writing database pages to block storage or cloud object storage is included according to some embodiments. Process 400 may be performed, for example, by a component of a storage subsystem of a database management system.

[0048] Process 400 and all other processes mentioned herein can be embodied as program code read from one or more non-transitory computer-readable media (such as hard disk drives, flash drives, DVD-ROMs, and tapes), and then stored in a compressed, uncompiled, and / or encrypted format. The program code can be executed by one or more processing units (such as, but not limited to, microprocessors, microprocessor cores, and microprocessor execution threads). In some embodiments, hard-wired circuits can be used in place of program code or in combination with program code for implementation of processes according to some embodiments. Therefore, embodiments are not limited to any particular combination of hardware and software.

[0049] Initially, at S405, a request to write a page to non-volatile memory is received. The request includes a logical page number and a version number, and may include a request to flush dirty pages of the buffer pool to persistent memory. As described above, such a request may occur before a transaction commits, or due to a cache eviction policy (e.g., the buffer manager needs to evict recently used pages to make room for newer pages).

[0050] Assume that the aforementioned page H is modified or "dirty" by a transaction. Figure 5 The buffer pool 300 showing the generation of a dirty page H' is shown. According to some embodiments, the request received at S405 may include a request to flush the page H' to the persistent memory.

[0051] Returning to process 400, S410 includes identifying a block mapping page associated with the logical page received at S405 and the requested version. According to some embodiments, S410 includes determining the user database space to which the logical page belongs, for example, by consulting a system directory. An identification object for the user database space can also be identified from the system directory. The identified identification object includes a pointer to a root page of the block mapping associated with the user database space. Starting from the root page, the block mapping pages are traversed based on logical page numbers known in the art until the block mapping page of the control logic page is reached at S410.

[0052] refer to Figure 4A , S410 may include identifying a root block mapping page A of the block mapping page 230 corresponding to the user database space of the logical page H. Traversing the block mapping page 230 until reaching the block mapping page D, which includes metadata about the page H (including the object key of the persistent object storing the page H).

[0053] Next, at S415, a block number associated with the logical page number and the version number is determined from the identified block mapping page. In a conventional system, the block number indicates a block of a block storage device at which a corresponding physical page is stored. Embodiments also contemplate the possibility that the block number indicates a block of a block storage device storing a physical page. However, as described above, in some embodiments, the block number may also include an object key of a cloud object storing a physical page.

[0054] Returning to process 400, at S420 it is determined whether the determined block number is associated with a cloud object. In other words, S420 includes determining whether the block number associated with the logical page number in the identified block map page is a block number of a block storage device or an object key of a cloud object. As described above, block numbers and object keys occupy different numeric ranges. Therefore, S420 may include determining whether the determined block number is within the numeric range of an object key.

[0055] In this example, the block number associated with page H in block map page D is the object key. Therefore, the process proceeds from S420 to S425. At S425, a new block number is generated for the logical page. The new block number is within the numeric range associated with the object key. The new block number can be generated by the object key generator component as described above, and, unlike storage within a block storage device, there is no need to refer to a free list during the generation of the new block number.

[0056] At S430, the page is written to the cloud object storage as an object. The block number generated at S425 is used as an object key to write the page to the object storage. Figure 6 Page H' is shown being written to cloud object storage 250. As shown, the object storing page H' is different from the object storing page H. That is, the page H object is not overwritten at S430 because the page H object is associated with an object key that is different from the object key generated for page H' at S425.

[0057] According to some embodiments, the object key used to write the page to the object store is different from the object key generated for the page at S425. For example, by applying a computationally efficient hash function to the 64-bit object key generated for the logical page, a prefix is ​​constructed before storage. The prefix precedes the 64-bit object key, and the resulting value is used as the object key for the corresponding physical page in the object store. Using these prefixes can avoid throughput limitations imposed by some object stores on objects that share the same prefix.

[0058] As described above, the new object key should be written to the corresponding block mapping page to ensure that the persistent page can be retrieved by lookup in the future. At S435, it is determined whether the logical page is the root page of the block mapping. If not, the identified block mapping page is updated with the new block number at S440. For example, block mapping page D is updated to the object key of the object that references storage page H'. This update dirtys block mapping page D in the buffer pool, resulting in Figure 7 Shown and Figure 8 Page D' is shown.

[0059] Therefore, at the next flush of dirty pages from the buffer pool 300, S410 to S430 are performed as described above to identify block mapping page A, determine the block number / object key associated with block mapping page D, and write block mapping page D' to the object store 250 using the uniquely generated object key, as shown in FIG. Figure 8 At S435, it is determined that block mapping page D is not a root block mapping page, and the process continues to S440 to update block mapping page A. Fig. 9 As shown, the update dirtyes page A in buffer pool 300 .

[0060] When the dirty pages of the buffer pool 300 are refreshed next time, S410 to S430 are performed as described above to write the block mapping page A' into the object storage 250 using the uniquely generated object key, such as Fig.10 As shown. Since the page being written is the block mapping root page, the process proceeds from S435 to S445 to update the identification object corresponding to the block mapping using the object key of the storage object A'. The identification object is stored on the block storage device and is therefore updated in-place at S445.

[0061] like Fig.10As shown, logical pages A, D, and H are marked so that when a transaction that modifies page H is committed, the page can be garbage collected from object store 250 if necessary.

[0062] Returning to process 400, if it is determined that the block number of the logical page to be written does not correspond to the object storage (i.e., the block number is within the range of block numbers of the block storage device), the process proceeds from S420 to S450. At S450, it is determined whether the logical page reflects a new table-level version or simply reflects an update to the logical page of the current table-level version. If the latter, at S460, the page is simply updated in place according to the traditional process. That is, the persistent page stored at the block number of the block storage device is overwritten by the data of the updated page. Then, the process returns to S405.

[0063] If the logical page to be refreshed reflects the new table-level version, then at S465 the free list is referenced to determine the block number of a free physical block of the block storage device where the page can be persisted. At S470, the page is written to the block of the block storage device. The process then continues to S435 to update the block mapping page associated with the logical page with the new block number and continues as described above.

[0064] Thus, as with traditional block-based storage models, embodiments update pages of file-based dbspaces in-place (i.e., on disk) if the table-level version has not changed. In contrast, logical pages of cloud dbspaces are versioned each time the page is written out to object storage. However, for both file-based and cloud dbspace logical pages, if the logical page is updated to a new table-level version, a new version of the corresponding identification object is added to the catalog. Furthermore, for all logical pages, there is no need to physically version them when they are updated as long as the page remains in the buffer pool.

[0065] Fig.11 1 is a block diagram of a distributed database 1100 according to some embodiments. The database 1100 includes a cluster of distributed servers 1110 and 1120 that concurrently perform loads and queries in a scalable manner. The system 1100 includes a coordinator node 1110 and a number of auxiliary nodes 1120. The auxiliary nodes 1120 may include writer nodes or reader nodes. Embodiments may seamlessly add or remove one or more writer nodes and / or reader nodes as needed.

[0066] The writer auxiliary node 1120 and the coordinator node 1110 can perform database updates, while the reader node 1110 cannot. In some embodiments, the writer node 1120 is used for data operation language operations, and the coordinator node 1110 is mainly used for data description language operations. The database 1100 can implement MVCC using table-level version control and snapshot isolation.

[0067] Unlike slave nodes 1120, coordinator node 1110 includes object key generator 1118 and is responsible for generating object keys used in database 1100. The request to generate an object key can be received by coordinator node 1110 from writer slave node 1120 via remote procedure call (RPC), or from coordinator node 1110 itself. Reader slave nodes 120 do not need object keys because reader slave nodes 120 do not store pages in persistent storage.

[0068] The object key generator 1118 assigns object keys to requesting nodes in a range and monotonically increasing manner. For example, an auxiliary writer node 1120 may request 100 keys from a coordinator node 1110. In response, the coordinator node 1110 generates object keys 0-99, stores records associating the range of object keys with the requesting auxiliary writer node 1120, and provides object keys 0-99 to the requesting auxiliary writer node 1120. The auxiliary writer node 1120 caches the assigned keys locally, and then can consume the object keys in any desired manner, including not using some or all of the object keys. If another auxiliary writer node 1120 requests 100 keys from the coordinator node 1110, the coordinator node 1110 can generate object keys 100-199, store metadata associating the range of object keys with another auxiliary writer node 1120, and provide object keys 100-199 to another auxiliary writer node 1120.

[0069] Caching assigned keys locally can avoid the need to issue expensive RPC calls to the coordinator node 1110 each time a new object key is needed. According to some embodiments, the number of keys requested by a node (i.e., the range size) starts at a default value and is dynamically increased or decreased on subsequent RPC calls based on the load on the node.

[0070] The RPC call from the auxiliary writer node 1120 to the coordinator node 1110 starts a new transaction on the coordinator node 1110. The transaction includes recording the largest allocated object key in the transaction log, updating the data structure that maintains the object key range that has been distributed to the auxiliary writer node (and the coordinator node 1110), and refreshing the data structure to disk. Upon success, the transaction commits and returns the newly allocated key range to the requesting auxiliary node. This process ensures that after crash recovery, the coordinator node 1110 can continue to allocate object key ranges in a strictly monotonically increasing manner and can perform accurate garbage collection.

[0071] If a request for a new range of object keys is initiated on the coordinator node 1110, the coordinator node 1110 does not make an RPC call to itself, but performs the allocation directly within the transaction. Therefore, if the coordinator node 1110 crashes, it is able to recover the maximum object key allocated in the server cluster by restoring the maximum object key stored in the transaction log since the last checkpoint.

[0072] According to some embodiments, when a transaction modifies data, a new version of the table is created. As long as there are still transactions that reference these versions, the old versions of the table continue to exist. In a traditional database system that uses only block storage devices for persistence, the task of the transaction manager is to determine that the old version of the table is no longer referenced and then delete the physical pages associated with the old version.

[0073] Some embodiments extend such a transaction manager to track pages stored on the object store and appropriately delete them when they are no longer needed. These garbage collection events fall into two cases: (i) garbage collection of pages used by committed or rolled back transactions; and (ii) garbage collection in response to a crash of a coordinator node or writer slave node.

[0074] In the absence of a coordinator node or writer slave node crash, the transaction manager relies on the existing roll forward / roll back (RF / RB) bitmap to determine which pages to delete from the underlying object store 1134. Each transaction is associated with its own pair of RF / RB bitmaps. The RF bitmap records pages marked for deletion by the transaction, and the RB bitmap records allocated pages. In block-only storage deployments, these bitmaps record the block ranges that pages occupy on the shared block storage as a sequence of 1 bits in the bitmap. In some embodiments, for logical pages associated with a cloud-based database space, the RF / RB bitmap is used to record object keys as a single bit in the bitmap. Whether the RF / RB bitmap represents a physical block number or an object key sequence can be determined by simply checking the range of the recorded bits.

[0075] When a transaction rolls back, the pages recorded in its RB bitmap can be deleted (from block storage or object storage, depending on the bit range of the RB bitmap). However, when a transaction commits, pages marked for deletion by the transaction cannot be deleted immediately because other transactions may still be accessing these pages in an MVCC system using snapshot isolation. Instead, when a transaction commits, its RF / RB bitmap is flushed to storage, the bitmap's identity is recorded in the transaction log, and the responsibility for garbage collection is passed to the transaction manager.

[0076] In this regard, the transaction manager maintains a chain of committed transactions using pointers to the associated RF / RB bitmaps and keeps track of the oldest transaction in the chain (whose pages are still referenced by active transactions in the distributed system). Once the transaction manager determines that the pages of the oldest transaction in the chain are no longer referenced, the RF / RB bitmap of the oldest transaction is used to determine the persistent pages that can be deleted, including pages persisted on the object store. These pages will be deleted and the oldest transaction will be removed from the chain.

[0077] Garbage collection attempts in response to a coordinator node or writer node crash meet the following three requirements. First, if the coordinator node crashes, the metadata structures maintained by the object key generator (i.e., the maximum object key and the active set of object keys distributed to slave nodes) must be restored to a consistent state. Next, if a node goes down, active transactions may be aborted before their RF / RB bitmaps are persisted, and if so, allocations performed by the aborted transactions must be undone without accessing the RB bitmap. Finally, if the active set of object keys allocated by the coordinator node was not fully used by the receiving node at the time of the crash, the storage objects corresponding to the unused object keys must be garbage collected.

[0078] The RF / RB bitmap can be used to recover the active set of object keys that have been distributed to secondary nodes. In traditional block-only storage deployments, crash recovery starts from the last checkpoint where a copy of the free list is kept, and applies the RF / RB bitmaps of all committed transactions to the free list in order. Pages in the RF bitmap are removed from the free list (i.e., reallocations are applied to the free list), and pages in the RB bitmap are marked as "in use" in the free list.

[0079] In the case of an embodiment including pages persisted on a cloud object store, the RF / RB bitmap is used to recover the active set of object keys that have been distributed to secondary nodes. Fig.12 Table 1200 lists a sequence of events in a distributed system including a coordinator node and a writer node (ie, W1). The events involve three transactions T1-T3 and two crash points.

[0080] In the event that the coordinator node crashes at clock 110, the transaction log will be replayed from the checkpoint state that existed at clock 50. At the time of the checkpoint, the object key active set is empty, so the replay starts from an empty object key set. In the general case, the active set may contain object keys from a previous allocation event.

[0081] The allocation event that occurred at clock 60 is replayed and the object key active set is reconstructed as W1:{101–200}. When the commit of T1 is replayed at clock 90, the active set is updated to W1:{131–200} because there is no longer a need to track the commit range for object key {101–130}. No garbage collection of cloud-persistent objects is required because there are no active transactions on the coordinator node that were aborted by the crash.

[0082] Now consider the case where the writer node crashes at clock 140. If there were any active transactions on the writer node at the time of the crash, the allocations performed by those transactions must be garbage collected because those transactions will never be committed. In addition, any outstanding allocations on the writer node must also be garbage collected.

[0083] When the writer node is restarted at clock 150, the writer node issues an RPC call to the coordinator node to start the garbage collection process. When the coordinator node receives the RPC call, it determines the active set of the writer node W1 based on its stored metadata. Next, each object key in the active set W1:{131–200} is polled for garbage collection. Each page in the object store associated with the polled object key will be deleted.

[0084] Based on this example, some pages with object keys in the range {151–160} may not have been flushed to the underlying object store. Regardless, the coordinator node will poll each page in the range as a potential candidate for garbage collection. Furthermore, at the time T2 rolled back, the pages in the range {131–150} had already been garbage collected, but this information was not communicated to the coordinator node. Therefore, when node W1 is restarted, the same range is polled for garbage collection. This process can be viewed as an optimization to reduce the amount of inter-node communication for transaction rollbacks, which are expected to occur more frequently than node restarts.

[0085] As described above, storing pages directly on object storage can significantly reduce storage costs while benefiting from the elasticity and scale-out properties of object storage. However, the I / O characteristics of object storage are different from those of traditional storage solutions (such as hard disk drives or solid-state drives). In particular, while object storage can allow for increased throughput, individual read and write operations may incur higher latency than traditional storage solutions, negatively affecting query performance.

[0086] Fig.13 A database architecture is shown that includes a query engine 1310, a cache manager 1320, a block storage device 1330, and an object store 1340, each of which can be implemented to perform the above functions. To offset the impact of the high latency of the object store 1340 without utilizing more random access memory (RAM), an object cache manager 1350 is arranged between the cache manager 1320 and the object store 1340. The object cache manager 1350 can be viewed as a disk-based extension of the cache manager 1320.

[0087] Each object cache manager 1350 uses a fast solid-state drive (SSD) or hard disk drive (HDD) 1360 that is locally attached to the node. The latency on a locally attached SSD / HDD 1360 is significantly lower than object storage, and it is cheaper than RAM. In a distributed environment, each node includes its own object cache manager (and associated SSD / HDD), and objects cached by one object cache manager instance are not shared with another instance.

[0088] The object cache manager 1350 acts as a read-write cache. During a read, the page is first looked up by the buffer manager 1320, which resides on RAM. If the page is not found, the page is looked up by the object cache manager 1350. If the page is found in the object cache manager 1350, the page is read from the locally attached storage 1360 and returned to the caller. If the page is not found, the object cache manager 1350 reads the page from the underlying object store 1340, returns the page to the caller, and asynchronously caches the new page in the storage 1360 for future lookups. The page is also cached in RAM, in the traditional buffer manager buffer manager 1320. This read-through semantics significantly reduces the read latency of cached pages in the object cache manager 1350 compared to the read latency of reading pages from the object store 1340.

[0089] The object cache manager 1350 supports write operations in write-back mode and write-through mode. In write-back mode, pages are written synchronously to the locally attached storage 1360 and asynchronously to the object storage 1340. The latency of a write operation in write-back mode is determined by the latency of the locally attached storage 1360, so the write speed is relatively fast. In write-through mode, pages are written synchronously to the object storage 1340 and asynchronously cached in the locally attached storage 1360. Therefore, the latency of a write operation in write-through mode is determined by the latency of the object storage 1340, so the write speed is slower than in write-back mode.

[0090] Thus, during both read and write operations, pages are cached in the object cache manager 1350. The object cache manager 1350 creates space for new pages in the memory 1360, relying on a least recently used eviction policy that is consistent with the page eviction policy of the buffer manager 1320. The object cache manager 1350 may maintain a least recently used list representing reads and writes, assuming that pages that were recently written or read by the object cache manager 1350 are more likely to be read again than other pages. As described herein, the page cache in the object cache manager 1350 primarily benefits read operations because a page that was read by the object cache manager 1350 cannot be written again with the same object key. In addition, during a write-back operation, a page is not added to the least recently used list maintained by the object cache manager 1350 until the page is successfully written to the object store 1340. This requirement may prevent unnecessary accumulation of pages (i.e., pages of failed / rolled-back transactions) in the store 1360.

[0091] According to some embodiments, transactions interact with the buffer manager 1320 in three phases: (i) warm-up (ii) churn; and (iii) commit. In the warm-up phase, pages begin to occupy the buffer pool in RAM. In the churn phase, the least recently used pages are moved out of the buffer pool to create space for the most recently used pages. In the commit phase, the buffer manager 1320 clears pages that have been soiled by the committed transaction, including pages residing in the object cache manager 1350.

[0092] In an OLAP system, long-running transactions are normal and expected, and the churn phase constitutes the longest period during a transaction. Therefore, optimizations in the churn phase take precedence over those in the other two phases. Therefore, to keep latency low, pages moved from the buffer pool during the churn phase are written out using the write-back mode of the object cache manager 135. During the commit phase, to ensure that dirty pages are flushed to the object store 1340, the object cache manager 1350 utilizes a write-through mode that prioritizes writes to the object store 134 over caching to the locally attached storage 1360.

[0093] In the presence of multiple transactions, the object cache manager 1350 prioritizes write operations of the committing transaction. A transaction indicates its desire to initiate the commit phase by sending a FlushForCommit signal to the object cache manager 1350. Upon receiving this signal, the object cache manager 1350 moves the dirty pages belonging to the committing transaction to the head of the write queue, thereby prioritizing all previously initiated background jobs for that transaction. The object cache manager 1350 also changes its write mode from write-back to write-through. This change in write mode ensures that all subsequent write requests from the committing transaction are directly executed on the object store 1340 instead of being treated as background jobs.

[0094] The object cache manager 1350 is intended to be a performance optimization, so its presence or absence does not affect transaction consistency. In the absence of the object cache manager 1350, write operations are issued directly to the object store 1340. Failed writes to the object store 1340 are retried, and after a predetermined number of failed writes to the same page, the corresponding transaction is rolled back. Finally, the transaction manager garbage collects the pages that belong to the rolled back transaction.

[0095] In the presence of object cache manager 1350, write operations take two forms as described above: (i) write to storage 1360 for caching; and (ii) write directly to object store 1340. If the write to storage 1360 fails, the error will be ignored and the page will be written directly to object store 1340. If the write to object store 1340 fails, the transaction will be rolled back after a predetermined number of retries, as described above.

[0096] If encryption is enabled, the cache manager 1320 provides pages to the object cache manager 1350 in encrypted form and decrypts pages read from the object cache manager 1350. Thus, pages cached in the memory 1360 and pages persisted on the object memory 1340 are encrypted.

[0097] Traditional, fully file-based relational database management systems support multiple types of backup scenarios (e.g., full backups, incremental backups, incremental backups since full, virtual backups, and decoupled backups) to provide fault tolerance in the event of software or hardware failures. In contrast, most object stores provide native fault tolerance in the form of replication, thereby alleviating the burden of providing fault tolerance from the relational database management system. Therefore, embodiments may leverage the properties of cloud-based object stores to support (i) frequent and near-instantaneous snapshots, and (ii) recovery to consistent snapshots using point-in-time recovery. Such support may be provided in addition to the traditional file-based backup schemes described above.

[0098] To support frequent and near-instant snapshots, the deletion of pages from the object store is delayed for a user-defined retention period. This delay takes advantage of the relatively cheap storage provided by cloud-based object storage.

[0099] Conventionally, a transaction manager is responsible for determining that a version of a table is no longer referenced and, in response to that determination, for deleting the physical pages associated with that version. According to some embodiments, if the transaction manager determines that a version of a page associated with a cloud-based database space is no longer referenced, the page is not deleted from the object store and ownership of the page is transferred to a snapshot manager, such as Fig.14 As shown. The snapshot manager is then responsible for permanently deleting the page when the user-defined retention period for the page expires (e.g., two months) in a background process. Since ownership of different pages is transferred to the snapshot manager at different points in time, the snapshot manager maintains a first-in-first-out list containing a record <object key, expiration> for each page transferred to it. The record can be used to identify pages that should be deleted from the object store (i.e., expiration > current time) and to delete the page from the object store (i.e., using the associated object key). The first-in-first-out list is stored in the object store and pruned when a page is permanently deleted.

[0100] According to Fig.14 In the illustrated and described embodiments, taking a snapshot involves backing up the snapshot manager's first-in, first-out list and taking a full backup of the system directory and all file-based database spaces, including the system database space. Since the snapshot manager retains the cloud-stored pages, taking a snapshot does not require backing up the cloud-based database space. When a snapshot expires (i.e., when the snapshot's retention period ends), the snapshot manager automatically deletes the data backed up during the snapshot operation.

[0101] If all user dbspaces in a database instance are cloud-based, taking snapshots is nearly instantaneous. In this case, only the system dbspace needs to be fully backed up, and due to the reduced role of free lists, the system dbspace is significantly smaller than in a traditional database instance. Therefore, even frequent snapshots place a minimal burden on processing resources.

[0102] To restore a database from a snapshot taken within the retention window, simply restore the first-in, first-out lists of the snapshot manager, system catalogs, system dbspaces, and any file-based dbspaces. The block map pages and data pages of the cloud-based dbspaces that identify object references in the system catalogs have been preserved in the underlying object store. After the restore, the database will no longer need any pages that were created between the snapshot and the restore operation. Because the object key generator provides object keys in a monotonically increasing manner, the range of object keys to be garbage collected after the restore can be calculated from the object keys used during the snapshot operation (recorded in the metadata stored during the snapshot) and the restore operation.

[0103] Fig.15 A cloud-based database deployment according to some embodiments is shown. The components shown can reside in one or more public clouds, providing self-service and instant provisioning, automatic scaling, security, compliance, and identity management capabilities.

[0104] Database system 1510 includes a coordinator node 1511, a secondary node 1512, a cloud-based block storage device 1513, and cloud object stores 1514 and 1515. As described herein, nodes 1511 and 1512 are operable to persist pages of a file-based database space to cloud-based block storage device 1513, and to persist pages of a cloud-based database space to cloud object stores 1514 and 1515.

[0105] Each of the coordinator node 1511 and the auxiliary node 1512 may include cloud-based computing resources, such as virtual machines, provided by a public cloud provider. Cloud-based block storage 1513 may include a reserved block storage device for use by any of the nodes 1511 and 1512, and cloud object storage 1514 and 1515 may include key-value object storage as described herein. Two or more nodes or data storage may be provided by different public cloud providers.

[0106] The application server 1520 may also include cloud-based computing resources allocated by a public cloud provider. Therefore, the application server 1520 may also exhibit elasticity based on demand. The user device 1530 may interact with the application executed on the application server 1520, for example, via a web browser executed on the user device 1530, to create, read, update, and delete data managed by the database management system 1510.

[0107] The above-mentioned accompanying drawings represent the logical architecture for describing the process according to some embodiments, and actual implementation may include more or different components arranged in other ways. Other topologies can be used in conjunction with other embodiments. In addition, each component or device described herein can be implemented by any number of devices communicating via any number of other public and / or private networks. Two or more such computing devices can be far away from each other, and can communicate with each other via any known network mode and / or dedicated connection. Each component or device can include any number of hardware and / or software elements suitable for providing the functions described herein and any other functions.

[0108] The embodiments described herein are for illustration only. Those skilled in the art will appreciate that other embodiments can be implemented by modifying and altering the embodiments described above.

Claims

1. A system comprising: A memory for storing executable program codes; as well as The processing unit executes the program code to enable the system to: Determine a first logical page number of a first page to be persisted; identifying a first block mapping page associated with the first logical page number; determining, from the first block mapping page, a block number associated with the first logical page number; determining that the block number is an object key, wherein the object key is associated with a first object stored in an object store; In response to determining that the block number is an object key, determining a first object key associated with the first logical page number, the first object key being different from the object key; as well as The first page is written to an object store as a second object using the first object key.

2. The system of claim 1 , wherein the processing unit executes the program code to cause the system to: The first block map page is updated to associate the first object key with the first logical page number.

3. The system of claim 1 , wherein the processing unit executes the program code to cause the system to: Determine a second logical page number of a second page to be persisted; identifying a second block mapping page associated with the second logical page number; determining, from the second block mapping page, a second block number associated with the second logical page number; determining that the second block number is associated with a block of a block storage device; as well as In response to determining that the second block number is associated with a block of a block storage device, the second page is written to the block of the block storage device.

4. The system according to claim 3, wherein: Determining that the block number is an object key includes determining that the block number is in a range associated with an object key of an object store, and Wherein, determining that the second block number is associated with a block of a block storage device includes determining that the second block number is in a range associated with a block of a block storage device.

5. The system according to claim 3, wherein: The first block map page is associated with a first block map of a first database space, and wherein the second block map page is associated with a second block map of a second database space.

6. The system of claim 1 further comprising a locally attached non-volatile memory device, wherein: Writing the first page to the object store using the first object key includes synchronously writing the first page to the locally attached non-volatile memory device and asynchronously writing the first page to the object store using the first object key.

7. The system of claim 1 further comprising a locally attached non-volatile memory device, wherein: Writing the first page to the object store using the first object key includes asynchronously writing the first page to the locally attached non-volatile memory device and asynchronously writing the first page to the object store using the first object key.

8. A method comprising: Determine a first logical page number of a first page to be persisted; identifying a first block mapping page associated with the first logical page number; determining, from the first block mapping page, a block number associated with the first logical page number; determining that the block number is an object key, wherein the object key is associated with a first object stored in an object store; In response to determining that the block number is an object key, determining a first object key associated with the first logical page number, the first object key being different from the object key; as well as The first page is written to an object store as a second object using the first object key.

9. The method according to claim 8, further comprising: The first block map page is updated to associate the first object key with the first logical page number.

10. The method according to claim 8, further comprising: Determine a second logical page number of a second page to be persisted; identifying a second block mapping page associated with the second logical page number; determining, from the second block mapping page, a second block number associated with the second logical page number; determining that the second block number is associated with a block of a block storage device; as well as In response to determining that the second block number is associated with a block of a block storage device, the second page is written to the block of the block storage device.

11. The method according to claim 10, wherein: Determining that the block number is an object key includes determining that the block number is in a range associated with an object key of an object store, and Wherein, determining that the second block number is associated with a block of a block storage device includes determining that the second block number is in a range associated with a block of a block storage device.

12. The method according to claim 10, wherein: The first block map page is associated with a first block map of a first database space, and wherein the second block map page is associated with a second block map of a second database space.

13. The method according to claim 8, wherein: Writing the first page to the object store using the first object key includes synchronously writing the first page to a locally attached non-volatile memory device and asynchronously writing the first page to the object store using the first object key.

14. The method according to claim 8, wherein: Writing the first page to the object store using the first object key includes asynchronously writing the first page to a locally attached non-volatile memory device and asynchronously writing the first page to the object store using the first object key.

15. A database system comprising: Block storage devices; Cloud object storage; as well as The server node includes a memory storing executable program code and a processing unit executing the program code, so that the system: Determining a first logical page number of a first database page to be persisted; identifying a first block mapping page associated with the first logical page number; Based on the first block mapping page, determining a block number associated with the first logical page number; determining that the block number is an object key, wherein the object key is associated with a first object stored in the cloud object store; In response to determining that the block number is an object key, determining a first object key associated with the first logical page number, the first object key being different from the object key; as well as The first database page is written to the cloud object storage as a second object using the first object key.

16. The database system of claim 15, the server node updates the first block map page to associate the first object key with the first logical page number.

17. The database system according to claim 15, wherein the server node is used for: Determining a second logical page number of a second database page to be persisted; identifying a second block mapping page associated with the second logical page number; determining, based on the second block mapping page, a second block number associated with the second logical page number; determining that the second block number is associated with a block of the block storage device; as well as In response to determining that the second block number is associated with a block of the block storage device, the second database page is written to the block of the block storage device.

18. The database system according to claim 17, wherein: Determining that the block number is an object key includes determining that the block number is in a range associated with an object key of an object store, and Wherein, determining that the second block number is associated with a block of a block storage device includes determining that the second block number is in a range associated with a block of a block storage device.

19. The database system of claim 15, further comprising a locally attached non-volatile memory device, wherein: Writing the first database page to the object store using the first object key includes synchronously writing the first database page to the locally attached non-volatile memory device and asynchronously writing the first database page to the object store using the first object key.

20. The database system of claim 15, further comprising a locally attached non-volatile memory device, wherein: Writing the first database page to the object store using the first object key includes asynchronously writing the first database page to the locally attached non-volatile memory device and asynchronously writing the first database page to the object store using the first object key.