Methods for creating databases, methods and apparatus for operating databases

By encapsulating the sub-database as a storage space layer of the target database and configuring independent metadata, the problems of efficiency and resource waste in full database updates are solved, achieving storage space flexibility and efficient resource utilization, and improving database operation efficiency and security.

CN114647634BActive Publication Date: 2025-10-31BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210274610.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-18
Publication Date
2025-10-31
Estimated Expiration
2042-03-18

AI Technical Summary

Technical Problem

During a full database update, existing technologies suffer from inefficiency and resource waste, especially when the amount of data changes, as they cannot flexibly adjust the number of storage space shards and the data distribution relationship.

Method used

By encapsulating the sub-database as a storage space layer of the target database and configuring independent metadata, the switching and rollback of the storage space layer are allowed, and the number of shards and data distribution relationships are dynamically adjusted, thereby improving the scalability and resource utilization of the database.

Benefits of technology

It achieves flexibility in database storage space and efficient use of resources, reduces resource waste when data volume changes, and improves database operation efficiency and security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114647634B_ABST
    Figure CN114647634B_ABST
Patent Text Reader

Abstract

This disclosure provides a method for creating a database, a method for operating a database, an apparatus, a device, a storage medium, and a program product, relating to the field of computer technology, and particularly to the fields of artificial intelligence technology such as knowledge graphs and big data. The method for creating a database includes: in response to receiving a database creation request, creating a target database and a first sub-database; encapsulating the first sub-database as a first storage space layer of the target database; and determining the first storage space layer as an available storage space layer of the target database. The method for operating a database includes: receiving an initial operation request for the target database; determining the available storage space layer of the target database; and operating the available storage space layer according to the initial operation request.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and in particular to the fields of artificial intelligence such as knowledge graphs and big data. Background Technology

[0002] A full database update refers to updating all the data in the database. In database applications, some users need to periodically perform full updates of online data. The efficiency and security of a database during a full data update are important performance indicators. Summary of the Invention

[0003] This disclosure provides a method for creating a database, a method for operating a database, an apparatus, a device, a storage medium, and a program product.

[0004] According to one aspect of this disclosure, a method for creating a database is provided, comprising: in response to receiving a database creation request, creating a target database and a first sub-database; encapsulating the first sub-database as a first storage space layer of the target database; and determining the first storage space layer as an available storage space layer of the target database.

[0005] According to another aspect of this disclosure, a method for operating a database is provided, comprising: receiving an initial operation request for a target database; determining an available storage space layer of the target database; and operating the available storage space layer according to the initial operation request, wherein the target database is created according to the method described in embodiments of this disclosure.

[0006] According to another aspect of this disclosure, an apparatus for creating a database is provided, comprising: a creation module for creating a target database and a first sub-database in response to receiving a database creation request; an encapsulation module for encapsulating the first sub-database as a first storage space layer of the target database; and a first determination module for determining the first storage space layer as an available storage space layer of the target database.

[0007] According to another aspect of this disclosure, an apparatus for operating a database is provided, comprising: a receiving module for receiving an original operation request for a target database; a second determining module for determining an available storage space layer of the target database; and an operating module for operating the available storage space layer according to the original operation request, wherein the target database is created according to the method described in the embodiments of this disclosure.

[0008] Another aspect of this disclosure provides an electronic device including: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the methods shown in embodiments of this disclosure.

[0009] According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause the computer to perform the methods shown in the embodiments of the present disclosure.

[0010] According to another aspect of the present disclosure, a computer program product is provided, including a computer program / instructions, characterized in that, when the computer program / instructions are executed by a processor, they implement the steps of the method shown in the embodiments of the present disclosure.

[0011] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description

[0012] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:

[0013] Figure 1 This is a schematic diagram of an exemplary database according to an embodiment of the present disclosure;

[0014] Figure 2 A flowchart illustrating a method for creating a database according to an embodiment of the present disclosure is shown schematically;

[0015] Figure 3 A flowchart illustrating a method for creating a database according to another embodiment of this disclosure is shown schematically;

[0016] Figure 4 A flowchart illustrating a method for operating a database according to an embodiment of the present disclosure is shown schematically;

[0017] Figure 5 A schematic diagram illustrating a method of operating a database according to another embodiment of the present disclosure is shown.

[0018] Figure 6 A block diagram illustrating an apparatus for creating a database according to an embodiment of the present disclosure is shown schematically;

