Database data processing method, storage medium and equipment
By setting encryption tags in the database and decrypting only the pages that need to be decrypted, the problem of high resource consumption in the database when converting encrypted objects is solved, improving database performance and the accuracy of encrypted pages.
Patent Information
- Application Number
- CN202410822312.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-24
- Publication Date
- 2024-10-15
AI Technical Summary
When existing databases convert encrypted objects into non-encrypted objects, the amount of decrypted data is large and resources are consumed, resulting in a large impact on performance.
Set an encryption tag on each page of the database, use the encryption tag to determine whether the page is encrypted, and only decrypt the pages that need to be decrypted to avoid full decryption.
Reduce the number of decryptions, improve database performance, improve the accuracy of encrypted pages in encrypted objects and the convenience of determining whether a page is encrypted.
Smart Images

Figure CN118779897A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to database technology, and in particular to a database data processing method, storage medium and device. Background Art
[0002] With the development of computer security, more and more databases use page-level transparent storage encryption when storing. Database pages are encrypted when writing from memory to disk and decrypted when reading from disk to memory. When database objects do not need to be encrypted, the encrypted pages need to be converted to non-encrypted pages. Currently, when an encrypted object in a database is converted to a non-encrypted object, all data of the entire encrypted object containing multiple pages will be decrypted to convert the decrypted encrypted object into a non-encrypted object.
[0003] However, when the encrypted object is very large, decrypting a large amount of data consumes too many resources. In addition, decrypting a large amount of data immediately also has a great impact on the hard disk IO. Therefore, when the database currently processes transactions that convert encrypted objects into non-encrypted objects, there are problems such as large amounts of decrypted data, high resource consumption, and a great impact on the overall performance of the database. Summary of the invention
[0004] In view of the above problems, a method for processing database data, a storage medium and a device are proposed to overcome the above problems or at least partially solve the above problems.
[0005] An object of the present invention is to provide a method for processing database data, which can reduce the number of decryptions and thus improve database performance.
[0006] A further object of the present invention is to improve the accuracy of obtaining encrypted pages in an encrypted object.
[0007] Another further object of the present invention is to improve the convenience of determining whether a page is encrypted.
[0008] In particular, the present invention provides a method for processing data in a database, comprising:
[0009] An encryption flag is set on each page of the database to record whether the page is encrypted;
[0010] Perform at least one conversion operation to convert an encrypted object in the database into a non-encrypted object, each conversion operation further comprising:
[0011] Acquire an encrypted page in an encrypted object according to the encryption tag, wherein the encrypted object includes a plurality of pages;
[0012] Get the encryption key of the database and decrypt the encrypted pages.
[0013] Optionally, the encryption mark has two recording modes for indicating that the page is in an encrypted state and that the page is in a non-encrypted state respectively; and
[0014] Obtaining the encrypted pages in the encrypted object based on the encryption tag includes:
[0015] Obtain the pages in the encrypted object and the encryption tags in the pages one by one;
[0016] Determine whether the state of the acquired page is an encrypted state according to the recording method of the encryption mark;
[0017] If so, it is determined that the acquired page is an encrypted page.
[0018] Optionally, the two recording modes include an encryption mark being recorded as true and an encryption mark being recorded as false, wherein the encryption mark being recorded as true indicates that the page is in an encrypted state, and the encryption mark being recorded as false indicates that the page is in a non-encrypted state; and
[0019] Judging whether the state of the acquired page is encrypted according to the recording method of the encryption mark includes:
[0020] Determine whether the encryption flag is recorded as true;
[0021] If it is recorded as true, it is determined that the state of the obtained page is encrypted;
[0022] If it is not recorded as true, it is determined that the state of the acquired page is not an encrypted state.
[0023] Optionally, the page includes a page header and at least one area for storing user data; and
[0024] The encrypted token is stored in the page header.
[0025] Optionally, after the step of obtaining the encryption key of the database and performing a decryption operation on the encrypted page, the conversion operation further includes:
[0026] When a database page is written from memory to hard disk, it is determined whether the page to be written is a decrypted page based on the encryption mark;
[0027] If it is a decrypted page, the state of the page to be written out is changed to a non-encrypted state;
[0028] If it is not a decrypted page, skip the state modification operation on the page to be written.
[0029] Optionally, after the step of setting an encryption mark for recording whether the page is encrypted on each page of the database, the database data processing method further includes:
[0030] Setting a preset storage location for storing the encryption key of the database on each page of the database;
[0031] When the encryption mark record page is in an encrypted state, writing the encryption key into a preset storage location;
[0032] When the encryption mark records that the page is in a non-encrypted state, the encryption key writing operation is skipped.
[0033] Optionally, modifying the state of the page to be written out to a non-encrypted state includes:
[0034] The encryption mark in the page to be written out is modified to record that the page is not encrypted, and the encryption key in the preset storage location in the page to be written out is cleared.
[0035] Optionally, the preset storage location is located at the end of the page; and
[0036] The steps to obtain the encryption key of the database and decrypt the encrypted page include:
[0037] Get the encryption key at the end of the page;
[0038] Decrypt the encrypted page according to the encryption key.
[0039] According to another aspect of the present invention, there is further provided a machine-readable storage medium on which a machine executable program is stored. When the machine executable program is executed by a processor, any of the above-mentioned database data processing methods is implemented.
[0040] 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-mentioned database data processing methods when executing the machine executable program.
[0041] The data processing method of the database of the present invention realizes a clear distinction of the encryption status of the page by setting an encryption mark for recording whether the page is encrypted on each page of the database. In addition, the data processing method of the database of the present invention realizes the conversion operation of converting the encrypted object in the database into a non-encrypted object by obtaining the encrypted page in the encryption object according to the encryption mark, obtaining the encryption key of the database, and performing a decryption operation on the encrypted page, thereby realizing the gradual decryption of the pages in the encrypted object, avoiding the problem of a large amount of decrypted data and high resource consumption caused by decrypting all data of the entire encrypted object, and reducing the number of decryptions. The data processing method of the database of the present invention identifies the pages that need to be decrypted in advance during the execution of the conversion operation, and realizes that only the pages that need to be decrypted in the encrypted object can be decrypted in a targeted manner, avoiding other invalid decryption operations, reducing the waste of resources and performance loss of the database, and effectively improving the overall performance of the database.
[0042] Furthermore, in the data processing method of the database of the present invention, the encryption mark has two recording modes for indicating that the page is in an encrypted state and the page is in a non-encrypted state, respectively, so that the encryption state of the page can be effectively distinguished by using the encryption mark. In addition, the data processing method of the database of the present invention obtains the pages in the encryption object and the encryption marks in the pages one by one, determines whether the state of the obtained page is an encrypted state according to the recording mode of the encryption mark, and determines that the obtained page is an encrypted page when the state of the obtained page is an encrypted state, thereby obtaining the encrypted page in the encryption object, improving the accuracy of obtaining the encrypted page in the encryption object, avoiding invalid decryption operations, and thus ensuring the execution accuracy and efficiency of the conversion operation.
[0043] Furthermore, in the data processing method of the database of the present invention, the page includes a page header and at least one area for storing user data, and the encryption mark is stored in the page header. Since the page header of the page in the database does not contain user data, encryption is not required in the encryption operation of the write process, and the encryption mark is stored in plain text for the encrypted page. Therefore, in the data processing method of the database of the present invention, in the process of executing the conversion operation of converting the encrypted object in the database into the non-encrypted object, the encryption mark in the page header can be directly obtained without secondary processing, and it is more convenient and quick to judge whether the page is encrypted according to the encryption mark, which effectively improves the judgment speed, thereby improving the convenience of judging whether the page is encrypted, and further improving the overall performance of the database.
[0044] 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
[0045] 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:
[0046] Figure 1 is a flowchart of a method for processing data in a database according to an embodiment of the present invention;
[0047] Figure 2 is a flow chart of a method for executing a conversion operation in a method for processing database data according to an embodiment of the present invention;
[0048] Figure 3 is a schematic diagram of the structure of a page in a method for processing database data according to an embodiment of the present invention;
[0049] Figure 4 is a flowchart of a method for processing data in a database according to another embodiment of the present invention;
[0050] Figure 5 is a flowchart of a method for processing data in a database according to yet another embodiment of the present invention;
[0051] Figure 6 is a schematic diagram of the structure of a machine-readable storage medium according to an embodiment of the present invention; and
[0052] Figure 7 is a schematic diagram of the structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0053] 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.
[0054] In order to solve the above technical problems, an embodiment of the present invention proposes a data processing method for a database. Figure 1 It is a flowchart of a method for processing database data according to an embodiment of the present invention. Figure 2 FIG. 1 is a flow chart of a method for executing a conversion operation in a method for processing database data according to an embodiment of the present invention. Figure 1 As shown, the data processing method of the database of the present invention may generally include:
[0055] Step S102, setting an encryption mark on each page of the database to record whether the page is encrypted;
[0056] Step S104, executing at least one conversion operation of converting the encrypted object in the database into a non-encrypted object.
[0057] In this embodiment, the database adopts page-level transparent storage encryption when storing. That is, data is encrypted and decrypted in units of pages. In the above step S102, the page structure of the database is modified, and an encryption mark is added to the page of the database to record whether the page is encrypted, so as to judge whether the page is encrypted later.
[0058] In the above step S104, when a conversion instruction for converting an encrypted object into a non-encrypted object is received, a conversion operation for converting the encrypted object in the database into a non-encrypted object is performed according to the conversion instruction. In this embodiment, the execution method of the conversion operation in the above step S204 is as follows: Figure 2 As shown, each conversion operation may further include the following steps:
[0059] Step S202: Obtain an encrypted page in the encryption object according to the encryption tag, wherein the encryption object includes a plurality of pages. It should be noted that the plurality of pages in the encryption object may include an encrypted page and a non-encrypted page.
[0060] Step S204, obtain the encryption key of the database, and perform a decryption operation on the encrypted page. It should be noted that the encryption key can be pre-stored in the database.
[0061] That is to say, in the data processing method of the database in the embodiment of the present invention, in the process of executing the conversion operation of converting the encrypted object in the database into the non-encrypted object, not all the pages in the encrypted object are decrypted at one time, but when some pages are used, the used parts of the pages are decrypted, and the unused pages are kept in the encrypted state and wait for the next use to perform the decryption operation.
[0062] After the above step S204, that is, after the decryption operation of an encrypted page is completed, each conversion operation in the database data processing method of the embodiment of the present invention may further include the following steps: determining whether all pages of the encrypted object have been obtained; if not, returning to step S202 to obtain the next encrypted page; if so, determining that the decryption operation of all encrypted pages in the encrypted object has been completed. At this point, the page reading and decryption process in each conversion operation is completed.
[0063] The data processing method of the database of the embodiment of the present invention realizes a clear distinction of the encryption status of the page by setting an encryption mark for recording whether the page is encrypted on each page of the database. In addition, the data processing method of the database of the embodiment of the present invention realizes the conversion operation of converting the encrypted object in the database into a non-encrypted object by obtaining the encrypted page in the encryption object according to the encryption mark, obtaining the encryption key of the database, and performing a decryption operation on the encrypted page, thereby realizing the gradual decryption of the pages in the encrypted object, avoiding the problem of large amount of decrypted data and high resource consumption caused by decrypting all data of the entire encrypted object, and reducing the number of decryptions. The data processing method of the database of the embodiment of the present invention identifies the pages that need to be decrypted in advance during the execution of the conversion operation, and realizes that only the pages that need to be decrypted in the encryption object can be decrypted in a targeted manner, avoiding other invalid decryption operations, reducing the waste of resources and performance loss of the database, and effectively improving the overall performance of the database.
[0064] In one embodiment, the encryption mark in the above step S202 has two recording modes for indicating that the page is in an encrypted state and the page is in a non-encrypted state. Based on this, the step of obtaining the encrypted page in the encryption object according to the encryption mark in the above step S102 may include the following steps: obtaining the pages in the encryption object and the encryption mark in the page one by one; judging whether the state of the obtained page is an encrypted state according to the recording mode of the encryption mark; if so, determining that the obtained page is an encrypted page.
[0065] In the data processing method of the database of the embodiment of the present invention, the encryption mark has two recording modes for indicating that the page is in an encrypted state and the page is in a non-encrypted state, respectively, so that the encryption state of the page can be effectively distinguished by using the encryption mark. In addition, the data processing method of the database of the embodiment of the present invention obtains the pages in the encryption object and the encryption marks in the pages one by one, determines whether the state of the obtained page is an encrypted state according to the recording mode of the encryption mark, and determines that the obtained page is an encrypted page when the state of the obtained page is an encrypted state, thereby obtaining the encrypted page in the encryption object, improving the accuracy of obtaining the encrypted page in the encryption object, avoiding invalid decryption operations, and thus ensuring the execution accuracy and efficiency of the conversion operation.
[0066] In one embodiment, after the above-mentioned step of determining whether the status of the acquired page is an encrypted state according to the recording method of the encryption mark, the data processing method of the database of the present invention may further include the following steps: when the status of the acquired page is not an encrypted state, determining that the acquired page is a non-encrypted page, at this time, skipping the decryption operation on the acquired page.
[0067] The data processing method of the database in the embodiment of the present invention, when it is determined that the acquired page is a non-encrypted page according to the recording method of the encryption mark, determines that the acquired page does not need to be decrypted, and thus skips the decryption operation. This makes it possible to skip the decryption operation for the page that does not need to be decrypted, effectively ensuring that the number of decryption times is reduced, thereby reducing the waste of database resources and performance loss.
[0068] In order to more clearly illustrate the location of the encrypted mark in this embodiment, the following Figure 3 , further explains the structure of the pages in the database.
[0069] Figure 3 FIG. 1 is a schematic diagram of the structure of a page in a method for processing database data according to an embodiment of the present invention. Figure 3 As shown, in this embodiment, page 1 includes a page header and at least one area for storing user data.
[0070] In the prior art, the page header of the database includes Pagetype. Pagetype refers to the page type, which is used to record the category, layout, template type, format and other descriptive text information of a page. Figure 3 As shown, in the database, Pagetype is stored as a character type (such as Char or VARCHAR) field.
[0071] The data processing method of the database of the embodiment of the present invention modifies the structure of the page 1 of the database and adds a record in the page 1 of the database: Pageisecnrypted. Pageisecnrypted is the encryption mark mentioned above in the present invention, which is used to indicate whether the page content or page data has been encrypted during the transmission process to protect information security. Figure 3 As shown, in the database, Pageisecnrypted is stored as a Boolean (Bool or BIT) field.
[0072] In addition, since the area for storing user data stores user data, the data in the area for storing user data can be encrypted when page 1 needs to be encrypted. Since the page header does not contain user data, when the encryption operation is performed on page 1, the data in the page header does not need to be encrypted, so that the data in the page header can be directly obtained in the subsequent process.
[0073] In one embodiment, Pageisecnrypted has two recording modes, which are used to indicate that page 1 is in an encrypted state and page 1 is in an unencrypted state. The two recording modes include Pageisecnrypted being recorded as true and Pageisecnrypted being recorded as false. Pageisecnrypted being recorded as true indicates that page 1 is in an encrypted state, and Pageisecnrypted being recorded as false indicates that page 1 is in an unencrypted state. Based on this, the above-mentioned step of judging whether the state of page 1 obtained is in an encrypted state according to the recording mode of the encryption mark may include the following steps: judging whether Pageisecnrypted is recorded as true; if it is recorded as true, determining that the state of page 1 obtained is in an encrypted state; if it is not recorded as true, determining that the state of page 1 obtained is not in an encrypted state.
[0074] The data processing method of the database of the embodiment of the present invention determines whether the state of the acquired page 1 is an encrypted state according to the recording method of the encryption mark, thereby realizing a quick judgment on the encryption state of page 1 in the encryption object, improving the convenience of obtaining the encrypted pages in the encryption object, and further improving the execution efficiency of the conversion operation.
[0075] In some embodiments, the encryption mark of the database can also be set to different values when the encryption state of page 1 is changed. For example, the encryption mark is recorded as 1 to indicate that page 1 is in an encrypted state, and the encryption mark is recorded as 0 to indicate that page 1 is in a non-encrypted state.
[0076] In addition, the encryption mark of the database can also be stored in the space of the last preset length in the page header, and the preset length can be one byte. Therefore, the data processing method of the database of the embodiment of the present invention can obtain the encryption mark by reading the data in the last byte of the page header. For example, the encryption mark is recorded as 1 to indicate that page 1 is in an encrypted state, and the encryption mark is recorded as 0 to indicate that page 1 is in a non-encrypted state. Based on this, the above-mentioned step of judging whether the state of the acquired page 1 is an encrypted state according to the recording method of the encryption mark can include the following steps: reading the data in the last byte of the page header; judging whether the read data is 1; if it is 1, determining that the state of the acquired page 1 is an encrypted state; if it is not 1, determining that the state of the acquired page 1 is not an encrypted state.
[0077] In some embodiments, Figure 3 As shown, the encryption mark is stored in the page header. Since the page header of page 1 in the database does not contain user data, it does not need to be encrypted in the encryption operation of the write process, and the encryption mark is stored in plain text for the encrypted page.
[0078] Therefore, in the data processing method of the database of the embodiment of the present invention, in the process of executing the conversion operation of converting the encrypted object in the database into the non-encrypted object, the encryption mark in the page header can be directly obtained without secondary processing, thereby realizing a more convenient and quick judgment of whether the page is encrypted according to the encryption mark, effectively improving the judgment speed, thereby improving the convenience of judging whether the page is encrypted, and further improving the overall performance of the database.
[0079] In some embodiments, Figure 3 As shown, each page 1 of the database is also provided with a preset storage location 100 for storing the encryption key of the database. Based on this, after the above step S102, the data processing method of the database of the present invention may further include the following steps: setting a preset storage location 100 for storing the encryption key of the database on each page 1 of the database; when the encryption mark record page 1 is in an encrypted state, writing the encryption key in the preset storage location 100; when the encryption mark record page 1 is in a non-encrypted state, skipping the writing operation of the encryption key.
[0080] The data processing method of the database in the embodiment of the present invention, by setting a preset storage location 100 for storing the encryption key of the database on each page 1 of the database, facilitates the rapid acquisition of the encryption key in the subsequent process, improves the convenience of obtaining the encryption key, and thus further improves the execution efficiency of the conversion operation.
[0081] Specifically, the preset storage location 100 may be located at the end of page 1. Based on this, the above step S204 may include the following steps: obtaining an encryption key at the end of page 1; and performing a decryption operation on the encrypted page 1 according to the encryption key.
[0082] In a specific embodiment, the data processing method of the database of the embodiment of the present invention adds a record Pageisecnrypted to the page header of page 1, and adds a preset storage location 100 for storing the encryption key (keydata) at the end of page 1. In the page writing process, if page 1 needs to be encrypted, Pageisecnrypted is recorded as true, and key data is recorded at the end of page 1; if page 1 does not need to be encrypted, Pageisecnrypted is recorded as false, and key data is not saved at the end of page 1.
[0083] In the database data processing method of the embodiment of the present invention, since the preset storage location 100 does not store user data, encryption is not required in the encryption operation, and the encryption key of the database is stored in plain text for the encrypted database. Therefore, in the database reading process, the plain text of the encryption key can be directly read from the end of page 1 without secondary processing, which effectively improves the decryption speed, thereby further improving the overall performance of the database.
[0084] In some embodiments, the encryption key of the database may also be stored in other locations of the database, such as in a preset key file, so as to facilitate accurate acquisition of the encryption key in subsequent processes.
[0085] In some embodiments, after the above step S204, each conversion operation in the data processing method of the database of the present invention may also include a process of writing a page from the memory to the hard disk and modifying the page status. Specifically, the process of writing a page from the memory to the hard disk and modifying the page status may include the following steps: when the page of the database is written from the memory to the hard disk, judging whether the page to be written is a decrypted page according to the encryption mark; if it is a decrypted page, modifying the status of the page to be written to a non-encrypted state; if it is not a decrypted page, skipping the state modification operation of the page to be written.
[0086] That is, after the page reading and decryption process in each conversion operation is completed, a page is written from memory to hard disk and the page status is modified until the status of all decrypted pages in the encrypted object is modified to the unencrypted state. At this point, a conversion operation is completed.
[0087] Specifically, the above step of modifying the state of the page to be written to a non-encrypted state may include the following steps: modifying the encryption mark in the page to be written to record that the page is non-encrypted, and clearing the encryption key in the preset storage location 100 in the page to be written.
[0088] That is, when a page is written from memory to hard disk, for the decrypted page, the encryption state of the page and the key information at the end of the page are cleared to change the state of the page to a non-encrypted state; for the unencrypted page, its non-encrypted state is maintained.
[0089] The data processing method of the database in the embodiment of the present invention adopts a method of gradual decryption and gradual modification of the encryption state when converting the encrypted objects stored at the page level in the database into non-encrypted objects, thereby achieving stable operation of the conversion operation, avoiding the impact of one-time large-scale decryption on the database performance, and improving the stability of the database performance.
[0090] In a specific embodiment, the data processing method of the database of the present invention may specifically include the following steps:
[0091] 1. Modify the page structure of the database and add records to the database page: Pageisecnrypted and Keydata. Specifically, Pageisecnrypted is stored in the page header. Key data is stored at the end of the page. When Pageisecnrypted is true, key data is added to the end of the page. When Pageisecnrypted is false, key data is not saved at the end of the page.
[0092] 2. When receiving the conversion instruction indicating that the encrypted object is converted from encrypted to non-encrypted, the conversion is no longer performed by decrypting all pages in the encrypted object at once. Instead, when some pages are used, only the used pages are decrypted, and the unused pages are kept encrypted and decrypted when they are used next time. The specific steps include:
[0093] a) When reading a page, there are both encrypted pages and non-encrypted pages on the disk. The page header's Pageisecnrypted is used to determine whether it is an encrypted page. If it is an encrypted page, the encryption key is read and decryption is performed based on the encryption key. If it is not an encrypted page, the encryption operation is skipped and the page is read directly.
[0094] b) When a page is written from memory to hard disk, for an encrypted page, the encryption status at the page header and the key information at the page tail are cleared to change the page status to a non-encrypted status, and for a non-encrypted page, the non-encrypted status is maintained.
[0095] The data processing method of the database in the embodiment of the present invention adds encryption marks and encryption keys to the pages of the database, so that when the pages are converted into non-encrypted pages, they do not need to be completed all at once, but can be decrypted step by step, thereby reducing the impact of one-time large-scale decryption on database performance. At the same time, gradual decryption also reduces the impact on disk IO.
[0096] Figure 4 FIG. 1 is a flow chart of a method for processing data in a database according to another embodiment of the present invention. Figure 4 The process steps of page decryption in the database data processing method of this embodiment are described in detail.
[0097] Step S402, read the page in the encrypted object and the Pageisecnrypted in the page. It should be noted that Pageisecnrypted is an encryption mark used to record whether the page is encrypted. The page may include a page header and at least one area for storing user data, and the Pageisecnrypted in the page may be stored in the page header.
[0098] Step S404, determine whether Pageisecnrypted is true, if so, proceed to step S406, if not, proceed to step S408. It should be noted that if Pageisecnrypted is recorded as true, it means that the page is encrypted, and if Pageisecnrypted is recorded as false, it means that the page is not encrypted.
[0099] Step S406, read Key data, and perform a decryption operation on the encrypted page. It should be noted that Key data is the encryption key of the database. Key data can be at the end of the storage page. At this point, the decryption operation on the encrypted page is completed, and this process ends.
[0100] Step S408: skip the decryption operation and the process ends.
[0101] The data processing method of the database of the embodiment of the present invention realizes accurate distinction of the encryption status of the page by using the encryption mark set for each page of the database. In addition, the data processing method of the database of the embodiment of the present invention realizes the conversion operation of converting the encrypted object in the database into the non-encrypted object by obtaining the encrypted page in the encrypted object according to the encryption mark, obtaining the encryption key of the database, and performing the decryption operation on the encrypted page, thereby realizing the gradual decryption of the pages in the encrypted object, avoiding the problem of large amount of decrypted data and high resource consumption caused by decrypting all data of the entire encrypted object, and reducing the number of decryptions.
[0102] The data processing method of the database in the embodiment of the present invention identifies the pages that need to be decrypted in advance during the execution of the conversion operation, so that only the pages that need to be decrypted in the encrypted object can be decrypted in a targeted manner, avoiding other invalid decryption operations, reducing the waste of database resources and performance loss, and effectively improving the overall performance of the database.
[0103] Figure 5 FIG. 1 is a flow chart of a method for processing data in a database according to another embodiment of the present invention. Figure 5 The process steps of writing pages from the memory to the hard disk in the database data processing method of this embodiment are specifically described.
[0104] Step S502, read the page to be written out in the encrypted object and the Pageisecnrypted in the page. It should be noted that the page to be written out can be an encrypted page or a non-encrypted page that has not been decrypted.
[0105] Step S504, determine whether Pageisecnrypted is true, if so, proceed to step S506, if not, proceed to step S508. It should be noted that Pageisecnrypted is an encryption mark used to record whether the page is encrypted. Specifically, if Pageisecnrypted is recorded as true, it means that the page is encrypted, and if Pageisecnrypted is recorded as false, it means that the page is not encrypted.
[0106] Step S506, modify Pageisecnrypted to false, and clear Key data. It should be noted that Key data is the encryption key of the database. Key data can be stored at the end of the page. In addition, in the page writing process, if the page needs to be encrypted, Pageisecnrypted is recorded as true, and key data is recorded at the end of the page; if the page does not need to be encrypted, Pageisecnrypted is recorded as false, and key data is not saved at the end of the page. At this point, the operation of modifying the page status of the decrypted page is completed, and this process ends.
[0107] Step S508: skip the page status modification operation and the process ends.
[0108] The data processing method of the database in the embodiment of the present invention adopts a method of gradually modifying the encryption state when converting the encrypted objects stored at the page level in the database into non-encrypted objects, thereby achieving stable operation of the conversion operation, avoiding the impact of one-time large-scale decryption on the database performance, and improving the stability of the database performance.
[0109] This embodiment also provides a machine-readable storage medium and a computer device. Figure 6 is a schematic diagram of the structure of a machine-readable storage medium 10 according to an embodiment of the present invention, Figure 7 is a schematic diagram of the structure of a computer device 20 according to an embodiment of the present invention.
[0110] 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.
[0111] 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.
[0112] 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.
[0113] For the description of this embodiment, the machine-readable storage medium 10 can be any device that can contain, store, communicate, propagate or transmit a program for use with an instruction execution system, device or equipment or in conjunction with these instruction execution systems, devices or equipment. More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection portion with one or more wirings (electronic device), a portable computer disk box (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 can even be paper or other suitable media on which the program can be printed, because the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting or processing in other suitable ways as necessary, and then stored in a computer memory.
[0114] 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.
[0115] 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.
[0116] 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.
[0117] The processor 210 may be connected to an I / O interface (input / output interface) suitable for connecting the computer device 20 to one or more I / O devices (input / output devices) through a system interconnect (e.g., PCI, PCI-Express, etc.). The I / O devices may include, for example, a keyboard and a pointing device, wherein the pointing device may include a touch pad or a touch screen, etc. The I / O devices may be built-in components of the computer device 20, or may be devices externally connected to the computing device.
[0118] The processor 210 may also be linked to a display interface suitable for connecting the computer device 20 to a display device through a system interconnect. The display device may include a display screen as a built-in component of the computer device 20. The display device may also include a computer monitor, a television, or a projector, etc., which are externally connected to the computer device 20. In addition, a network interface controller (NIC) may be suitable for connecting the computer device 20 to a network through a system interconnect. In some embodiments, the NIC may use any suitable interface or protocol (such as an Internet small computer system interface, etc.) to transmit data. The network may be a cellular network, a radio network, a wide area network (WAN), a local area network (LAN), or the Internet, etc. A remote device may be connected to the computing device through a network.
[0119] 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.
[0120] 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 method for processing data in a database, comprising: An encryption flag is set on each page of the database to record whether the page is encrypted; Performing at least one conversion operation of converting the encrypted object in the database into a non-encrypted object, each conversion operation further comprising: Acquire an encrypted page in the encryption object according to the encryption tag, wherein the encryption object includes a plurality of the pages; The encryption key of the database is obtained, and a decryption operation is performed on the encrypted page.
2. The method for processing database data according to claim 1, wherein: The encryption mark has two recording modes for indicating that the page is in an encrypted state and the page is in a non-encrypted state respectively; and Acquiring the encrypted page in the encryption object according to the encryption tag includes: Acquire pages in the encrypted object and encryption marks in the pages one by one; Determining whether the state of the acquired page is an encrypted state according to the recording method of the encryption mark; If so, it is determined that the acquired page is an encrypted page.
3. The method for processing database data according to claim 2, wherein: The two recording modes include the encryption mark being recorded as true and the encryption mark being recorded as false, wherein the encryption mark being recorded as true indicates that the page is in an encrypted state, and the encryption mark being recorded as false indicates that the page is in a non-encrypted state; and Judging whether the state of the acquired page is an encrypted state according to the recording method of the encryption mark includes: Determining whether the encryption mark is recorded as true; If it is recorded as true, determining that the state of the acquired page is an encrypted state; If it is not recorded as true, it is determined that the state of the acquired page is not an encrypted state.
4. The method for processing database data according to claim 1, wherein: The page includes a page header and at least one area for storing user data; and The encryption tag is stored in the page header.
5. The method for processing database data according to claim 1, wherein: After the step of obtaining the encryption key of the database and performing a decryption operation on the encrypted page, the conversion operation further includes: When a page of the database is written from the memory to the hard disk, judging whether the page to be written is a decrypted page according to the encryption mark; If it is a decrypted page, modify the state of the page to be written to a non-encrypted state; If it is not a decrypted page, the state modification operation on the page to be written out is skipped.
6. The method for processing database data according to claim 5, wherein: After the step of setting an encryption mark for recording whether the page is encrypted on each page of the database, the database data processing method further includes: Setting a preset storage location for storing an encryption key of the database on each page of the database; When the encryption mark records that the page is in an encrypted state, writing the encryption key into the preset storage location; In the case where the encryption mark records that the page is in a non-encrypted state, the writing operation of the encryption key is skipped.
7. The method for processing database data according to claim 6, wherein: Changing the state of the page to be written out to a non-encrypted state includes: The encryption mark in the page to be written out is modified to record that the page is not encrypted, and the encryption key in the preset storage location in the page to be written out is cleared.
8. The method for processing database data according to claim 6, wherein: The preset storage location is located at the end of the page; and The steps of obtaining the encryption key of the database and performing a decryption operation on the encrypted page include: Obtaining the encryption key at the end of the page; The encrypted page is decrypted according to the encryption key.
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 database 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 database data processing method according to any one of claims 1 to 8 when executing the machine executable program.
