Distributed database daily offloading method, device, electronic device and storage medium
By obtaining the maximum global transaction identifier and active list, the distributed database quickly and accurately obtains daily cut-off and unloading data within the accounting date, solving the problem of obtaining accurate daily cut-off and unloading under non-stop service conditions, and achieving efficient business processing.
Patent Information
- Application Number
- CN202411841488.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-13
- Publication Date
- 2025-04-08
AI Technical Summary
How to quickly obtain accurate daily cut-off and unloading data within the accounting date under the condition of 7×24 hours of continuous service in distributed databases.
An active list is formed by obtaining the maximum global transaction identifier allowed for records on the current accounting date and finding all active global transaction identifiers smaller than the maximum global transaction identifier in the transaction data on the next accounting date. Determine the version data of the data item inserted into the daily cut-off table based on the target global transaction identifier, the maximum global transaction identifier, and the active list. Insert old version data if the target global transaction identifier exceeds the maximum global transaction identifier or belongs to the active list.
It realizes the rapid and accurate acquisition of daily cut-off data within the accounting date, which facilitates subsequent business processing and ensures efficient operation of the database under continuous service conditions.
Smart Images

Figure CN119782332A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a distributed database daily offloading method, device, electronic device and storage medium. Background Art
[0002] With the rapid development of the Internet and the continuous advancement of technology, the scale and types of business are also constantly developing, and the amount of data stored in the database is showing an explosive growth trend. As an online transaction system, the database needs to process a large number of business SQL statements in real time. How to quickly obtain accurate daily unloading data within the accounting date under the condition of 7×24 hours of service in the distributed database has become an urgent problem to be solved. Summary of the invention
[0003] The present application provides a distributed database daily cut-off number method, device, electronic device and storage medium to solve the technical problem of how a distributed database can quickly obtain accurate daily cut-off number data within an accounting date under the condition of 7×24 hours non-stop service.
[0004] In a first aspect, the present application provides a distributed database daily offloading method, the method comprising:
[0005] Get the maximum global transaction identifier allowed to be recorded on the current accounting date;
[0006] Searching for all active global transaction identifiers smaller than the maximum global transaction identifier in the transaction data of the next accounting date, and taking the set of active global transaction identifiers as an active list;
[0007] When the preset day cut-off number moment of the current accounting date is reached, determining from the database a data item to be inserted into the day cut-off number table of the current accounting date;
[0008] Determine the version data of the data item to be inserted into the daily cutoff number table according to the target global transaction identifier of the data item, the maximum global transaction identifier and the active list; wherein, when the target global transaction identifier exceeds the maximum global transaction identifier, or the target global transaction identifier belongs to the active list, insert the old version data of the data item into the daily cutoff number table.
[0009] Optionally, determining the version data of the data item to be inserted into the daily unloading number table according to the target global transaction identifier of the data item, the maximum global transaction identifier and the active list includes:
[0010] If the target global transaction identifier of the data item is less than or equal to the maximum global transaction identifier, and the target global transaction identifier does not belong to the active list, inserting the current version data of the data item into the daily unloading number table;
[0011] If the target global transaction identifier of the data item belongs to the active list, inserting the previous old version data corresponding to the target global transaction identifier that does not belong to the active list into the daily unloading number table;
[0012] If the target global transaction identifier of the data item is greater than the maximum global transaction identifier, the previous old version data corresponding to the target global transaction identifier that is less than or equal to the maximum global transaction identifier is inserted into the daily unloading number table.
[0013] Optionally, before reaching the preset day cut-off number moment of the current accounting date, the method further includes:
[0014] Obtaining the daily cut-off number table; wherein the field information of the daily cut-off number table at least includes a bank identifier and an accounting date;
[0015] Clear the information in the daily cut-off number table.
[0016] Optionally, the database includes a timer, and the timer is used to clean up old version data under the same data item in the database when the timer is started and reaches a preset time. The method also includes:
[0017] When a first moment is reached, the timer is stopped; wherein the first moment is a moment before the preset daily cut-off time;
[0018] Accordingly, when the daily cut-off number of the current accounting date is completed, the timer is started.
[0019] Optionally, the duration between the first moment and the preset daily shedding time is positively correlated with the service timeout time.
[0020] Optionally, the method further comprises:
[0021] When the second time is reached, query whether the target global transaction identifier belongs to the active list; wherein the second time is a time after the preset daily offloading time.
[0022] Optionally, the duration between the second moment and the preset daily shedding time is positively correlated with the service timeout time.
[0023] In a second aspect, the present application provides a distributed database daily offloading device, the device comprising:
[0024] An acquisition module is used to obtain the maximum global transaction identifier allowed to be recorded on the current accounting date;
[0025] A search module, used for searching all active global transaction identifiers smaller than the maximum global transaction identifier in the transaction data of the next accounting date, and taking the set of active global transaction identifiers as an active list;
[0026] A first determination module is used to determine, from a database, a data item to be inserted into a daily cut-off number table of the current accounting date when a preset daily cut-off number moment of the current accounting date is reached;
[0027] The second determination module is used to determine the version data of the data item to be inserted into the daily switching number table according to the target global transaction identifier of the data item, the maximum global transaction identifier and the active list; wherein, when the target global transaction identifier exceeds the maximum global transaction identifier, or the target global transaction identifier belongs to the active list, the old version data of the data item is inserted into the daily switching number table.
[0028] In a third aspect, the present application provides an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus;
[0029] Memory, used to store computer programs;
[0030] The processor is used to implement the distributed database daily offloading method described in any one of the embodiments of the first aspect when executing the program stored in the memory.
[0031] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the distributed database daily offloading method as described in any one of the embodiments of the first aspect is implemented.
[0032] The above technical solution provided by the embodiment of the present application has the following advantages compared with the prior art: the method provided by the embodiment of the present application obtains the maximum global transaction identifier allowed to be recorded on the current accounting date; searches for all active global transaction identifiers less than the maximum global transaction identifier in the transaction data of the next accounting date, and uses the set of active global transaction identifiers as the active list; when the preset day cut-off number moment of the current accounting date is reached, determines from the database the data item to be inserted into the day cut-off number table of the current accounting date; determines the version data of the data item to be inserted into the day cut-off number table according to the target global transaction identifier, the maximum global transaction identifier and the active list of the data item. Wherein, when the target global transaction identifier exceeds the maximum global transaction identifier, or the target global transaction identifier belongs to the active list, the old version data of the data item is inserted into the day cut-off number table. The method uses the maximum global transaction identifier allowed to be recorded on the current accounting date and the active list of the next accounting date, and when the target global transaction identifier exceeds the maximum global transaction identifier, or the target global transaction identifier belongs to the active list, the old version data of the data item is inserted into the day cut-off number table, so that the version data of the data item inserted into the day cut-off number table can be accurately determined, which is convenient for the processing of subsequent business. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0034] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0035] One or more embodiments are exemplarily described by pictures in the corresponding drawings, and these exemplified descriptions do not constitute limitations on the embodiments. Elements with the same reference numerals in the drawings represent similar elements, and unless otherwise stated, the figures in the drawings do not constitute proportional limitations.
[0036] Figure 1 A system architecture diagram of a distributed database daily offloading method provided in one embodiment of the present application;
[0037] Figure 2 A schematic diagram of a flow chart of a distributed database daily offloading method provided in one embodiment of the present application;
[0038] Figure 3 A schematic diagram of determining a data version in a daily shedding process provided by an embodiment of the present application;
[0039] Figure 4 A schematic diagram of the structure of a distributed database daily unloading device provided in one embodiment of the present application;
[0040] Figure 5 A schematic diagram of the structure of an electronic device provided in accordance with an embodiment of the present application. DETAILED DESCRIPTION
[0041] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0042] The disclosure below provides many different embodiments or examples to realize the different structures of the present application. In order to simplify the disclosure of the present application, the parts and settings of specific examples are described below. Of course, they are only examples, and the purpose is not to limit the present application. In addition, the present application can repeat reference numbers and / or letters in different examples. This repetition is for the purpose of simplification and clarity, and does not itself indicate the relationship between the various embodiments and / or settings discussed.
[0043] In order to solve the technical problem in the prior art of how a distributed database can quickly obtain accurate daily cut-off number data within an accounting date without stopping service 24 hours a day, the present application provides a distributed database daily cut-off number method, device, electronic device and storage medium, which can accurately determine the version data of the data items inserted into the daily cut-off number table, so as to facilitate the processing of subsequent business.
[0044] The first embodiment of the present application provides a distributed database daily offloading method, which can be applied to Figure 1 The system architecture shown includes at least a storage node 101 and a server 102, and the storage node 101 and the server 102 establish a communication connection.
[0045] The method can be applied to the server 102 in the system architecture, wherein the storage node 101 can be the storage node of each bank, and the data of each storage node 101 is aggregated and stored in the server 102. The server 102 can be a local server, a cloud server, or a server cluster.
[0046] Unloading is a banking operation, which is generally divided into the following methods:
[0047] Normal unloading: This type of unloading is generally for static tables that are rarely modified. Since such tables are basically unchanged, the data is directly exported during unloading without special processing.
[0048] Daily cut-off number: The daily cut-off number will set the time boundary between T0 and T1. T0 and T1 represent accounting dates. For example, T0 can represent the current accounting date, and T1 represents the next accounting date of T0. The daily cut-off number requires that the transactions completed at T0 need to be included in the data at the time of the daily cut-off number of T0.
[0049] Next, based on the system architecture, the distributed database daily offloading method is described in detail. Figure 2 The distributed database daily unloading method includes:
[0050] Step 201, obtaining the maximum global transaction identifier allowed to be recorded on the current accounting date.
[0051] The Global Transaction ID (GTID) is a number used to identify globally unique transactions in the database. It is generally composed of server_uuid and transaction_id. Server_uuid is the unique identifier of the server, and transaction_id is an increasing number that indicates the order of transactions submitted under the server_uuid. Every time a new transaction is submitted on the server, transaction_id will increase. In a distributed database, the database reserves different segments of transaction_id for each storage node. Inside each storage node (DataNode, referred to as DN), GTID increases in the order of transactions. Businesses with large GTIDs belong to T1, and businesses with small GTIDs belong to T0. However, from the perspective of distributed databases as a whole, it may happen that businesses with small GTIDs belong to T1 first, and businesses with large GTIDs belong to T0. For example, on the accounting date T0, DN1 is assigned GTIDs 1, 2, and 3, DN2 is assigned GTIDs 4, 5, and 6, and DN3 is assigned GTIDs 7, 8, and 9. DN3 processed 3 transactions at T0, marked with GTIDs 7, 8, and 9, respectively. DN2 processed 2 transactions at T0, marked as GTID 4 and 5 respectively, and processed 1 transaction at T1, marked as GTID 6. Then, although GTID6 is smaller than 7, 8, and 9, the transaction belongs to T1. The maximum GTID allowed to be recorded in the current accounting date can be determined according to the amount of transactions normally processed by each DN node, such as 100, 1000, 10000, etc., or other values, without limitation. In the examples of various embodiments of the present application, the maximum GTID of T0 = 9 is used as an example, which does not represent a limitation on the maximum GTID. It should be understood that when the maximum GTID of T0 = 9, the maximum GTID of T1 can be 18. In addition, after the daily cut-off number of the T0 accounting date is completed, the T1 accounting date becomes the current accounting date, that is, the maximum GTID gradually increases with the passage of dates. For ease of understanding, the maximum GTID mentioned in the embodiments of the present application refers to T0 corresponding to a date.
[0052] Step 202: Search the transaction data of the next accounting date for all active global transaction identifiers that are smaller than the maximum global transaction identifier, and use the set of active global transaction identifiers as an active list.
[0053] In this embodiment, the time boundary between T0 and T1 may be different from the time boundary between natural days. For example, the time boundary between T0 and T1 may be 9:00 p.m., 10:00 p.m., 11:00 p.m., etc. Taking 9:00 p.m. as an example, the time boundary between T0 and T1 can also be called the preset daily cut-off time of the current accounting date. The transaction data before 9:00 p.m. belongs to the transaction data of T0, and the transaction data at 9:00 p.m. and later belongs to the transaction data of T1. Due to the huge amount of actual data, after the preset daily cut-off time when performing daily cut-off processing, the transaction data of T1 will appear in the database. At this time, all GTIDs that are less than the maximum GTID of T0 are searched in the transaction data of T1. Such GTIDs can be called active GTIDs, and the collection of active GTIDs can be used as an active list.
[0054] Step 203, when the preset day cut-off number moment of the current accounting date is reached, determine the data item to be inserted into the day cut-off number table of the current accounting date from the database.
[0055] When the preset daily cut-off time of T0 is reached, the data items to be inserted into the daily cut-off table of T0 are determined from the database. The data items to be inserted into the daily cut-off table of T0 may be data items corresponding to all transactions processed by the entire T0, or data items corresponding to transactions processed in a time period close to the preset daily cut-off time, such as data items corresponding to transactions processed 1 hour or 10 minutes before the preset daily cut-off time. At this time, the data items corresponding to other transactions processed by T0 may be processed in advance, and when the preset daily cut-off time of T0 is reached, only the data in the time period close to the preset daily cut-off time is processed, thereby reducing the processing volume of the daily cut-off number and improving the processing efficiency of the daily cut-off number.
[0056] Step 204, determining the version data of the data item to be inserted into the daily cutoff number table according to the target global transaction identifier, the maximum global transaction identifier and the active list of the data item; wherein, when the target global transaction identifier exceeds the maximum global transaction identifier, or the target global transaction identifier belongs to the active list, inserting the old version data of the data item into the daily cutoff number table.
[0057] This method uses the maximum global transaction identifier allowed to be recorded on the current accounting date and the active list of the next accounting date. When the target global transaction identifier exceeds the maximum global transaction identifier or the target global transaction identifier belongs to the active list, the old version data of the data item is inserted into the daily cut-off number table. This method can accurately determine the version data of the data item inserted into the daily cut-off number table, which is convenient for the processing of subsequent business.
[0058] In one embodiment, determining the version data of the data item to be inserted into the daily unloading number table according to the target global transaction identifier, the maximum global transaction identifier and the active list of the data item includes:
[0059] If the target global transaction identifier of the data item is less than or equal to the maximum global transaction identifier, and the target global transaction identifier does not belong to the active list, the current version data of the data item is inserted into the daily unloading table;
[0060] If the target global transaction identifier of the data item belongs to the active list, the previous old version of data that does not belong to the active list and corresponds to the target global transaction identifier is inserted into the daily unloading number table;
[0061] If the target global transaction identifier of the data item is greater than the maximum global transaction identifier, the previous old version of the data corresponding to the target global transaction identifier that is less than or equal to the maximum global transaction identifier is inserted into the daily unloading number table.
[0062] In this embodiment, the schematic diagram of determining the data version during the daily shedding process can be as follows: Figure 3 , row records refer to the data recorded in the database. For the row data with id=1, transaction 3 was processed on accounting date T0, money=money+20, and the initial money was 100. Therefore, the current version data of the data item after processing is money=120. The GTID corresponding to transaction 3 is 9, so the GTID of the current version data is also 9, that is, the target GTID of the data item is 9, 9 is equal to the maximum GTID, and 9 does not belong to the active list. The current version data of the data item with id=1 is the data of the daily cut-off number, which can be inserted into the daily cut-off number table. For the row data with id=2, since transaction 1 was processed on accounting date T1, the corresponding GTID=7, GTID=7 is the GTID in the active list. Therefore, when inserting into the daily cut-off number table, it is necessary to find the previous old version data and insert the old version data into the daily cut-off number table, that is, insert the old version data when money=100 and GTID=0 into the daily cut-off number table. Similarly, for the row data with id=3, transaction 2 was processed at T0, corresponding to GTID=8, and transaction 4 was processed at T1, corresponding to GTID=10. Since 10 exceeds the maximum GTID, the old version data with GTID=8 and money=130 is inserted into the daily unloading table.
[0063] In one embodiment, before reaching the preset daily cut-off number moment of the current accounting date, the method further includes: obtaining a daily cut-off number table; wherein the field information of the daily cut-off number table includes at least a bank identifier and an accounting date; and clearing the information in the daily cut-off number table.
[0064] In this embodiment, the daily cut-off number table can be a newly created business daily cut-off number table, which includes a bank identification field and an accounting date field. Since the database can store data of multiple storage node DNs, in order to distinguish different banks, the daily cut-off number table needs to include an identification field corresponding to each bank. At the same time, before unloading, the original information in the daily cut-off number table needs to be cleaned up and only the field information is retained.
[0065] In one embodiment, the database includes a timer, and the timer is used to clean up old version data under the same data item in the database when the timing is started and reaches a preset time; the method also includes: stopping the timer when a first moment is reached; wherein the first moment is a moment before a preset daily cut-off number moment.
[0066] Accordingly, when the day cut-off number of the current accounting date is completed, the timer is started.
[0067] In this embodiment, the database includes a timer, and the old version data under the same data item stored for a preset time can be cleaned up by the timer. Since it is necessary to select the data to be unloaded between the current version data and the old version data when performing daily unloading, it is necessary to retain the old version data within a certain period of time. The timer can be stopped at the first moment before the preset daily unloading moment to stop the task of regularly cleaning up the old version data. For example, the first moment can be a moment associated with the business timeout time, such as the first moment is the preset daily unloading moment-N×business timeout time, and the value of N is not limited, such as 2, 3, 4, etc. Of course, data cleaning can be performed in the storage node DN. At this time, the database needs to send a cleaning instruction to each storage node without restriction. In order to save storage space, after the daily unloading of the current accounting date is completed, the timer can be started immediately to resume the task of regularly cleaning up the old version data.
[0068] In one embodiment, in the process of determining the version data of the data item to be inserted into the daily shedding table according to the target global transaction identifier, the maximum global transaction identifier and the active list of the data item, it is necessary to query whether the target GTID belongs to the active list. When the second moment is reached, it is possible to query whether the target global transaction identifier belongs to the active list to avoid T0 transaction not being counted into the daily shedding table. At this time, the second moment is required to be a moment after the preset daily shedding moment. The second moment can be set to data associated with the business timeout time, for example, the second moment is the preset daily shedding moment + M × business timeout time, and the value of M is not limited, for example, it can be 2, 3, 4, etc., without limitation.
[0069] In a specific embodiment, a distributed database daily offloading method includes:
[0070] Step S1, obtain the maximum GTID of the T0 transaction record, assuming that the maximum GTID is 9.
[0071] Step S2, obtain the active GTID list: take those GTIDs of the T1 transaction that are smaller than the maximum GTID of T0 to form an active list.
[0072] Step S3, create a business day cut-off number table, which contains two fields: bank id (bank_id) and accounting date (accounting_date).
[0073] Step S4, clear the information in the business daily offloading number table before the daily offloading number.
[0074] Step S5: Stop the task of cleaning up old versions of data periodically before the daily offload. This operation is performed before (accounting date switching time point - 3 × business timeout time) to prevent the database from automatically cleaning up useful old versions of data. In this process, all computing nodes (CNs) are notified to stop the timer for periodically cleaning up old versions of data and no longer send cleaning instructions to DNs.
[0075] Step S6, start inserting into the business daily cut-off number table. Before the transaction is submitted, the business adds the insertion into the business daily cut-off number table according to whether it is within the daily cut-off number cycle, for example, inserting through the following instruction:
[0076] insert into table_dumpinfo(bank_id,accounting_date)values($bank_id,$accounting_date);
[0077] Because the database automatically adds a GTID column to the table when creating the table, the GTID value of the transaction itself is inserted when this statement is executed on the DN.
[0078] Step S7, query the active GTID list of daily cut-off numbers. The business queries the active GTID list, and the database returns a string to the business for subsequent daily cut-off number queries. This query is performed after (accounting date switching time point + 3 × business timeout time) to avoid T0 transactions not being recorded in the business daily cut-off number table.
[0079] The query needs to include the following GTID values:
[0080] A. t0_max_gtid=max(gtid) of T0
[0081] B. t1_gtid_list = {gitd set that is less than t0_max_gitd and whose accounting date is T1}
[0082] Query the transactions that have been completed before T0. After the business obtains the returned result string, it will be used in the subsequent daily offloading number.
[0083] Step S8, query the daily number of switches. After determining the active GTID list, use the following method to query the table that needs the daily number of switches. Assuming that the string returned in S7 is str, you can use comments to assemble str in the query statement to perform multi-version query. The business side can perform related data operations based on the result set obtained.
[0084] Step S9, after obtaining the daily uninstallation number, immediately start the task of restoring the scheduled cleanup of old version data to save storage space.
[0085] In this embodiment, by utilizing multi-version data, different versions of data can be quickly and accurately queried according to different needs, thereby realizing the daily offloading number of the business and providing services for subsequent reconciliation, interest settlement, and statistics of the business.
[0086] Based on the same technical concept, the second embodiment of the present application provides a distributed database daily offloading device, such as Figure 4 , the device comprises:
[0087] Acquisition module 401, used to acquire the maximum global transaction identifier allowed to be recorded on the current accounting date;
[0088] A search module 402 is used to search for all active global transaction identifiers that are smaller than the maximum global transaction identifier in the transaction data of the next accounting date, and use the set of active global transaction identifiers as an active list;
[0089] The first determination module 403 is used to determine, from the database, a data item to be inserted into the daily cut-off number table of the current accounting date when the preset daily cut-off number moment of the current accounting date is reached;
[0090] The second determination module 404 is used to determine the version data of the data item to be inserted into the daily switching number table according to the target global transaction identifier of the data item, the maximum global transaction identifier and the active list; wherein, when the target global transaction identifier exceeds the maximum global transaction identifier, or the target global transaction identifier belongs to the active list, the old version data of the data item is inserted into the daily switching number table.
[0091] The device uses the maximum global transaction identifier allowed to be recorded on the current accounting date and the active list of the next accounting date to insert the old version data of the data item into the daily cut-off number table when the target global transaction identifier exceeds the maximum global transaction identifier or the target global transaction identifier belongs to the active list. This can accurately determine the version data of the data item inserted into the daily cut-off number table, facilitating the processing of subsequent business.
[0092] like Figure 5 As shown, an embodiment of the present application provides an electronic device, including a processor 111, a communication interface 112, a memory 113 and a communication bus 114, wherein the processor 111, the communication interface 112, and the memory 113 communicate with each other through the communication bus 114.
[0093] Memory 113, used for storing computer programs;
[0094] In one embodiment of the present application, the processor 111 is used to execute the program stored in the memory 113 to implement the distributed database daily offloading method provided by any one of the above method embodiments, including:
[0095] Get the maximum global transaction identifier allowed to be recorded on the current accounting date;
[0096] Searching for all active global transaction identifiers smaller than the maximum global transaction identifier in the transaction data of the next accounting date, and taking the set of active global transaction identifiers as an active list;
[0097] When the preset day cut-off number moment of the current accounting date is reached, determining from the database a data item to be inserted into the day cut-off number table of the current accounting date;
[0098] Determine the version data of the data item to be inserted into the daily cutoff number table according to the target global transaction identifier of the data item, the maximum global transaction identifier and the active list; wherein, when the target global transaction identifier exceeds the maximum global transaction identifier, or the target global transaction identifier belongs to the active list, insert the old version data of the data item into the daily cutoff number table.
[0099] The communication bus mentioned in the above terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0100] The communication interface is used for communication between the above terminal and other devices.
[0101] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0102] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0103] An embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the distributed database daily offloading method provided in any one of the aforementioned method embodiments is implemented.
[0104] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or 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.
[0105] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a general hardware platform, and of course, by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the relevant technology can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0106] It should be understood that the terms used herein are only for the purpose of describing specific example embodiments and are not intended to be limiting. Unless the context clearly indicates otherwise, the singular forms "one", "an" and "said" as used herein may also be meant to include plural forms. The terms "include", "comprise", "contain", and "have" are inclusive, and therefore specify the existence of stated features, steps, operations, elements and / or parts, but do not exclude the existence or addition of one or more other features, steps, operations, elements, parts, and / or combinations thereof. The method steps, processes, and operations described herein are not interpreted as necessarily requiring them to be performed in the specific order described or illustrated, unless the execution order is clearly indicated. It should also be understood that additional or alternative steps may be used.
[0107] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application. In the description, the suffixes such as "module", "component" or "unit" used to represent the elements are only used to facilitate the description of the present application and have no specific meaning in themselves. Therefore, "module", "component" or "unit" can be used in a mixed manner.
[0108] The above description is only a specific implementation of the present application, so that those skilled in the art can understand or implement 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 range consistent with the principles and novel features applied for herein.
Claims
1. A distributed database daily offloading method, characterized in that: The method comprises: Get the maximum global transaction identifier allowed to be recorded on the current accounting date; Searching for all active global transaction identifiers smaller than the maximum global transaction identifier in the transaction data of the next accounting date, and taking the set of active global transaction identifiers as an active list; When the preset day cut-off number moment of the current accounting date is reached, determining from the database a data item to be inserted into the day cut-off number table of the current accounting date; Determine the version data of the data item to be inserted into the daily cutoff number table according to the target global transaction identifier of the data item, the maximum global transaction identifier and the active list; wherein, when the target global transaction identifier exceeds the maximum global transaction identifier, or the target global transaction identifier belongs to the active list, insert the old version data of the data item into the daily cutoff number table.
2. The method according to claim 1, characterized in that Determining version data of the data item to be inserted into the daily unloading number table according to the target global transaction identifier of the data item, the maximum global transaction identifier, and the active list, including: If the target global transaction identifier of the data item is less than or equal to the maximum global transaction identifier, and the target global transaction identifier does not belong to the active list, inserting the current version data of the data item into the daily unloading number table; If the target global transaction identifier of the data item belongs to the active list, inserting the previous old version data corresponding to the target global transaction identifier that does not belong to the active list into the daily unloading number table; If the target global transaction identifier of the data item is greater than the maximum global transaction identifier, the previous old version data corresponding to the target global transaction identifier that is less than or equal to the maximum global transaction identifier is inserted into the daily unloading number table.
3. The method according to claim 1, characterized in that Before reaching the preset day cut-off number moment of the current accounting date, the method further comprises: Obtaining the daily cut-off number table; wherein the field information of the daily cut-off number table at least includes a bank identifier and an accounting date; Clear the information in the daily cut-off number table.
4. The method according to claim 1, characterized in that The database includes a timer, and the timer is used to clean up old version data under the same data item in the database when the timer is started and reaches a preset time. The method also includes: When a first moment is reached, the timer is stopped; wherein the first moment is a moment before the preset daily cut-off time; Accordingly, when the daily cut-off number of the current accounting date is completed, the timer is started.
5. The method according to claim 4, characterized in that The duration between the first moment and the preset daily shedding time is positively correlated with the service timeout time.
6. The method according to claim 2, characterized in that The method further comprises: When the second time is reached, query whether the target global transaction identifier belongs to the active list; wherein the second time is a time after the preset daily offloading time.
7. The method according to claim 6, characterized in that The duration between the second moment and the preset daily shedding time is positively correlated with the service timeout time.
8. A distributed database daily unloading device, characterized in that: The device comprises: An acquisition module is used to obtain the maximum global transaction identifier allowed to be recorded on the current accounting date; A search module, used for searching all active global transaction identifiers smaller than the maximum global transaction identifier in the transaction data of the next accounting date, and taking the set of active global transaction identifiers as an active list; A first determination module is used to determine, from a database, a data item to be inserted into a daily cut-off number table of the current accounting date when a preset daily cut-off number moment of the current accounting date is reached; The second determination module is used to determine the version data of the data item to be inserted into the daily switching number table according to the target global transaction identifier of the data item, the maximum global transaction identifier and the active list; wherein, when the target global transaction identifier exceeds the maximum global transaction identifier, or the target global transaction identifier belongs to the active list, the old version data of the data item is inserted into the daily switching number table.
9. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; The processor is used to implement the distributed database daily offloading method described in any one of claims 1-7 when executing the program stored in the memory.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the distributed database daily offloading method as described in any one of claims 1 to 7 is implemented.