Database management method and device, electronic equipment, chip and medium
The hash partitioning strategy divides the database data into multiple shards for parallel backup and recovery, which solves the problem of low efficiency of database backup and recovery, achieves accurate recovery and flexibility of data, and ensures the consistency and integrity of the data.
Patent Information
- Application Number
- CN202311493026.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-07
- Publication Date
- 2024-10-18
AI Technical Summary
Database backup and recovery efficiency is low, data cannot be restored in a fine-grained manner, and it lacks flexibility and scalability.
The hash partitioning strategy is used to divide the data into multiple shards. By backing up and restoring the sharded data in parallel, a backup file is generated, and the specified range of data is restored according to the requirements and merged into a complete database data.
It improves the efficiency of data backup and recovery, achieves accurate data recovery, ensures data consistency and integrity, and enhances the flexibility and scalability of backup and recovery.
Smart Images

Figure CN118796543A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of databases, and in particular to a database management method, device, electronic device, chip and medium. Background Art
[0002] Database backup and recovery are important links to ensure data security. Related database backup technologies usually require backing up the data in the database one by one in sequence. When restoring data, it can only be restored to the overall state of the backup one by one in the order of backup, resulting in low efficiency of database backup and recovery, inability to perform fine-grained data recovery, and lack of flexibility and scalability. Summary of the invention
[0003] The present disclosure provides a database management method, device, electronic device, chip and medium to solve the problems of low efficiency of database backup and recovery, inability to perform fine-grained data recovery, lack of flexibility and scalability. The data is divided into multiple shards by adopting a hash partitioning strategy to ensure that the data is evenly distributed in each shard, thereby improving the efficiency of data backup and recovery. Each shard is backed up in parallel and a backup file is generated. The data range to be recovered is determined according to the requirements, the corresponding backup file is retrieved, and the recovered shard data is merged into the complete database data, thereby achieving accurate data recovery.
[0004] A first aspect embodiment of the present disclosure proposes a database management method, the method comprising: dividing the first data of a database into at least two shards through a hash partitioning strategy; copying the data of the shards to a first memory, generating a backup file, the backup file comprising at least an identifier of the shard and a backup timestamp; generating second data of the database based on the backup file according to a recovery range of the first data, the first data comprising the second data.
[0005] In one embodiment of the present disclosure, dividing the first data of the database into at least two fragments by using a hash partitioning strategy includes:
[0006] Using one of the key field, index field, and unique identifier field of the first data as the division basis field;
[0007] The shards are determined based on the value of the partition basis field and the hash partition strategy.
[0008] In one embodiment of the present disclosure, determining the sharding based on the value of the partition basis field and the hash partitioning strategy includes:
[0009] Based on the value of the division basis field, determine a first hash value by using a hash function;
[0010] Convert the first hash value into a first hash code, where the first hash code is used as a basis for data division;
[0011] Allocating the first data to the data block according to the first hash code and a preset hash code range, the preset hash code range corresponding to the data block;
[0012] The fragment is stored in the second memory, the fragment including one or more data blocks.
[0013] In one embodiment of the present disclosure, after storing the slices in the second memory, the method further includes:
[0014] Update the index table, which records the hash code range and storage location of the data block.
[0015] In one embodiment of the present disclosure, generating second data of a database based on a backup file according to a first data recovery range includes:
[0016] Determine the number of first shards to be restored according to the first data recovery range and the first information of the backup file;
[0017] Locating the first shard according to the first information;
[0018] Read the first shard according to the number of the first shard and the location of the first shard in the backup file;
[0019] Based on the first shard, second data of the database is determined.
[0020] In one embodiment of the present disclosure, determining second data of a database based on the first shard includes:
[0021] Determine a corresponding data redundancy erasure code based on the data content and storage format of the first shard;
[0022] Based on the data redundancy erasure code, second data of the database is determined by decoding and reconstructing the first shard.
[0023] In one embodiment of the present disclosure, the method further includes:
[0024] Verify the shard data based on the first time period;
[0025] If the verification is consistent, the data of the record shard is complete and correct;
[0026] If the verification is inconsistent, the sharded data is detected and repaired, and the exception information and operation log are recorded.
[0027] In one embodiment of the present disclosure, taking the first time as a period, verifying the data of the slice includes:
[0028] Read the sharded data;
[0029] Obtain a first checksum of the sharded data;
[0030] Determine a second checksum of the sharded data by using a hash function;
[0031] Check whether the first checksum is consistent with the second checksum.
[0032] In one embodiment of the present disclosure, if the verification is inconsistent, detecting and repairing the data of the shard, and recording the abnormal information and operation log include:
[0033] If the verification is inconsistent, the fault handling mechanism is triggered;
[0034] In response to the failure handling mechanism, the shard is repaired through the backup file;
[0035] Record exception information and operation logs. Exception information includes verification inconsistency and fault handling mechanism. Operation logs are used to repair shards through backup files.
[0036] A second aspect of the present disclosure provides a database management device, the device comprising:
[0037] A data partitioning module, used to partition the first data of the database into at least two fragments by using a hash partitioning strategy;
[0038] A data backup module, used to copy the data of the shard to the first storage device and generate a backup file, wherein the backup file at least includes an identifier of the shard and a backup timestamp;
[0039] The data recovery module is used to generate second data of the database based on the backup file according to the first data recovery range, and the first data includes the second data.
[0040] The third aspect embodiment of the present disclosure proposes an electronic device, comprising: 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, and the instructions are executed by the at least one processor so that the at least one processor can execute any one of the methods in the first aspect embodiment of the present disclosure.
[0041] The fourth aspect embodiment of the present disclosure proposes a non-transitory computer-readable storage medium storing computer instructions, characterized in that the computer instructions are used to enable a computer to execute the method in the first aspect embodiment of the present disclosure.
[0042] The fifth aspect embodiment of the present disclosure proposes a computer program product, characterized in that it includes a computer program, and when the computer program is executed by a processor, it implements any method in the first aspect embodiment of the present disclosure.
[0043] The sixth aspect embodiment of the present disclosure proposes a chip, comprising at least one processor and a communication interface; the communication interface is used to receive signals input into the chip or signals output from the chip, the processor communicates with the communication interface and implements any one of the methods in the first aspect embodiment of the present disclosure through logic circuits or execution code instructions.
[0044] In summary, according to the database management method proposed in the present invention, the first data of the database is divided into at least two shards through a hash partitioning strategy, thereby improving the efficiency of data backup and recovery; the sharded data is copied to the first memory to generate a backup file, and the backup file includes at least the shard identifier and the backup timestamp, thereby ensuring the consistency and integrity of the data; according to the recovery range of the first data, the second data of the database is generated based on the backup file, and the first data includes the second data, thereby realizing accurate recovery of the data and improving the flexibility and scalability of data backup and recovery.
[0045] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.
[0047] Figure 1 A flowchart of a database management method according to an embodiment of the present disclosure;
[0048] Figure 2 A flowchart of dividing first data of a database into at least two fragments by using a hash partitioning strategy according to an embodiment of the present disclosure;
[0049] Figure 3 A flowchart of determining shards based on the value of a partition basis field and a hash partition strategy according to an embodiment of the present disclosure;
[0050] Figure 4 A flowchart of updating an index table after storing a shard in a second memory according to an embodiment of the present disclosure;
[0051] Figure 5 A flowchart of an embodiment of the present disclosure for generating second data of a database based on a backup file according to a first data recovery range;
[0052] Figure 6 A flowchart of determining second data of a database based on a first shard according to an embodiment of the present disclosure;
[0053] Figure 7 A flowchart of a data consistency check according to an embodiment of the present disclosure;
[0054] Figure 8 This is a flow chart of checking the data of a slice using a first time period as a cycle according to an embodiment of the present disclosure;
[0055] Fig. 9 A flowchart of detecting and repairing the data of a shard and recording abnormal information and operation logs when the data verification of a shard is inconsistent according to an embodiment of the present disclosure;
[0056] Fig.10 A schematic diagram of data partitioning according to an embodiment of the present disclosure;
[0057] Fig.11 A schematic diagram of converting a hash value into a hash code according to an embodiment of the present disclosure;
[0058] Fig.12 A schematic diagram of the structure of a database management device according to an embodiment of the present disclosure;
[0059] Fig.13 is a block diagram of an electronic device for implementing the database management method disclosed in the present invention according to an exemplary embodiment;
[0060] Fig.14 It is a schematic diagram of the structure of the chip of the embodiment of the present disclosure. DETAILED DESCRIPTION
[0061] Embodiments of the present disclosure are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout identify the same or similar originals or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present disclosure, and should not be construed as limiting the present disclosure.
[0062] Database backup and recovery is an important part of data security, used to ensure data security and integrity. First, database backup is the process of copying the data in the database to another location, which is to make it possible to recover the original data in the event of loss or damage. Secondly, when facing database damage or data loss, you can perform a recovery operation, that is, copy the previously backed up data back to the original database, thereby restoring the integrity and availability of the data.
[0063] In the related art, database backup and recovery backs up data one by one in sequence, and when restoring, it is necessary to restore one by one in the order of backup. Especially when the amount of data is very large, the database backup and recovery has the following problems:
[0064] 1. Low backup efficiency: Related database backup technologies often require backing up data in the database one by one, which makes the backup process time-consuming, especially for large-scale databases, the backup time is even longer, affecting the availability and performance of the system.
[0065] 2. Low data recovery accuracy: Related backup technologies can only restore the overall state of the backup during data recovery, and cannot perform fine-grained data recovery. This means that if only part of the data or data at a specific point in time needs to be restored, traditional backup technologies cannot meet such requirements, resulting in low data recovery accuracy.
[0066] 3. Lack of flexibility and scalability: Related backup technologies often lack flexibility and scalability and cannot adapt to database environments of different sizes and requirements. For example, it is impossible to flexibly configure the backup frequency, backup storage location, or select a specific data range for backup.
[0067] The present disclosure aims to solve the problems of low efficiency of database backup and recovery, inability to perform fine-grained data recovery, lack of flexibility and scalability. Through hash partitioning and parallel processing technology, multiple shards can be backed up and restored at the same time, improving the efficiency of backup and recovery. Compared with traditional backup tools, the present disclosure reduces the time and resource consumption of backup and recovery, and realizes efficient backup and recovery.
[0068] Through the data partitioning and merging algorithm, the present disclosure can accurately restore the data in the specified range and merge the fragmented data into a complete database. The restored data is consistent with the original database, ensuring the integrity and consistency of the data and achieving accurate data recovery.
[0069] The present disclosure ensures the integrity and consistency of backup data through a checksum algorithm and a fault detection mechanism. During the recovery process, the data consistency module verifies the backup data, detects and handles faults in a timely manner, and ensures that the recovered data is reliable. Data integrity is ensured.
[0070] The present disclosure can be flexibly configured and expanded according to actual needs. Appropriate hash functions and algorithms can be selected for data partitioning, and parameters such as backup frequency and backup storage location can be configured according to system requirements to meet different database environments and data protection requirements. The flexibility and scalability of database backup and recovery are achieved.
[0071] The method proposed in the present disclosure is applied to database management tasks and can be widely used in scenarios where databases are used, and is particularly suitable for use in scenarios involving the full process management of database backup and recovery. The present disclosure improves the efficiency of database backup and recovery and achieves accurate data recovery. Its application has good commercial prospects and can be widely used in technical fields such as big data, data migration, data security protection, data mining, distributed file systems, cloud computing platforms, and scalable storage systems. The application scenarios are not limited in the embodiments of the present disclosure.
[0072] The database management method provided by the present application is described in detail below with reference to the accompanying drawings.
[0073] Figure 1 FIG. 1 is a flow chart of a database management method according to an embodiment of the present disclosure. Figure 1 In the embodiment shown, the database management method includes:
[0074] Step 101: divide the first data of the database into at least two shards by using a hash partitioning strategy.
[0075] In this embodiment, the hash partitioning strategy refers to a data partitioning method that uses a hash function to calculate the hash value of the data and distributes the data to different shards according to the range of the hash value. The first data refers to the data stored in the database, and the data type of the data can not only be a predefined data type, such as a numerical value, date and time, and a string type, but also can store data of a custom type. Sharding refers to database sharding, which is a data management technology. The core idea is to split a large database into multiple smaller components, each of which exists on a separate database server instance. Each shard is responsible for storing and processing part of the data. When the size of the data set exceeds the processing capacity of a computer or database server, it is necessary to use database sharding technology to divide the data and distribute it to multiple machines. In the present disclosure, the first data of the database is divided into many shards through a hash partitioning strategy.
[0076] Step 102, copy the data of the slice to the first storage device, and generate a backup file, which at least includes the identifier of the slice and the backup timestamp.
[0077] In this embodiment, the first memory refers to a memory for storing the backup data of the shard, which may be a storage device such as a hard disk, a read-only memory, a flash memory, etc. The backup file refers to a copy of the data of the shard, which is stored in the first memory. The identification of the shard refers to the attribute information used to record the serial number assigned to the shard, etc., and the backup timestamp refers to the time when the backup file is generated by the shard.
[0078] Step 103: Generate second data of the database based on the backup file according to the first data recovery range, where the first data includes the second data.
[0079] In this embodiment, the first data recovery range refers to the data range that is recovered according to the demand, which may include the default skin care data, or the user-defined data that needs to be recovered. The second data refers to the data that is restored by the user or the system default after the first data is backed up, and its data content is included in the first data. Data recovery can determine the data to be recovered in the backup file through the first data recovery range, and generate the second data of the database to complete the accurate recovery of the data.
[0080] In summary, according to the database management method proposed in the present invention, the first data of the database is divided into at least two shards through a hash partitioning strategy, thereby improving the efficiency of data backup and recovery; the sharded data is copied to the first memory to generate a backup file, and the backup file includes at least the shard identifier and the backup timestamp, thereby ensuring the consistency and integrity of the data; according to the recovery range of the first data, the second data of the database is generated based on the backup file, and the first data includes the second data, thereby realizing accurate recovery of the data and improving the flexibility and scalability of data backup and recovery.
[0081] Figure 2 The present invention is a flowchart of an embodiment of the present invention for dividing first data of a database into at least two shards by using a hash partitioning strategy. Figure 2 Yes Figure 1 Specific instructions for step 101 are based on Figure 2 The embodiment shown comprises the following steps:
[0082] Step 201: Use one of the key field, index field, and unique identifier field of the first data as a division basis field.
[0083] In this embodiment, the first data in the database is used as a data set, wherein the key field of the first data refers to a field in the current data set that contains important information reflecting the current data set, such as the data set name, category, etc., the index field refers to a digital label in the first data used to determine the data content, and the unique identifier field refers to a unique identifier that distinguishes the data from each other in the first data, usually represented by the overall number of the data. The division basis field refers to a basis field used to divide the first data into multiple fragments, and a field can be selected from the key field, index field, and unique identifier field of the first data as the division basis field.
[0084] Step 202, determine the shards based on the value of the partition basis field and the hash partition strategy.
[0085] In this embodiment, after determining the partition basis field in step 201, a hash partitioning strategy can be used to calculate the hash value of the data in the partition basis field using a hash function, and the data in the partition basis field is allocated to different shards according to the range of the hash value for data partitioning, thereby determining different shards. The specific partitioning process is described in the following embodiment.
[0086] Figure 3 The present invention is a flowchart for determining shards based on the value of a partition basis field and a hash partition strategy according to an embodiment of the present invention. Figure 3 Yes Figure 2 The specific description of step 202 is based on Figure 3 The embodiment shown comprises the following steps:
[0087] Step 301: Determine a first Hash value through a Hash function based on the value of the division basis field.
[0088] In this embodiment, a hash function refers to a function that can map an input of any length to a hash value of a fixed length, which is a type of function that has multiple forms. The input can be a fixed length such as an integer, or an arbitrary string, or even a longitude and latitude or a high-dimensional vector. The first hash value refers to a hash value of a fixed size obtained after the value of the partition basis field is input into the hash function, which has the characteristics of irreversibility, uniqueness, and anti-collision, and is used to uniquely identify the value of the partition basis field.
[0089] In one implementation of this embodiment, for a value of a division basis field, it is input into the SHA-256 hash function for calculation to obtain a 256-bit (32-byte) hash value. For example, there is a database record in the first data:
[0090] ID: "12345"
[0091] Other fields...
[0092] 1) Select the field to be divided: Select the "ID" field as the basis for division.
[0093] 2) Extract the value of the partitioning field: extract "12345" as input.
[0094] 3) Convert the field value to a byte array: Convert "12345" to a byte array representation.
[0095] 4) Use the SHA-256 hash function to calculate the hash value: Input the byte array into the SHA-256 hash function for calculation to obtain a 256-bit hash value.
[0096] 5) Get hash value: Get the calculated 256-bit hash value 0x75f18e7412a6b8a1a78973dc0ef47b0c64f98a3d3dd0e3efb6f301af6c94c92d.
[0097] Step 302: Convert the first Hash value into a first Hash code, where the first Hash code is used as a basis for data division.
[0098] In this embodiment, the first hash code refers to converting the inoperable, long and complex first hash value into an operational coding value. The coding value can be an integer or encoded using a coding method, such as hexadecimal, to facilitate subsequent processing and division. It can be used to define the range of data blocks, as a basis for data division, and to record the location and storage information of data blocks. The length and representation of the hash code can be adjusted and defined according to actual needs and system design.
[0099] The first hash value is converted into a first hash code for use in data partitioning.
[0100] In one implementation of this embodiment, if the first hash value is a 256-bit hash value, it is: 0x75f18e7412a6b8a1a78973dc0ef47b0c64f98a3d3dd0e3efb6f301af6c94c92d.
[0101] 1) Obtain a 256-bit first hash value: obtain a 256-bit hash value calculated by the SHA-256 hash function.
[0102] 2) Select the first hash code length: determine to use a 10-digit hexadecimal hash code.
[0103] 3) Extract the first hash value: extract 10 bits from the beginning or end of the 256-bit hash value: 0x75f18e7412.
[0104] 4) Convert to an operational first hash code: Convert the intercepted 10-digit hash value to a hexadecimal string representation: "75f18e7412".
[0105] That is, the first hash code is "75f18e7412".
[0106] Step 303: Allocate the first data to the data block according to the first hash code and a preset hash code range, where the preset hash code range corresponds to the data block.
[0107] In this embodiment, the preset hash code range refers to different intervals of hash codes based on which the first data is divided and defined by the user, and the data block refers to a part of the data content of the first data.
[0108] In one implementation of this embodiment, the first data includes four data blocks.
[0109] 1) The four data blocks are: data block A, data block B, data block C and data block D, and the following corresponding hash code ranges are defined:
[0110] Data block A: hash code range 0x0000-0x3FFF
[0111] Data block B: hash code range 0x4000-0x7FFF
[0112] Data block C: hash code range 0x8000-0xBFFF
[0113] Data block D: hash code range 0xC000-0xFFFF
[0114] 2) Get the hash code: Get the hash code "75f18e7412".
[0115] 3) Convert the hash code to decimal: Convert the hash code "75f18e7412" to the corresponding decimal value and get 487894719794.
[0116] 4) Allocate data records to data blocks based on hash code range:
[0117] The hash code value is 487894719794.
[0118] According to the defined hash code range, it is determined that it belongs to the range of data block B.
[0119] Therefore, the data record "12345" will be allocated to data block B. That is, according to the first hash code according to the ID field "12345" in the first data and the preset four hash code ranges, it is determined that the field belongs to data block B.
[0120] Step 304: Store the shard in the second memory, where the shard includes one or more data blocks.
[0121] In this embodiment, the second memory refers to a memory for storing the shards after the first data is divided. It can be a storage device such as a hard disk, a read-only memory, a flash memory, etc., which is different from the first memory. A distributed storage system or multiple physical devices can also be selected to store data blocks to ensure the redundancy and reliability of the data. Each data block should contain all data records within the corresponding hash code range. In this embodiment, the shards are determined based on the value of the division basis field and the hash division strategy, and the divided data blocks are stored. The data in the database is divided into multiple shards according to the hash division strategy. The data division module uses a hash function to calculate the hash value of the data, and distributes the data to different shards according to the range of the hash value. This method of data division is more refined and more conducive to storage, which helps to improve the efficiency of data backup and recovery.
[0122] Figure 4 The present invention is a flowchart of updating an index table after storing slices in a second memory according to an embodiment of the present invention. Figure 4 Yes Figures 1 to 3 Further explanation, based on Figure 3 The embodiment shown comprises the following steps:
[0123] Step 401: Update the index table, which records the hash code range and storage location of the data block.
[0124] In this embodiment, the index table refers to a file storing the hash code range of the data block and the storage location of the data block. The file can be in any form such as text, table, form in a database, etc. The present disclosure does not limit the form of the index table. The index table is used to associate and save the identification set of the stored data block, that is, the hash code range, with the corresponding storage location. After the shard storage, the re-established storage location needs to be recorded so that the storage location of the data block can be determined according to the index table during data recovery, thereby facilitating accurate data recovery.
[0125] Figure 5 The present invention is a flowchart of an embodiment of the present invention for generating second data of a database based on a backup file according to a first data recovery range. Figure 5 Yes Figure 1 The specific description of step 103 is based on Figure 5 The embodiment shown comprises the following steps:
[0126] Step 501, determining the number of first shards to be restored according to a first data restoration range and first information of a backup file;
[0127] In this embodiment, the first data range is a user-defined data range that needs to be restored. The first information of the backup file includes metadata and index information of the backup file. The metadata describes the data blocks stored in the backup file, and the index information stores the storage location of the data blocks. The first number of shards to be restored refers to the number of shards involved and the backup strategy of the data backup system, that is, according to the first data recovery range and the first information of the backup file, the number of shards that need to be involved is determined. Since each shard involves one or more data blocks, the data blocks within the data recovery range are searched according to the first data recovery range, the shards to which these data blocks belong are determined, and the total number of shards is counted.
[0128] Step 502: locate the first slice according to the first information.
[0129] In this embodiment, the first shard refers to one or more specific data blocks in the backup file, which are determined according to the first information of the backup file. For example, the location of the first shard and its data content can be determined according to the file storage location in the first information.
[0130] Step 503: read the first fragment according to the number of the first fragment and the location of the first fragment in the backup file.
[0131] After determining the number of first shards and the location of the first shard of the backup file, that is, according to the storage location of the data block in the first shard and the number of first shards, read the data blocks in each first shard one by one until the number of read first shards reaches the number of first shards, and then end the reading.
[0132] Step 504: Determine second data of the database based on the first shard.
[0133] In this embodiment, the second data is the data that is restored by user definition or system default after the first data is backed up. The second data of the database can be determined based on the first shard that has been read. The data recovery based on the backup file is completed, wherein the second data of the database determined based on the first shard can be implemented by the following embodiment.
[0134] Figure 6 The present invention is a flowchart of determining second data of a database based on a first shard according to an embodiment of the present disclosure. Figure 6 Yes Figure 5 The specific description of step 504 is based on Figure 6 The embodiment shown comprises the following steps:
[0135] Step 601: Determine a corresponding data redundancy erasure code based on the data content and storage format of the first shard.
[0136] In this embodiment, data redundancy erasure code is a data redundancy technology in the storage field. By adding additional redundant parts to the data, when the original data is lost or damaged, these redundant information can be used for recovery. Preferably, Reed-Solomon coding is used. Different data redundancy erasure codes are selected for encoding according to the data content and storage format of different shards, that is, according to the data content and storage format of the first shard, a data redundancy erasure code matching it is selected.
[0137] Step 602: Determine second data of the database by decoding and reconstructing the first shard based on the data redundancy erasure code.
[0138] In this embodiment, based on the data redundancy erasure code corresponding to the first shard, the data in the first shard is decoded and reconstructed, and the decoded and reconstructed data shards are combined to merge into complete database data to generate a recovery result, i.e., the second data. According to the first shard data obtained from the backup file, the user-defined data to be recovered is recovered after decoding and reconstruction, thereby achieving fine-grained and accurate recovery of the data.
[0139] Figure 7 The present invention is a flowchart of a data consistency check according to an embodiment of the present invention. Figure 7 Yes Figure 1 Further explanation, based on Figure 7 The embodiment shown comprises the following steps:
[0140] Step 701, verifying the data of the slices with the first time as a period.
[0141] In this embodiment, the first time refers to the cycle of verifying the backup data, which can be user-defined or determined by the system according to the storage usage of the database. The database will verify the backup data slices based on the first time as a cycle to detect damage or tampering of the data backup.
[0142] Step 702: If the verification is consistent, the data of the record fragment is complete and correct.
[0143] In this embodiment, during the verification process of the shards with the first time period as the period, if the verification data calculated based on the current shard is consistent with the verification data of the stored shards, it means that the data storage of the shards is complete and consistent, and the data recorded in the shards is complete and correct.
[0144] Step 703: If the verification is inconsistent, the data of the shard is detected and repaired, and the abnormal information and operation log are recorded.
[0145] In this embodiment, the abnormal information refers to the warning information when the verification inconsistency occurs, such as the verification error file and the error code. The operation log refers to the log record of the repair strategy and the repair process adopted for the abnormal information. When the backup data is regularly verified, if the verification inconsistency occurs, the inconsistent shards and data blocks are detected, and the operation log of the abnormal information and the processing method is recorded. It is convenient to provide support for subsequent troubleshooting, tracking the repair process and data auditing. In database management, for backup data, the integrity and consistency of the backup data are ensured through regular verification.
[0146] Figure 8 This is a flowchart of an embodiment of the present disclosure for verifying sliced data using a first time period. Figure 8 Yes Figure 7 The specific description of step 701 is based on Figure 8 The embodiment shown comprises the following steps:
[0147] Step 801, read the sharded data.
[0148] In this embodiment, the data of the slice is read, and the data of the slice includes the data block content and the check code of the slice.
[0149] Step 802, obtaining a first checksum of the sliced data.
[0150] In this embodiment, the first checksum refers to the checksum calculated using a hash function for each data block or backup file. Preferably, the hash function is SHA-256. The sharded data block is hashed using the hash function to generate a checksum value of a fixed length. The value is generated and saved when the data block is stored in the shard.
[0151] Step 803: Determine a second checksum of the sharded data through a hash function.
[0152] In this embodiment, the second checksum refers to a checksum value of the data of the shard recalculated by a hash function based on the data of the shard. After obtaining the first checksum pre-stored in the shard, the checksum of the data of the shard is recalculated as the second checksum.
[0153] Step 804: Check whether the first checksum is consistent with the second checksum.
[0154] In this embodiment, after obtaining the first checksum and the second checksum, the first checksum and the second checksum are compared to see if they are consistent. This determines whether the shard data has been damaged or tampered with during the storage process, providing an early warning for the integrity of the data. When the first checksum and the second checksum are consistent after verification, the instruction manual shard data is stored intact and consistent. If the verification is inconsistent, the method of the following embodiment is required to be processed.
[0155] Fig. 9 This is a flowchart of detecting and repairing shard data and recording abnormal information and operation logs when data verification of a shard is inconsistent in an embodiment of the present disclosure. Fig. 9 Yes Figure 7 The specific description of step 703 is based on Fig. 9 The embodiment shown comprises the following steps:
[0156] Step 901: If the verification is inconsistent, a fault handling mechanism is triggered.
[0157] In this embodiment, the fault handling mechanism refers to a method of using other backup copies or repair tools to restore data when the checksum is detected regularly in the database backup. When the checksum of the shard is inconsistent, the fault handling mechanism is triggered to start the repair of the data.
[0158] Step 902, in response to the fault handling mechanism, repair the shard using the backup file.
[0159] In this embodiment, after the fault handling mechanism is triggered, the shards with inconsistent verification are repaired through the backup file. The repair operation can be to copy data from other backups or to repair through technologies such as error correction codes.
[0160] Step 903, record the exception information and operation log, the exception information includes verification inconsistency and fault handling mechanism, and the operation log is to repair the shard through the backup file.
[0161] In this embodiment, when inconsistency occurs in the verification of shard data, that is, when a problem occurs in the data consistency check, the abnormal information and operation log that appear are recorded. The abnormal information includes warning information of verification inconsistency, such as verification error file; processing strategy information of the fault handling mechanism; the operation log is the repair process of repairing the shard through the backup file after the fault handling mechanism is triggered, which may include a record log of operation processing such as repair progress, current repair file, and repaired file. This information can be used to troubleshoot the cause of the fault, track the repair process, and conduct subsequent data audits. Through the checksum algorithm and data consistency mechanism, when verification inconsistency occurs, the integrity of the backup data is guaranteed by repairing the shard. During the recovery process, data errors can be detected and corrected, reliable data recovery results can be provided, and data integrity and consistency can be enhanced.
[0162] Fig.10 A data partitioning diagram of an embodiment of the present disclosure. Fig.10 Yes Figure 2 and Figure 3 Further explanation, such as Fig.10In the embodiment shown, in this embodiment, the original data of the database is used as a data set, wherein each record in the data set contains a keyword or index field as a basis for division. Usually, a unique identification field is selected as the basis for division, and the data is divided and managed according to this basis for division, and the division unit is 512 bits, which has been divided into group 1, group 2, group 3, ..., group n.
[0163] Fig.11 A schematic diagram of converting a hash value into a hash code according to an embodiment of the present disclosure. Fig.11 Yes Figure 3 Further description of step 302, such as Fig.11 In the embodiment shown, in this embodiment, data H0 is 10111101111011110111, data H1 is 110011110100110101, and data H2 is 00111101110000110101. Through the XOR operation between the data, it can be obtained that: H0^H1=0111 0010 1010 0010 0010, H0^H2=1000 0000 0010 1100 0010, H1^H2=1111 0010 1000 1110 0000. In this embodiment, the custom hash code algorithm is Ma(H0, H1, H2)=(H0^H1)+(H0^H2)+(H1^H2). According to the algorithm, the hash code Ma(H0, H1, H2)=0001 1110 0101 0101 1100 0100 (which can be expressed as 0x 1E55C4 in hexadecimal) corresponding to the hash values of data H0, data H1, and data H2 can be obtained. That is, the hash codes of the three data can be determined by the hash code algorithm.
[0164] The database management method disclosed in the present invention divides the first data of the database into at least two shards through a hash partitioning strategy, thereby improving the efficiency of data backup and recovery; the data of the shards are copied to a first storage device to generate a backup file, and the backup file at least includes an identifier of the shard and a backup timestamp, thereby ensuring the consistency and integrity of the data; according to the recovery range of the first data, the second data of the database is generated based on the backup file, and the first data includes the second data, thereby achieving accurate data recovery and improving the flexibility and scalability of data backup and recovery.
[0165] Corresponding to the methods provided in the above-mentioned embodiments, the present disclosure also provides a database management device. Since the device provided in the embodiment of the present disclosure corresponds to the methods provided in the above-mentioned embodiments, the implementation method of the method is also applicable to the device provided in this embodiment and will not be described in detail in this embodiment.
[0166] Fig.12FIG. 1 is a schematic diagram of the structure of a database management device 1200 according to an embodiment of the present disclosure. Fig.12 As shown, the database management device includes:
[0167] A data partitioning module 1210, configured to partition the first data of the database into at least two fragments by using a hash partitioning strategy;
[0168] The data backup module 1220 is used to copy the data of the shard to the first storage device and generate a backup file, wherein the backup file includes at least an identifier of the shard and a backup timestamp;
[0169] The data recovery module 1230 is used to generate second data of the database based on the backup file according to the first data recovery range, and the first data includes the second data.
[0170] In some embodiments, the data partitioning module 1210 is used to:
[0171] Using one of the key field, index field, and unique identifier field of the first data as the division basis field;
[0172] The shards are determined based on the value of the partition basis field and the hash partition strategy.
[0173] In some embodiments, the data partitioning module 1210 determines the shards based on the value of the partition basis field and the hash partitioning strategy in the following manner:
[0174] Based on the value of the division basis field, determine a first hash value by using a hash function;
[0175] Convert the first hash value into a first hash code, where the first hash code is used as a basis for data division;
[0176] Allocating the first data to the data block according to the first hash code and a preset hash code range, the preset hash code range corresponding to the data block;
[0177] The fragment is stored in the second memory, the fragment including one or more data blocks.
[0178] In some embodiments, the data partitioning module 1210 is further used after storing the slices in the second memory in the following manner:
[0179] Update the index table, which records the hash code range and storage location of the data block.
[0180] In some embodiments, the data recovery module 1230 is used to:
[0181] Determine the number of first shards to be restored according to the first data recovery range and the first information of the backup file;
[0182] Locating the first shard according to the first information;
[0183] Read the first shard according to the number of the first shard and the location of the first shard in the backup file;
[0184] Based on the first shard, second data of the database is determined.
[0185] In some embodiments, the data recovery module 1230 determines the second data of the database based on the first shard in the following manner:
[0186] Determine a corresponding data redundancy erasure code based on the data content and storage format of the first shard;
[0187] Based on the data redundancy erasure code, second data of the database is determined by decoding and reconstructing the first shard.
[0188] In some embodiments, the device is also used to:
[0189] Verify the shard data based on the first time period;
[0190] If the verification is consistent, the data of the record shard is complete and correct;
[0191] If the verification is inconsistent, the sharded data is detected and repaired, and the exception information and operation log are recorded.
[0192] In some embodiments, the device verifies the data of the slices using the first time period in the following manner:
[0193] Read the sharded data;
[0194] Obtain a first checksum of the sharded data;
[0195] Determine a second checksum of the sharded data by using a hash function;
[0196] Check whether the first checksum is consistent with the second checksum.
[0197] In some embodiments, the device detects and repairs the sharded data if the check is inconsistent, and records the abnormal information and operation log in the following manner:
[0198] If the verification is inconsistent, the fault handling mechanism is triggered;
[0199] In response to the failure handling mechanism, the shard is repaired through the backup file;
[0200] Record exception information and operation logs. Exception information includes verification inconsistency and fault handling mechanism. Operation logs are used to repair shards through backup files.
[0201] In summary, through the database management device, it is achieved that: the first data of the database is divided into at least two shards through a hash partitioning strategy, thereby improving the efficiency of data backup and recovery; the sharded data is copied to the first storage device to generate a backup file, and the backup file at least includes the shard identification and the backup timestamp, thereby ensuring the consistency and integrity of the data; according to the first data recovery range, the second data of the database is generated based on the backup file, and the first data includes the second data, thereby achieving accurate data recovery and improving the flexibility and scalability of data backup and recovery.
[0202] The device solves the problems of low efficiency of database backup and recovery, inability to perform fine-grained data recovery, lack of flexibility and scalability, improves the efficiency of data backup and recovery, and realizes accurate data recovery. In addition, the device has rich application scenarios. The proposal relates to the field of data business technology, and in particular to the whole process management of database backup and recovery. Traditional database backup and recovery tools have the disadvantages of low backup efficiency, poor backup and recovery accuracy, and poor scalability. The implementation of the database backup and recovery device based on hash partitioning provided by the present disclosure can effectively solve this problem. Compared with the existing backup and recovery technology, the method and device provided by the present disclosure have higher data recovery accuracy, enhanced data integrity, provided data security protection, data migration and expansion support, and have great commercial value. Traditional backup tools can often only restore the state of the entire database and cannot perform fine-grained data recovery. The basic device can accurately restore the data in a specified range, meet the user's recovery needs for a specific time period or specific data, and improve the accuracy and flexibility of data recovery. The device ensures the integrity of the backup data through a checksum algorithm and a data consistency mechanism. During the recovery process, it can detect and correct data errors, provide reliable data recovery results, and enhance data integrity and consistency. This device effectively protects the security of important data in the database through efficient backup and recovery technology. In the event of accidental data loss, hardware failure or human error, data can be quickly restored to reduce the risk of data leakage and loss, and maintain business stability and reliability. As business develops and data grows, organizations may need to migrate and expand databases. This device can support seamless data migration and expansion operations, ensure smooth migration of database backups, and provide elasticity and scalability to accommodate future business growth.
[0203] In the embodiments provided in the present application, the methods and devices provided in the embodiments of the present application are introduced. In order to implement the functions in the methods provided in the embodiments of the present application, the electronic device may include a hardware structure and a software module, and implement the functions in the form of a hardware structure, a software module, or a hardware structure plus a software module. A function of the functions may be executed in the form of a hardware structure, a software module, or a hardware structure plus a software module.
[0204] Fig.13 is a block diagram of an electronic device 1300 for implementing the above database management method according to an exemplary embodiment.
[0205] For example, the electronic device 1300 may be a mobile phone, a computer, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0206] Reference Fig.13 , the electronic device 1300 may include one or more of the following components: a processing component 1302 , a memory 1304 , a power component 1306 , a multimedia component 1308 , an audio component 1310 , an input / output (I / O) interface 1312 , a sensor component 1314 , and a communication component 1316 .
[0207] The processing component 1302 generally controls the overall operation of the electronic device 1300, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 1302 may include one or more processors 1320 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 1302 may include one or more modules to facilitate the interaction between the processing component 1302 and other components. For example, the processing component 1302 may include a multimedia module to facilitate the interaction between the multimedia component 1308 and the processing component 1302.
[0208] The memory 1304 is configured to store various types of data to support operations on the electronic device 600. Examples of such data include instructions for any application or method operating on the electronic device 1300, contact data, phone book data, messages, pictures, videos, etc. The memory 1304 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0209] The power supply component 1306 provides power to the various components of the electronic device 1300. The power supply component 1306 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 1300.
[0210] The multimedia component 1308 includes a screen that provides an output interface between the electronic device 1300 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 1308 includes a front camera and / or a rear camera. When the electronic device 1300 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0211] The audio component 1310 is configured to output and / or input audio signals. For example, the audio component 1310 includes a microphone (MIC), and when the electronic device 1300 is in an operation mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 1304 or sent via the communication component 1316. In some embodiments, the audio component 1310 also includes a speaker for outputting audio signals.
[0212] I / O interface 1312 provides an interface between processing component 1302 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.
[0213] The sensor assembly 1314 includes one or more sensors for providing various aspects of status assessment for the electronic device 1300. For example, the sensor assembly 1314 can detect the open / closed state of the electronic device 1300, the relative positioning of components, such as the display and keypad of the electronic device 1300, and the sensor assembly 1314 can also detect the position change of the electronic device 1300 or a component of the electronic device 1300, the presence or absence of user contact with the electronic device 1300, the orientation or acceleration / deceleration of the electronic device 1300, and the temperature change of the electronic device 1300. The sensor assembly 1314 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 1314 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 1314 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0214] The communication component 1316 is configured to facilitate wired or wireless communication between the electronic device 1300 and other devices. The electronic device 1300 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, 4G LTE, 5G NR (NewRadio) or a combination thereof. In an exemplary embodiment, the communication component 1316 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 1316 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0215] In an exemplary embodiment, the electronic device 1300 may be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to perform the above methods.
[0216] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 1304 including instructions, and the instructions can be executed by a processor 1320 of the electronic device 1300 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0217] The embodiments of the present disclosure further provide a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable a computer to execute the database management method described in the above embodiments of the present disclosure.
[0218] The embodiments of the present disclosure further provide a computer program product, including a computer program, which executes the database management method described in the above embodiments of the present disclosure when a processor is used.
[0219] Fig.14 is a schematic structural diagram of a chip 1400 for implementing the above database management method according to an exemplary embodiment.
[0220] Reference Fig.14The chip 1400 includes at least one communication interface 1401 and a processor 1402; the communication interface 1401 is used to receive a signal input to the chip 1400 or a signal output from the chip 1400, and the processor 1402 communicates with the communication interface 1401 and implements the database management method described in the above embodiment through a logic circuit or executing code instructions.
[0221] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0222] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "illustrative embodiments", "examples", "specific examples" or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiments or examples are included in at least one embodiment or example of the present disclosure. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0223] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code that includes one or more executable instructions for implementing the steps of a specific logical function or process, and the scope of the preferred embodiments of the present disclosure includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by those skilled in the art to which the embodiments of the present disclosure belong.
[0224] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processing module, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (control method), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or otherwise processing in a suitable manner if necessary, and then stored in a computer memory.
[0225] It should be understood that the various parts of the embodiments of the present disclosure can be implemented by hardware, software, firmware or a combination thereof. In the above embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0226] A person skilled in the art may understand that all or part of the steps in the method for implementing the above-mentioned embodiment may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps of the method embodiment.
[0227] In addition, each functional unit in each embodiment of the present disclosure may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium. The above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.
[0228] Although the embodiments of the present disclosure have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present disclosure. A person skilled in the art may make changes, modifications, substitutions and variations to the above embodiments within the scope of the present disclosure.
Claims
1. A database management method, characterized in that: The method comprises: Dividing the first data of the database into at least two shards by using a hash partitioning strategy; Copy the data of the shard to the first storage device to generate a backup file, wherein the backup file at least includes an identifier of the shard and a backup timestamp; According to the first data recovery range, second data of the database is generated based on the backup file, and the first data includes the second data.
2. The method according to claim 1, characterized in that The step of dividing the first data of the database into at least two fragments by using a hash partitioning strategy includes: Using one of the key field, index field, and unique identifier field of the first data as a division basis field; The sharding is determined based on the value of the partition basis field and the hash partitioning strategy.
3. The method according to claim 2, characterized in that The determining the sharding based on the value of the partition basis field and the hash partitioning strategy includes: Based on the value of the division basis field, determining a first hash value by a hash function; Convert the first hash value into a first hash code, where the first hash code is used as a basis for data division; allocating the first data to data blocks according to the first hash code and a preset hash code range, the preset hash code range corresponding to the data blocks; The fragment is stored in a second memory, wherein the fragment includes one or more of the data blocks.
4. The method according to claim 3, characterized in that: After storing the fragments in the second memory, the method further includes: An index table is updated, wherein the index table records the hash code range and storage location of the data block.
5. The method according to claim 1, characterized in that: The step of restoring the first data range and generating the second data of the database based on the backup file comprises: Determine the number of first shards to be restored according to the first data recovery range and the first information of the backup file; Locating a first shard according to the first information; Reading the first shard according to the number of the first shards and the location of the first shard in the backup file; Based on the first shard, the second data of the database is determined.
6. The method according to claim 5, characterized in that The determining, based on the first shard, the second data of the database comprises: Determine a corresponding data redundancy erasure code based on the data content and storage format of the first shard; Based on the data redundancy erasure code, the second data of the database is determined by decoding and reconstructing the first shard.
7. The method according to claim 1, characterized in that The method further comprises: Verify the data of the shard using the first time as a period; If the verification is consistent, the data recorded in the shard is complete and correct; If the verification is inconsistent, the data of the shard is detected and repaired, and the abnormal information and operation log are recorded.
8. The method according to claim 7, characterized in that The checking of the data of the slices with the first time as a period includes: Reading data of the shard; Obtaining a first checksum of the data of the shard; Determine a second checksum of the data of the shard by a hash function; Check whether the first checksum is consistent with the second checksum.
9. The method according to claim 7, characterized in that: If the verification is inconsistent, the data of the shard is detected and repaired, and the abnormal information and operation log are recorded, including: If the verification is inconsistent, a fault handling mechanism is triggered; In response to the fault handling mechanism, repairing the shard using the backup file; The exception information and the operation log are recorded, wherein the exception information includes the verification inconsistency and the fault handling mechanism, and the operation log is to repair the shard through the backup file.
10. A database management device, characterized in that: The device comprises: A data partitioning module, used to partition the first data of the database into at least two fragments by using a hash partitioning strategy; A data backup module, used to copy the data of the shard to the first memory and generate a backup file, wherein the backup file at least includes an identifier of the shard and a backup timestamp; The data recovery module is used to generate second data of the database based on the backup file according to the first data recovery range, wherein the first data includes the second data.
11. An electronic device, characterized in that: include: 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, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 9.
12. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-9.
13. A computer program product, characterized in that The invention comprises a computer program which, when executed by a processor, implements the method according to any one of claims 1 to 9.
14. A chip, characterized in that: It includes at least one processor and a communication interface; the communication interface is used to receive a signal input to the chip or a signal output from the chip, and the processor communicates with the communication interface and implements the method according to any one of claims 1-9 through a logic circuit or executing code instructions.