[0019] Figure 7 A block diagram illustrating an apparatus for operating a database according to embodiments of the present disclosure is shown schematically; and

[0020] Figure 8A block diagram of an example electronic device that can be used to implement embodiments of the present disclosure is illustrated schematically. Detailed Implementation

[0021] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0022] The following will combine Figure 1 The database of the present disclosure embodiments will be described.

[0023] Figure 1 This is a schematic diagram of an exemplary database according to an embodiment of this disclosure. It should be noted that... Figure 1 The examples shown are merely examples of databases that can be applied to the embodiments of this disclosure, in order to help those skilled in the art understand the technical content of this disclosure, but do not mean that the embodiments of this disclosure cannot be used for other databases.

[0024] like Figure 1 As shown, the database 100 may include a database layer 110 and storage space layers 120 and 130.

[0025] According to embodiments of this disclosure, each storage layer may contain a sub-database. For example, storage layer 120 contains sub-database 121, and storage layer 130 contains sub-database 131.

[0026] According to embodiments of this disclosure, each sub-database in a storage space layer may correspond to one or more space shards for storing data. For example, sub-database 121 in storage space layer 120 may correspond to space shards 122 and 123, and sub-database 131 in storage space layer 130 may correspond to space shards 132, 133, 134, and 135.

[0027] According to embodiments of this disclosure, each storage space layer can be configured with metadata, which can be used to represent the number of fragments and the data distribution relationship in that storage space layer. The number of space fragments and the data distribution relationship in the space fragments can be set based on the metadata.

[0028] According to embodiments of this disclosure, database 100 may set one of its various storage space layers as an available storage space layer. When a user sends a database operation request, the database operation request can be converted into an operation request for that available storage space layer.

[0029] For example, database 100 can set storage space layer 120 as an available storage space layer. When a user sends a database operation request, the database operation request can be converted into an operation request for the available storage space layer, so as to perform the corresponding operation on storage space layer 120.

[0030] According to embodiments of this disclosure, the available storage space layer can be switched as needed. For example, in the initial stage, storage space layer 120 can be set as the available storage space layer, and the initial data uploaded by the user can be stored in storage space layer 120. Subsequently, if the user needs to perform a full data update on the data in the database, the available storage space layer can be switched from storage space layer 120 to storage space layer 130 so that the subsequent updated data can be stored in storage space layer 130.

[0031] According to embodiments of this disclosure, when a user views database 100 from the outside, only one database is visible. The user is unaware of the existence of multiple storage space layers when operating on database 100. Switching between internal storage space layers within database 100 does not affect the user's use of database 100.

[0032] According to embodiments of this disclosure, the number of storage space layers in database 100 can be set as needed. Additional storage space layers can be added when storage demand is insufficient.

[0033] If a full update is performed on a database and the amount of data to be updated increases or decreases, using the original number of spatial partitions and data distribution relationships will lead to a waste of resources.

[0034] According to embodiments of this disclosure, by encapsulating sub-databases into storage space layers of the target database, each storage space layer contains completely independent sub-databases, and each storage space layer can be configured with different numbers of space shards and data distribution relationships. When the amount of user data increases, new storage space layers can be created, and the number of space shards and data distribution relationships of the storage space layer can be configured according to the increased data volume, thereby reducing resource waste.

[0035] The collection, storage, use, processing, transmission, provision, and disclosure of user personal information involved in the technical solution disclosed herein comply with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0036] Figure 2A flowchart illustrating a method for creating a database according to an embodiment of the present disclosure is shown schematically.

[0037] like Figure 2 As shown, the method 200 for creating a database includes operation S210, in response to receiving a database creation request, creating a target database and a first sub-database.

[0038] Then, in operation S220, the first sub-database is encapsulated as the first storage space layer of the target database.

[0039] In operation S230, the first storage space layer is determined as the available storage space layer for the target database.

[0040] According to embodiments of this disclosure, when creating a target database, instead of creating an actual data storage space, the first sub-database can be encapsulated as a storage space layer of the target database, serving as the actual data storage space.

[0041] According to embodiments of this disclosure, the available storage space layer can be the storage space actually used by the target database.

[0042] According to embodiments of this disclosure, the flexibility of the target database storage space can be improved by encapsulating the sub-database as a storage space layer of the target database.

