CN106933657B - Database deadlock processing method and device - Google Patents

Database deadlock processing method and device Download PDF

Info

Publication number
CN106933657B
CN106933657B CN201710140957.XA CN201710140957A CN106933657B CN 106933657 B CN106933657 B CN 106933657B CN 201710140957 A CN201710140957 A CN 201710140957A CN 106933657 B CN106933657 B CN 106933657B
Authority
CN
China
Prior art keywords
database
deadlock
file
updating
information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710140957.XA
Other languages
Chinese (zh)
Other versions
CN106933657A (en
Inventor
陈亚坤
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Bank of China Ltd
Original Assignee
Bank of China Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Bank of China Ltd filed Critical Bank of China Ltd
Priority to CN201710140957.XA priority Critical patent/CN106933657B/en
Publication of CN106933657A publication Critical patent/CN106933657A/en
Application granted granted Critical
Publication of CN106933657B publication Critical patent/CN106933657B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/466Transaction processing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/52Program synchronisation; Mutual exclusion, e.g. by means of semaphores
    • G06F9/524Deadlock detection or avoidance

Abstract

The invention provides a database deadlock processing method and device, which comprise the following steps: acquiring a file to be processed, and determining a partition rule of the file to be processed; searching a main record file related to the file to be processed from a database, and determining a partition rule of the main record file; and comparing the partition rule of the file to be processed with the partition rule of the main recording file, when the partition rule of the file to be processed is different from the partition rule of the main recording file, re-partitioning the file to be processed according to the partition rule of the main recording file, and updating the main recording file according to the re-partitioned file to be processed. The data to be processed is correspondingly processed before the database deadlock occurs, so that the database deadlock is prevented from occurring, one or more transactions do not need to be abandoned, the time length of concurrent transaction processing is not influenced, the timeliness is strong, the running stability of the host system is not influenced, and the maintenance workload of the host system is reduced.

Description

Database deadlock processing method and device
Technical Field
The invention relates to the technical field of databases, in particular to a database deadlock processing method and device.
Background
The existing host system has a strong capability of concurrent transaction processing, and the transaction refers to a program execution unit which is accessed by a database system in the host system and can update various data in the database. In a system using a database table, database Deadlock cannot be avoided as long as there are a lot of concurrent updates to centralized resources (data) (Deadlock, which means that in a database system, a transaction T1 blocks data a, and a transaction T2 blocks data B. after that, a transaction T1 applies for blocking data B, a transaction T2 also applies for blocking data a, since a transaction T1 has blocked data a and a transaction T2 has blocked data B, a transaction T2 such as a transaction T1 occurs, and a transaction T2 waits for a transaction T1, and both transactions cannot end to form Deadlock). For example, if there are master-slave dependencies between data records and the master record needs to be updated when processing the slave records, and if the master-slave records are not in the same database partition and are not processed in the same job, a deadlock may occur between jobs. For another example, for two entity (data) tables a and B (which may be multiple) that need to be updated continuously, if the partition rules of the entity (data) tables a and B are not consistent, a deadlock may occur between jobs. The database partitioning refers to further subdividing the data table into segments according to preset conditions, and the segments of the database objects are called partitions. Partitioning of the data table is accomplished by a "partition key," which refers to columns that determine the partition in which a row is located. The preset conditions may include the following: (1) range partitioning: each partition is specified by a range of partition key values (for a table with the date column as the partition key, the "1 month 2005" partition contains rows with partition key values from "1 month 1 day 2005" to "31 month 1 year 2005". (2) List partitioning: each partition is specified by a list of partition key values (for a list of regions as a table of partition keys, "north american" partition may contain the values "canada," "usa," and "mexico"). (3) And (4) hash partitioning: a hashing algorithm is used with the partition keys to determine the partition in which the designated row is located. (4) Combined range hash partitioning: a combination of range and hash partitioning techniques whereby a table is first range partitioned and then further subdivided using hash partitioning techniques for each individual range partition. (5) Combined range list partitioning: a combination of range and list partitioning techniques whereby the table is first range partitioned and then further subdivided using the list partitioning technique for each individual range partition.
The general process flow for database deadlock is: after the database is found to be dead locked, one or more of the transactions are abandoned and rolled back to release resources, namely, the operation or transaction is automatically interrupted, and the normal completion of the other transaction is ensured; and calling operation error report information by maintenance personnel to find the abnormality, and then processing according to a given emergency method. The above scheme has the following problems: after the deadlock of the database occurs, the processing is carried out, the running stability of the host system is influenced, and the maintenance workload of the host system is increased; one or more of the transactions are abandoned, only one transaction is processed, the duration of concurrent transaction processing is influenced, and the timeliness is poor; maintenance personnel cannot find the occurrence of database deadlock in time and influence the timeliness of concurrent transaction processing.
Disclosure of Invention
The embodiment of the invention provides a database deadlock processing method, which is used for correspondingly processing data to be processed before database deadlock occurs, so that the database deadlock is prevented from occurring, one or more transactions do not need to be abandoned, the time length of concurrent transaction processing is not influenced, the timeliness is strong, the stability of the operation of a host system is not influenced, and the maintenance workload of the host system is reduced. The method comprises the following steps:
acquiring a file to be processed, and determining a partition rule of the file to be processed;
searching a main record file related to the file to be processed from a database, and determining a partition rule of the main record file;
and comparing the partition rule of the file to be processed with the partition rule of the main recording file, when the partition rule of the file to be processed is different from the partition rule of the main recording file, re-partitioning the file to be processed according to the partition rule of the main recording file, and updating the main recording file according to the re-partitioned file to be processed.
In one embodiment, further comprising: when the database deadlock occurs when the updating operation is executed, the error information of the updating operation is automatically acquired, and when the error information of the updating operation is analyzed to determine that the database deadlock occurs, the error information of the updating operation is sent to a database maintenance worker.
In one embodiment, after analyzing the update operation error information to determine that a database deadlock occurs, the method further includes:
and acquiring deadlock processing information of the database, and sending the deadlock processing information of the database to a database maintainer.
In one embodiment, analyzing the update operation error information to determine that a database deadlock has occurred includes:
and when the error information of the updating operation contains specified information, determining that the deadlock of the database occurs.
In one embodiment, the designation information includes deadlock or timeout.
The embodiment of the invention also provides a database deadlock processing device, which is used for correspondingly processing the data to be processed before the database deadlock occurs, so that the database deadlock is prevented from occurring, one or more transactions do not need to be abandoned, the duration of concurrent transaction processing is not influenced, the timeliness is strong, the stability of the operation of the host system is not influenced, and the maintenance workload of the host system is reduced. The device includes:
the acquisition module is used for acquiring the file to be processed and determining the partition rule of the file to be processed;
the searching module is used for searching a main recording file related to the file to be processed from a database and determining a partition rule of the main recording file;
the comparison module is used for comparing the partition rule of the file to be processed with the partition rule of the main recording file;
and the partition updating module is used for re-partitioning the file to be processed according to the partition rule of the main recording file and updating the main recording file according to the re-partitioned file to be processed when the partition rule of the file to be processed is different from the partition rule of the main recording file.
In one embodiment, further comprising: a database deadlock processing module;
the database deadlock processing module is configured to: when the database deadlock occurs when the updating operation is executed, the error information of the updating operation is automatically acquired, and when the error information of the updating operation is analyzed to determine that the database deadlock occurs, the error information of the updating operation is sent to a database maintenance worker.
In one embodiment, the database deadlock processing module is further configured to:
and after the updating operation error information is analyzed to determine that the database deadlock occurs, acquiring database deadlock processing information and sending the database deadlock processing information to a database maintenance personnel.
In one embodiment, the database deadlock processing module is specifically configured to:
analyzing the error information of the updating operation to determine the occurrence of the database deadlock according to the following modes:
and when the error information of the updating operation contains specified information, determining that the deadlock of the database occurs.
In one embodiment, the designation information includes deadlock or timeout.
In the embodiment of the invention, aiming at the main and sub subdependencies among data records, the main record is required to be updated when the sub records are processed, if the main and sub records are not in the same database partition and are not processed in the same job, deadlock can be generated among the jobs. Compared with the prior art, the method and the device have the advantages that the corresponding pretreatment is carried out on the data to be processed before the database deadlock occurs, so that the database deadlock is prevented, one party or more parties of the transactions do not need to be abandoned, the time length of concurrent transaction processing is not influenced, the timeliness is high, the stability of the operation of the host system is not influenced, and the maintenance workload of the host system is reduced.
The embodiment of the invention also provides a database deadlock processing method, which is used for correspondingly processing the data to be processed before the database deadlock occurs, thereby preventing the database deadlock from occurring, avoiding abandoning one or more transactions, not influencing the time length of concurrent transaction processing, ensuring strong timeliness, not influencing the running stability of the host system and reducing the maintenance workload of the host system. The method comprises the following steps:
acquiring data table updating request information; the data table updating request information comprises data table information to be updated;
searching a plurality of corresponding data tables from a database according to the data table information to be updated in the data table updating request information, and determining the association relation among the data tables and the partition rule of the data tables;
determining the updating sequence of the data tables according to the incidence relation among the data tables;
and comparing the partition rules of the adjacent data tables in the plurality of data tables according to the updating sequence, updating the previous data table in the updating sequence when the partition rules of the adjacent data tables are different to generate a first intermediate file, re-partitioning the first intermediate file according to the partition rule of the next data table in the updating sequence to generate a second intermediate file, and updating the next data table according to the second intermediate file.
In one embodiment, further comprising: when the database deadlock occurs when the updating operation is executed, the error information of the updating operation is automatically acquired, and when the error information of the updating operation is analyzed to determine that the database deadlock occurs, the error information of the updating operation is sent to a database maintenance worker.
In one embodiment, after analyzing the update operation error information to determine that a database deadlock occurs, the method further includes:
and acquiring deadlock processing information of the database, and sending the deadlock processing information of the database to a database maintainer.
In one embodiment, analyzing the update operation error information to determine that a database deadlock has occurred includes:
and when the error information of the updating operation contains specified information, determining that the deadlock of the database occurs.
In one embodiment, the designation information includes deadlock or timeout.
The embodiment of the invention also provides a database deadlock processing device, which is used for correspondingly processing the data to be processed before the database deadlock occurs, so that the database deadlock is prevented from occurring, one or more transactions do not need to be abandoned, the duration of concurrent transaction processing is not influenced, the timeliness is strong, the stability of the operation of the host system is not influenced, and the maintenance workload of the host system is reduced. The device includes:
the acquisition module is used for acquiring the data table updating request information; the data table updating request information comprises data table information to be updated;
the searching module is used for searching a plurality of corresponding data tables from the database according to the data table updating request information and determining the incidence relation among the data tables and the partition rules of the data tables;
the updating sequence determining module is used for determining the updating sequence of the data tables according to the incidence relation among the data tables;
the comparison module compares the partition rules of adjacent data tables in the plurality of data tables according to the updating sequence;
and the partition updating module is used for updating the previous data table in the two adjacent data tables in the updating sequence to generate a first intermediate file when the partition rules of the two adjacent data tables are different, re-partitioning the first intermediate file according to the partition rule of the next data table in the two adjacent data tables in the updating sequence to generate a second intermediate file, and updating the next data table according to the second intermediate file.
In one embodiment, further comprising: a database deadlock processing module;
the database deadlock processing module is configured to: when the database deadlock occurs when the updating operation is executed, the error information of the updating operation is automatically acquired, and when the error information of the updating operation is analyzed to determine that the database deadlock occurs, the error information of the updating operation is sent to a database maintenance worker.
In one embodiment, the database deadlock processing module is further configured to:
and after the updating operation error information is analyzed to determine that the database deadlock occurs, acquiring database deadlock processing information and sending the database deadlock processing information to a database maintenance personnel.
In one embodiment, the database deadlock processing module is specifically configured to:
analyzing the error information of the updating operation to determine the occurrence of the database deadlock according to the following modes:
and when the error information of the updating operation contains specified information, determining that the deadlock of the database occurs.
In one embodiment, the designation information includes deadlock or timeout.
In the embodiment of the invention, aiming at the condition that two entity (data) tables A and B need to be updated continuously, if partition rules of the entity (data) tables A and B are not consistent, deadlock is possibly generated between jobs, the invention can carry out updating operation on the former data table when partition rules of adjacent data tables are different, generate a first intermediate file, re-partition the first intermediate file according to the partition rule of the latter data table, generate a second intermediate file, and carry out updating operation on the latter data table according to the second intermediate file. Compared with the prior art, the method and the device have the advantages that the corresponding pretreatment is carried out on the data to be processed before the database deadlock occurs, so that the database deadlock is prevented, one party or more parties of the transactions do not need to be abandoned, the time length of concurrent transaction processing is not influenced, the timeliness is high, the stability of the operation of the host system is not influenced, and the maintenance workload of the host system is reduced.
In addition, after the database deadlock occurs, error information of updating operation on the database can be automatically acquired, and the error information of the updating operation is sent to database maintenance personnel, so that the maintenance personnel can find the occurrence of the database deadlock in time, and the timeliness of concurrent transaction processing is not influenced.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a flowchart of a database deadlock processing method according to an embodiment of the present invention;
FIG. 2 is a first diagram illustrating a database deadlock processing apparatus according to an embodiment of the present invention;
FIG. 3 is a flowchart of a database deadlock processing method according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a database deadlock processing apparatus according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. 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.
Aiming at the situation that the main and sub-subdependencies exist among the data records, the main records need to be updated when the sub-records are processed, and if the main and sub-records are not in the same database partition and are not processed in the same job, deadlock can be generated among the jobs.
Fig. 1 is a flowchart of a database deadlock processing method according to an embodiment of the present invention, which is known from the flowchart shown in fig. 1, and in an embodiment of the present invention, the database deadlock processing method includes:
step 101: acquiring a file to be processed, and determining a partition rule of the file to be processed;
step 102: searching a main record file related to the file to be processed from a database, and determining a partition rule of the main record file;
step 103: and comparing the partition rule of the file to be processed with the partition rule of the main recording file, when the partition rule of the file to be processed is different from the partition rule of the main recording file, re-partitioning the file to be processed according to the partition rule of the main recording file, and updating the main recording file according to the re-partitioned file to be processed.
In specific implementation, according to the characteristics of the data to be processed, for example, the application operation of the sub-records (data in the file to be processed) is only writing, while the application operation of the main record is updating, at this time, the input file (file to be processed) which is originally split according to the range of the sub-records is correspondingly searched for the corresponding main record file according to the relation of the main and sub-records, the files to be processed are recombined and split (re-partitioned) again according to the range (partition rule) of the main record file to form a new input file, and the main record file is updated according to the new input file, so that the updating operation of each job is concentrated in one partition, and the database deadlock is avoided.
In specific implementation, a general processing flow for database deadlock is as follows: and calling operation error report information by maintenance personnel to find the abnormality, and then processing according to a given emergency method. Therefore, maintenance personnel cannot find the occurrence of the deadlock of the database in time, and the timeliness of concurrent transaction processing is influenced. Based on this, the method of the invention can also adopt the following mode after the deadlock of the database occurs: and automatically acquiring error information (such as log information) of the updating operation, and when the error information of the updating operation is analyzed to determine that the deadlock of the database occurs, sending the error information of the updating operation to a database maintenance personnel. Specifically, the database deadlock is determined to occur when the update operation error information includes specific information, where the specific information may include deadlock or timeout, and the like.
Based on the same inventive concept, an embodiment of the present invention further provides a database deadlock processing apparatus, as described in the following embodiments. Because the principle of solving the problem of the database deadlock processing device is similar to that of the database deadlock processing method, the implementation of the database deadlock processing device can refer to the implementation of the database deadlock processing method, and repeated parts are not described again. As used hereinafter, the term "unit" or "module" may be a combination of software and/or hardware that implements a predetermined function. Although the means described in the embodiments below are preferably implemented in software, an implementation in hardware, or a combination of software and hardware is also possible and contemplated.
Fig. 2 is a schematic structural diagram of a database deadlock processing apparatus according to an embodiment of the present invention, as shown in fig. 2, in an embodiment of the present invention, a database deadlock processing apparatus includes:
an obtaining module 202, configured to obtain a file to be processed, and determine a partition rule of the file to be processed;
the searching module 204 is configured to search a main record file associated with the file to be processed from a database, and determine a partition rule of the main record file;
a comparison module 206, configured to compare the partition rule of the file to be processed with the partition rule of the main record file;
and the partition updating module 208 is configured to, when the partition rule of the to-be-processed file is different from the partition rule of the main record file, re-partition the to-be-processed file according to the partition rule of the main record file, and update the main record file according to the re-partitioned to-be-processed file.
This structure will be explained below.
In specific implementation, the database deadlock processing apparatus further includes: a database deadlock processing module;
the database deadlock processing module is configured to: when the database deadlock occurs when the updating operation is executed, the error information of the updating operation is automatically acquired, and when the error information of the updating operation is analyzed to determine that the database deadlock occurs, the error information of the updating operation is sent to a database maintenance worker.
In specific implementation, the database deadlock processing module is further configured to:
and after the updating operation error information is analyzed to determine that the database deadlock occurs, acquiring database deadlock processing information and sending the database deadlock processing information to a database maintenance personnel.
In specific implementation, the database deadlock processing module is specifically configured to:
analyzing the error information of the updating operation to determine the occurrence of the database deadlock according to the following modes:
and when the error information of the updating operation contains specified information, determining that the deadlock of the database occurs.
In specific implementation, the specific information includes a deadlock or timeout.
Aiming at the condition that two entity (data) tables A and B (a plurality of entity (data) tables A and B) need to be updated continuously, and if partition rules of the entity (data) tables A and B are inconsistent, deadlock can be generated between operations, the invention provides another database deadlock processing method, which carries out modification in the process, namely asynchronous processing, disassembles continuous updating actions and prevents database deadlock from occurring.
Fig. 3 is a flowchart of a database deadlock processing method according to an embodiment of the present invention, and it is known from the flowchart shown in fig. 3 that, in the embodiment of the present invention, the database deadlock processing method includes:
step 301: acquiring data table updating request information; the data table updating request information comprises data table information to be updated;
step 302: searching a plurality of corresponding data tables from a database according to the data table information to be updated in the data table updating request information, and determining the association relation among the data tables and the partition rule of the data tables;
step 303: determining the updating sequence of the data tables according to the incidence relation among the data tables;
step 304: and comparing the partition rules of the adjacent data tables in the plurality of data tables according to the updating sequence, updating the previous data table in the updating sequence when the partition rules of the adjacent data tables are different to generate a first intermediate file, re-partitioning the first intermediate file according to the partition rule of the next data table in the updating sequence to generate a second intermediate file, and updating the next data table according to the second intermediate file.
In specific implementation, the partition rules of adjacent data tables in the multiple data tables are compared according to the updating sequence, which means that two data tables are compared. For example, there are three data tables A, B, C, the partition rules of data table A and B are compared, and the partition rules of data table B and C are compared. When the partition rules of the adjacent data tables are different, the partition rules of the data table A and the data table B are different, and the partition rules of the data table B and the data table C are different. The partition rules of the data table a and the data table C may be the same or different.
The procedure of the method is described below in terms of updating two data tables and updating three data tables.
For example, for a situation where two entity tables A and B need to be updated consecutively. The first obtained data table update request information includes information of the entity tables a and B, such as data table names, data information in the data tables, information to be updated in the data tables a and B, and the like. According to the information of the entity tables A and B in the data table updating request information, corresponding data tables A and B are searched from a database, then the association relationship between the data tables A and B and the partition rule of the data tables A and B are determined, and the updating sequence of the data tables A and B is determined according to the association relationship between the data tables A and B, for example, the data tables A and B can be updated firstly and then the data tables B are updated. Then, comparing the partition rules of the data tables A and B, and updating the data tables A and B simultaneously when the partition rules of the data tables A and B are the same; when the partition rules of the data tables A and B are inconsistent, step updating is adopted, namely, the table A is normally processed (updated) at first, the first updating operation is completed, a result file group a is generated, then the files a1, a2 and … … an in the intermediate file group a are recombined according to the partition rules of the data table B, an intermediate file group B is generated, wherein the file group B comprises B1, B2 and … … bn, and the data table B is updated according to B1, B2 and … … bn, so that the second updating operation is completed.
For example, three data tables A, B and C may need to be updated in succession. The first obtained data table update request information includes information of the entity tables A, B and C, corresponding data tables A, B and C are searched from the database according to the information of the entity tables A, B and C in the data table update request information, then the association relationship between the data tables A, B and C, the partition rules of the data tables A, B and C, and the update sequence of the data tables A, B and C is determined according to the association relationship between the data tables A, B and C, for example, A can be updated first, then B can be updated, and C can be updated second. And then comparing the partition rules of the data tables A and B, and the partition rules of the data tables B and C, updating the data tables A and B simultaneously when the partition rules of the data tables A and B are the same, and updating the data tables B and C simultaneously when the partition rules of the data tables B and C are the same. When the partition rules of the data tables A and B are inconsistent, step updating is adopted, namely, the table A is normally processed (updated) at first, the first updating operation is completed, a result file group a is generated, then the files a1, a2 and … … an in the intermediate file group a are recombined according to the partition rules of the data table B, an intermediate file group B is generated, wherein the file group B comprises B1, B2 and … … bn, and the data table B is updated according to B1, B2 and … … bn, so that the second updating operation is completed. When the partition rules of the data tables B and C are inconsistent, step updating is also adopted, namely, the table B is processed (updated) normally and concurrently according to B1, B2 and … … bn to finish the second updating operation to generate a result file group C, then the files C1, C2 and … … cn in the intermediate file group C are recombined according to the partition rules of the data table C to generate an intermediate file group d, wherein the file group d comprises d1, d2 and … … dn, and then the data table C is updated according to d1, d2 and … … dn to finish the third updating operation.
In specific implementation, when a database deadlock occurs during execution of an update operation under the condition, the method also can automatically acquire update operation error information (such as log information), and when the update operation error information is analyzed to determine that the database deadlock occurs, the update operation error information is sent to a database maintenance worker, and meanwhile, database deadlock processing information is also acquired, and the database deadlock processing information is sent to the database maintenance worker. Specifically, the database deadlock is determined to occur only when the update operation error information includes specific information, where the specific information may include deadlock or timeout, and the like.
Based on the same inventive concept, an embodiment of the present invention further provides a database deadlock processing apparatus, as described in the following embodiments. The implementation of the database deadlock processing apparatus can also refer to the implementation of the database deadlock processing method, and repeated details are not repeated.
Fig. 4 is a schematic structural diagram of a database deadlock processing apparatus according to an embodiment of the present invention, as shown in fig. 4, in the embodiment of the present invention, the database deadlock processing apparatus includes:
an obtaining module 402, configured to obtain data table update request information; the data table updating request information comprises data table information to be updated;
a searching module 404, configured to search a plurality of corresponding data tables from the database according to the data table update request information, and determine an association relationship between the plurality of data tables and a partition rule of the plurality of data tables;
an update sequence determining module 406, configured to determine an update sequence of the multiple data tables according to an association relationship between the multiple data tables;
a comparison module 408 for comparing the partition rules of the adjacent data tables in the plurality of data tables according to the update sequence;
and the partition updating module 410 is configured to, when the partition rules of the adjacent data tables are different, perform an updating operation on a previous data table in the two adjacent data tables in the updating sequence to generate a first intermediate file, re-partition the first intermediate file according to the partition rule of a subsequent data table in the two adjacent data tables in the updating sequence to generate a second intermediate file, and perform an updating operation on the subsequent data table according to the second intermediate file.
This structure will be explained below.
In specific implementation, the database deadlock processing apparatus further includes: a database deadlock processing module;
the database deadlock processing module is configured to: when the database deadlock occurs when the updating operation is executed, the error information of the updating operation is automatically acquired, and when the error information of the updating operation is analyzed to determine that the database deadlock occurs, the error information of the updating operation is sent to a database maintenance worker.
In specific implementation, the database deadlock processing module is further configured to:
and after the updating operation error information is analyzed to determine that the database deadlock occurs, acquiring database deadlock processing information and sending the database deadlock processing information to a database maintenance personnel.
In specific implementation, the database deadlock processing module is specifically configured to:
analyzing the error information of the updating operation to determine the occurrence of the database deadlock according to the following modes:
and when the error information of the updating operation contains specified information, determining that the deadlock of the database occurs.
In specific implementation, the specific information includes a deadlock or timeout.
In summary, compared with the prior art, the method provided by the invention can start from the three aspects of the prior art, the prior art and the later art, and performs corresponding preprocessing on the data to be processed in the prior art and the prior art, thereby preventing the occurrence of database deadlock, so that one or more transactions are not required to be abandoned, the duration of concurrent transaction processing is not influenced, the timeliness is strong, the stability of the operation of the host system is not influenced, and the maintenance workload of the host system is reduced. When the database deadlock occurs, the error information of the updating operation of the database can be automatically acquired, and the error information of the updating operation is sent to the database maintenance personnel, so that the maintenance personnel can find the occurrence of the database deadlock in time without influencing the timeliness of concurrent transaction processing. In addition, the method of the invention has the following advantages:
(1) the method is easy to implement, the added partition updating module is not complex in principle, easy to write and low in implementation cost.
(2) The partition updating module can be applied to a plurality of scenes, such as a plurality of scenes that an account and a client or an account and a card user need to be updated simultaneously, and the reusability is good.
(3) The batch interruption times are greatly reduced. After the partition updating module is put into operation, the number of deadlock interruptions of batch processing only on the rest day is reduced from nearly 50 to 0.
(4) Maintenance becomes simple, deadlock information is automatically captured and pushed to a console, and the operation is clear at a glance.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The above description is only a preferred embodiment of the present invention, and is not intended to limit the present invention, and various modifications and changes may be made to the embodiment of the present invention by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (20)

1. A database deadlock processing method, comprising:
acquiring a file to be processed, and determining a partition rule of the file to be processed;
searching a main record file related to the file to be processed from a database, and determining a partition rule of the main record file;
and comparing the partition rule of the file to be processed with the partition rule of the main recording file, when the partition rule of the file to be processed is different from the partition rule of the main recording file, re-partitioning the file to be processed according to the partition rule of the main recording file, and updating the main recording file according to the re-partitioned file to be processed.
2. The database deadlock processing method according to claim 1, further comprising: when the database deadlock occurs when the updating operation is executed, the error information of the updating operation is automatically acquired, and when the error information of the updating operation is analyzed to determine that the database deadlock occurs, the error information of the updating operation is sent to a database maintenance worker.
3. The method for processing database deadlock according to claim 2, wherein after analyzing the update operation error information to determine that database deadlock has occurred, the method further comprises:
and acquiring deadlock processing information of the database, and sending the deadlock processing information of the database to a database maintainer.
4. The method of claim 2, wherein analyzing the update operation error information to determine that a database deadlock has occurred comprises:
and when the error information of the updating operation contains specified information, determining that the deadlock of the database occurs.
5. The database deadlock processing method according to claim 4, wherein the designation information includes deadlock or timeout.
6. A database deadlock processing apparatus, comprising:
the acquisition module is used for acquiring the file to be processed and determining the partition rule of the file to be processed;
the searching module is used for searching a main recording file related to the file to be processed from a database and determining a partition rule of the main recording file;
the comparison module is used for comparing the partition rule of the file to be processed with the partition rule of the main recording file;
and the partition updating module is used for re-partitioning the file to be processed according to the partition rule of the main recording file and updating the main recording file according to the re-partitioned file to be processed when the partition rule of the file to be processed is different from the partition rule of the main recording file.
7. The database deadlock processing apparatus according to claim 6, further comprising: a database deadlock processing module;
the database deadlock processing module is configured to: when the database deadlock occurs when the updating operation is executed, the error information of the updating operation is automatically acquired, and when the error information of the updating operation is analyzed to determine that the database deadlock occurs, the error information of the updating operation is sent to a database maintenance worker.
8. The database deadlock processing apparatus according to claim 7, wherein the database deadlock processing module is further configured to:
and after the updating operation error information is analyzed to determine that the database deadlock occurs, acquiring database deadlock processing information and sending the database deadlock processing information to a database maintenance personnel.
9. The database deadlock processing apparatus according to claim 6, wherein the database deadlock processing module is specifically configured to:
analyzing the error information of the updating operation to determine the occurrence of the database deadlock according to the following modes:
and when the error information of the updating operation contains specified information, determining that the deadlock of the database occurs.
10. The database deadlock processing apparatus according to claim 9, wherein the designation information comprises deadlock or timeout.
11. A database deadlock processing method, comprising:
acquiring data table updating request information; the data table updating request information comprises data table information to be updated;
searching a plurality of corresponding data tables from a database according to the data table information to be updated in the data table updating request information, and determining the association relation among the data tables and the partition rule of the data tables;
determining the updating sequence of the data tables according to the incidence relation among the data tables;
and comparing the partition rules of the adjacent data tables in the plurality of data tables according to the updating sequence, when the partition rules of the adjacent data tables are different, performing a first updating operation on the previous data table in the updating sequence to generate a first intermediate file, re-partitioning the first intermediate file according to the partition rule of the next data table in the updating sequence to generate a second intermediate file, and performing a second updating operation on the next data table according to the second intermediate file.
12. The database deadlock processing method according to claim 11, further comprising: when the database deadlock occurs when the updating operation is executed, automatically acquiring second updating operation error information, and when the second updating operation error information is analyzed to determine that the database deadlock occurs, sending the second updating operation error information to a database maintenance worker.
13. The method of claim 12, wherein after analyzing the second update operation error information to determine that the database deadlock has occurred, further comprising:
and acquiring deadlock processing information of the database, and sending the deadlock processing information of the database to a database maintainer.
14. The method of processing database deadlock according to claim 12, wherein analyzing the second update operation error information to determine that database deadlock has occurred comprises:
and when the second updating operation error information contains specified information, determining that the database deadlock occurs.
15. The database deadlock processing method according to claim 14, wherein the designation information includes deadlock or timeout.
16. A database deadlock processing apparatus, comprising:
the acquisition module is used for acquiring the data table updating request information; the data table updating request information comprises data table information to be updated;
the searching module is used for searching a plurality of corresponding data tables from the database according to the data table updating request information and determining the incidence relation among the data tables and the partition rules of the data tables;
the updating sequence determining module is used for determining the updating sequence of the data tables according to the incidence relation among the data tables;
the comparison module compares the partition rules of adjacent data tables in the plurality of data tables according to the updating sequence;
and the partition updating module is used for performing first updating operation on a previous data table in two adjacent data tables in the updating sequence when the partition rules of the two adjacent data tables are different to generate a first intermediate file, re-partitioning the first intermediate file according to the partition rule of a next data table in the two adjacent data tables in the updating sequence to generate a second intermediate file, and performing second updating operation on the next data table according to the second intermediate file.
17. The database deadlock processing apparatus according to claim 16, further comprising: a database deadlock processing module;
the database deadlock processing module is configured to: when the database deadlock occurs when the updating operation is executed, automatically acquiring second updating operation error information, and when the second updating operation error information is analyzed to determine that the database deadlock occurs, sending the second updating operation error information to a database maintenance worker.
18. The database deadlock processing apparatus according to claim 17, wherein the database deadlock processing module is further configured to:
and after the second updating operation error information is analyzed to determine that database deadlock occurs, acquiring database deadlock processing information and sending the database deadlock processing information to database maintenance personnel.
19. The database deadlock processing apparatus according to claim 16, wherein the database deadlock processing module is specifically configured to:
analyzing the error information of the second updating operation to determine that the database deadlock occurs according to the following modes:
and when the second updating operation error information contains specified information, determining that the database deadlock occurs.
20. The database deadlock processing apparatus according to claim 19, wherein the specifying information comprises deadlock or timeout.
CN201710140957.XA 2017-03-10 2017-03-10 Database deadlock processing method and device Active CN106933657B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710140957.XA CN106933657B (en) 2017-03-10 2017-03-10 Database deadlock processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710140957.XA CN106933657B (en) 2017-03-10 2017-03-10 Database deadlock processing method and device

Publications (2)

Publication Number Publication Date
CN106933657A CN106933657A (en) 2017-07-07
CN106933657B true CN106933657B (en) 2020-12-04

Family

ID=59433842

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710140957.XA Active CN106933657B (en) 2017-03-10 2017-03-10 Database deadlock processing method and device

Country Status (1)

Country Link
CN (1) CN106933657B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112256442A (en) * 2019-07-22 2021-01-22 中兴通讯股份有限公司 Database deadlock detection method and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101661402A (en) * 2008-08-29 2010-03-03 国际商业机器公司 Deadlock treatment method and system for databank management system
CN101876983A (en) * 2009-04-30 2010-11-03 国际商业机器公司 Method for partitioning database and system thereof
CN105373541A (en) * 2014-08-22 2016-03-02 博雅网络游戏开发(深圳)有限公司 Processing method and system for data operation request of database

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102890720A (en) * 2012-10-16 2013-01-23 南京通达海信息技术有限公司 Database inspection and maintenance method

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101661402A (en) * 2008-08-29 2010-03-03 国际商业机器公司 Deadlock treatment method and system for databank management system
CN101876983A (en) * 2009-04-30 2010-11-03 国际商业机器公司 Method for partitioning database and system thereof
CN105373541A (en) * 2014-08-22 2016-03-02 博雅网络游戏开发(深圳)有限公司 Processing method and system for data operation request of database

Also Published As

Publication number Publication date
CN106933657A (en) 2017-07-07

Similar Documents

Publication Publication Date Title
CN109271450B (en) Database synchronization method, device, server and storage medium
US9582520B1 (en) Transaction model for data stores using distributed file systems
US9372908B2 (en) Merging an out of synchronization indicator and a change recording indicator in response to a failure in consistency group formation
US7890508B2 (en) Database fragment cloning and management
EP0723238B1 (en) Relational database system and method with high data availability during table data restructuring
US9734223B2 (en) Difference determination in a database environment
US6477535B1 (en) Method and apparatus for concurrent DBMS table operations
US8719271B2 (en) Accelerating data profiling process
CN109643310B (en) System and method for redistribution of data in a database
JP7438603B2 (en) Transaction processing methods, apparatus, computer devices and computer programs
CN114661816B (en) Data synchronization method and device, electronic equipment and storage medium
US10901854B2 (en) Temporal logical transactions
CN111258985A (en) Data cluster migration method and device
CN115730008A (en) Log analysis method, data synchronization system, electronic device and storage medium
CN106933657B (en) Database deadlock processing method and device
CN110908978B (en) Database data structure verification method and device
CN115629822A (en) Concurrent transaction processing method and system based on multi-core processor
CN115687378A (en) DDL task parallel processing method, computing node and electronic equipment
CN111726249B (en) Configuration file processing method and device of network equipment
CN112000671A (en) Block chain-based database table processing method, device and system
CN116049302A (en) Cross-database data synchronization method
CN116521692A (en) Data synchronization method and device, electronic equipment and storage medium
CN114661719A (en) Method for creating global index on OpenGauss database partition table on line
CN115905402A (en) Method and device for processing transaction log

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant