Disclosure of Invention
The invention provides a data reduction method, a data reduction device, electronic equipment and a storage medium, which are used for solving the technical problems that a data reduction method in the prior art needs to occupy a large amount of computing resources and the data reduction time is long.
The invention provides a data reduction method, which comprises the following steps:
acquiring the appointed reduction date of the service to be reduced;
determining a full data generation date with the shortest time interval with the specified reduction date and an incremental data generation date between the full data generation date and the specified reduction date based on the specified reduction date;
fusing the incremental data corresponding to the incremental data generation date to obtain total incremental data corresponding to the service to be restored;
and fusing the total incremental data and the full data corresponding to the full data generation date to obtain the full data corresponding to the service to be restored on the specified restoration date.
According to the data reduction method provided by the invention, the full data and the incremental data corresponding to the service to be reduced are generated based on the following steps:
acquiring a service data storage instruction;
if the storage date corresponding to the service data storage instruction is the full data generation date of the service to be restored, storing all service data of the service to be restored, and generating full data of the service to be restored on the storage date;
if the storage date corresponding to the business data storage instruction is the incremental data generation date of the business to be restored, comparing all business data of the storage date with all business data of the previous date of the storage date, and generating the incremental data of the business to be restored on the storage date based on the comparison result.
According to the data reduction method provided by the invention, the generation date of the full data and the generation date of the incremental data of the service to be reduced are determined based on the following steps:
determining the generation date of the full data of the service to be restored based on a preset time interval and the service on-line date corresponding to the service to be restored;
and taking the date between the two adjacent full data generation dates as the incremental data generation date.
According to the data restoration method provided by the invention, the preset time interval is determined based on the service supervision requirement corresponding to the service to be restored.
According to the data reduction method provided by the invention, the fusion of the incremental data corresponding to the generation date of each incremental data to obtain the total incremental data corresponding to the service to be reduced comprises the following steps:
determining a fusion sequence of the incremental data corresponding to each incremental data generation date based on each incremental data generation date;
and fusing the incremental data corresponding to the incremental data generation dates based on the fusion sequence to obtain the total incremental data corresponding to the service to be restored.
According to the data reduction method provided by the invention, the fusing of the incremental data corresponding to the generation date of each incremental data based on the fusion sequence comprises the following steps:
acquiring first incremental data and second incremental data based on the fusion sequence;
if a first data record in the first incremental data is the same as a second data record in the second incremental data, retaining the second data record in a fusion result of the first incremental data and the second incremental data;
and if a first data record in the first incremental data is different from a second data record in the second incremental data, simultaneously reserving the first data record and the second data record in the fusion result of the first incremental data and the second incremental data.
The present invention provides a data restoring apparatus, including:
the date acquisition unit is used for acquiring the appointed reduction date of the service to be reduced;
a date determination unit configured to determine, based on the specified restore date, a full-volume data generation date that is the shortest interval from the specified restore date, and an incremental data generation date between the full-volume data generation date and the specified restore date;
the increment fusion unit is used for fusing the increment data corresponding to each increment data generation date to obtain the total increment data corresponding to the service to be restored;
and the total fusion unit is used for fusing the total incremental data and the total data corresponding to the total data generation date to obtain the total data corresponding to the to-be-restored service on the appointed restoration date.
The invention provides electronic equipment which comprises a memory, a processor and a computer program which is stored on the memory and can run on the processor, wherein the processor realizes the data recovery method when executing the program.
The present invention provides a non-transitory computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the data reduction method.
The invention provides a computer program product comprising a computer program which, when executed by a processor, implements the data reduction method.
The data reduction method, the data reduction device, the electronic equipment and the storage medium obtain the appointed reduction date of the service to be reduced; determining a full data generation date with the shortest time interval with the designated reduction date and an incremental data generation date between the full data generation date and the designated reduction date according to the designated reduction date; fusing the incremental data corresponding to the incremental data generation date to obtain total incremental data corresponding to the service to be restored; the total incremental data and the full data corresponding to the full data generation date are fused to obtain the full data corresponding to the business to be restored on the appointed restoration date, all the incremental data are fused firstly and then fused with the full data, the full data do not need to be substituted into each data fusion operation, a large amount of computing resources are saved, the data restoration time is shortened, the response speed of a business data storage database is improved, and the use experience of a user is improved.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is obvious that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first", "second", etc. in the present invention are used for distinguishing similar objects, and are not necessarily used for describing a particular order or sequence. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Fig. 1 is a schematic flow chart of a data restoring method provided by the present invention, and as shown in fig. 1, the method includes step 110, step 120, step 130, and step 140.
And step 110, acquiring the appointed reduction date of the service to be reduced.
Specifically, the data reduction method provided by the embodiment of the present invention is applicable to a database storing business data, such as a Distributed File System (HDFS). The business data is data generated along with a business process flow. For example, the business data may be status data generated when the financial institution transacts financial business for the customer, including account information and transaction information of the customer. These data are time-stamped and may therefore also be referred to as timepoint data. The business to be restored is various services which are transacted by the financial institution for the client, including deposit business, loan business, transfer business and the like.
For these business data, long-term preservation is required for regulatory or intra-enterprise audits. The date of auditing is typically separated by a long period from the date of business data generation. Therefore, the service data needs to be restored during auditing. The data is restored to the state when the business data is restored to the specified date. The specified restore date is the date on which the specified data was restored.
For example, for bank transaction data, it is often necessary to retain for 5 years, 10 years, or even longer. The current date is 2022 years, 1 month and 1 day. Now, according to the auditing requirements of the regulatory body, the data of the transfer transaction of the customer A in a certain bank in 2017, 2, month and 1 are required to be audited. Then the date of reduction specified is now 2017, 2/1.
And step 120, based on the designated reduction date, determining a full data generation date with the shortest time interval with the designated reduction date and an incremental data generation date between the full data generation date and the designated reduction date.
Specifically, the full amount of data is all service data related to the service to be restored, which is stored in the database. The incremental data is service data which is stored in a database and is related to the change of the service to be restored. For example, when a certain bank performs a deposit transaction, all recorded transaction data related to the deposit transaction are full data, including account information opened by a customer, transaction information for transacting a storage transaction for each account, and the like. Comparing the storage business processed by the bank on the current day with the storage business processed on the previous day of the current day, the changed data is incremental data, and the incremental data comprises the change of account information, the change of account amount and the like.
Since the data amount of the full-size data is particularly enormous, the full-size data is stored in its entirety by selecting an appropriate date according to the actual situation, and the date on which the full-size data is stored is the full-size data creation date. Only the incremental data may be stored, and the date on which the incremental data is stored is the incremental data generation date. The incremental data generation date may be a date other than the full data generation date, or may be a full data generation date. That is, on the day of the full data generation date, the incremental data may also be generated.
For example, if a bank selects to store all data of deposit transaction on the first day of each month to generate full data and stores only data that changes when the deposit transaction is transacted on the remaining days to generate incremental data, the first day of each month is the full data generation date and the remaining days are the incremental data generation dates.
When data is restored, the full data generation date with the shortest time interval with the designated restoration date can be determined according to the designated restoration date, and then the corresponding incremental data generation date can be determined according to the full data generation date and the designated restoration date. Here, the reason for selecting the total data generation date having the shortest time interval from the designated reduction date is to improve the accuracy and timeliness of data reduction.
For example, if the designated restoration date is 2022 years, 3 months and 18 days, the total data generation date having the shortest time interval with the designated restoration date is 2022 years, 3 months and 1 days, and the incremental data generation dates include 2022 years, 3 months and 2 days to 3 months and 18 days.
And step 130, fusing the incremental data corresponding to the incremental data generation dates to obtain total incremental data corresponding to the service to be restored.
Specifically, the incremental data corresponding to each incremental data generation date are fused first, so that the total incremental data corresponding to the service to be restored can be obtained. For example, the incremental data of each day between 3 month 2 days and 3 month 18 days in 2022 are fused, so that the total incremental data corresponding to the service to be restored can be obtained.
The data fusion method may be to compare the incremental data for the current day with the previous day. The field names may be compared first and then the values may be compared. For example, comparing the field names of the incremental data of 3/2/2022 and 3/2022, and if the field names are different, simultaneously keeping the numerical values corresponding to the different field names in 3/2/3 and 3/3; if the field names are the same, only the numerical values corresponding to the same field names in 3 months and 3 days are reserved.
And 140, fusing the total incremental data with the full data corresponding to the full data generation date to obtain the full data corresponding to the to-be-restored service on the appointed restoration date, and restoring the to-be-restored service based on the full data.
Specifically, after all incremental data are fused to obtain total incremental data, the total incremental data and the full data corresponding to the full data generation date are fused, according to the principle that the full data corresponding to the specified reduction date is equal to the sum of the full data and the total incremental data, the full data corresponding to the service to be reduced on the specified reduction date can be obtained, reduction of the service data is achieved, and finally the obtained full data is the service data on the specified reduction date.
For example, if 2022 year 3 month 1 day is the full volume data generation date, the full volume data of the day may be used as the full volume data for the final data fusion. And fusing total incremental data (including incremental data of 3 months and 2 days to 3 months and 18 days) on the full-scale data to obtain business data of 3 months and 18 days in 2022.
The fusion method of the total incremental data and the total incremental data is the same as that of the incremental data, and is not described herein again.
The data reduction method provided by the embodiment of the invention obtains the appointed reduction date of the service to be reduced; determining a full data generation date with the shortest time interval with the specified reduction date and an incremental data generation date between the full data generation date and the specified reduction date according to the specified reduction date; fusing the incremental data corresponding to each incremental data generation date to obtain total incremental data corresponding to the service to be restored; the total incremental data and the full data corresponding to the full data generation date are fused to obtain the full data corresponding to the business to be restored on the appointed restoration date, all the incremental data are fused firstly and then fused with the full data, the full data do not need to be substituted into each data fusion operation, a large amount of computing resources are saved, the data restoration time is shortened, the response speed of a business data storage database is improved, and the use experience of a user is improved.
Based on the above embodiment, the full amount data and the incremental data corresponding to the service to be restored are generated based on the following steps:
acquiring a service data storage instruction;
if the storage date corresponding to the service data storage instruction is the full data generation date of the service to be restored, storing all service data of the service to be restored, and generating full data of the service to be restored on the storage date;
and if the storage date corresponding to the business data storage instruction is the incremental data generation date of the business to be restored, comparing all the business data of the storage date with all the business data of the previous date of the storage date, and generating the incremental data of the business to be restored on the storage date based on the comparison result.
Specifically, the database storing the service data may store the service data according to a time set by a user or an operation by the user. For example, the user may set the business data to be automatically stored by the database at a certain fixed time during the evening. And a timing module in the database judges that the fixed time set by the user comes temporarily, and triggers and generates a service data storage instruction, wherein the instruction is used for storing the service data.
If the storage module in the database judges that the storage date (time label) corresponding to the service data storage instruction is the full data generation date, storing all service data of the service to be restored to generate the full data of the service to be restored on the storage date; and if the storage module in the database judges that the storage date (time label) corresponding to the business data storage instruction is the incremental data generation date, comparing all the business data of the storage date with all the business data of the previous date of the storage date, taking all the inconsistent data as comparison results, and finally generating the incremental data of the business to be restored on the storage date according to the comparison results.
For example, if the storage module in the database judges that the storage date corresponding to the business data storage instruction is the first day of each month, determining that the current day is the full data generation date; if the storage date is the other day of each month, it is determined that the current day is the incremental data generation date.
Based on any embodiment, the generation date of the full data and the generation date of the incremental data of the service to be restored are determined based on the following steps:
determining the full data generation date of the service to be restored based on a preset time interval and the service online date corresponding to the service to be restored;
and taking the date between the two adjacent full data generation dates as the incremental data generation date.
Specifically, the service online date corresponding to the service to be restored may be used as the first full data generation date. For example, if the business online date corresponding to the business to be restored is 2022 year 1 month 15 days, then 2022 year 1 month 15 days may be used as the first full data generation date of the business to be restored.
The preset time interval may be set as desired, for example, 1 month, 1 week, or half a year, etc. The remaining full data generation date of the service to be restored can be determined according to the preset time interval and the first full data generation date, and taking 1 month as an example, the remaining full data generation date of the service to be restored is 2022 year 4 month 15 day, 2022 year 5 month 15 day, and the like, that is, 15 days per month is taken as the full data generation date.
The date between two adjacent full data generation dates becomes the incremental data generation date, and for example, from 4 months 16 to 5 months 14 are the incremental data generation dates.
Based on any of the above embodiments, the preset time interval is determined based on the service supervision requirement corresponding to the service to be restored.
Specifically, if there is a setting requirement for a preset time interval in the service supervision requirement of the service to be restored, the preset time interval is determined according to the service supervision requirement.
Based on any of the above embodiments, step 130 includes:
determining a fusion sequence of the incremental data corresponding to each incremental data generation date based on each incremental data generation date;
and fusing the incremental data corresponding to the incremental data generation dates based on the fusion sequence to obtain the total incremental data corresponding to the service to be restored.
Specifically, the fusion order of the incremental data corresponding to each incremental data generation date may be determined according to each incremental data generation date and the chronological order. The earlier the incremental data generation date is, the earlier the fusion order is. For example, for the incremental data from 2 days after 3 months to 18 days after 3 months, the fusion sequence is determined according to the time sequence, the incremental data from 2 days after 3 months and 3 days after 3 months are fused to obtain an incremental data fusion result 1, the incremental data fusion result 1 is fused with the incremental data from 4 days after 3 months to obtain an incremental data fusion result 2, and so on, the finally obtained incremental data fusion result is used as the total incremental data.
Based on any of the embodiments, fusing the incremental data corresponding to the incremental data generation dates based on the fusion order includes:
acquiring first incremental data and second incremental data based on the fusion sequence;
if the first data record in the first incremental data is the same as the second data record in the second incremental data, reserving the second data record in the fusion result of the first incremental data and the second incremental data;
and if the first data record in the first incremental data is different from the second data record in the second incremental data, simultaneously keeping the first data record and the second data record in the fusion result of the first incremental data and the second incremental data.
Specifically, the first incremental data and the second incremental data may be acquired according to a fusion order. The generation date of the first incremental data is earlier than the generation date of the second incremental data.
The first data record is a data record in the first incremental data and the second data record is a data record in the second incremental data. And comparing the two data records, and if the two data records are the same, keeping the data record with the latest generation date, namely keeping the second data record in the fusion result of the first incremental data and the second incremental data. If the two data records are different, the first data record and the second data record are simultaneously reserved in the fusion result of the first incremental data and the second incremental data.
Based on any of the above embodiments, fig. 2 is a second schematic flow chart of the data reduction method provided by the present invention, as shown in fig. 2, the data reduction method includes:
step one, fusing the incremental data of D +1 day as incremental basic data with the incremental data of D +2 day to obtain a result, and fusing the result with the incremental data of D +3 day by analogy until the total incremental data of D + n day is generated. The D day is the full data generation date with the shortest time interval with the specified reduction date; d + n days is the designated reduction date. n is a positive integer.
And step two, fusing the total data of the D days with the generated total incremental data of the D + n days on the basis of the total data of the D days, so as to generate the total data of the D + n days.
Based on any of the above embodiments, fig. 3 is a schematic structural diagram of a data restoring apparatus provided by the present invention, as shown in fig. 3, the apparatus includes:
a date acquisition unit 310, configured to acquire a specified restoration date of the service to be restored;
a date determination unit 320 for determining, based on the specified reduction date, a full-volume data generation date that is the shortest interval from the specified reduction date, and an incremental data generation date between the full-volume data generation date and the specified reduction date;
the increment fusion unit 330 is configured to fuse the increment data corresponding to each increment data generation date to obtain total increment data corresponding to the service to be restored;
and the total fusion unit 340 is configured to fuse the total incremental data with the total data corresponding to the total data generation date to obtain the total data corresponding to the service to be restored on the specified restoration date.
The data reduction device provided by the embodiment of the invention acquires the appointed reduction date of the service to be reduced; determining a full data generation date with the shortest time interval with the specified reduction date and an incremental data generation date between the full data generation date and the specified reduction date according to the specified reduction date; fusing the incremental data corresponding to the incremental data generation date to obtain total incremental data corresponding to the service to be restored; the total incremental data and the full data corresponding to the full data generation date are fused to obtain the full data corresponding to the business to be restored on the appointed restoration date, all the incremental data are fused firstly and then fused with the full data, the full data do not need to be substituted into each data fusion operation, a large amount of computing resources are saved, the data restoration time is shortened, the response speed of a business data storage database is improved, and the use experience of a user is improved.
Based on any embodiment above, still include:
the data generating unit is used for acquiring a service data storage instruction;
if the storage date corresponding to the service data storage instruction is the full data generation date of the service to be restored, storing all service data of the service to be restored, and generating full data of the service to be restored on the storage date;
and if the storage date corresponding to the business data storage instruction is the incremental data generation date of the business to be restored, comparing all the business data of the storage date with all the business data of the previous date of the storage date, and generating the incremental data of the business to be restored on the storage date based on the comparison result.
Based on any embodiment above, the date determination unit is further configured to:
determining the generation date of the full data of the service to be restored based on a preset time interval and the service on-line date corresponding to the service to be restored;
and taking the date between the two adjacent full data generation dates as the incremental data generation date.
Based on any of the above embodiments, the preset time interval is determined based on the service supervision requirement corresponding to the service to be restored.
Based on any of the embodiments, the incremental fusion unit is specifically configured to:
determining a fusion sequence of incremental data corresponding to each incremental data generation date based on each incremental data generation date;
and fusing the incremental data corresponding to the incremental data generation dates based on the fusion sequence to obtain the total incremental data corresponding to the service to be restored.
Based on any of the embodiments above, the incremental fusion unit is further specifically configured to:
acquiring first incremental data and second incremental data based on the fusion sequence;
if the first data record in the first incremental data is the same as the second data record in the second incremental data, reserving the second data record in the fusion result of the first incremental data and the second incremental data;
and if the first data record in the first incremental data is different from the second data record in the second incremental data, simultaneously keeping the first data record and the second data record in the fusion result of the first incremental data and the second incremental data.
Based on any of the above embodiments, fig. 4 is a schematic structural diagram of an electronic device provided by the present invention, and as shown in fig. 4, the electronic device may include: a Processor (Processor)410, a communication Interface (communication Interface)420, a Memory (Memory)430 and a communication Bus (communication Bus)440, wherein the Processor 410, the communication Interface 420 and the Memory 430 are communicated with each other via the communication Bus 440. The processor 410 may call logical commands in the memory 430 to perform the following method:
acquiring the appointed reduction date of the service to be reduced; determining, based on the specified restore date, a full-volume data generation date that is the shortest time interval from the specified restore date, and an incremental data generation date between the full-volume data generation date and the specified restore date; fusing the incremental data corresponding to each incremental data generation date to obtain total incremental data corresponding to the service to be restored; and fusing the total incremental data and the full data corresponding to the full data generation date to obtain the full data corresponding to the service to be restored on the appointed restoration date.
In addition, the logic commands in the memory 430 may be implemented in the form of software functional units and stored in a computer readable storage medium when the logic commands are sold or used as independent products. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes a plurality of commands for enabling a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The processor in the electronic device provided in the embodiment of the present invention may call a logic instruction in the memory to implement the method, and the specific implementation manner of the method is consistent with the implementation manner of the method, and the same beneficial effects may be achieved, which is not described herein again.
Embodiments of the present invention further provide a non-transitory computer-readable storage medium, on which a computer program is stored, where the computer program is implemented to perform the methods provided in the foregoing embodiments when executed by a processor, and a specific implementation manner of the method is consistent with the foregoing method implementation manner and can achieve the same beneficial effects, and details are not repeated herein.
Embodiments of the present invention provide a computer program product, which includes a computer program, and when being executed by a processor, the computer program implements the steps of the method.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one position, or may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as ROM/RAM, magnetic disk, optical disk, etc., and includes commands for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method according to the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.