[0043] According to another embodiment of this disclosure, the metadata of the storage space layer can support custom configuration, wherein the metadata may include, for example, the number of shards and data distribution relationships. By configuring the metadata of the storage space layer, the number of shards and data distribution relationships of the corresponding storage space layer can be set.

[0044] For example, a user can send a configuration request for any storage tier in the target database. Upon receiving a configuration request for a storage tier, the metadata of that storage tier can be configured according to the request.

[0045] According to embodiments of this disclosure, a configuration interface can be pre-configured to receive configuration requests for the storage space layer. Users can actively invoke this configuration interface to adjust the metadata of the storage space layer according to their needs. This configuration interface may, for example, include an HTTP (Hypertext Transfer Protocol) interface.

[0046] According to embodiments of this disclosure, encapsulating a first sub-database into a first storage space layer of the target database may include, for example, generating an operation interface for the first storage space layer based on the operation functions of the first sub-database. These operation functions may include, for example, add, delete, modify, and query operation functions. By generating the operation interface for the first storage space layer based on the operation functions of the first sub-database, the first sub-database can be encapsulated within the target database, allowing the target database to uniformly receive operation requests and convert them into operations corresponding to the sub-database.

[0047] According to embodiments of this disclosure, the first storage space layer can be the storage space layer initially created for the target database. In addition to the first storage space, other storage spaces can also be created for the target database. It is understood that the target database can have any number of storage space layers, and this disclosure does not impose a specific limitation on the number of storage space layers in the target database.

[0048] Based on this Figure 3 A flowchart illustrating a method for creating a database according to another embodiment of this disclosure is shown schematically.

[0049] like Figure 3 As shown, after the first storage space has been created, the method of creating a database may also include creating a second sub-database in operation S340.

[0050] In operation S350, the second sub-database is encapsulated as the second storage space layer of the target database.

[0051] In operation S360, in response to receiving a second configuration request for the second storage space layer, the metadata of the second storage space layer is configured according to the second configuration request.

[0052] Then, in operation S370, in response to receiving a switching request for the second storage space layer, the second storage space layer is determined as an available storage space layer.

[0053] According to the embodiments of this disclosure, the method of encapsulating the second sub-database as the second storage space layer of the target database is the same as the method of encapsulating the first sub-database as the first storage space layer of the target database. For details, please refer to the above text, and it will not be repeated here.

[0054] According to embodiments of this disclosure, the available storage space layer can be the storage space actually operated by the target database. This available storage space layer can be switched as needed. For example, a user can send a switching request to the target database for a second storage space layer, and the target database can determine the second storage space layer as the available storage space layer based on this switching request.

[0055] According to embodiments of this disclosure, a switching interface can be pre-configured and provided to users. When a user needs to switch storage layers, they can send a switching request to this switching interface. The target database can receive the user's switching request through this switching interface and perform the corresponding switching operation.

[0056] According to embodiments of this disclosure, after switching the available storage space layer from the original storage space layer to a new storage space layer, it is also possible to roll back from the new storage space layer to the original storage space layer to achieve data rollback. Users can trigger the rollback operation by sending a rollback request to the target database.

[0057] For example, if the available storage space tier of the target database is configured from the first storage space tier to the second storage space tier, in response to receiving a rollback request, the available storage space tier of the target database can be configured back to the first storage space tier.

[0058] According to embodiments of this disclosure, by encapsulating each sub-database into a storage space layer of the target database, each storage space layer contains a completely independent sub-database, and each storage space layer can have different data distribution relationships, thereby improving the scalability and configuration flexibility of the database.

[0059] According to embodiments of this disclosure, when the amount of user data changes, a new storage space layer can be created, and the data distribution relationship of the new storage space layer can be configured according to the change in data volume to adapt to the change in data volume, thereby reducing resource waste.

[0060] Figure 4 A flowchart illustrating a method for operating a database according to an embodiment of the present disclosure is shown schematically.

[0061] like Figure 4 As shown, the method 400 for operating the database includes operation S410, receiving an original operation request for the target database.

[0062] In operation S420, determine the available storage space tiers for the target database.

[0063] When operating S430, the available storage space layer is operated according to the original operation request.

[0064] According to embodiments of this disclosure, a user can send an operation request to a target database to manipulate data within the database. This operation request is the original operation request. Such requests may include, for example, requests to add data, modify data, delete data, query data, and so on. Specifically, an add data request can be used to request an operation to add data to the database. A delete data request can be used to request a operation to delete data from the database. A modify data request can be used to request a operation to modify data in the database. A query data request can be used to request a operation to query data in the database.

