Data processing method, storage medium and equipment
By performing page integrity checking and global block table verification on data pages in the database, the data tampering detection and recovery problems in the existing technology are solved, efficient and accurate data checksum recovery is achieved, and the security and performance of the database are improved.
Patent Information
- Application Number
- CN202411897422.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-20
- Publication Date
- 2025-04-15
AI Technical Summary
In existing databases, data verification schemes have problems such as low performance, reduced verification accuracy and difficulty in data recovery in terms of tamper-proof and data recovery.
By performing page integrity verification on all data pages to be verified after transaction submission, and reading the page verification value in the global block table after successful verification, verifying whether the header data of the data page has been tampered with. If tampered, locate and restore the data page according to the global block table.
It improves data security and recoverability, improves the efficiency and accuracy of data verification, reduces verification costs, and improves the overall performance of the database.
Smart Images

Figure CN119829593A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of databases, and in particular to a data processing method, storage medium and device. Background Art
[0002] During the data storage and transmission process of the database, it is crucial to ensure the integrity of the data in the database. Some existing data verification schemes can be based on the SM3 algorithm and can implement row-level data verification. However, such schemes lack records of tampered data and cannot accurately locate the rows with problems, so they cannot restore the tampered data. They can only confirm whether the data has been tampered with. Data recovery is difficult and security cannot be guaranteed.
[0003] In order to implement anti-tampering technology, there are now some data verification schemes that can implement row-level integrity verification based on blockchain technology. When creating a user table, a corresponding history table and block table are also created to record modifications to the user table. In this way, anti-tampering technology can be implemented while implementing row-level integrity verification. However, for verification schemes that use blockchain technology and use row data as the verification granularity, as the amount of data increases, the length of the blockchain increases, the cost of verification will gradually increase, and the performance will be low. At the same time, as the data in the table increases, the data in the history table and the block table will continue to increase, and the subsequent verification difficulty and calculation amount will increase rapidly, greatly reducing the subsequent verification efficiency, thereby affecting the overall performance of the database.
[0004] In order to reduce the verification cost and improve performance, the verification granularity can be appropriately increased. For example, the verification granularity is set to the data page, and the data page is subjected to page integrity verification. However, the page integrity verification scheme usually uses the pre-stored verification value in the page header of the data page as the verification benchmark for page integrity verification. If there is an illegal intrusion so that the physical file is directly modified, the correctness of all the verification values in the page header of the data page will not be guaranteed. As a result, the accuracy of the page integrity verification is also greatly reduced, and it is impossible to use all the verification values in the page header to accurately detect whether the entire page has been tampered with, which greatly affects the security of user data. In addition, the page integrity verification scheme also has the problem of being unable to locate the tampered data due to the lack of records of tampered data, and the data with problems cannot be accurately located, so that the tampered data cannot be restored, and the security of the data cannot be guaranteed. Summary of the invention
[0005] In view of the above problems, a data processing method, a storage medium and a device are proposed to overcome the above problems or at least partially solve the above problems.
[0006] An object of the present invention is to provide a data processing method that can improve performance while ensuring data security.
[0007] A further object of the present invention is to improve the recoverability of data.
[0008] Another further object of the present invention is to improve the efficiency of data verification.
[0009] In particular, the present invention provides a data processing method, comprising:
[0010] After the transaction is committed, all data pages to be verified are checked for page integrity;
[0011] When the page integrity check succeeds, data in a preset global block table is read, wherein the preset global block table is used to record a page check value corresponding to each data page;
[0012] Verify whether the data in the page header of the data page to be verified has been tampered with based on the page verification value read;
[0013] If it has not been tampered with, it is confirmed that the data of the data page to be verified is complete.
[0014] Optionally, the global block table is pre-created and stored in a database, and each row of data in the global block table includes a transaction number corresponding to a data page, a page check value, execution information, and a global block check value.
[0015] Optionally, after the step of verifying whether the data in the page header of the data page to be verified has been tampered with, the data processing method further includes:
[0016] In the case where data in a page header of a data page to be verified is tampered with, locating the tampered data page according to the global block table, and acquiring execution information corresponding to the tampered data page;
[0017] According to the execution information, data recovery is performed on the tampered data page.
[0018] Optionally, the global block checksum is obtained by the following steps:
[0019] Calculate the page checksum in the first row of data of the global block table and the hash value of the data after the execution information is spliced as the global block checksum in the first row of data; and / or
[0020] Calculate the hash value of the data obtained by concatenating the page check value in the non-first row of data of the global block table, the execution information, and the global block check value in the previous row of data as the global block check value in the non-first row of data.
[0021] Optionally, the step of locating the tampered data page according to the global block table includes:
[0022] Recalculate the global block checksum of the data page according to the data in the data area of the data page;
[0023] Read the global block checksum in the global block table;
[0024] Compare the recalculated global block checksum value with the read global block checksum value;
[0025] A data page corresponding to the global block checksum value that is inconsistent with the comparison result is obtained as the tampered data page.
[0026] Optionally, each data page includes a page header and a data area, wherein the data area is used to store at least part of the data modified by the transaction; and
[0027] The step of verifying whether the data in the page header of the data page to be verified has been tampered with according to the read page verification value includes:
[0028] Calculate the hash value of all data in the data area of the data page to be verified and obtain the calculation result;
[0029] Determine whether the page checksum read is consistent with the calculated result;
[0030] If they are consistent, it is confirmed that the data in the page header of the data page to be verified has not been tampered with;
[0031] If they are inconsistent, it is confirmed that the data in the page header of the data page to be verified has been tampered with.
[0032] Optionally, before the transaction is committed, the data processing method further includes:
[0033] Calculate the hash value of all data in the data area of the data page modified by the transaction as the page checksum;
[0034] The page checksum is recorded in the global block table and the header of the corresponding data page.
[0035] Optionally, after the transaction is committed, the step of performing page integrity verification on all data pages to be verified includes:
[0036] After the transaction is committed, the data page modified by the transaction is obtained as the data page to be verified;
[0037] Obtain the page checksum value recorded in the page header of the data page to be checked;
[0038] Recalculate the hash value of all data in the data area of the data page to be verified;
[0039] Determine whether the recalculated hash value is the same as the obtained page check value;
[0040] If they are the same, it is confirmed that the page integrity check of the data page to be checked is successful;
[0041] If they are not the same, it is confirmed that the page integrity check of the data page to be checked is unsuccessful.
[0042] According to another aspect of the present invention, a machine-readable storage medium is provided, on which a machine-executable program is stored. When the machine-executable program is executed by a processor, any of the above-mentioned data processing methods is implemented.
[0043] According to another aspect of the present invention, a computer device is provided, comprising a memory, a processor, and a machine executable program stored in the memory and running on the processor, and the processor implements any of the above data processing methods when executing the machine executable program.
[0044] The data processing method of the present invention implements page-level integrity verification by performing page integrity verification on all data pages to be verified after the transaction is committed, thereby reducing verification costs to improve performance. In addition, the data processing method of the present invention also implements the accuracy of obtaining page verification values by reading the page verification value corresponding to the data page recorded in the preset global block table when the page integrity verification is successful, and verifies whether the data in the page header of the data page to be verified has been tampered with based on the read page verification value. If it has not been tampered with, it is confirmed that the data of the data page to be verified is complete, and verification based on the correct verification value is implemented, avoiding the problem that the correctness of all verification values in the page header of the data page cannot be guaranteed when encountering illegal intrusion so that the physical file is directly modified, thereby greatly improving the accuracy of page-level verification, thereby improving the security of data.
[0045] Furthermore, the data processing method of the present invention locates the tampered data page according to the global block table when the data in the page header of the data page to be verified is tampered with, obtains execution information corresponding to the tampered data page, and recovers the tampered data page according to the execution information, thereby avoiding the problem of being unable to recover the tampered data due to lack of records of the tampered data, improving the recoverability of the data, and further ensuring the security of the data.
[0046] Furthermore, the data processing method of the present invention directly reads the global block check value corresponding to the data page in the global block table, and recalculates the global block check value of the data page according to the data in the data area of the data page, and compares the read global block check value with the recalculated global block check value, thereby verifying the block check value and verifying the security of the link between pages, thereby further improving the security of the data. In addition, the data processing method of the present invention also verifies the block check value and obtains the data page corresponding to the global block check value that is inconsistent with the comparison result as the tampered data page, thereby accurately locating the problem page, further ensuring the accuracy of subsequent data recovery operations, thereby further improving the overall performance of the database.
[0047] Based on the following detailed description of specific embodiments of the present invention in conjunction with the accompanying drawings, those skilled in the art will become more aware of the above and other objects, advantages and features of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Hereinafter, some specific embodiments of the present invention will be described in detail in an exemplary and non-limiting manner with reference to the accompanying drawings. The same reference numerals in the accompanying drawings indicate the same or similar components or parts. It should be understood by those skilled in the art that these drawings are not necessarily drawn to scale. In the accompanying drawings:
[0049] Figure 1 is a schematic flow chart of a data processing method according to an embodiment of the present invention;
[0050] Figure 2 is a schematic diagram of an application scenario of a data processing method according to an embodiment of the present invention;
[0051] Figure 3 is a flow chart of a data processing method according to an embodiment of the present invention;
[0052] Figure 4 is a schematic diagram of a machine-readable storage medium according to an embodiment of the present invention; and
[0053] Figure 5 is a schematic diagram of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0054] The exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present disclosure and to enable the scope of the present invention to be fully communicated to those skilled in the art.
[0055] In order to solve the above technical problem, an embodiment of the present invention proposes a data processing method. Figure 1 is a schematic flow chart of a data processing method according to an embodiment of the present invention. Figure 2 Schematic diagram of an application scenario of a data processing method according to an embodiment of the present invention. Figure 1 As shown, the data processing method of this embodiment may generally include:
[0056] Step S102: after the transaction is committed, perform page integrity check on all data pages to be checked. It should be noted that in this step, all data pages modified by the transaction can be used as the data pages to be checked.
[0057] Step S104 , when the page integrity check succeeds, reading data in a preset global block table, wherein the preset global block table is used to record a page check value corresponding to each data page.
[0058] Step S106 , verifying whether the data in the page header of the data page to be verified has been tampered with according to the read page verification value, if not, executing step S108 .
[0059] Step S108, confirming that the data of the data page to be verified is complete. Therefore, an instruction indicating that the verification result is that the data is complete can be output later.
[0060] The data processing method of the present invention implements page-level integrity verification by performing page integrity verification on all data pages to be verified after the transaction is committed, thereby reducing verification costs to improve performance. In addition, the data processing method of the present invention also implements the accuracy of obtaining page verification values by reading the page verification value corresponding to the data page recorded in the preset global block table when the page integrity verification is successful, and verifies whether the data in the page header of the data page to be verified has been tampered with according to the read page verification value. If it has not been tampered with, it is confirmed that the data of the data page to be verified is complete, and verification based on the correct verification value is implemented, avoiding the problem that the correctness of all verification values in the page header of the data page cannot be guaranteed when encountering illegal intrusion so that the physical file is directly modified, thereby greatly improving the accuracy of page-level verification, thereby improving the security of user data.
[0061] In this embodiment, each data page (or page) includes a page header (or page header) and a data area. The page header is used to store the header data of the data page, including a pre-calculated page check value (which can be recorded as P_hash), etc. The data area is used to store at least part of the data modified by the transaction.
[0062] Accordingly, the above step S102 may include the following steps: after the transaction is committed, obtaining the data page modified by the transaction as the data page to be verified; obtaining the page verification value recorded in the page header of the data page to be verified; recalculating the hash value of all data in the data area of the data page to be verified; determining whether the recalculated hash value is the same as the obtained page verification value; if they are the same, confirming that the page integrity verification of the data page to be verified is successful; if they are not the same, confirming that the page integrity verification of the data page to be verified is unsuccessful.
[0063] It can be seen from this that the page integrity check is only used to compare whether the hash check value of the data in the data area of the data page to be checked is consistent with the P_hash recorded in the page header. If there is an illegal intrusion that causes the physical file to be directly modified, the correctness of all P_hashes in the page header of the data page to be checked will not be guaranteed. For example, the entire page of the data page to be checked (including the data recorded in the page header and the data in the data area) is tampered with, and the P_hash recorded in the page header and the data in the data area are tampered with, and the tampered P_hash is exactly the same as the hash value calculated based on the tampered data in the data area. As a result, the accuracy of the page integrity check result is greatly reduced, and it is impossible to use all the P_hashes in the page header to accurately verify whether the entire page of the data page to be checked has been tampered with, which greatly affects the security of user data.
[0064] Therefore, the data processing method of the present invention adds a system table (i.e., global block table) based on the original page integrity verification scheme to record the P_hash and other information of each page when the transaction is submitted, and adds new verification steps, including record verification and block hash verification. This further increases the tamper-proof and locatability of user data through blockchain technology on the basis of the original page integrity verification.
[0065] It should be noted that the global block table is pre-created and stored in the database. Specifically, the global block table can be a system table stored locally in the database. Figure 2As shown, each row of data in the global block table includes the transaction number corresponding to a page (which can be recorded as Xid), P_hash, execution information (which can be recorded as Info), and the global block check value (which can be recorded as Global_hash). In other words, the column names of the global block table can include: Xid, P_hash, Info, Global_hash. Among them, Xid refers to the transaction number of the transaction; P_hash refers to the page hash value; Info refers to the execution information, which can include user information, timestamps, and sql statements; Global_hash refers to the global block hash value, specifically the block check value of each page.
[0066] In some embodiments, before a transaction is committed, the data processing method of the present invention may further include the following steps: calculating the hash value of all data in the data area of the data page modified by the transaction as P_hash; recording P_hash in the global block table and the page header of the data page corresponding thereto. That is, the P_hash recorded in the global block table is obtained by calculating the hash value of all data in the data area of the data page modified by the transaction and stored in the table.
[0067] Specifically, the data pages modified by the transaction may include one or more. When a transaction only involves the modification of one data page, when the transaction is committed, only a P_hash is generated based on the data in the data area of the current data page, and is recorded in the page header of the data page and the global block table. At the same time, the transaction number of the transaction and all SQL statements, user information and timestamps involved in the transaction are written in the same row in the global block table. When a transaction involves the modification of multiple data pages, after each data page is filled, a P_hash is generated based on the data in the data area of the current data page, and is recorded in the page header of the data page and the global block table. At the same time, the transaction number of the transaction and all SQL statements, user information and timestamps used to modify the data page are written in the same row in the global block table.
[0068] In addition, Global_hash can be obtained through the following steps: calculate the hash value of the data spliced from P_hash in the first row of data of the global block table and the execution information, as the Global_hash in the first row of data; and / or calculate the hash value of the data spliced from P_hash in the non-first row of data of the global block table, the execution information and Global_hash in the previous row of data, as the Global_hash in the non-first row of data.
[0069] In a specific embodiment, for the first row of data in the global block table, Global_hash can be obtained by concatenating the p_hash and info of the block to calculate the sm3 digest value. For non-first row data in the global block table, Global_hash can be obtained by concatenating the p_hash, info of the block, and the global_hash of the previous block to calculate the sm3 digest value.
[0070] In an optional embodiment, at least part of each block corresponding to the global block table may correspond to each data page. When a transaction involves the modification of multiple data pages, multiple blocks corresponding to the sequence of the global block table correspond to multiple data pages. In other words, the global block hash value only needs to concatenate the block check value of the previous page and the check value of the current page, user information, timestamp, SQL and other information.
[0071] In another optional embodiment, each block corresponding to the global block table may correspond to each transaction, and each transaction corresponds to a block. When multiple transactions only involve the modification of one data page, multiple blocks corresponding to the sequence of the global block table correspond to multiple transactions respectively. In other words, the global block hash value only needs to concatenate the block check value of the previous page and the check value of the current page, user information, timestamp, SQL and other information.
[0072] Therefore, the global block table can locally store the Xid, P_hash, user information, timestamp, sql statement and Global_hash corresponding to each data page, thereby realizing the combination of blockchain technology and page integrity verification technology, thereby solving the problem of high computational cost of row-level anti-tampering scheme and inability of page integrity verification scheme to locate tampered data, and realizing support for the recovery function of tampered data.
[0073] In some optional embodiments, the above step S106 may include the following steps: calculate the hash value of all data in the data area of the data page to be verified to obtain the calculation result; determine whether the read P_hash is consistent with the calculation result; if consistent, confirm that the data in the page header of the data page to be verified has not been tampered with; if inconsistent, confirm that the data in the page header of the data page to be verified has been tampered with. At this point, it can be verified whether the entire data page record (including the data in the page header and the data in the data area) has been tampered with.
[0074] In some other optional embodiments, the above step S106 may include the following steps: calculating the hash values of all data in the data area of the data page to be verified in sequence according to the record order of the global block table, and calculating the hash value of the data spliced by the multiple calculation results obtained in sequence based on the SM3 algorithm; calculating the hash value of the data spliced by each P_hash in the P_hash column in the global block table based on the SM3 algorithm; judging whether the two hash values are consistent; if they are consistent, confirming that the data in the page header of the data page to be verified has not been tampered with; if they are inconsistent, confirming that the data in the pageheader of the data page to be verified has been tampered with. At this point, it can be verified whether the entire data page record (including the data in the page header and the data in the data area) has been tampered with.
[0075] It should be noted that, when the page integrity check is successful, the data of the data page to be checked may be in the following two situations: the data in the page header of the data page to be checked and the data in the data area of the data page to be checked have not been tampered with; and the data in the page header of the data page to be checked and the data in the data area of the data page to be checked have been tampered with, and the tampered P_hash in the page header happens to be the same as the hash value calculated based on the data in the data area of the data page to be checked.
[0076] Since the read P_hash is recorded in the global block table when the transaction is committed, the data correctness level is relatively high. Therefore, after the above step of determining whether the read P_hash is consistent with the calculation result, if they are consistent, it can be basically confirmed that the data in the data area of the data page to be verified has not been tampered with, and at the same time, it can be basically confirmed that the data in the page header of the data page to be verified has not been tampered with. If they are inconsistent, it can basically be said that the data in the data area of the data page to be verified has been tampered with, and at the same time, the data in the page header of the data page to be verified has also been tampered with.
[0077] At this point, the above steps S104 to S108 can be combined into a record verification operation of the data processing method of the present invention.
[0078] The data processing method of the present invention directly reads the P_hash corresponding to the data page in the global block table as the verification standard, compares the calculated hash value of all data in the data area of the data page to be verified with the read verification standard, and confirms whether the data in the page header of the data page to be verified has not been tampered with according to the comparison result, thereby realizing a convenient judgment on whether all data of the data page is complete. The data processing method of the present invention directly reads the P_hash corresponding to the data page in the global block table as the verification standard, greatly improving the verification efficiency of verifying whether the data of the data page is complete, reducing the verification cost, and further improving the overall performance of the database.
[0079] In some embodiments, after the above step S106, the data processing method of the present invention may further include the following steps: when the data in the page header of the data page to be verified is tampered with, locate the tampered data page according to the global block table, and obtain the execution information corresponding to the tampered data page; according to the execution information, perform data recovery on the tampered data page. Specifically, the execution information may include all SQL statements, user information and timestamps corresponding to the tampered data page. Thus, according to all SQL statements, user information and timestamps corresponding to the tampered data page, data recovery of the tampered data page can be achieved.
[0080] The data processing method of the present invention locates the tampered data page according to the global block table when the data in the page header of the data page to be verified is tampered, obtains the execution information corresponding to the tampered data page, and recovers the data of the tampered data page according to the execution information, thereby avoiding the problem of being unable to recover the tampered data due to the lack of records of the tampered data, improving the recoverability of the data, and further ensuring the security of the data.
[0081] In some embodiments, the above step of locating the tampered data page according to the global block table may include the following steps: recalculating the Global_hash of the data page according to the data in the data area of the data page; reading the Global_hash in the global block table; comparing the recalculated Global_hash with the read Global_hash; obtaining the data page corresponding to the Global_hash that is inconsistent with the comparison result as the tampered data page. So far, the above steps of this embodiment can be combined into the block hash verification operation of the data processing method of the present invention.
[0082] The data processing method of the present invention directly reads the global block check value corresponding to the data page in the global block table, and recalculates the global block check value of the data page according to the data in the data area of the data page, and compares the read global block check value with the recalculated global block check value, thereby realizing the verification of the block check value, verifying the security of the link between pages, and further improving the security of the data. In addition, the data processing method of the present invention also verifies the block check value and obtains the data page corresponding to the global block check value that is inconsistent with the comparison result as the tampered data page, thereby realizing the accurate positioning of the problem page, further ensuring the accuracy of subsequent data recovery operations, and further improving the overall performance of the database.
[0083] Figure 3 1 is a flow chart of a data processing method according to an embodiment of the present invention. Figure 3 The process steps of this embodiment are described in detail.
[0084] Step S302: Before the transaction is committed, the SQL statement is executed to insert data into the page.
[0085] Step S304, calculate the hash check value of all data in the data area of the modified page as P_hash of the page.
[0086] Step S306, record P_hash into the page header of the page.
[0087] Step S308, record P_hash and its corresponding Xid, P_hash, user information, timestamp, sql statement and Global_hash in the global block table. It should be noted that the global block table is pre-created and stored in the database, and the global block table is used to locally store Xid, P_hash, user information, timestamp, sql statement and Global_hash corresponding to each page. Among them, Global_hash is obtained by splicing p_hash, info, and global_hash of the previous block to calculate the sm3 summary value.
[0088] Step S310: After the transaction is committed, obtain the p_hash recorded in the page header of the page to be verified.
[0089] Step S312, recalculate the hash check value of all data in the data area of the page to be checked;
[0090] Step S314, determine whether the recalculated hash check value is the same as the p_hash recorded in the page header. If so, proceed to step S316, if not, proceed to step S320. At this point, the page integrity check of all pages to be checked is completed. Therefore, this step can compare whether the hash check value of the data in the data area of the page to be checked is consistent with the P_hash recorded in the pageheader.
[0091] Step S316, read the P_hash corresponding to the page to be verified in the preset global block table. It should be noted that if the result of step S314 is yes, it can only be said that the hash check value of the data in the data area of the page to be verified is consistent with the P_hash recorded in the page header, and it cannot be determined whether the P_hash recorded in the page header has been tampered with. Therefore, it is necessary to perform this step to determine whether the P_hash recorded in the page header has been tampered with, so as to verify whether the data of the entire page has been tampered with.
[0092] Step S318, determine whether the recalculated hash check value is consistent with the p_hash recorded in the global block table. If they are consistent, execute step S324; if they are inconsistent, execute step S320.
[0093] Step S320, locate the tampered page according to the global block table. Specifically, this step can be performed as a block hash check, comparing the global_hash recorded in the global block table with the global_hash recalculated according to the data in the data area of the page.
[0094] Step S322, obtain the user information and SQL statement corresponding to the tampered page, and restore the data of the tampered page according to the user information and SQL statement. At this point, this process ends.
[0095] Step S324: confirm that the page data to be verified is complete. At this point, this process ends.
[0096] Therefore, the data processing method of the present invention implements page-level integrity verification by performing page integrity verification on all pages to be verified after the transaction is submitted, thereby reducing verification costs to improve performance. At the same time, the data processing method of the present invention also realizes the accuracy of P_hash acquisition by reading the P_hash corresponding to the page recorded in the preset global block table when the page integrity verification is successful, and verifies whether the data in the page header of the page to be verified has been tampered with according to the read P_hash. If it has not been tampered with, it is confirmed that the data of the page to be verified is complete, and verification based on the correct verification value is realized, avoiding the problem that the correctness of all P_hashes in the page header of the page cannot be guaranteed when encountering illegal intrusion so that the physical file is directly modified, thereby greatly improving the accuracy of page-level verification, and further improving the security of user data.
[0097] Furthermore, the data processing method of the present invention locates the tampered page according to the global block table when the data in the page header of the page to be verified is tampered with, obtains the user information and SQL statement corresponding to the tampered page, and recovers the data of the tampered page according to the user information and SQL statement, thereby avoiding the problem of being unable to recover the tampered data due to lack of records of the tampered data, improving the recoverability of the data, and further ensuring the security of the data.
[0098] Furthermore, the data processing method of the present invention compares the global_hash recorded in the global block table with the global_hash recalculated according to the data in the data area of the page by adding a block hash verification step, thereby ensuring the integrity of the data link. At the same time, the data processing method of the present invention also verifies the block check value and obtains the page corresponding to the global_hash that is inconsistent with the comparison result as the tampered page, thereby achieving accurate positioning of the problem page, further ensuring the accuracy of subsequent data recovery operations, and further improving the overall performance of the database.
[0099] The invention also provides a machine-readable storage medium and a computer device. Figure 4 is a schematic diagram of the structure of a machine-readable storage medium 10 according to an embodiment of the present invention, Figure 5 is a schematic diagram of the structure of a computer device 20 according to an embodiment of the present invention.
[0100] The machine-readable storage medium 10 stores a machine-executable program 11 , and when the machine-executable program 11 is executed by a processor, the data processing method of any of the above embodiments is implemented.
[0101] The computer device 20 may include a memory 220, a processor 210, and a machine executable program 11 stored in the memory 220 and running on the processor 210, and the processor 210 implements the data processing method of any of the above embodiments when executing the machine executable program 11.
[0102] It should be noted that the logic and / or steps represented in the flowchart or described in other ways herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be specifically implemented in any machine-readable storage medium for use by an instruction execution system, device or equipment (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or equipment and execute instructions), or used in combination with these instruction execution systems, devices or equipment.
[0103] For the purposes of the description of this embodiment, the machine-readable storage medium 10 may be any device that can contain, store, communicate, propagate or transmit a program for use with an instruction execution system, device or apparatus or in conjunction with such instruction execution systems, devices or apparatuses. More specific examples (a non-exhaustive list) of the machine-readable storage medium 10 include the following: an electrical connection portion (electronic device) having one or more wirings, a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and editable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disk read-only memory (CDROM). In addition, the machine-readable storage medium 10 may even be paper or other suitable medium on which the program may be printed, because the program may be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or processing in other suitable ways as necessary, and then stored in a computer memory.
[0104] It should be understood that each part of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system.
[0105] The computer device 20 may be, for example, a server, a desktop computer, a notebook computer, a tablet computer, or a smart phone. In some examples, the computer device 20 may be a cloud computing node. The computer device 20 may be described in the general context of computer system executable instructions (such as program modules) executed by a computer system. Typically, a program module may include routines, programs, target programs, components, logic, data structures, etc. that perform specific tasks or implement specific abstract data types. The computer device 20 may be implemented in a distributed cloud computing environment where remote processing devices linked through a communication network perform tasks. In a distributed cloud computing environment, program modules may be located on a local or remote computing system storage medium including a storage device.
[0106] The computer device 20 may include a processor 210 adapted to execute stored instructions, and a memory 220 providing temporary storage space for the operation of the instructions during operation. The processor 210 may be a single-core processor, a multi-core processor, a computing cluster, or any number of other configurations. The memory 220 may include a random access memory (RAM), a read-only memory, a flash memory, or any other suitable storage system.
[0107] The flow chart provided by the present embodiment is not intended to indicate that the operation of the method will be performed in any particular order, or that all operations of the method are included in all every case. In addition, the method may include additional operations. Within the scope of the technical thinking provided by the present embodiment method, additional changes may be made to the above method.
[0108] At this point, those skilled in the art should recognize that, although multiple exemplary embodiments of the present invention have been shown and described in detail herein, many other variations or modifications that conform to the principles of the present invention can still be directly determined or derived based on the content disclosed in the present invention without departing from the spirit and scope of the present invention. Therefore, the scope of the present invention should be understood and recognized as covering all these other variations or modifications.
Claims
1. A data processing method, comprising: After the transaction is committed, all data pages to be verified are checked for page integrity; In the case where the page integrity check succeeds, reading data in a preset global block table, wherein the preset global block table is used to record a page check value corresponding to each of the data pages; Verifying, based on the page verification value read, whether the data in the page header of the data page to be verified has been tampered with; If it has not been tampered with, it is confirmed that the data of the data page to be verified is complete.
2. The data processing method according to claim 1, wherein: The global block table is pre-created and stored in a database, and each row of data in the global block table includes a transaction number corresponding to one of the data pages, a page check value, execution information, and a global block check value.
3. The data processing method according to claim 2, wherein: After the step of verifying whether the data in the page header of the data page to be verified has been tampered with, the data processing method further includes: In the case where data in the page header of the data page to be verified is tampered with, locating the tampered data page according to the global block table, and acquiring the execution information corresponding to the tampered data page; Data recovery is performed on the tampered data page according to the execution information.
4. The data processing method according to claim 3, wherein: The global block checksum is obtained by the following steps: Calculate a hash value of the page check value in the first row of data of the global block table and the data obtained by splicing the execution information as the global block check value in the first row of data; and / or A hash value of data obtained by concatenating the page check value in the non-first row of data of the global block table, the execution information, and the global block check value in the previous row of data is calculated as the global block check value in the non-first row of data.
5. The data processing method according to claim 3, wherein: The step of locating the tampered data page according to the global block table comprises: Recalculating a global block checksum of the data page according to the data in the data area of the data page; Reading the global block check value in the global block table; Comparing the recalculated global block check value with the read global block check value; A data page corresponding to the global block check value that is inconsistent with the comparison result is obtained as the tampered data page.
6. The data processing method according to claim 1, wherein: Each of the data pages comprises the page header and a data area, wherein the data area is used to store at least part of the data modified by the transaction; and The step of verifying whether the data in the page header of the data page to be verified has been tampered with according to the read page verification value comprises: Calculate the hash value of all data in the data area of the data page to be verified to obtain a calculation result; Determining whether the page check value read is consistent with the calculation result; If they are consistent, it is confirmed that the data in the page header of the data page to be verified has not been tampered with; If they are inconsistent, it is confirmed that the data in the page header of the data page to be verified has been tampered with.
7. The data processing method according to claim 1, wherein: Before the transaction is submitted, the data processing method further includes: Calculate the hash value of all data in the data area of the data page modified by the transaction as the page check value; The page check value is recorded in the global block table and in the page header of the corresponding data page.
8. The data processing method according to claim 7, wherein: After the transaction is committed, the steps for performing page integrity verification on all data pages to be verified include: After the transaction is committed, the data page modified by the transaction is obtained as the data page to be verified; Obtaining the page verification value recorded in the page header of the data page to be verified; Recalculate the hash value of all data in the data area of the data page to be verified; Determine whether the recalculated hash value is the same as the acquired page check value; If they are the same, it is confirmed that the page integrity check of the data page to be checked is successful; If they are not the same, it is confirmed that the page integrity check of the data page to be checked is unsuccessful.
9. A machine-readable storage medium having a machine-executable program stored thereon, wherein the machine-executable program, when executed by a processor, implements the data processing method according to any one of claims 1 to 8.
10. A computer device comprising a memory, a processor, and a machine executable program stored in the memory and running on the processor, wherein the processor implements the data processing method according to any one of claims 1 to 8 when executing the machine executable program.