Data updating method and device and server
By using binary and multi-level encoding to record historical changes of modified fields in a large-scale database, combined with storage cycle management and compressed storage technology, the problem of soaring storage resource consumption and performance degradation caused by traditional log recording methods is solved, achieving efficient data storage and retrieval.
Patent Information
- Application Number
- CN202510890140.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-30
- Publication Date
- 2025-10-17
AI Technical Summary
Traditional logging methods generate a large amount of redundant data in large-scale databases, resulting in a surge in storage resource usage and degraded system performance.
The system records historical changes to modified fields using binary and multi-level encoding. By setting rules and change cycles to map change types to codes, and appending or updating codes to log data, combined with storage cycle management and compression storage technology, the amount of log data is reduced.
It effectively reduces data storage volume, saves storage costs, avoids performance degradation, and improves query efficiency and system response speed.
Smart Images

Figure CN120804116A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data storage, and more particularly, to a data updating method and device and a server. BACKGROUND
[0002] With the rapid development of information technology, large-scale databases are increasingly widely used in the Internet, e-commerce, finance and other fields. These systems can generate tens of billions of data change records every day. In order to support data backtracking and error repair operations, log recording has become an indispensable part of the system. However, the traditional log recording method (such as recording detailed information of each change) will generate a large amount of redundant data, resulting in a sharp increase in the occupation of disk storage resources and reducing the efficiency of the system.
[0003] In combination Figure 1 For example, an application stores data of 1 billion users, each user has one record. The data of each user every day (the "change field" in the table) only changes once, and the change type is relatively small (four change cases are shown in the figure). In this case, if the traditional log storage scheme (the log table shown in the lower figure) is used, the log of 1 billion users changing every day will generate 1 billion records. Although the log table may have fewer fields compared to the original table, even if it only contains three fields (user ID, data change situation, and change date), 1 billion records require about 30 GB of storage space. If the log storage lasts for one year, the total data volume will exceed 10 TB. Such a huge storage requirement not only occupies a large amount of resources, but also significantly affects the query efficiency and reduces the system performance. SUMMARY
[0004] Therefore, the present application provides the following technical solutions:
[0005] The first aspect of the present application provides a data updating method, comprising:
[0006] determining a change request for a change field of first data, the change request meeting a set rule and containing a change type, the set rule being that the change type is contained and has a fixed change period;
[0007] mapping the change type contained in the change request to a binary code based on a preset mapping relationship between the change type and the binary code;
[0008] controlling the change field to be updated according to the change type, and saving the binary code into log data of the change field.
[0009] In one possible implementation, the saving of the binary code into the log data of the change field comprises:
[0010] if no log data of the change field exists before, directly storing the binary code;
[0011] if log data of the change field exists before, appending the binary code to the end of the log data.
[0012] In a possible implementation, the storing the binary code into the log data of the change field comprises:
[0013] converting the binary code into a multi-ary code and storing the multi-ary code into the log data of the change field, wherein the number of the multi-ary code is greater than that of the binary code.
[0014] In a possible implementation, the converting the binary code into a multi-ary code and storing the multi-ary code into the log data of the change field comprises:
[0015] converting the log data from the multi-ary code into binary data;
[0016] appending the binary code to the end of the binary data to obtain updated binary data;
[0017] converting the updated binary data into a multi-ary code and storing the multi-ary code as log data.
[0018] In a possible implementation, the method further comprises:
[0019] obtaining a storage period configured to limit a time span of the log data;
[0020] managing the log data based on the storage period, comprising: automatically deleting log data whose time length from a current time exceeds the storage period, so that the log data only stores log data in a time period with a length of the storage period from the current time.
[0021] In a possible implementation, the managing the log data based on the storage period comprises:
[0022] determining a number of changes of the change field in the storage period based on the change period;
[0023] determining a length of a binary code of the log data in the storage period based on the number of changes and a number of binary bits added each time, wherein the number of binary bits added each time is determined based on a number of change types;
[0024] based on the length of the binary code, deleting binary data in the log data with the earliest storage time and exceeding the length of the binary code.
[0025] In a possible implementation, the method further includes:
[0026] obtaining a log query request, wherein the log query request includes data identification and the change field;
[0027] determining corresponding log data based on the data identification and the change field;
[0028] obtaining the change type of the change field at each change node based on the log data and the preset rule.
[0029] In a possible implementation, the obtaining the change type of the change field at each change node based on the log data and the preset rule includes:
[0030] determining the binary code corresponding to each change of the change field based on the preset rule;
[0031] determining the change type of each change based on the binary code corresponding to each change of the change field, and the mapping relationship between the change type and the binary code.
[0032] The second aspect of the present application provides a data updating device, comprising:
[0033] a data obtaining module configured to determine a change request for a change field of first data, wherein the change request conforms to a preset rule, and includes a change type, and the preset rule includes a preset change type and a fixed change period;
[0034] a data conversion module configured to map the change type included in the change request to a binary code based on a preset mapping relationship between the change type and the binary code;
[0035] a log saving module configured to control the change field to be updated according to the change type, and save the binary code into log data of the change field.
[0036] The third aspect of the present application provides a server, comprising at least one processor and a memory connected with the processor, wherein:
[0037] the memory is configured to store a computer program;
[0038] the processor is configured to execute the computer program, so that the electronic device can implement any of the above data updating methods.
[0039] According to the technical solution, the application discloses a data updating method, device and server, which comprises the following steps: determining a change request for a change field of first data, wherein the change request meets a set rule and contains a change type, and the set rule is that the change type is contained and has a fixed change period; mapping the change type contained in the change request into a binary code based on a preset mapping relationship between the change type and the binary code; and controlling the change field to be updated according to the change type, and saving the binary code into log data of the change field. The above scheme uses the binary code to store the log data to record the historical change of the change field meeting the set rule. In the implementation process of the scheme, a new storage entry does not need to be added for the change event, and only the log data corresponding to the change field needs to be updated, so that the data storage amount can be greatly reduced compared with the traditional scheme, the storage cost can be saved, and the problem of performance degradation caused by the excessively large database storage amount can be effectively avoided. BRIEF DESCRIPTION OF DRAWINGS
[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or the prior art description will be briefly introduced. Obviously, the drawings in the following description are only embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor on the basis of the provided drawings.
[0041] Figure 1 A traditional scheme data updating implementation principle example diagram;
[0042] Figure 2 A flowchart of a data updating method disclosed by the embodiments of the present application;
[0043] Figure 3 A flowchart of saving a binary code disclosed by the embodiments of the present application;
[0044] Figure 4 An implementation principle schematic diagram of a data updating scheme disclosed by the embodiments of the present application;
[0045] Figure 5 A flowchart of log data management disclosed by the embodiments of the present application;
[0046] Figure 6 A specific implementation flowchart example diagram of a data updating scheme disclosed by the embodiments of the present application;
[0047] Figure 7 A structure schematic diagram of a data updating device disclosed by the embodiments of the present application;
[0048] Figure 8A structural schematic diagram of a server disclosed in an embodiment of the present application. DETAILED DESCRIPTION
[0049] The technical solutions in the embodiments of the present application will be clearly and completely described in combination with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all the other embodiments obtained by a person of ordinary skill in the art without creative work fall within the protection scope of the present application.
[0050] The disclosed content of the present embodiment can be a solution for data change of a large-scale database. A large-scale database can store a large amount of data, and the amount can reach tens of billions. In a conventional scenario, for tens of billions of data change records per day, a log table will rapidly expand, resulting in extremely high storage space requirements. For example, if 1 billion data records are recorded per day, more than 10 TB of storage space will be occupied in a year; this not only greatly increases the storage cost, but also seriously affects the performance of the entire database. To solve the above problem, the present application proposes a data update solution to reduce the data storage cost of the database and optimize the query performance of the database.
[0051] The solution disclosed in the embodiments of the present application can be applied to an electronic device, and the product form of the electronic device is not limited in the present application, which can include but is not limited to a smart phone, a tablet computer, a wearable device, a personal computer (PC), a netbook, and the like, and can be selected according to application requirements.
[0052] Figure 2 A flowchart of a data update method disclosed in an embodiment of the present application. Referring to FIG. 2, Figure 2 The data update method can include the following steps.
[0053] Step 201: determining a change request for a change field of first data, the change request meeting a set rule and containing a change type, the set rule being that the change type is contained and has a fixed change period.
[0054] The database stores big data level data, which includes multiple fields such as user ID, gender, age, member days, and the like. Some fields are fixed, such as user ID, gender, age, and the like, and some fields are changeable, such as member days. The data stored in the database has multiple data, each piece of data has a unique identifier to distinguish different data, and the unique identifier is, for example, user ID, account ID, and the like. The first data can be any one or more of the multiple data stored in the database. When the data in the database needs to be changed, it is necessary to know which piece of data in the multiple pieces of data needs to be changed. Therefore, in the embodiment of the present application, the first data represents a piece of data or a group of data with a unique identifier.
[0055] The scheme of the present application can be applied to a scenario in which only a certain item of data in each piece of data stored in the database is changed at a specific time node, and the change mode has only a few fixed cases. For example, the member days are changed every day at midnight, and the change type is +1. This case can be a change event that meets the set rules. Based on the above, the set rules are a few fixed change types and a fixed change period.
[0056] Step 202: mapping the change type contained in the change request to a binary code based on a preset mapping relationship between the change type and the binary code.
[0057] The mapping relationship can be determined artificially. If the change type of a certain data is set to include only four types, it can be represented by two-bit binary code. The four change types correspond to 00, 01, 10, and 11, respectively. The mapping relationship between the change type and the binary code can be preconfigured, and when a change of a certain type occurs in the change field subsequently, the specific binary code is mapped. In one example, the change type of the change field includes +1, +2, +3, and unchanged, and the corresponding binary codes are 01, 10, 11, and 00, respectively. If the data changes to +2 this time, the determined binary code is 10. In another example, the change field is the attendance days, which is updated every day at 20:00, and the change type has only two types, one is +1, and the other is unchanged (or +0).
[0058] Step 203: controlling the change field to be updated according to the change type, and saving the binary code to the log data of the change field.
[0059] After the binary code is determined, the database can be updated, which includes the synchronous update of the change field and the log data to ensure the synchronization of the data. For example, the original value of the change field is 23, the change type is +2, the corresponding binary code is 10, and the log data is originally 10001110. Then the change field is updated to 23+2=25, and the binary code 10 is added to the end of the original log data 10001110 to update it to 1000111010.
[0060] In the traditional scheme, each time a field in the user data is updated, a change record is separately stored, and each change record stores multiple fields completely, resulting in a large amount of repeated information. For example, the user ID, data change, and change date are stored in each change record, and the user ID is the same, causing a large amount of data redundancy. In addition, the storage of the change date can also be omitted in the scenario that meets the set rules.
[0061] Therefore, in the present application, for each change event, a new change record is not stored separately, but the change content is stored in the form of a log. In the implementation, a "log data" field can be added to the user data, and each change of the change field is stored in the log data. Specifically, the change content of each time is recorded by using binary code, and since the change meets the set rules and has a fixed change time, when it is necessary to trace back or query the historical change event, the binary code sequence in the log data can be used to determine which time node and what data change.
[0062] For example, each change is represented by two-bit binary code, and the change field is updated once a day. The log data is 1000110110. According to the mapping relationship between the change type and the binary code described in the foregoing, it can be determined that the binary code of the current day is 10 (the last two bits in 1000110110), and the corresponding change type is +2. The binary code of the previous day is 01 (the third and fourth bits from the end in 1000110110), and the corresponding change type is +1. The same applies to the rest.
[0063] The data change method described in the embodiment records the historical change of the change field that meets the set rules by using binary code to store the log data. In the implementation process of the scheme, no new storage item needs to be added for the change event, and only the log data corresponding to the change field needs to be updated. Compared with the traditional scheme, the data storage amount can be greatly reduced, the storage cost can be saved, and the problem of performance degradation caused by the excessively large amount of database storage data can be effectively avoided.
[0064] In one implementation, the storing of the binary code into the log data of the changed field can include: if there is no log data of the changed field before, directly storing the binary code; if there is log data of the changed field before, appending the binary code to the end of the log data.
[0065] In actual application, there are two cases when storing the binary code. One is that the changed field is changed for the first time, and the binary code is stored for the first time, and there is no log data or the log data is empty before. The other is that the changed field has been changed before, and the corresponding log data has been stored.
[0066] In the case that there is no log data or the log data is empty before, the binary code can be directly stored as log data. In the case that there is log data before, the binary code corresponding to the current change can be added to the end of the previously stored log data in an appending manner, and then the binary data after adding the binary code is stored as a whole.
[0067] In one implementation, the log data is a multi-ary code, such as octal data, hexadecimal data, etc. The storing of the binary code into the log data of the changed field can include: converting the binary code into a multi-ary code and storing the multi-ary code into the log data of the changed field, wherein the number of the multi-ary code is greater than that of the binary code. The process of converting the binary code into a multi-ary code and storing the multi-ary code into the log data of the changed field can be referred to Figure 3 , the storing of the binary code into the log data of the changed field can include: Figure 3
[0068] Step 301: converting the log data from a multi-ary code into a binary data.
[0069] In this implementation, in order to further reduce the data to be stored, a multi-ary code can be used to store the log of the change event. That is, the change content of the change event is still represented by a binary code, but when storing the log data, a multi-ary code is used for storage.
[0070] Taking hexadecimal as an example, the change state of each record is encoded in binary, for example, using two bits, each bit indicating a specific state. The encoded binary data is converted into hexadecimal form. Since each character in hexadecimal can represent four binary bits, it is equivalent to further compressing the overall data of the database. The converted hexadecimal string is stored in the log field, which occupies less storage space; compared with directly storing all change information in the new data table and storing change information only in binary data, this compressed form of log data stored in hexadecimal data can significantly reduce the log storage space. Each time the record is changed, only the changed field of the record, i.e. the log data field, is updated, without the need to add new entries.
[0071] Since the log data is encoded in multiple bases, when it is necessary to append binary encoding to it, the multiple bases need to be unified and the multiple base encoding needs to be converted into binary data.
[0072] Step 302: The binary encoding is added at the end of the binary data in an appended manner to obtain updated binary data.
[0073] After converting the multiple base encoding into binary data, the binary encoding can be added at the end of the binary data in an appended manner to obtain the latest binary data, i.e. a new and longer binary string.
[0074] Step 303: The updated binary data is converted into multiple base encoding and saved as log data.
[0075] In order to further compress data and save storage space, after obtaining the updated binary data, it needs to be converted into multiple base encoding. If the log data is stored for one year, it needs to occupy 365*2 binary bits, which needs to be stored in about 184 bits in hexadecimal form; based on the data of 1 billion users, the storage space required by the log data field is about 170G; compared with the 10950G required by the traditional scheme shown in the table, the effect of reducing the storage space is very significant. Figure 1
[0076] Figure 4 The implementation principle of the data updating scheme disclosed in the embodiments of the present application is shown in the figure. In combination with the description of the embodiments of the present application, the implementation principle of the data updating scheme disclosed in the embodiments of the present application is shown in the figure. In combination with the description of the embodiments of the present application, Figure 4 As shown, the scheme is directed to massive data in the change scene conforming to the set rules, when data change needs to record logs, by encoding the change state of the data into binary form, and further compressing and storing as a hexadecimal string, thereby effectively reducing the storage space of log data. In the implementation, the change of data is stored after compression using corresponding encoding conversion, a field is added to the original data table to store the data change, without the need to create an additional log table. In this way, a large number of daily change records can be processed, and the disk storage space occupation of the log file can be greatly reduced, while maintaining the efficiency and convenience of recording the change state.
[0077] The scheme described in the embodiment greatly reduces the storage space occupation of log records by using binary encoding and hexadecimal data compression storage mode for storing logs, while maintaining accurate recording of the data change state.
[0078] On the basis of the foregoing disclosure, in other implementations, the data updating method can further include: compressing and storing the log data of the change field.
[0079] As can be understood, in order to further save storage space, the log data of the change field can be compressed and stored in the implementation, that is, on the basis of the foregoing binary data storage log data or multi-encoding storage log data, the log data is further compressed and stored after obtaining the log data, which can save more storage space and reduce the storage cost of log data.
[0080] In one implementation, the data updating method can further include Figure 5 the content shown. Figure 5 The flowchart of the log data management disclosed in the embodiments of the present application. Referring to Figure 5 As shown, the data updating method can further include:
[0081] Step 501: Obtain a configured storage period, the storage period being used to limit the time span of log data.
[0082] The storage period can have a default value, or can be configured by the user according to the actual application scenario, for example, the storage period is one year.
[0083] Step 502: Manage the log data based on the storage period, including: automatically deleting log data whose time length from the current time exceeds the storage period, so that the log data only saves log data within a time period of the storage period length from the current time.
[0084] Specifically, the managing the log data based on the storage period can include: determining a number of changes of the change field in the storage period based on the change period; determining a binary encoding length of the log data in the storage period based on the number of changes and a number of binary bits added each time of change, wherein the number of binary bits added each time of change is determined based on a number of change types; for example, if the change type is not greater than 2, the binary data is only one bit; if the change type is greater than 2 and not more than 4, the binary data is two bits; if the change type is greater than 4 and not more than 8, the binary data is three bits; and deleting, based on the binary encoding length, binary data of the log data that is earliest in storage time and exceeds the binary encoding length. Thus, the log data stored in the database can be dynamically managed according to actual needs.
[0085] For example, the change field is updated only once a day, two binary characters are added each time of change, and only log data of nearly one year needs to be saved. After the hexadecimal data is converted into binary data, it is determined that the binary encoding length corresponding to one year is equal to 365*2, and then the binary encoding of the string that exceeds the length of 365*2 at the front is removed.
[0086] For another example, two binary encodings are added each time of change, and the storage period has a total of 100 changes. Thus, the length of the binary encoding in the storage period is 100*2=200.
[0087] In one implementation, the data updating method can further include: obtaining a log query request, wherein the log query request includes a data identifier and the change field; determining corresponding log data based on the data identifier and the change field; and determining a change type of the change field at each change node based on the log data and the setting rule.
[0088] That is, to query log change conditions of a certain user, only the value of the current change field of the user, the log data, and the log change date need to be queried, and then the data change condition of the current user each day can be calculated.
[0089] Specifically, the determining the change type of the change field at each change node based on the log data and the setting rule includes: determining a binary encoding corresponding to each change of the change field based on the setting rule; and determining the change type of each change based on the binary encoding corresponding to each change of the change field and a mapping relationship between the change type and the binary encoding.
[0090] For example, for the log data 010010, the setting rule determines that there are 4 types of changes, and two binary codes are added each time the change is made; since the log data 010010 has 6 bits in total, it can be determined that the change field has been changed 3 times, the first change corresponds to the binary code "01", the second change corresponds to the binary code "00", and the third change corresponds to the binary code "10"; the mapping relationship between the change type and the binary code is that 00 corresponds to +1, 01 corresponds to +0, and 10 corresponds to +2, so the change type of the first change is +1, the change type of the second change is +0, and the change type of the third change is +2; if the current change field is the value 50, then the value before the third change is 50-2=48, the value before the second change is 48-0=48, and the value before the first change is 48-1=47.
[0091] Figure 6 A specific implementation flowchart of the data updating scheme disclosed in the embodiments of the present application is shown. In combination with Figure 6 As shown, the data updating scheme can include the following contents:
[0092] 1. First, the original data and log data of the change field of the data table are obtained, which provides original information for data change and log recording;
[0093] 2. According to the business itself, the current data change of the user is determined, such as Figure 6 As shown, there are 4 changes, and the user in the example needs to add 3 to the original basis;
[0094] 3. According to the business change type and binary code correspondence table, +3 is converted into binary 11;
[0095] 4. The log data of the current user is obtained, if there is no log data, it is the first change; if there is log data, the hexadecimal data needs to be converted into binary data. Figure 6 The previous log record of the example user is f, which is converted into binary 011110;
[0096] 5. The binary of the current change is appended to the string after the binary of the previous log record; Figure 6 In the example, 11 of the current change needs to be appended to 011110, which is 01111011;
[0097] 6. Convert the binary data into hexadecimal data, Figure 6 In the example, the binary string is 01111011, which is converted into hexadecimal data 7b;
[0098] 7. Update the database, including the change field 6+3=9 and the log field 7b.
[0099] The technical solution disclosed by the embodiments of the present application is directed to a change event scene with limited data change types and change rules. The change state is compactly represented by means of binary coding, thereby saving the storage space required for recording the change event. Further, the binary data can be converted into multi-ary coded storage, further compressing the storage space. The recording of the change time only needs to update the field of the record log data, without adding redundant log entries. The corresponding efficient decoding logic can be designed to quickly restore the compact coding to complete change information.
[0100] In the log data query, analysis or backtracking operation, the compact storage and efficient decoding mechanism can reduce the data query and processing time, improve the system response speed, and optimize the user experience. The technical solution is particularly suitable for high-concurrency and high-performance scenarios.
[0101] For the foregoing method embodiments, in order to simply describe, they are all expressed as a series of action combinations, but those skilled in the art should know that the present application is not limited by the action sequence described, because according to the present application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification all belong to preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
[0102] The method is described in detail in the embodiments disclosed by the present application. The method of the present application can be implemented by various forms of devices, and therefore the present application also discloses a device. The following specific embodiments are given to describe in detail.
[0103] Figure 7 A structural schematic diagram of a data updating device disclosed by the embodiments of the present application is shown in FIG. 7. Figure 7 As shown in FIG. 7, the data updating device 70 can include:
[0104] The data obtaining module 701 is configured to determine a change request for a change field of first data, wherein the change request conforms to a set rule and contains a change type, and the set rule is that the change type contains a set change type and has a fixed change period.
[0105] The data conversion module 702 is configured to map the change type contained in the change request to a binary code based on a preset mapping relationship between the change type and the binary code.
[0106] The log saving module 703 is configured to control the change field to be updated according to the change type, and save the binary code into log data of the change field.
[0107] The data changing device records the historical change of the change field conforming to the setting rule by storing the log data in a binary encoding mode. In the implementation process, the new storage entry does not need to be added for the change event, and the log data corresponding to the change field can be updated only. Compared with the traditional scheme, the data storage amount can be greatly reduced, the storage cost can be saved, and the performance degradation problem caused by the excessively large database storage data amount can be effectively avoided.
[0108] In one implementation, the log saving module can be specifically configured to: if the log data of the change field does not exist before, directly store the binary code; and if the log data of the change field exists before, append and save the binary code to the end of the log data.
[0109] In one implementation, the log saving module can be specifically configured to: convert the binary code into a multi-base code and save the multi-base code into the log data of the change field, wherein the base number of the multi-base code is greater than the base number of the binary code.
[0110] In one implementation, the log saving module can be specifically configured to: convert the log data from the multi-base code into binary data; add the binary code at the end of the binary data in an appended manner to obtain updated binary data; and convert the updated binary data into a multi-base code and save the multi-base code as log data.
[0111] In one implementation, the device can further include a storage management module configured to: obtain a configured storage period, wherein the storage period is used to limit the time span of the log data; and manage the log data based on the storage period, including: automatically deleting the log data whose time length from the current time exceeds the storage period, so that the log data only saves the log data in a time period with a length of the storage period from the current time.
[0112] In one implementation, the log saving module can be specifically configured to: determine the number of changes of the change field in the storage period based on the change period; determine the binary code length of the log data in the storage period based on the number of changes and the number of binary bits added each time, wherein the number of binary bits added each time is determined based on the number of change types; and delete the binary data with the earliest storage time in the log data and exceeding the binary code length based on the binary code length.
[0113] In one implementation, the device may also include: a query management module, used to obtain a log query request, the log query request including a data identifier and the change field; determine the corresponding log data based on the data identifier and the change field; and obtain the change type of the change field at each change node based on the log data and the set rule parsing processing.
[0114] In one implementation, the query management module is specifically used to: determine the binary code corresponding to each change of the change field based on the setting rules; determine the change type of each change based on the binary code corresponding to each change of the change field, and the mapping relationship between the change type and the binary code.
[0115] The specific implementation of the above-mentioned data updating device and the modules it contains can be found in the corresponding parts of the method embodiment, which will not be repeated here.
[0116] Any one of the data updating devices described in the above embodiments includes a processor and a memory. The data acquisition module, data conversion module, log saving module, log saving module, log saving module, query management module, etc. in the above embodiments are all stored in the memory as program modules, and the processor executes the above program modules stored in the memory to realize corresponding functions.
[0117] The processor contains a kernel, which retrieves the corresponding program module from the memory. There can be one or more kernels, and the kernel parameters can be adjusted to process the returned data.
[0118] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0119] In an exemplary embodiment, a computer-readable storage medium is also provided, which can be directly loaded into the internal memory of a computer and contains software code. After being loaded and executed by a computer, the computer program can implement the steps shown in any embodiment of the above-mentioned data updating method.
[0120] In an exemplary embodiment, a computer program product is also provided, which can be directly loaded into the internal memory of a computer and contains software code. After being loaded and executed by the computer, the computer program can implement the steps shown in any embodiment of the data updating method described above.
[0121] Furthermore, an embodiment of the present application provides a server, which may be a database server in an application. Figure 8 This is a schematic diagram of the structure of a server disclosed in an embodiment of this application.Figure 8 As shown, the server includes at least one processor 801, and at least one memory 802 connected with the processor, a bus 803; wherein the processor, the memory complete mutual communication through the bus; the processor is used to call the program instruction in the memory, to execute the above-mentioned data updating method.
[0122] The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the difference from other embodiments, and the same or similar parts between various embodiments can be referred to each other. For the device disclosed by the embodiments, since it corresponds to the method disclosed by the embodiments, the description is relatively simple, and the related parts can be referred to the method part.
[0123] It should also be noted that the relationship terms such as first and second in this paper are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between the entities or operations. Moreover, the terms "include", "contain" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, article or device. Without more limitation, the element defined by the sentence "including a…" does not exclude the existence of other same elements in the process, method, article or device including the element.
[0124] The steps of the method or algorithm described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, software module executed by a processor, or a combination of the two. The software module can be placed in random access memory (RAM), memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, register, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0125] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A data updating method, characterized in that: include: Determining a change request for a changed field of the first data, the change request conforming to a set rule and including a change type, the set rule including a set change type and having a fixed change period; Based on a preset mapping relationship between the change type and the binary code, mapping the change type included in the change request into a binary code; The change field is controlled to be updated according to the change type, and the binary code is saved in the log data of the change field.
2. The data updating method according to claim 1, wherein: Saving the binary code to the log data of the changed field includes: If the log data of the changed field does not exist before, directly store the binary code; If log data of the changed field exists before, the binary code is appended and saved at the end of the log data.
3. The data updating method according to claim 1, wherein: Saving the binary code to the log data of the changed field includes: The binary code is converted into a multi-base code and saved in the log data of the change field, wherein the base number of the multi-base code is greater than the base number of the binary code.
4. The data updating method according to claim 3, wherein: The converting the binary code into a multi-base code and saving the converted code into the log data of the changed field includes: Converting the log data from multi-base encoding to binary data; Adding the binary code to the end of the binary data in an appending manner to obtain updated binary data; The updated binary data is converted into a multi-base code and saved as log data.
5. The data updating method according to claim 1, wherein: Also includes: Obtaining a configured storage period, wherein the storage period is used to limit the time span of log data; Managing the log data based on the storage period includes automatically deleting log data that is more than the storage period away from the current time, so that the log data only stores log data within a period of the storage period from the current time.
6. The data updating method according to claim 5, characterized in that: Managing the log data based on the storage period includes: Based on the change period, determining the number of changes of the change field in the storage period; Determining the binary encoding length of the log data within the storage period based on the number of changes and the number of binary digits added for each change, wherein the number of binary digits added for each change is determined based on the number of change types; Based on the binary code length, the binary data with the earliest storage time in the log data and exceeding the binary code length is deleted.
7. The data updating method according to claim 1, wherein: Also includes: Obtaining a log query request, wherein the log query request includes a data identifier and the change field; Determining corresponding log data based on the data identifier and the changed field; The change type of the changed field at each change node is obtained based on the log data and the setting rule analysis process.
8. The data updating method according to claim 7, characterized in that: The obtaining of the change type of the change field at each change node based on the log data and the setting rule parsing process includes: Determine the binary code corresponding to each change of the change field based on the setting rule; The change type of each change is determined based on the binary code corresponding to each change of the change field and the mapping relationship between the change type and the binary code.
9. A data updating device, characterized in that: include: a data acquisition module, configured to determine a change request for a change field of the first data, the change request conforming to a set rule and including a change type, the set rule including a set change type and having a fixed change period; A data conversion module, configured to map the change type included in the change request into a binary code based on a preset mapping relationship between the change type and the binary code; The log saving module is used to control the change field to be updated according to the change type and save the binary code into the log data of the change field.
10. A server, characterized in that: comprising at least one processor and a memory connected to the processor, wherein: The memory is used to store computer programs; The processor is configured to execute the computer program so as to enable the electronic device to implement the data updating method according to any one of claims 1 to 8.