[0065] Since the actual data stored in the target database is distributed across various storage space layers, upon receiving the original operation request, the target database can determine which storage space layer is currently available. Then, based on the original operation request, it performs the corresponding operation on that available storage space layer.

[0066] For example, the target database can generate a target operation request for the available storage space layer based on the original operation request. Then, the target operation request is sent to the operation interface of the available storage space layer to perform operations on the available storage space layer.

[0067] According to embodiments of this disclosure, from an external perspective, a user can only see the target database as a single database, and cannot see the various storage space layers within the target database. From the user's perspective, user operations on the database are only directed at the target database, not at the storage space layers within the target database. When the storage space layers within the target database switch, the user's use of the database remains unaffected.

[0068] The following is for reference. Figure 5 The method for operating the database described above will be further explained with reference to specific embodiments. Those skilled in the art will understand that the following example embodiments are only for understanding this disclosure, and this disclosure is not limited thereto.

[0069] Figure 5 A schematic diagram illustrating a method of operating a database according to another embodiment of this disclosure is shown.

[0070] exist Figure 5 The diagram illustrates that a database can include a database layer and storage space layers encapsulated beneath the database. The database serves as the entry point for user access, and each space represents a physical database. Each database can have two spaces, and each space is independent of the others.

[0071] For example, in this embodiment, when creating the database, a database and a storage space layer (space-0) are created. A mapping relationship is also preset, which records the storage space layers currently in use under this database, i.e., available storage space layers. This mapping relationship is one-to-one. Users can query the currently used available storage space layers through a preset query interface. Initially, the mapping relationship records the mapping from database to space-0.

[0072] When a user wants to delete a database, they can send a delete command to the database. In response to receiving the user's delete command, the database and all spaces within it can be deleted.

[0073] During use, a new storage space layer, space-1, can be created for the database. When a data upload operation is triggered, the available storage space layer can be switched to space-1, and the newly uploaded data will be stored in space-1. More specifically, the mapping switch (Switch) interface can be called to change the mapping relationship to database->space-1, thereby switching the available storage space layer to space-1. Subsequent data writes will be written to this new space-1. It should be noted that after the switch, the old space-0 still exists.

[0074] Users can perform operations such as adding, deleting, querying, and modifying data in the database. When users perform these operations, they access the database layer. Internally, the database layer determines which space to access through a maintained mapping relationship.

[0075] According to embodiments of this disclosure, since the old space-0 still exists after new user data is uploaded, when a user needs to roll back data, the mapping relationship can be adjusted to database->space0 by calling the mapping switch interface, thereby enabling data rollback.

[0076] According to embodiments of this disclosure, space-0 and space-1 each correspond to a sub-database and are completely independent of each other. Each space has independent metadata and independent underlying storage space. The metadata may include, for example, the number of shards and data distribution relationships. Users can dynamically adjust the metadata of the space data according to the data volume. In this embodiment, a configuration interface can be provided for adjusting the metadata of the space data. For example, this configuration interface can be provided to users via an HTTP interface. Users can actively call this HTTP interface to adjust the metadata of the space according to their needs.

[0077] According to embodiments of this disclosure, sub-databases can be encapsulated as spaces within a database, allowing each space to correspond to a completely independent sub-database. Each space can have different numbers of shards and data distribution relationships, thereby improving the database configuration flexibility. Furthermore, the number of shards and data distribution relationships of a space can be configured according to the data volume, thereby improving resource utilization.

[0078] The following will combine Figure 6 An apparatus for creating a database according to embodiments of the present disclosure will be described.

[0079] Figure 6 A block diagram of an apparatus for creating a database according to an embodiment of the present disclosure is shown schematically.

[0080] like Figure 6 As shown, the database creation device 600 includes a first creation module 610, a first encapsulation module 620, and a first determination module 630.

[0081] The first creation module 610 is used to create a target database and a first sub-database in response to receiving a database creation request.

[0082] The first encapsulation module 620 is used to encapsulate the first sub-database into the first storage space layer of the target database.

[0083] The first determining module 630 is used to determine the first storage space layer as the available storage space layer of the target database.

[0084] According to embodiments of this disclosure, the apparatus for creating a database may further include a first configuration module, which may be used to configure the metadata of the first storage space layer in response to receiving a first configuration request for the first storage space layer.

[0085] According to embodiments of this disclosure, the metadata may include, for example, the number of shards and / or data distribution relationships.

[0086] According to embodiments of this disclosure, the encapsulation module may include a generation submodule, which can be used to generate the operation interface of the first storage space layer based on the operation function of the first sub-database.

[0087] According to embodiments of this disclosure, the apparatus for creating a database may further include a second creation module, a second encapsulation module, a second configuration module, and a switching module. The second creation module is used to create a second sub-database. The second encapsulation module is used to encapsulate the second sub-database into a second storage space layer of the target database. The second configuration module is used to configure the metadata of the second storage space layer according to the second configuration request received. The switching module is used to determine the second storage space layer as the available storage space layer in response to a switching request received.

[0088] According to embodiments of this disclosure, the above-described apparatus for creating a database may further include a rollback module, configured to, in response to receiving a rollback request, configure the available storage space layer of the target database as the first storage space layer when the available storage space layer of the target database is configured as the second storage space layer.

[0089] The following will combine Figure 7 An apparatus for operating a database according to embodiments of the present disclosure will be described.

[0090] Figure 7 A block diagram of an apparatus for operating a database according to an embodiment of the present disclosure is shown schematically.

[0091] like Figure 7 As shown, the apparatus 700 for operating the database includes a receiving module 710, a second determining module 720, and an operating module 730.

[0092] The receiving module 710 is used to receive raw operation requests for the target database.

[0093] The second determining module 720 is used to determine the available storage space layer of the target database.

[0094] Operation module 730 is used to operate the available storage space layer according to the original operation request.

[0095] The target database is created according to the database creation method of the embodiments of this disclosure.

[0096] According to embodiments of this disclosure, the operation module may include a conversion submodule and a sending submodule. The conversion submodule is configured to generate a target operation request for the available storage space layer based on the original operation request. The sending submodule is configured to send the target operation request to the operation interface of the available storage space layer to operate the available storage space layer.

[0097] According to embodiments of this disclosure, the original operation request may include at least one of an add data request, a delete data request, a query data request, and a modify data request.

[0098] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.

[0099] Figure 8 A block diagram schematically illustrates an example electronic device 800 that can be used to implement embodiments of the present disclosure. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0100] like Figure 8 As shown, device 800 includes a computing unit 801, which can perform various appropriate actions and processes based on a computer program stored in read-only memory (ROM) 802 or a computer program loaded from storage unit 808 into random access memory (RAM) 803. RAM 803 may also store various programs and data required for the operation of device 800. The computing unit 801, ROM 802, and RAM 803 are interconnected via bus 804. Input / output (I / O) interface 805 is also connected to bus 804.

[0101] Multiple components in device 800 are connected to I / O interface 805, including: input unit 806, such as keyboard, mouse, etc.; output unit 807, such as various types of monitors, speakers, etc.; storage unit 808, such as disk, optical disk, etc.; and communication unit 809, such as network card, modem, wireless transceiver, etc. Communication unit 809 allows device 800 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0102] The computing unit 801 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 801 performs the various methods and processes described above, such as methods for operating a database and methods for creating a database. For example, in some embodiments, the methods for operating a database and methods for creating a database may be implemented as computer software programs tangibly contained in a machine-readable medium, such as storage unit 808. In some embodiments, part or all of the computer program may be loaded and / or installed on device 800 via ROM 802 and / or communication unit 809. When the computer program is loaded into RAM 803 and executed by the computing unit 801, one or more steps of the methods for operating a database and methods for creating a database described above may be performed. Alternatively, in other embodiments, the computing unit 801 may be configured by any other suitable means (e.g., by means of firmware) to perform methods for operating the database and methods for creating the database.

[0103] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0104] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0105] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0106] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0107] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with embodiments of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.

[0108] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other.

[0109] A server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product in the cloud computing service system. It solves the shortcomings of traditional physical hosts and VPS services (Virtual Private Server, or VPS for short) in terms of high management difficulty and weak business scalability. A server can also be a server for a distributed system, or a server that incorporates blockchain technology.

[0110] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.

[0111] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.

Claims

1. A method for creating a database, comprising: In response to receiving a database creation request, the target database and the first sub-database are created; The first sub-database is encapsulated as the first storage space layer of the target database; as well as The first storage space layer is determined as the available storage space layer of the target database; Create a second sub-database; The second sub-database is encapsulated as the second storage space layer of the target database; In response to receiving a switching request for the second storage space layer, the available storage space layer is switched from the first storage space layer to the second storage space layer; The first storage space layer and the second storage space layer each contain independent sub-databases, and each storage space layer is configured with different numbers of shards and data distribution relationships.

2. The method according to claim 1, further comprising: In response to receiving a first configuration request for the first storage space layer, the metadata of the first storage space layer is configured according to the first configuration request.

3. The method according to claim 2, wherein, The metadata includes the number of fragments and / or data distribution relationships.

4. The method according to claim 1, wherein, The first storage space layer for encapsulating the first sub-database into the target database includes: Based on the operation functions of the first sub-database, the operation interface of the first storage space layer is generated.

5. The method according to claim 1, further comprising: In response to receiving a second configuration request for the second storage space layer, the metadata of the second storage space layer is configured according to the second configuration request.

6. The method according to claim 5, further comprising: If the available storage space layer of the target database is configured as the second storage space layer, in response to receiving a rollback request, the available storage space layer of the target database is configured as the first storage space layer.

7. A method for operating a database, comprising: Receive raw operation requests for the target database; Determine the available storage space tiers of the target database; as well as The available storage space layer is operated according to the original operation request, wherein the target database is created by the method according to any one of claims 1-6.

8. The method according to claim 7, wherein, The step of operating the available storage space layer according to the original operation request includes: Based on the original operation request, generate a target operation request for the available storage space layer; and The target operation request is sent to the operation interface of the available storage space layer in order to operate the available storage space layer.

9. The method according to claim 7 or 8, wherein, The original operation request includes at least one of the following: add data request, modify data request, delete data request, query data request, and modify data request.

10. An apparatus for creating a database, comprising: The first creation module is used to create the target database and the first sub-database in response to receiving a database creation request; The first encapsulation module is used to encapsulate the first sub-database into the first storage space layer of the target database; as well as The first determining module is used to determine the first storage space layer as the available storage space layer of the target database; The second creation module is used to create the second sub-database; The second encapsulation module is used to encapsulate the second sub-database into the second storage space layer of the target database; A switching module is configured to, in response to receiving a switching request for the second storage space layer, switch the available storage space layer from the first storage space layer to the second storage space layer; The first storage space layer and the second storage space layer each contain independent sub-databases, and each storage space layer is configured with different numbers of shards and data distribution relationships.

11. The apparatus of claim 10, further comprising: The first configuration module is configured to, in response to receiving a first configuration request for the first storage space layer, configure the metadata of the first storage space layer according to the first configuration request.

12. The apparatus according to claim 11, wherein, The metadata includes the number of fragments and / or data distribution relationships.

13. The apparatus according to claim 10, wherein, The packaging module includes: The generation submodule is used to generate the operation interface of the first storage space layer based on the operation function of the first sub-database.

14. The apparatus of claim 10, further comprising: The second configuration module is used to respond to receiving a second configuration request for the second storage space layer and configure the metadata of the second storage space layer according to the second configuration request.

15. The apparatus of claim 14, further comprising: A rollback module is configured to, in response to receiving a rollback request, configure the available storage space layer of the target database to the first storage space layer when the available storage space layer of the target database is configured as the second storage space layer.

16. An apparatus for operating a database, comprising: The receiving module is used to receive raw operation requests for the target database; The second determining module is used to determine the available storage space layer of the target database; as well as An operation module is configured to operate the available storage space layer according to the original operation request, wherein the target database is created by the method according to any one of claims 1-6.

17. The apparatus according to claim 16, wherein, The operation module includes: The conversion submodule is configured to generate a target operation request for the available storage space layer based on the original operation request; and The sending submodule is used to send the target operation request to the operation interface of the available storage space layer so as to operate the available storage space layer.

18. The apparatus according to claim 16 or 17, wherein, The original operation request includes at least one of the following: add data request, delete data request, query data request, and modify data request.

19. An electronic device comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-9.

20. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-9.

21. A computer program product, comprising a computer program / instructions, characterized in that, When the computer program / instructions are executed by the processor, they implement the steps of the method described in any one of claims 1-9.

Citation Information

Patent Citations

  • Basic database packaging method and device, computer equipment and storage medium

    CN110209717A