WO2018113534A1 - Database deadlock processing method and apparatus, and database system - Google Patents

Database deadlock processing method and apparatus, and database system Download PDF

Info

Publication number
WO2018113534A1
WO2018113534A1 PCT/CN2017/115191 CN2017115191W WO2018113534A1 WO 2018113534 A1 WO2018113534 A1 WO 2018113534A1 CN 2017115191 W CN2017115191 W CN 2017115191W WO 2018113534 A1 WO2018113534 A1 WO 2018113534A1
Authority
WO
WIPO (PCT)
Prior art keywords
sub
transaction
savepoint
transactions
rollback
Prior art date
Application number
PCT/CN2017/115191
Other languages
French (fr)
Chinese (zh)
Inventor
范孝剑
张广舟
林晓斌
周正中
Original Assignee
阿里巴巴集团控股有限公司
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 阿里巴巴集团控股有限公司 filed Critical 阿里巴巴集团控股有限公司
Publication of WO2018113534A1 publication Critical patent/WO2018113534A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • 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
    • 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
    • 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

Definitions

  • the present application relates to the field of databases, and in particular, to a method, an apparatus, and a database system for processing a database deadlock.
  • Non-deprivation conditions The resources that the process has obtained cannot be forcibly deprived until the end of use.
  • Loop wait condition A loop-waiting resource relationship between head and tail is formed between several processes.
  • the method of resolving a deadlock in an existing database is usually determined by the database to determine whether a deadlock occurs. If a deadlock is found, the entire transaction operation is rolled back, and the application retry or requires human intervention. If a transaction takes a long time to execute, then when a transaction is forced to roll back due to a deadlock in execution, the transaction needs to be executed from the beginning, which can take a lot of unnecessary time.
  • the purpose of the embodiments of the present application is to provide a method, an apparatus, and a database system for processing a database deadlock to improve the execution efficiency of a transaction in which a deadlock occurs.
  • a method for processing a database deadlock comprising: dividing a transaction into N sub-transactions executed sequentially, wherein N is a positive integer greater than 1; each of the N sub-transactions Creating a savepoint before the transaction is executed; sequentially executing the N child transactions; when the nth child transaction of the N child transactions has a lock wait and the wait time is greater than the first wait time corresponding to the nth child transaction, the transaction is rolled back To roll back the savepoint, where n is a positive integer less than or equal to N, the rollback savepoint is a savepoint created before the execution of the nth child transaction; continue to execute the rollback in the N subtransactions Sub-transaction after the point.
  • an apparatus for processing a database deadlock comprising: a transaction division unit, an execution unit, a savepoint creation unit, and a transaction rollback unit, wherein the transaction division unit divides the transaction into sequentially executed N a sub-transaction, where N is a positive integer greater than one; the execution unit sequentially executes the N sub-transactions; the savepoint creation unit creates a savepoint before executing each of the N sub-transactions; when the N sub-transactions When the nth child transaction in the lock waits and the wait time is greater than the first wait time corresponding to the nth child transaction, the transaction rollback unit rolls back the transaction to the rollback savepoint, where n is less than or equal to N.
  • the rollback savepoint is a savepoint created before the execution of the nth child transaction; the execution unit continues to execute the N sequentially after the transaction rollback unit rolls back the transaction to the rollback savepoint The child transaction in the child transaction after the rollback savepoint.
  • the above at least one technical solution adopted by the embodiment of the present application can achieve the following beneficial effects: by splitting a transaction into multiple sub-transactions and setting a save point before execution, the sub-transaction in which the lock transaction waits for more than the first corresponding to the sub-transaction After waiting for the time, roll back to the savepoint before the child transaction and continue execution, so that the execution efficiency of the deadlock transaction can be improved to some extent.
  • FIG. 1 is a flowchart of a method for processing a database deadlock according to an embodiment of the present application
  • FIG. 2 is a flow chart of a specific processing method for database deadlock in an embodiment of the present application
  • FIG. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
  • FIG. 4 is a schematic structural diagram of an apparatus for processing a database deadlock according to an embodiment of the present application.
  • FIG. 5 is a schematic structural diagram of an apparatus for processing a database deadlock according to another embodiment of the present application.
  • FIG. 1 is a flow chart of a method for processing a database deadlock in an embodiment of the present application.
  • the method of Figure 1 is processed by the data
  • the device of the deadlock is executed.
  • the device that handles database deadlocks may be a functional module of the database system.
  • the method includes:
  • N is a positive integer greater than one.
  • Transaction is a program execution unit that accesses and possibly updates various data items in the database.
  • a transaction consists of the entire operation performed between a begin transaction and an end transaction.
  • a transaction can be a Structured Query Language (SQL) statement, a set of SQL statements, or an entire program.
  • SQL Structured Query Language
  • the transaction includes a plurality of Insert, Update, or Delete SQL statements and other database manipulation statements involving database modification, which can be further divided into a plurality of sub-transactions.
  • the transaction can be further divided into multiple sub-transactions.
  • the transaction can be divided into sub-transaction 1 and sub-transaction 2, where
  • Subtransaction 1 is:
  • Subtransaction 2 is:
  • the transaction can also be divided into a sub-transaction 1, a sub-transaction 2, and a sub-transaction 3, wherein
  • Subtransaction 1 is:
  • Subtransaction 2 is:
  • Subtransaction 3 is:
  • the sub-transaction may be divided according to the number of SQL statements therein, or the number of records inserted, updated, or deleted may be sub-transactions according to the number of records required to be inserted (updated), updated (updated), or deleted (Delete).
  • the sub-transaction is divided according to the pre-estimated execution time, and the application is not limited herein.
  • a savepoint is a logical point in a transaction process. By saving a point, the transaction can be rolled back to the state of the savepoint without having to roll back the entire transaction.
  • savepoints can be created with the savepoint savepoint_name command. Where savepoint_name represents the savepoint name.
  • n is a positive integer less than or equal to N
  • the rollback savepoint is a savepoint created before the execution of the nth child transaction.
  • nth sub-transaction of the present application refers to the nth sub-transaction executed sequentially in the N sub-transactions.
  • the rollback savepoint is a savepoint created before the execution of the nth child transaction.
  • the selection of the rollback savepoint determines the number of child transactions that the transaction needs to roll back. Therefore, before step S140, the method may further include: determining the rollback savepoint.
  • determining the rollback savepoint may be implemented as: when the nth sub-transaction of the N sub-transactions has a lock wait for the i-th time and the waiting time is greater than the first corresponding to the n-th sub-transaction Waiting time, according to the number of sub-transactions s that need to be rolled back according to the i-th lock, determine the roll-back save point, the mapping relationship between s and i is preset, and both i and s are positive integers.
  • mapping relationship between s and i is preset.
  • a mapping relationship table between s and i may be preset, or a functional relationship between s and i may be preset, and so on.
  • mapping relationship between s and i can be as shown in Table 1:
  • mapping relationship table and function relationship are only schematic, and in actual applications, they can be set according to actual conditions.
  • the number of sub-transactions s that need to be rolled back may be greater than the number n of sub-transactions that have been currently executed, when s ⁇ n, it may be determined that s sub-transactions need to be rolled back; when s ⁇ n To determine the need to roll back n child transactions. In other words, when s ⁇ n, it is determined that the first save point before the n-s+1th sub-transaction is the roll-back save point; or, when s ⁇ n, the save point before the first sub-transaction is determined. Save the point for this rollback.
  • the number of sub-transactions that need to be rolled back is determined by the number of times the lock waits and the waiting time is greater than the first waiting time, and the save point of the rollback is determined, thereby avoiding the rollback.
  • the child transaction is set too low to release the lock, or the transaction is rolled back due to too many child transaction settings being rolled back.
  • the first waiting time corresponding to the lock waiting of each of the N sub-transactions may be the same or different.
  • the first waiting time may be set by a user of the database.
  • the user can set a fixed value for the first waiting time, or set the first waiting time according to some configuration rule.
  • Setting a first waiting time according to a parameter for example, a data operation type according to the nth sub-transaction, a record number of data operations related to the n-th sub-transaction, a sequence number n of the n-th sub-transaction, and the nth At least one of the number of times the sub-transaction has a lock waiting, setting the first waiting time.
  • the first waiting time is set according to a random number. Setting the first wait time by random number prevents all connection timeouts from being the same.
  • the user can interfere with the deadlock process and improve the execution efficiency of the database.
  • the number of sub-transactions that are rolled back can be reduced to some extent on the premise that the lock is released after the sub-transaction is rolled back.
  • step S150 is specifically implemented as: after rolling back to the rollback savepoint and waiting for the second waiting time, continuing to sequentially execute the sub-sub-transactions of the N sub-transactions after the roll-back savepoint Transaction.
  • the second waiting time may be set by a user of the database.
  • the user can set a fixed value for the second waiting time or set the second waiting time according to some configuration rule.
  • the second waiting time is determined according to the type of SQL involved in the transaction.
  • data The second wait time of the Data Definition Language (DDL) type can be set longer; the second wait time of the data manipulation language (DML) can be set shorter, and so on.
  • DDL Data Definition Language
  • DML data manipulation language
  • the second waiting time is set according to a random number. Setting the second wait time by random number prevents all connection timeouts from being the same.
  • the transaction that holds the lock of the nth child transaction can be prevented to some extent without releasing the lock, thereby causing the nth child.
  • the transaction continues to lock out, further improving the execution efficiency of the deadlocked transaction.
  • the method further includes: when the save point corresponding to each of the N sub-transactions is created, the save point is sequentially recorded; and the transaction is rolled back to the rollback save When you click, delete the record of the savepoint created after the rollback savepoint.
  • the created savepoint can be deleted by the release savepoint command.
  • the specific command format is as follows
  • savepoint_name represents the name of the savepoint created.
  • the record of the savepoint created after the rollback savepoint is also deleted from the linked list or data structure.
  • the device for processing the database deadlock can quickly locate the save point of the rollback in the subsequent operation of determining the save point of the rollback.
  • the save points created by each of the N sub-transactions before execution may be stored in the linked list in order, wherein the roll-back save point is by searching The list is determined.
  • searching for a rollback savepoint that needs to be rolled back through the linked list can improve the efficiency of finding a rollback savepoint, thereby further improving the execution efficiency of the transaction in which the deadlock occurs.
  • each of the N sub-transactions is created by a savepoint created before the execution according to the sequence number of the savepoint and a predetermined rule, and the rollback savepoint is based on the back The serial number of the savepoint is determined by the predetermined rule.
  • the record of the savepoint is not required.
  • the naming rule of the savepoint can be agreed to as the identifier name + sequence number.
  • the name of the savepoint can be determined to be rolled back, thereby finding the savepoint.
  • FIG. 1 of the present application will be further described in conjunction with specific embodiments.
  • the transaction can be divided into three sub-transactions: sub-transaction 1, sub-transaction 2, and sub-transaction 3.
  • the execution order is performed in the order of sub-transaction 1, sub-transaction 2, and sub-transaction 3.
  • the savepoint savepoint1 is established; before the sub-transaction 2 is executed, the savepoint savepoint2 is established; before the sub-transaction 2 is executed, the savepoint savepoint3 is established.
  • a lock wait occurs when a transaction is executed to sub-transaction 3.
  • the first savepoint before the 3 subtransactions that is, the first savepoint savepoint3 before the child transaction 3.
  • the database needs to release the lock after savepoint3.
  • the database needs to release the lock after savepoint2.
  • a storage point is recorded using a linked list or the like in the embodiment of the present application, it is also necessary to delete the save point record after savepoint2.
  • the first savepoint before the child transaction that is, the first savepoint savepoint1 before the child transaction 1.
  • the database needs to release the lock after savepoint3.
  • a storage point is recorded using a linked list or the like in the embodiment of the present application, it is also necessary to delete the save point record after the savepoint3.
  • the identifier of the save point created before each sub-transaction is executed can be saved through the linked list.
  • the save points created by the three sub-transactions in Figure 2 are stored in the linked list in order of execution, corresponding to execution plan 1, execution plan 2, and execution plan 3.
  • the database can find the identifier of the corresponding savepoint from the linked list according to the number of sub-transactions that need to be rolled back.
  • the savepoint can be determined to be savepoint3, and so on.
  • the waiting time for the lock waiting for determining whether to time out it may be specified that the waiting time for each lock waiting is the same, or the number of times the timeout occurs according to the lock waiting, the number of the sub-transaction when the lock waits, and the time when the lock waits.
  • the waiting time waiting for can be randomly assigned according to the random number.
  • a wait time can be set. After the wait time elapses after the rollback, the sub-transaction is resumed, so that the transaction holding the lock of the transaction cannot be released in time. As a result, the transaction continues to lock waiting.
  • the execution bodies of the steps of the method provided by the embodiment shown in FIG. 1 may be the same device, or the method may also be performed by different devices.
  • the execution body of step S110 and step S120 may be device 1
  • the execution body of step S130 may be device 2
  • the execution body of step S110 may be device 1
  • the execution body of step S120 and step S130 may be device 2 ;and many more.
  • FIG. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
  • the electronic device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory, and may of course include hardware required for other services.
  • the processor reads the corresponding computer program from the non-volatile memory into memory and then runs to form a device that unlocks the user interface at a logical level.
  • the present application does not exclude other implementation manners, such as a logic device or a combination of software and hardware, etc., that is, the execution body of the following processing flow is not limited to each logical unit, and may be Hardware or logic device.
  • FIG. 4 is a schematic structural diagram of an apparatus 400 for processing a database deadlock according to an embodiment of the present application.
  • the device 400 for processing the database deadlock may be a database system or a specific implementation module in the database system, which is not limited herein.
  • the database deadlock device 400 can include a transaction partitioning unit 410, a savepoint creation unit 420, an execution unit 430, and a transaction rollback unit 440. among them,
  • the transaction dividing unit 410 divides the transaction into N sub-transactions that are sequentially executed, where N is a positive integer greater than one;
  • the savepoint creation unit 420 creates a savepoint before executing each of the N subtransactions
  • Execution unit 430 sequentially executes the N sub-transactions
  • the transaction rollback unit 440 rolls back the transaction to the rollback savepoint, where a positive integer less than or equal to N, the rollback savepoint is a savepoint created before the execution of the nth child transaction;
  • the execution unit 430 also continues to sequentially execute the sub-transactions of the N sub-transactions after the first save point after the transaction rollback unit 440 rolls back the to-be-executed transaction to the first savepoint.
  • FIG. 5 is a schematic structural diagram of an apparatus 400 for processing a database deadlock according to another embodiment of the present application.
  • the apparatus 400 may further include a determining unit 450, when the nth sub-transaction of the N sub-transactions has a lock wait for the i-th time and the waiting time is greater than the first wait corresponding to the n-th sub-transaction
  • the determining unit 450 determines the rollback savepoint according to the number of sub-transactions s that need to be rolled back according to the ith lock, and the mapping relationship between s and i is preset, and both i and s are positive integers.
  • the determining unit 450 determines, according to the number of sub-transactions that need to be rolled back corresponding to the ith lock, the rollback savepoint includes: the determining unit 450 may determine that the first savepoint before the ns sub-transaction is the The first save point, where s ⁇ n; or, the determining unit 45 may determine that the save point before the first sub-transaction is the first save point, where s ⁇ n.
  • the first waiting time is set by a user of the database system of the firm; or the first waiting time is set according to a random number.
  • the executing unit 430 continues to sequentially execute the sub-transactions of the N sub-transactions after the first save point after specifically rolling back to the first save point and waiting for the second waiting time.
  • the second waiting time is set according to a SQL type of the structured query language involved in the office; or the second waiting time is set by a user of the database system of the firm; or, the second The waiting time is set according to the random number.
  • the savepoint created by each of the N sub-transactions before execution is named according to a sequence number of the savepoint and a predetermined rule, and the rollback savepoint is based on the rollback savepoint.
  • the serial number and the predetermined rule are determined.
  • the save points created by each of the N sub-transactions before execution are stored in a linked list in a sequential order, and the roll-back save points are determined by searching the linked list.
  • the device 400 may further include a deleting unit 460. If the savepoint creation unit records the savepoint in sequence when creating a savepoint corresponding to each of the N child transactions; the delete unit may roll back the transaction to the back in the transaction rollback unit When you save a savepoint, delete the record of the savepoint created after the rollback savepoint.
  • the device 400 handling the database deadlock can also perform the method of FIG. 1 and implement database or process database deadlock The functions of the embodiment shown in FIG. 1 and FIG. 2 are not described herein again.
  • the present application also discloses a database system comprising the apparatus 400 for processing database deadlocks of the embodiment shown in FIG. 4 or 5.
  • PLD Programmable Logic Device
  • FPGA Field Programmable Gate Array
  • HDL Hardware Description Language
  • the controller can be implemented in any suitable manner, for example, the controller can take the form of, for example, a microprocessor or processor and a computer readable medium storing computer readable program code (eg, software or firmware) executable by the (micro)processor.
  • computer readable program code eg, software or firmware
  • examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, The Microchip PIC18F26K20 and the Silicone Labs C8051F320, the memory controller can also be implemented as part of the memory's control logic.
  • the controller can be logically programmed by means of logic gates, switches, ASICs, programmable logic controllers, and embedding. Microcontroller, etc. The form to achieve the same functionality.
  • a controller can therefore be considered a hardware component, and the means for implementing various functions included therein can also be considered as a structure within the hardware component.
  • a device for implementing various functions can be considered as a software module that can be both a method of implementation and a structure within a hardware component.
  • the system, device, module or unit illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product having a certain function.
  • a typical implementation device is a computer.
  • the computer can be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or A combination of any of these devices.
  • embodiments of the present application can be provided as a method, system, or computer program product.
  • the present application can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment in combination of software and hardware.
  • the application can 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, etc.) including computer usable program code.
  • the computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device.
  • the apparatus implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.
  • These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device.
  • the instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.
  • a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
  • processors CPUs
  • input/output interfaces network interfaces
  • memory volatile and non-volatile memory
  • the memory may include non-persistent memory, random access memory (RAM), and/or non-volatile memory in a computer readable medium, such as read only memory (ROM) or flash memory.
  • RAM random access memory
  • ROM read only memory
  • Memory is an example of a computer readable medium.
  • Computer readable media includes both permanent and non-persistent, removable and non-removable media.
  • Information storage can be implemented by any method or technology.
  • the information can be computer readable instructions, data structures, modules of programs, or other data.
  • Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory. (ROM), electrically erasable programmable read only memory (EEPROM), flash memory or other memory technology, compact disk read only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, Magnetic tape cartridges, magnetic tape storage or other magnetic storage devices or any other non-transportable media can be used to store information that can be accessed by a computing device.
  • computer readable media does not include temporary storage of computer readable media, such as modulated data signals and carrier waves.
  • embodiments of the present application can be provided as a method, system, or computer program product.
  • the present application can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment in combination of software and hardware.
  • the application can 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, etc.) including computer usable program code.
  • the application can be described in the general context of computer-executable instructions executed by a computer, such as a program module.
  • program modules include routines, programs, objects, components, data structures, and the like that perform particular tasks or implement particular abstract data types.
  • the present application can also be practiced in distributed computing environments where tasks are performed by remote processing devices that are connected through a communication network.
  • program modules can be located in both local and remote computer storage media including storage devices.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

A database deadlock processing method and apparatus, and a database system. The method comprises: dividing a transaction into N sub-transactions executed in sequence (S110); creating a savepoint and recording same before each of the N sub-transactions is executed (S120); sequentially executing the N sub-transactions (S130); when a lock wait occurs in an nth sub-transaction of the N sub-transactions and a waiting time is greater than a first waiting time corresponding to the nth sub-transaction, rolling the transaction back to a rollback savepoint (S140), wherein the rollback savepoint is a savepoint created before the nth sub-transaction is executed; and continuing to execute sub-transactions in the N sub-transactions in sequence following the rollback savepoint (S150). By means of dividing a transaction into a plurality of sub-transactions and setting a savepoint before execution, after the occurrence of a lock wait in a sub-transaction therein exceeds a first waiting time corresponding to the sub-transaction, the sub-transaction is rolled back to the savepoint prior to the sub-transaction and continues to be executed, so that the execution efficiency of a transaction experiencing deadlock can be improved to some extent.

Description

一种数据库死锁的处理方法、装置和数据库系统Method, device and database system for processing database deadlock
本申请要求2016年12月20日递交的申请号为201611183503.2、发明名称为“一种数据库死锁的处理方法、装置和数据库系统”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。The present application claims the priority of the Chinese Patent Application No. 201611183503.2, entitled "Processing Method, Apparatus and Database System for Database Deadlock", which is filed on December 20, 2016, the entire contents of which are incorporated herein by reference. In the application.
技术领域Technical field
本申请涉及数据库领域,尤其涉及数据库死锁的处理方法、装置和数据库系统。The present application relates to the field of databases, and in particular, to a method, an apparatus, and a database system for processing a database deadlock.
背景技术Background technique
数据库死锁是数据库中常见的问题。产生死锁一般需要以下四个必要条件:Database deadlocks are a common problem in databases. Generating a deadlock generally requires the following four necessary conditions:
(1)互斥条件:一个资源每次只能被一个进程使用。(1) Mutually exclusive conditions: A resource can only be used by one process at a time.
(2)请求与保持条件:一个进程因请求资源而阻塞时,对已获得的资源保持不放。(2) Request and hold conditions: When a process blocks due to requesting resources, it keeps the resources that have been acquired.
(3)不剥夺条件:进程已获得的资源,在末使用完之前,不能强行剥夺。(3) Non-deprivation conditions: The resources that the process has obtained cannot be forcibly deprived until the end of use.
(4)循环等待条件:若干进程之间形成一种头尾相接的循环等待资源关系。(4) Loop wait condition: A loop-waiting resource relationship between head and tail is formed between several processes.
现有数据库中解决死锁的方法,通常是由数据库来判定是否出现死锁,如果发现死锁则回滚整个事务操作,由应用程序进行重试或需要人为干预。如果事务需要很长时间才能执行完,那么当事务因执行到中间遇到死锁而被迫回滚时,事务需要从头开始执行,会耗费大量不必要的时间。The method of resolving a deadlock in an existing database is usually determined by the database to determine whether a deadlock occurs. If a deadlock is found, the entire transaction operation is rolled back, and the application retry or requires human intervention. If a transaction takes a long time to execute, then when a transaction is forced to roll back due to a deadlock in execution, the transaction needs to be executed from the beginning, which can take a lot of unnecessary time.
如何提高发生死锁的事务的执行效率,是本申请实施例所要解决的技术问题。How to improve the execution efficiency of a transaction in which a deadlock occurs is a technical problem to be solved in the embodiments of the present application.
发明内容Summary of the invention
本申请实施例的目的是提供一种数据库死锁的处理方法、装置和数据库系统,以提高发生死锁的事务的执行效率。The purpose of the embodiments of the present application is to provide a method, an apparatus, and a database system for processing a database deadlock to improve the execution efficiency of a transaction in which a deadlock occurs.
为解决上述技术问题,本申请实施例是这样实现的:To solve the above technical problem, the embodiment of the present application is implemented as follows:
第一方面,提供了一种数据库死锁的处理方法,该方法包括:将事务划分成顺序执行的N个子事务,其中,N为大于1的正整数;在该N个子事务中的每一个子事务执行之前创建保存点;顺序执行该N个子事务;当该N个子事务中的第n个子事务发生锁等待且等待时间大于该第n个子事务对应的第一等待时间时,将该事务回滚到回滚保存点,其中,n为小于或等于N的正整数,该回滚保存点为执行该第n个子事务之前创建的一个保存点;继续顺序执行该N个子事务中在该回滚保存点之后的子事务。 In a first aspect, a method for processing a database deadlock is provided, the method comprising: dividing a transaction into N sub-transactions executed sequentially, wherein N is a positive integer greater than 1; each of the N sub-transactions Creating a savepoint before the transaction is executed; sequentially executing the N child transactions; when the nth child transaction of the N child transactions has a lock wait and the wait time is greater than the first wait time corresponding to the nth child transaction, the transaction is rolled back To roll back the savepoint, where n is a positive integer less than or equal to N, the rollback savepoint is a savepoint created before the execution of the nth child transaction; continue to execute the rollback in the N subtransactions Sub-transaction after the point.
第二方面,提供了一种处理数据库死锁的装置,该装置包括:事务划分单元、执行单元、保存点创建单元和事务回滚单元,其中,该事务划分单元将事务划分成顺序执行的N个子事务,其中,N为大于1的正整数;该执行单元顺序执行该N个子事务;该保存点创建单元在执行该N个子事务中的每一个子事务之前创建保存点;当该N个子事务中的第n个子事务发生锁等待且等待时间大于该第n个子事务对应的第一等待时间时,该事务回滚单元将该事务回滚到回滚保存点,其中,n为小于等于N的正整数,该回滚保存点为执行该第n个子事务之前创建的一个保存点;该执行单元还在该事务回滚单元将该事务回滚到该回滚保存点之后,继续顺序执行该N个子事务中在该回滚保存点之后的子事务。In a second aspect, an apparatus for processing a database deadlock is provided, the apparatus comprising: a transaction division unit, an execution unit, a savepoint creation unit, and a transaction rollback unit, wherein the transaction division unit divides the transaction into sequentially executed N a sub-transaction, where N is a positive integer greater than one; the execution unit sequentially executes the N sub-transactions; the savepoint creation unit creates a savepoint before executing each of the N sub-transactions; when the N sub-transactions When the nth child transaction in the lock waits and the wait time is greater than the first wait time corresponding to the nth child transaction, the transaction rollback unit rolls back the transaction to the rollback savepoint, where n is less than or equal to N. a positive integer, the rollback savepoint is a savepoint created before the execution of the nth child transaction; the execution unit continues to execute the N sequentially after the transaction rollback unit rolls back the transaction to the rollback savepoint The child transaction in the child transaction after the rollback savepoint.
本申请实施例采用的上述至少一个技术方案能够达到以下有益效果:通过将事务拆分成多个子事务并在执行前设置保存点,在其中的子事务发生锁等待超过该子事务对应的第一等待时间后回滚到该子事务之前的保存点并继续执行,从而能够在一定程度提高发生死锁的事务的执行效率。The above at least one technical solution adopted by the embodiment of the present application can achieve the following beneficial effects: by splitting a transaction into multiple sub-transactions and setting a save point before execution, the sub-transaction in which the lock transaction waits for more than the first corresponding to the sub-transaction After waiting for the time, roll back to the savepoint before the child transaction and continue execution, so that the execution efficiency of the deadlock transaction can be improved to some extent.
附图说明DRAWINGS
此处所说明的附图用来提供对本申请的进一步理解,构成本申请的一部分,本申请的示意性实施例及其说明用于解释本申请,并不构成对本申请的不当限定。在附图中:The drawings described herein are intended to provide a further understanding of the present application, and are intended to be a part of this application. In the drawing:
图1为本申请的一个实施例数据库死锁的处理方法流程图;1 is a flowchart of a method for processing a database deadlock according to an embodiment of the present application;
图2是本申请的一个实施例数据库死锁的具体处理方法流程图;2 is a flow chart of a specific processing method for database deadlock in an embodiment of the present application;
图3是本申请的一个实施例电子设备的结构示意图;3 is a schematic structural diagram of an electronic device according to an embodiment of the present application;
图4是本申请的一个实施例处理数据库死锁的装置的结构示意图;4 is a schematic structural diagram of an apparatus for processing a database deadlock according to an embodiment of the present application;
图5是本申请的另一个实施例处理数据库死锁的装置的结构示意图。FIG. 5 is a schematic structural diagram of an apparatus for processing a database deadlock according to another embodiment of the present application.
具体实施方式detailed description
为使本申请的目的、技术方案和优点更加清楚,下面将结合本申请具体实施例及相应的附图对本申请技术方案进行清楚、完整地描述。显然,所描述的实施例仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions of the present application will be clearly and completely described in the following with reference to the specific embodiments of the present application and the corresponding drawings. It is apparent that the described embodiments are only a part of the embodiments of the present application, and not all of them. All other embodiments obtained by a person of ordinary skill in the art based on the embodiments of the present application without departing from the inventive scope are the scope of the present application.
以下结合附图,详细说明本申请各实施例提供的技术方案。The technical solutions provided by the embodiments of the present application are described in detail below with reference to the accompanying drawings.
图1是本申请的一个实施例数据库死锁的处理方法流程图。图1的方法由处理数据 库死锁的装置执行。在实际的应用中,该处理数据库死锁的装置可以是数据库系统的一个功能模块。该方法包括:1 is a flow chart of a method for processing a database deadlock in an embodiment of the present application. The method of Figure 1 is processed by the data The device of the deadlock is executed. In practical applications, the device that handles database deadlocks may be a functional module of the database system. The method includes:
S110,将事务划分成顺序执行的N个子事务。S110, dividing the transaction into N sub-transactions executed in sequence.
其中,N为大于1的正整数。Where N is a positive integer greater than one.
事务(Transaction)是访问并可能更新数据库中各种数据项的一个程序执行单元(unit)。事务由事务开始(begin transaction)和事务结束(end transaction)之间执行的全体操作组成。例如:在关系数据库中,一个事务可以是一条结构化查询语言(Structured Query Language,SQL)语句,一组SQL语句或整个程序。Transaction is a program execution unit that accesses and possibly updates various data items in the database. A transaction consists of the entire operation performed between a begin transaction and an end transaction. For example, in a relational database, a transaction can be a Structured Query Language (SQL) statement, a set of SQL statements, or an entire program.
应理解,在本申请中,该事务包含多条插入(Insert)、更新(Update)或删除(Delete)的SQL语句等涉及数据库修改的数据库操纵语句,能够进一步划分为多个子事务。It should be understood that in the present application, the transaction includes a plurality of Insert, Update, or Delete SQL statements and other database manipulation statements involving database modification, which can be further divided into a plurality of sub-transactions.
例如,假设该事务由以下SQL语句组成:For example, suppose the transaction consists of the following SQL statement:
delete from table 1 where col1=”value1”;Delete from table 1 where col1=”value1”;
insert into table2 values(value1,value2,value3……);Insert into table2 values(value1,value2,value3...);
update table3 set col2=”value4”where col3=“value5”。Update table3 set col2=”value4” where col3=“value5”.
该事务可以进一步划分为多个子事务。The transaction can be further divided into multiple sub-transactions.
例如,该事务可以分为子事务1和子事务2,其中,For example, the transaction can be divided into sub-transaction 1 and sub-transaction 2, where
子事务1为:Subtransaction 1 is:
delete from table 1 where col1=”value1”;Delete from table 1 where col1=”value1”;
insert into table2 values(value1,value2,value3……);Insert into table2 values(value1,value2,value3...);
子事务2为:Subtransaction 2 is:
update table3 set col2=”value4”where col3=“value5”。Update table3 set col2=”value4” where col3=“value5”.
又例如,该事务还可以分为子事务1、子事务2和子事务3,其中,For another example, the transaction can also be divided into a sub-transaction 1, a sub-transaction 2, and a sub-transaction 3, wherein
子事务1为:Subtransaction 1 is:
delete from table 1 where col1=”value1”;Delete from table 1 where col1=”value1”;
子事务2为:Subtransaction 2 is:
insert into table2 values(value1,value2,value3……);Insert into table2 values(value1,value2,value3...);
子事务3为:Subtransaction 3 is:
update table3 set col2=”value4”where col3=“value5”。Update table3 set col2=”value4” where col3=“value5”.
在具体的应用中,可以根据其中的SQL语句的多少进行子事务的划分,或者根据需要进行插入(Insert)、更新(Update)或删除(Delete)的记录的数量进行子事务的划 分,或者根据预先估计的执行时间进行子事务的划分,等待,本申请在此不做限制。In a specific application, the sub-transaction may be divided according to the number of SQL statements therein, or the number of records inserted, updated, or deleted may be sub-transactions according to the number of records required to be inserted (updated), updated (updated), or deleted (Delete). The sub-transaction is divided according to the pre-estimated execution time, and the application is not limited herein.
S120,在该N个子事务中的每一个子事务执行之前创建保存点。S120: Create a savepoint before each of the N sub-transactions is executed.
保存点(savepoint)是事务过程中的一个逻辑点,通过保存点可以把事务回退到保存点的状态,而不必回退整个事务。A savepoint is a logical point in a transaction process. By saving a point, the transaction can be rolled back to the state of the savepoint without having to roll back the entire transaction.
创建保存点的方式可参考现有技术。例如,在Oracle数据库中,可通过savepoint savepoint_name这条命令创建保存点。其中,savepoint_name表示保存点名称。The way to create savepoints can be found in the prior art. For example, in an Oracle database, savepoints can be created with the savepoint savepoint_name command. Where savepoint_name represents the savepoint name.
S130,顺序执行该N个子事务。S130. Perform the N sub-transactions in sequence.
S140,当该N个子事务中的第n个子事务发生锁等待且等待时间大于该第n个子事务对应的第一等待时间时,将该待处理事务回滚到回滚保存点。S140. When a lock wait is performed on the nth sub-transaction of the N sub-transactions and the waiting time is greater than the first waiting time corresponding to the n-th sub-transaction, the pending transaction is rolled back to the rollback savepoint.
其中,n为小于或等于N的正整数,该回滚保存点为执行该第n个子事务之前创建的一个保存点。Where n is a positive integer less than or equal to N, and the rollback savepoint is a savepoint created before the execution of the nth child transaction.
应理解,本申请的第n个子事务,是指该N个子事务中顺序执行的第n个子事务。It should be understood that the nth sub-transaction of the present application refers to the nth sub-transaction executed sequentially in the N sub-transactions.
S150,继续顺序执行该N个子事务中在该回滚保存点之后的子事务。S150. Continue to sequentially execute the sub-transactions of the N sub-transactions after the rollback savepoint.
在本申请实施例中,通过将事务拆分成多个子事务并在执行前设置保存点,在其中的子事务发生锁等待超过该子事务对应的第一等待时间后回滚到该子事务之前的保存点并继续执行,从而能够在一定程度提高发生死锁的事务的执行效率。In the embodiment of the present application, by splitting a transaction into multiple sub-transactions and setting a save point before execution, before the sub-transaction lock waits for more than the first wait time corresponding to the sub-transaction, before rolling back to the sub-transaction The save point continues to execute, which can improve the execution efficiency of the deadlock transaction to a certain extent.
在步骤S140中,该回滚保存点是在执行第n个子事务之前创建的保存点。该回滚保存点的选择决定了该事务需要回滚的子事务的数量。因此,在步骤S140之前,该方法还可包括:确定该回滚保存点。In step S140, the rollback savepoint is a savepoint created before the execution of the nth child transaction. The selection of the rollback savepoint determines the number of child transactions that the transaction needs to roll back. Therefore, before step S140, the method may further include: determining the rollback savepoint.
可选地,作为一个实施例,确定该回滚保存点具体可实现为:当该N个子事务中的第n个子事务第i次发生锁等待且等待时间大于该第n个子事务对应的第一等待时间,根据第i次锁等待对应的需要回滚的子事务个数s,确定该回滚保存点,s与i的映射关系是预设的,i、s都为正整数。Optionally, as an embodiment, determining the rollback savepoint may be implemented as: when the nth sub-transaction of the N sub-transactions has a lock wait for the i-th time and the waiting time is greater than the first corresponding to the n-th sub-transaction Waiting time, according to the number of sub-transactions s that need to be rolled back according to the i-th lock, determine the roll-back save point, the mapping relationship between s and i is preset, and both i and s are positive integers.
应理解,s与i的映射关系是预设的,例如可以预先设定s与i的映射关系表,或者,预先设定s与i之间的函数关系,等等。It should be understood that the mapping relationship between s and i is preset. For example, a mapping relationship table between s and i may be preset, or a functional relationship between s and i may be preset, and so on.
具体地,例如,s与i的映射关系表可如表1所示:Specifically, for example, the mapping relationship between s and i can be as shown in Table 1:
表1:Table 1:
锁等待次数Lock wait times 11 22 33 44 55
需要回滚的子事务个数Number of sub-transactions that need to be rolled back 11 22 33 55 88
或者,例如,可规定s与i的函数关系为s=i。Or, for example, a functional relationship between s and i may be specified as s=i.
当然,应理解,上述列举的映射关系表和函数关系仅仅是示意性的,在实际的应用中,可根据实际情况进行设置。Of course, it should be understood that the above-mentioned mapping relationship table and function relationship are only schematic, and in actual applications, they can be set according to actual conditions.
此外,应理解,由于上述需要回滚的子事务个数s可能大于当前已经执行的子事务的个数n,因此,当s<n时,可确定需要回滚s个子事务;当s≥n,可确定需要回滚n个子事务。换句话说,当s<n时,确定第n-s+1个子事务之前的第一个保存点为该回滚保存点;或者,当s≥n时,确定第1个子事务之前的保存点为该回滚保存点。In addition, it should be understood that since the number of sub-transactions s that need to be rolled back may be greater than the number n of sub-transactions that have been currently executed, when s < n, it may be determined that s sub-transactions need to be rolled back; when s ≥ n To determine the need to roll back n child transactions. In other words, when s<n, it is determined that the first save point before the n-s+1th sub-transaction is the roll-back save point; or, when s≥n, the save point before the first sub-transaction is determined. Save the point for this rollback.
在本实现方式中,通过根据子事务发生锁等待且等待时间大于第一等待时间的次数,确定需要回滚的子事务的个数,进而确定回滚的保存点,从而能够避免因回滚的子事务设置过少而无法释放锁,或者因回滚的子事务设置过多而导致不必要的事务回滚。In this implementation manner, the number of sub-transactions that need to be rolled back is determined by the number of times the lock waits and the waiting time is greater than the first waiting time, and the save point of the rollback is determined, thereby avoiding the rollback. The child transaction is set too low to release the lock, or the transaction is rolled back due to too many child transaction settings being rolled back.
当然,应理解,上述实现方式只是示出了一种可能的实现方式,在具体的应用中,还可通过其它方式确定回滚保存点。Of course, it should be understood that the foregoing implementation manner only shows a possible implementation manner, and in a specific application, the rollback savepoint may also be determined in other manners.
应理解,该N个子事务中每个子事务发生锁等待对应的第一等待时间可以相同,也可以不同。It should be understood that the first waiting time corresponding to the lock waiting of each of the N sub-transactions may be the same or different.
可选地,该第一等待时间可以是数据库的用户设置的。用户可为第一等待时间设定一个固定值,或者,或者根据某种配置规则设定该第一等待时间。根据参数设置第一等待时间,例如,根据第n个子事务的涉及的数据操作类型、所述第n个子事务涉及的数据操作的记录数、所述第n个子事务的序号n以及所述第n个子事务发生锁等待的次数中的至少一种参数,设置第一等待时间。Optionally, the first waiting time may be set by a user of the database. The user can set a fixed value for the first waiting time, or set the first waiting time according to some configuration rule. Setting a first waiting time according to a parameter, for example, a data operation type according to the nth sub-transaction, a record number of data operations related to the n-th sub-transaction, a sequence number n of the n-th sub-transaction, and the nth At least one of the number of times the sub-transaction has a lock waiting, setting the first waiting time.
或者,可选地,作为另一个实施例,该第一等待时间是根据随机数设置的。通过随机数设置第一等待时间,可以防止所有连接超时都是一样的。Alternatively, optionally, as another embodiment, the first waiting time is set according to a random number. Setting the first wait time by random number prevents all connection timeouts from being the same.
在本申请实施例中,通过灵活设置子事务发生锁等待的第一等待时间,可以无需用户干预死锁进程,提高数据库的执行效率。In the embodiment of the present application, by flexibly setting the first waiting time of the lock waiting of the sub-transaction, the user can interfere with the deadlock process and improve the execution efficiency of the database.
在本申请实施例中,通过灵活设置第n个子事务发生锁等待的第一等待时间,能够在使得子事务回滚后释放锁的前提下,一定程度上减少回滚的子事务的数量。In the embodiment of the present application, by flexibly setting the first waiting time for the lock wait of the nth sub-transaction, the number of sub-transactions that are rolled back can be reduced to some extent on the premise that the lock is released after the sub-transaction is rolled back.
可选地,作为一个实施例,步骤S150具体可实现为:在回滚到该回滚保存点且等待第二等待时间之后,继续顺序执行该N个子事务中在该回滚保存点之后的子事务。Optionally, as an embodiment, step S150 is specifically implemented as: after rolling back to the rollback savepoint and waiting for the second waiting time, continuing to sequentially execute the sub-sub-transactions of the N sub-transactions after the roll-back savepoint Transaction.
可选地,该第二等待时间可以是数据库的用户设置的。用户可为第二等待时间设定一个固定值,或者根据某种配置规则设定该第二等待时间。Alternatively, the second waiting time may be set by a user of the database. The user can set a fixed value for the second waiting time or set the second waiting time according to some configuration rule.
或者,可选地,第二等待时间是根据该事务所涉及的SQL类型确定的。例如,数据 定义语言(Data Definition Language,DDL)类型的第二等待时间可以设置长一些;数据操纵语言(data manipulation language,DML)的第二等待时间可以设置短一些,等等。Alternatively, optionally, the second waiting time is determined according to the type of SQL involved in the transaction. For example, data The second wait time of the Data Definition Language (DDL) type can be set longer; the second wait time of the data manipulation language (DML) can be set shorter, and so on.
或者,可选地,该第二等待时间是根据随机数设置的。通过随机数设置第二等待时间,可以防止所有连接超时都是一样的。Alternatively, optionally, the second waiting time is set according to a random number. Setting the second wait time by random number prevents all connection timeouts from being the same.
在本申请实施例中,通过在回滚到该回滚保存点后等待第二等待时间,能够在一定程度上避免持有第n个子事务的锁的事务未释放该锁而导致该第n个子事务继续发生锁等待,进一步提高发生死锁的事务的执行效率。In the embodiment of the present application, by waiting for the second waiting time after rolling back to the rollback savepoint, the transaction that holds the lock of the nth child transaction can be prevented to some extent without releasing the lock, thereby causing the nth child. The transaction continues to lock out, further improving the execution efficiency of the deadlocked transaction.
可选地,作为一个实施例,该方法还包括:在创建该N个子事务中的每一个子事务对应的保存点时,按顺序记录该保存点;在将该事务回滚到该回滚保存点时,删除该回滚保存点之后创建的保存点的记录。Optionally, as an embodiment, the method further includes: when the save point corresponding to each of the N sub-transactions is created, the save point is sequentially recorded; and the transaction is rolled back to the rollback save When you click, delete the record of the savepoint created after the rollback savepoint.
删除保存点的操作可参考现有技术,例如,在Oracle数据库中,可以通过release savepoint命令删除创建的保存点。具体的命令格式如下To delete a savepoint, refer to the existing technology. For example, in the Oracle database, the created savepoint can be deleted by the release savepoint command. The specific command format is as follows
release savepoint savepoint_name;Release savepoint savepoint_name;
其中,savepoint_name表示创建的保存点的名称。Where savepoint_name represents the name of the savepoint created.
此外,如果保存点的记录存储于某个链表或其它数据结构中,则还需要从该链表或数据结构中删除该回滚保存点之后创建的保存点的记录。In addition, if the record of the savepoint is stored in a linked list or other data structure, the record of the savepoint created after the rollback savepoint is also deleted from the linked list or data structure.
在本申请实施例中,通过删除回滚保存点之后的保存点的记录,使得处理数据库死锁的装置在后续的确定回滚的保存点的操作中能够迅速定位回滚的保存点。In the embodiment of the present application, by deleting the record of the save point after the rollback save point, the device for processing the database deadlock can quickly locate the save point of the rollback in the subsequent operation of determining the save point of the rollback.
当该保存点需要另外进行记录时,可选地,该N个子事务中的每一个子事务在执行之前创建的保存点可按先后顺序存储于链表中,其中,该回滚保存点是通过查找该链表确定的。When the save point needs to be additionally recorded, optionally, the save points created by each of the N sub-transactions before execution may be stored in the linked list in order, wherein the roll-back save point is by searching The list is determined.
在本申请实施例中,通过链表查找需要回滚的回滚保存点,能够提高查找回滚保存点的效率,从而能够进一步提高发生死锁的事务的执行效率。In the embodiment of the present application, searching for a rollback savepoint that needs to be rolled back through the linked list can improve the efficiency of finding a rollback savepoint, thereby further improving the execution efficiency of the transaction in which the deadlock occurs.
或者,可选地,作为另一个实施例,该N个子事务中的每一个子事务在执行之前创建的保存点是按照保存点的序号和预定规则命名的,该回滚保存点是根据该回滚保存点的序号和该预定规则确定的。Alternatively, optionally, as another embodiment, each of the N sub-transactions is created by a savepoint created before the execution according to the sequence number of the savepoint and a predetermined rule, and the rollback savepoint is based on the back The serial number of the savepoint is determined by the predetermined rule.
应理解,保存点的记录不是必须的。例如,可以约定保存点的命名规则为标识名+序号,则当确定回滚保存点的序号后,即可确定回滚保存点的名称,从而找到该保存点。It should be understood that the record of the savepoint is not required. For example, the naming rule of the savepoint can be agreed to as the identifier name + sequence number. When it is determined that the sequence number of the savepoint is rolled back, the name of the savepoint can be determined to be rolled back, thereby finding the savepoint.
当然,应理解,在实际的应用中,可能只记录保存点的信息,而不会记录回滚的子事务的个数。但是,由于每一个子事务之前都有一个对应的保存点,确定需要回滚的子 事务,也就等价于确定回滚的保存点。Of course, it should be understood that in practical applications, it is possible to record only the information of the save point, and not the number of sub-transactions that are rolled back. However, since each sub-transaction has a corresponding savepoint before it, determine the child that needs to be rolled back. The transaction is equivalent to determining the save point of the rollback.
下面,将结合具体的实施例,对本申请图1所示的实施例做进一步的描述。Hereinafter, the embodiment shown in FIG. 1 of the present application will be further described in conjunction with specific embodiments.
图2是本申请的一个实施例数据库死锁的具体处理方法流程图。在图2所示的场景中,事务可分成子事务1、子事务2和子事务3共3个子事务,其执行顺序按照子事务1、子事务2和子事务3顺序执行。如图2所示,在执行子事务1之前,建立保存点savepoint1;在执行子事务2之前,建立保存点savepoint2;在执行子事务2之前,建立保存点savepoint3。2 is a flow chart of a specific processing method for database deadlock in an embodiment of the present application. In the scenario shown in FIG. 2, the transaction can be divided into three sub-transactions: sub-transaction 1, sub-transaction 2, and sub-transaction 3. The execution order is performed in the order of sub-transaction 1, sub-transaction 2, and sub-transaction 3. As shown in FIG. 2, before the sub-transaction 1 is executed, the savepoint savepoint1 is established; before the sub-transaction 2 is executed, the savepoint savepoint2 is established; before the sub-transaction 2 is executed, the savepoint savepoint3 is established.
图2所示实施例中,假设事务执行到子事务3时,发生锁等待。In the embodiment shown in FIG. 2, a lock wait occurs when a transaction is executed to sub-transaction 3.
如果执行子事务3第1次发生锁等待且超出第一次锁等待对应的等待时间,需要回滚的子事务数s取值为1,该次回滚需要回滚到第3-1+1=3个子事务之前的第一个保存点,也即回滚到子事务3之前的第一个保存点savepoint3。同时,数据库需要释放savepoint3之后的锁。If the execution of the child transaction 3 occurs for the first time, and the waiting time corresponding to the first lock wait is exceeded, the number of sub-transactions s that need to be rolled back is 1, and the rollback needs to be rolled back to the 3-1+1= The first savepoint before the 3 subtransactions, that is, the first savepoint savepoint3 before the child transaction 3. At the same time, the database needs to release the lock after savepoint3.
如果执行子事务3第2次发生锁等待且超出第一次锁等待对应的等待时间,需要回滚的子事务数s取值为2,该次回滚需要回滚到第3-2+1=2个子事务之前的第一个保存点,也即回滚到子事务2之前的第一个保存点savepoint2。同时,数据库需要释放savepoint2之后的锁。此外,如果本申请实施例中使用链表等记录保存点,则还需要删除savepoint2之后的保存点记录。If the execution of the sub-transaction 3 occurs for the second time, and the waiting time corresponding to the first lock is exceeded, the number of sub-transactions s that need to be rolled back is 2, and the rollback needs to be rolled back to the 3-2+1= The first savepoint before the 2 subtransactions, that is, the first savepoint savepoint2 before the child transaction 2. At the same time, the database needs to release the lock after savepoint2. In addition, if a storage point is recorded using a linked list or the like in the embodiment of the present application, it is also necessary to delete the save point record after savepoint2.
如果执行子事务3第3次发生锁等待且超出第一次锁等待对应的等待时间,则需要回滚的子事务数s取值为3,该次回滚需要回滚到第3-3+1=1个子事务之前的第一个保存点,也即回滚到子事务1之前的第一个保存点savepoint1。同时,数据库需要释放savepoint3之后的锁。此外,如果本申请实施例中使用链表等记录保存点,则还需要删除savepoint3之后的保存点记录。If the execution of the child transaction 3 occurs for the third time, and the waiting time corresponding to the first lock wait is exceeded, the number of sub-transactions s that need to be rolled back is 3, and the rollback needs to be rolled back to the 3-3+1. =1 The first savepoint before the child transaction, that is, the first savepoint savepoint1 before the child transaction 1. At the same time, the database needs to release the lock after savepoint3. In addition, if a storage point is recorded using a linked list or the like in the embodiment of the present application, it is also necessary to delete the save point record after the savepoint3.
当然,应理解,如图2所示,可以通过链表保存每个子事务执行前创建的保存点的标识。图2中的3个子事务在执行之前创建的保存点按先后顺序存储于链表中,分别对应执行计划1、执行计划2和执行计划3。数据库可根据需要回滚的子事务的个数,从链表中找到对应的保存点的标识。Of course, it should be understood that, as shown in FIG. 2, the identifier of the save point created before each sub-transaction is executed can be saved through the linked list. The save points created by the three sub-transactions in Figure 2 are stored in the linked list in order of execution, corresponding to execution plan 1, execution plan 2, and execution plan 3. The database can find the identifier of the corresponding savepoint from the linked list according to the number of sub-transactions that need to be rolled back.
此外,应理解,在图2所示的场景中,也可以不用链表记录保存点的信息,而是规定保存点的命名规则。例如,可以规定图2中保存点的命名规则为“savepoint”+序号。在第一次回滚时,需要回滚的保存点的序号为3-1+1=3,根据该命名规则即可确定该保存点为savepoint3,等等。 In addition, it should be understood that in the scenario shown in FIG. 2, it is also possible to record the information of the save point without using a linked list, and to specify the naming rule of the save point. For example, it may be specified that the naming rule of the save point in FIG. 2 is "savepoint" + serial number. In the first rollback, the sequence number of the savepoint that needs to be rolled back is 3-1+1=3. According to the naming rule, the savepoint can be determined to be savepoint3, and so on.
另外,对于用于判断是否超时的锁等待的等待时间,可以规定每次锁等待的等待时间相同,或者根据锁等待发生超时的次数、锁等待发生时的子事务的序号、锁等待发生时的子事务涉及的数据操作类型、或者是锁等待发生时的子事务涉及的数据操作的记录数等因素,综合确定锁等待的等待时间。此外,也可以根据随机数,随机分配所等待的等待时间。In addition, for the waiting time for the lock waiting for determining whether to time out, it may be specified that the waiting time for each lock waiting is the same, or the number of times the timeout occurs according to the lock waiting, the number of the sub-transaction when the lock waits, and the time when the lock waits. The data operation type involved in the sub-transaction, or the number of records of the data operation involved in the sub-transaction when the lock waits, and the like, comprehensively determine the waiting time of the lock waiting. In addition, the waiting time waiting for can be randomly assigned according to the random number.
此外,每次发生回滚后,还可设定一个等待时间,当回滚后经过该等待时间后,再继续执行子事务,可避免持有本事务的锁的事务未能及时释放掉该锁而导致本事务继续发生锁等待。In addition, each time a rollback occurs, a wait time can be set. After the wait time elapses after the rollback, the sub-transaction is resumed, so that the transaction holding the lock of the transaction cannot be released in time. As a result, the transaction continues to lock waiting.
需要说明的是,上述如图1所示实施例所提供方法的各步骤的执行主体均可以是同一设备,或者,该方法也由不同设备作为执行主体。比如,步骤S110和步骤S120的执行主体可以为设备1,步骤S130的执行主体可以为设备2;又比如,步骤S110的执行主体可以为设备1,步骤S120和步骤S130的执行主体可以为设备2;等等。It should be noted that the execution bodies of the steps of the method provided by the embodiment shown in FIG. 1 may be the same device, or the method may also be performed by different devices. For example, the execution body of step S110 and step S120 may be device 1, and the execution body of step S130 may be device 2; for example, the execution body of step S110 may be device 1, and the execution body of step S120 and step S130 may be device 2 ;and many more.
图3是本本申请的一个实施例电子设备的结构示意图。请参考图3,在硬件层面,该电子设备包括处理器、内部总线、网络接口、内存以及非易失性存储器,当然还可能包括其他业务所需要的硬件。处理器从非易失性存储器中读取对应的计算机程序到内存中然后运行,在逻辑层面上形成用户界面解锁的装置。当然,除了软件实现方式之外,本申请并不排除其他实现方式,比如逻辑器件抑或软硬件结合的方式等等,也就是说以下处理流程的执行主体并不限定于各个逻辑单元,也可以是硬件或逻辑器件。FIG. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present application. Referring to FIG. 3, at the hardware level, the electronic device includes a processor, an internal bus, a network interface, a memory, and a non-volatile memory, and may of course include hardware required for other services. The processor reads the corresponding computer program from the non-volatile memory into memory and then runs to form a device that unlocks the user interface at a logical level. Of course, in addition to the software implementation, the present application does not exclude other implementation manners, such as a logic device or a combination of software and hardware, etc., that is, the execution body of the following processing flow is not limited to each logical unit, and may be Hardware or logic device.
图4是本申请的一个实施例的处理数据库死锁的装置400的结构示意图。应理解,处理数据库死锁的装置400可以是数据库系统,或者是数据库系统中的一个具体的实现模块,本申请实施例在此不作限制。请参考图4,在软件实施方式中,该数据库死锁的装置400可包括:事务划分单元410、保存点创建单元420、执行单元430和事务回滚单元440。其中,FIG. 4 is a schematic structural diagram of an apparatus 400 for processing a database deadlock according to an embodiment of the present application. It should be understood that the device 400 for processing the database deadlock may be a database system or a specific implementation module in the database system, which is not limited herein. Referring to FIG. 4, in a software implementation, the database deadlock device 400 can include a transaction partitioning unit 410, a savepoint creation unit 420, an execution unit 430, and a transaction rollback unit 440. among them,
事务划分单元410将事务划分成顺序执行的N个子事务,其中,N为大于1的正整数;The transaction dividing unit 410 divides the transaction into N sub-transactions that are sequentially executed, where N is a positive integer greater than one;
保存点创建单元420在执行该N个子事务中的每一个子事务之前创建保存点;The savepoint creation unit 420 creates a savepoint before executing each of the N subtransactions;
执行单元430顺序执行该N个子事务; Execution unit 430 sequentially executes the N sub-transactions;
当该N个子事务中的第n个子事务发生锁等待且等待时间大于该第n个子事务对应的第一等待时间时,事务回滚单元440将该事务回滚到回滚保存点,其中,n为小于等于N的正整数,该回滚保存点为执行该第n个子事务之前创建的一个保存点; When the nth child transaction of the N child transactions has a lock wait and the waiting time is greater than the first wait time corresponding to the nth child transaction, the transaction rollback unit 440 rolls back the transaction to the rollback savepoint, where a positive integer less than or equal to N, the rollback savepoint is a savepoint created before the execution of the nth child transaction;
执行单元430还在该事务回滚单元440将该待执行事务回滚到该第一保存点之后,继续顺序执行该N个子事务中在该第一保存点之后的子事务。The execution unit 430 also continues to sequentially execute the sub-transactions of the N sub-transactions after the first save point after the transaction rollback unit 440 rolls back the to-be-executed transaction to the first savepoint.
在本申请实施例中,通过将事务拆分成多个子事务并在执行前设置保存点,在其中的子事务发生锁等待超过该子事务对应的第一等待时间后回滚到该子事务之前的保存点并继续执行,从而能够在一定程度提高发生死锁的事务的执行效率。In the embodiment of the present application, by splitting a transaction into multiple sub-transactions and setting a save point before execution, before the sub-transaction lock waits for more than the first wait time corresponding to the sub-transaction, before rolling back to the sub-transaction The save point continues to execute, which can improve the execution efficiency of the deadlock transaction to a certain extent.
图5是本申请的另一个实施例的处理数据库死锁的装置400的结构示意图。可选地,如图5所示,装置400还可包括确定单元450,当该N个子事务中的第n个子事务第i次发生锁等待且等待时间大于该第n个子事务对应的第一等待时间,该确定单元450根据第i次锁等待对应的需要回滚的子事务个数s,确定该回滚保存点,s与i的映射关系是预设的,i、s都为正整数。FIG. 5 is a schematic structural diagram of an apparatus 400 for processing a database deadlock according to another embodiment of the present application. Optionally, as shown in FIG. 5, the apparatus 400 may further include a determining unit 450, when the nth sub-transaction of the N sub-transactions has a lock wait for the i-th time and the waiting time is greater than the first wait corresponding to the n-th sub-transaction The determining unit 450 determines the rollback savepoint according to the number of sub-transactions s that need to be rolled back according to the ith lock, and the mapping relationship between s and i is preset, and both i and s are positive integers.
进一步地,确定单元450根据第i次锁等待对应的需要回滚的子事务个数s,确定该回滚保存点包括:确定单元450可确定第n-s个子事务之前的第一个保存点为该第一保存点,其中,s<n;或者,确定单元45可确定第1个子事务之前的保存点为该第一保存点,其中,s≥n。Further, the determining unit 450 determines, according to the number of sub-transactions that need to be rolled back corresponding to the ith lock, the rollback savepoint includes: the determining unit 450 may determine that the first savepoint before the ns sub-transaction is the The first save point, where s<n; or, the determining unit 45 may determine that the save point before the first sub-transaction is the first save point, where s ≥ n.
可选地,该第一等待时间是该事务所在的数据库系统的用户设置的;或者,该第一等待时间是按照随机数设置的。Optionally, the first waiting time is set by a user of the database system of the firm; or the first waiting time is set according to a random number.
可选地,执行单元430具体在回滚到该第一保存点且等待第二等待时间之后,继续顺序执行该N个子事务中在该第一保存点之后的子事务。进一步地,该第二等待时间是根据该事务所涉及的结构化查询语言SQL类型设定的;或者,该第二等待时间是该事务所在的数据库系统的用户设置的;或者,该第二等待时间按照随机数设置的。Optionally, the executing unit 430 continues to sequentially execute the sub-transactions of the N sub-transactions after the first save point after specifically rolling back to the first save point and waiting for the second waiting time. Further, the second waiting time is set according to a SQL type of the structured query language involved in the office; or the second waiting time is set by a user of the database system of the firm; or, the second The waiting time is set according to the random number.
可选地,作为一个实施例,该N个子事务中的每一个子事务在执行之前创建的保存点是根据保存点的序号和预定规则命名的,该回滚保存点是根据该回滚保存点的序号和该预定规则确定的。Optionally, as an embodiment, the savepoint created by each of the N sub-transactions before execution is named according to a sequence number of the savepoint and a predetermined rule, and the rollback savepoint is based on the rollback savepoint. The serial number and the predetermined rule are determined.
或者,可选地,作为另一个实施例,该N个子事务中的每一个子事务在执行之前创建的保存点按先后顺序存储于链表中,该回滚保存点是通过查找该链表确定的。进一步地,如图5所示,装置400还可包括删除单元460。如果保存点创建单元在创建该N个子事务中的每一个子事务对应的保存点时,还按顺序记录该保存点;则该删除单元可在该事务回滚单元将该事务回滚到该回滚保存点时,删除该回滚保存点之后创建的保存点的记录。Alternatively, optionally, as another embodiment, the save points created by each of the N sub-transactions before execution are stored in a linked list in a sequential order, and the roll-back save points are determined by searching the linked list. Further, as shown in FIG. 5, the device 400 may further include a deleting unit 460. If the savepoint creation unit records the savepoint in sequence when creating a savepoint corresponding to each of the N child transactions; the delete unit may roll back the transaction to the back in the transaction rollback unit When you save a savepoint, delete the record of the savepoint created after the rollback savepoint.
处理数据库死锁的装置400还可执行图1的方法,并实现数据库或处理数据库死锁 的装置在图1、图2所示实施例的功能,本申请实施例在此不再赘述。The device 400 handling the database deadlock can also perform the method of FIG. 1 and implement database or process database deadlock The functions of the embodiment shown in FIG. 1 and FIG. 2 are not described herein again.
本申请还公开了一种数据库系统,包括图4或图5所示实施例的处理数据库死锁的装置400。The present application also discloses a database system comprising the apparatus 400 for processing database deadlocks of the embodiment shown in FIG. 4 or 5.
在20世纪90年代,对于一个技术的改进可以很明显地区分是硬件上的改进(例如,对二极管、晶体管、开关等电路结构的改进)还是软件上的改进(对于方法流程的改进)。然而,随着技术的发展,当今的很多方法流程的改进已经可以视为硬件电路结构的直接改进。设计人员几乎都通过将改进的方法流程编程到硬件电路中来得到相应的硬件电路结构。因此,不能说一个方法流程的改进就不能用硬件实体模块来实现。例如,可编程逻辑器件(Programmable Logic Device,PLD)(例如现场可编程门阵列(Field Programmable Gate Array,FPGA))就是这样一种集成电路,其逻辑功能由用户对器件编程来确定。由设计人员自行编程来把一个数字系统“集成”在一片PLD上,而不需要请芯片制造厂商来设计和制作专用的集成电路芯片。而且,如今,取代手工地制作集成电路芯片,这种编程也多半改用“逻辑编译器(logic compiler)”软件来实现,它与程序开发撰写时所用的软件编译器相类似,而要编译之前的原始代码也得用特定的编程语言来撰写,此称之为硬件描述语言(Hardware Description Language,HDL),而HDL也并非仅有一种,而是有许多种,如ABEL(Advanced Boolean Expression Language)、AHDL(Altera Hardware Description Language)、Confluence、CUPL(Cornell University Programming Language)、HDCal、JHDL(Java Hardware Description Language)、Lava、Lola、MyHDL、PALASM、RHDL(Ruby Hardware Description Language)等,目前最普遍使用的是VHDL(Very-High-Speed Integrated Circuit Hardware Description Language)与Verilog。本领域技术人员也应该清楚,只需要将方法流程用上述几种硬件描述语言稍作逻辑编程并编程到集成电路中,就可以很容易得到实现该逻辑方法流程的硬件电路。In the 1990s, improvements to a technology could clearly distinguish between hardware improvements (eg, improvements to circuit structures such as diodes, transistors, switches, etc.) or software improvements (for process flow improvements). However, as technology advances, many of today's method flow improvements can be seen as direct improvements in hardware circuit architecture. Designers almost always get the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that the improvement of a method flow cannot be implemented by hardware entity modules. For example, a Programmable Logic Device (PLD) (such as a Field Programmable Gate Array (FPGA)) is an integrated circuit whose logic function is determined by the user programming the device. Designers program themselves to "integrate" a digital system on a single PLD without having to ask the chip manufacturer to design and fabricate a dedicated integrated circuit chip. Moreover, today, instead of manually making integrated circuit chips, this programming is mostly implemented using "logic compiler" software, which is similar to the software compiler used in programming development, but before compiling The original code has to be written in a specific programming language. This is called the Hardware Description Language (HDL). HDL is not the only one, but there are many kinds, such as ABEL (Advanced Boolean Expression Language). AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc., are currently the most commonly used VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. It should also be apparent to those skilled in the art that the hardware flow for implementing the logic method flow can be easily obtained by simply programming the method flow into the integrated circuit with a few hardware description languages.
控制器可以按任何适当的方式实现,例如,控制器可以采取例如微处理器或处理器以及存储可由该(微)处理器执行的计算机可读程序代码(例如软件或固件)的计算机可读介质、逻辑门、开关、专用集成电路(Application Specific Integrated Circuit,ASIC)、可编程逻辑控制器和嵌入微控制器的形式,控制器的例子包括但不限于以下微控制器:ARC 625D、Atmel AT91SAM、Microchip PIC18F26K20以及Silicone Labs C8051F320,存储器控制器还可以被实现为存储器的控制逻辑的一部分。本领域技术人员也知道,除了以纯计算机可读程序代码方式实现控制器以外,完全可以通过将方法步骤进行逻辑编程来使得控制器以逻辑门、开关、专用集成电路、可编程逻辑控制器和嵌入微控制器等 的形式来实现相同功能。因此这种控制器可以被认为是一种硬件部件,而对其内包括的用于实现各种功能的装置也可以视为硬件部件内的结构。或者甚至,可以将用于实现各种功能的装置视为既可以是实现方法的软件模块又可以是硬件部件内的结构。The controller can be implemented in any suitable manner, for example, the controller can take the form of, for example, a microprocessor or processor and a computer readable medium storing computer readable program code (eg, software or firmware) executable by the (micro)processor. In the form of logic gates, switches, application specific integrated circuits (ASICs), programmable logic controllers, and embedded microcontrollers, examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, The Microchip PIC18F26K20 and the Silicone Labs C8051F320, the memory controller can also be implemented as part of the memory's control logic. Those skilled in the art will also appreciate that in addition to implementing the controller in purely computer readable program code, the controller can be logically programmed by means of logic gates, switches, ASICs, programmable logic controllers, and embedding. Microcontroller, etc. The form to achieve the same functionality. Such a controller can therefore be considered a hardware component, and the means for implementing various functions included therein can also be considered as a structure within the hardware component. Or even a device for implementing various functions can be considered as a software module that can be both a method of implementation and a structure within a hardware component.
上述实施例阐明的系统、装置、模块或单元,具体可以由计算机芯片或实体实现,或者由具有某种功能的产品来实现。一种典型的实现设备为计算机。具体的,计算机例如可以为个人计算机、膝上型计算机、蜂窝电话、相机电话、智能电话、个人数字助理、媒体播放器、导航设备、电子邮件设备、游戏控制台、平板计算机、可穿戴设备或者这些设备中的任何设备的组合。The system, device, module or unit illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product having a certain function. A typical implementation device is a computer. Specifically, the computer can be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or A combination of any of these devices.
为了描述的方便,描述以上装置时以功能分为各种单元分别描述。当然,在实施本申请时可以把各单元的功能在同一个或多个软件和/或硬件中实现。For the convenience of description, the above devices are described separately by function into various units. Of course, the functions of each unit may be implemented in the same software or software and/or hardware when implementing the present application.
本领域内的技术人员应明白,本申请的实施例可提供为方法、系统、或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art will appreciate that embodiments of the present application can be provided as a method, system, or computer program product. Thus, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment in combination of software and hardware. Moreover, the application can 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, etc.) including computer usable program code.
本申请是参照根据本申请实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (system), and computer program products according to embodiments of the present application. It will be understood that each flow and/or block of the flowchart illustrations and/or FIG. These computer program instructions can be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing device to produce a machine for the execution of instructions for execution by a processor of a computer or other programmable data processing device. Means for implementing the functions specified in one or more of the flow or in a block or blocks of the flow chart.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。The computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device. The apparatus implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。 These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device. The instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.
在一个典型的配置中,计算设备包括一个或多个处理器(CPU)、输入/输出接口、网络接口和内存。In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
内存可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。内存是计算机可读介质的示例。The memory may include non-persistent memory, random access memory (RAM), and/or non-volatile memory in a computer readable medium, such as read only memory (ROM) or flash memory. Memory is an example of a computer readable medium.
计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁带磁磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括暂存电脑可读媒体(transitory media),如调制的数据信号和载波。Computer readable media includes both permanent and non-persistent, removable and non-removable media. Information storage can be implemented by any method or technology. The information can be computer readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory. (ROM), electrically erasable programmable read only memory (EEPROM), flash memory or other memory technology, compact disk read only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, Magnetic tape cartridges, magnetic tape storage or other magnetic storage devices or any other non-transportable media can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary storage of computer readable media, such as modulated data signals and carrier waves.
还需要说明的是,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、商品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、商品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、商品或者设备中还存在另外的相同要素。It is also to be understood that the terms "comprises" or "comprising" or "comprising" or any other variations are intended to encompass a non-exclusive inclusion, such that a process, method, article, Other elements not explicitly listed, or elements that are inherent to such a process, method, commodity, or equipment. An element defined by the phrase "comprising a ..." does not exclude the presence of additional equivalent elements in the process, method, item, or device including the element.
本领域技术人员应明白,本申请的实施例可提供为方法、系统或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art will appreciate that embodiments of the present application can be provided as a method, system, or computer program product. Thus, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment in combination of software and hardware. Moreover, the application can 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, etc.) including computer usable program code.
本申请可以在由计算机执行的计算机可执行指令的一般上下文中描述,例如程序模块。一般地,程序模块包括执行特定任务或实现特定抽象数据类型的例程、程序、对象、组件、数据结构等等。也可以在分布式计算环境中实践本申请,在这些分布式计算环境中,由通过通信网络而被连接的远程处理设备来执行任务。在分布式计算环境中,程序模块可以位于包括存储设备在内的本地和远程计算机存储介质中。The application can be described in the general context of computer-executable instructions executed by a computer, such as a program module. Generally, program modules include routines, programs, objects, components, data structures, and the like that perform particular tasks or implement particular abstract data types. The present application can also be practiced in distributed computing environments where tasks are performed by remote processing devices that are connected through a communication network. In a distributed computing environment, program modules can be located in both local and remote computer storage media including storage devices.
本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分 互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于系统实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。The various embodiments in this specification are described in a progressive manner, with similar parts between the various embodiments. It is sufficient to refer to each other, and each embodiment focuses on differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiment.
以上所述仅为本申请的实施例而已,并不用于限制本申请。对于本领域技术人员来说,本申请可以有各种更改和变化。凡在本申请的精神和原理之内所作的任何修改、等同替换、改进等,均应包含在本申请的权利要求范围之内。 The above description is only an embodiment of the present application and is not intended to limit the application. Various changes and modifications can be made to the present application by those skilled in the art. Any modifications, equivalents, improvements, etc. made within the spirit and scope of the present application are intended to be included within the scope of the appended claims.

Claims (18)

  1. 一种数据库死锁的处理方法,其特征在于,包括:A method for processing a database deadlock, comprising:
    将事务划分成顺序执行的N个子事务,其中,N为大于1的正整数;Dividing the transaction into N sub-transactions executed sequentially, where N is a positive integer greater than one;
    在所述N个子事务中的每一个子事务执行之前创建保存点;Creating a savepoint before each of the N sub-transactions is executed;
    顺序执行所述N个子事务;Executing the N sub-transactions in sequence;
    当所述N个子事务中的第n个子事务发生锁等待且等待时间大于所述第n个子事务对应的第一等待时间时,将所述事务回滚到回滚保存点,其中,n为小于或等于N的正整数,所述回滚保存点为执行所述第n个子事务之前创建的一个保存点;When the nth sub-transaction of the N sub-transactions has a lock wait and the waiting time is greater than the first waiting time corresponding to the n-th sub-transaction, the transaction is rolled back to the rollback savepoint, where n is less than Or a positive integer equal to N, the rollback savepoint is a savepoint created before the execution of the nth child transaction;
    继续顺序执行所述N个子事务中在所述回滚保存点之后的子事务。The sub-transactions after the rollback savepoint in the N sub-transactions are continued to be sequentially executed.
  2. 如权利要求1所述的方法,其特征在于,所述方法还包括:The method of claim 1 wherein the method further comprises:
    当所述N个子事务中的第n个子事务第i次发生锁等待且等待时间大于所述第n个子事务对应的第一等待时间,根据第i次锁等待对应的需要回滚的子事务个数s,确定所述回滚保存点,s与i的映射关系是预设的,i、s都为正整数。When the nth sub-transaction of the N sub-transactions has a lock wait for the i-th time and the waiting time is greater than the first waiting time corresponding to the n-th sub-transaction, the sub-transactions that need to be rolled back according to the i-th lock wait The number s is determined by the rollback savepoint, and the mapping relationship between s and i is preset, and both i and s are positive integers.
  3. 如权利要求2所述的方法,其特征在于,所述根据第i次锁等待对应的需要回滚的子事务个数s,确定所述回滚保存点包括:The method of claim 2, wherein the determining, according to the number of sub-transactions s that need to be rolled back according to the ith lock, determining the rollback savepoint comprises:
    当s<n时,确定第n-s+1个子事务之前的第一个保存点为所述回滚保存点;或者When s<n, determining that the first savepoint before the n-s+1th sub-transaction is the rollback savepoint; or
    当s≥n时,确定第1个子事务之前的保存点为所述回滚保存点。When s ≥ n, it is determined that the save point before the first sub-transaction is the roll-back save point.
  4. 如权利要求1-3任一项所述的方法,其特征在于,A method according to any one of claims 1 to 3, wherein
    所述第一等待时间是所述事务所在的数据库系统的用户设置的;或者The first waiting time is set by a user of the database system in which the firm is located; or
    所述第一等待时间是按照随机数设置的。The first waiting time is set according to a random number.
  5. 如权利要求4所述的方法,其特征在于,所述继续顺序执行所述N个子事务中在所述回滚保存点之后的子事务包括:在回滚到所述回滚保存点且等待第二等待时间之后,继续顺序执行所述N个子事务中在所述回滚保存点之后的子事务。The method of claim 4, wherein the continuing to sequentially execute the sub-transactions of the N sub-transactions after the rollback savepoint comprises: rolling back to the rollback savepoint and waiting for the After the two waiting times, the sub-transactions after the rollback savepoint in the N sub-transactions are sequentially executed.
  6. 如权利要求5所述的方法,其特征在于,The method of claim 5 wherein:
    所述第二等待时间是根据所述事务所涉及的结构化查询语言SQL类型设定的;或者The second waiting time is set according to a SQL type of a structured query language involved in the office; or
    所述第二等待时间是所述事务所在的数据库系统的用户设置的;或者The second waiting time is set by a user of the database system of the firm; or
    所述第二等待时间按照随机数设置的。The second waiting time is set according to a random number.
  7. 如权利要求6所述的方法,其特征在于,所述方法还包括:在创建所述N个子事务中的每一个子事务对应的保存点时,按顺序记录所述保存点,并在将所述事务回滚到 所述回滚保存点时,删除所述回滚保存点之后创建的保存点的记录。The method according to claim 6, wherein the method further comprises: when creating a save point corresponding to each of the N sub-transactions, sequentially recording the save point, and The transaction is rolled back to When the save point is rolled back, the record of the save point created after the rollback save point is deleted.
  8. 如权利要求7所述的方法,其特征在于,The method of claim 7 wherein:
    所述N个子事务中的每一个子事务在执行之前创建的保存点按先后顺序存储于链表中,所述回滚保存点是通过查找所述链表确定的。The save points created by each of the N sub-transactions before execution are stored in a linked list in a sequential order, and the roll-back save points are determined by looking up the linked list.
  9. 如权利要求8所述的方法,其特征在于,The method of claim 8 wherein:
    所述N个子事务中的每一个子事务在执行之前创建的保存点是根据保存点的序号和预定规则命名的,所述回滚保存点是根据所述回滚保存点的序号和所述预定规则确定的。The savepoint created by each of the N sub-transactions before execution is named according to the sequence number of the savepoint and a predetermined rule, and the rollback savepoint is based on the sequence number of the rollback savepoint and the predetermined The rules are determined.
  10. 一种处理数据库死锁的装置,其特征在于,包括:事务划分单元、执行单元、保存点创建单元和事务回滚单元,其中,An apparatus for processing a database deadlock, comprising: a transaction division unit, an execution unit, a savepoint creation unit, and a transaction rollback unit, wherein
    所述事务划分单元将事务划分成顺序执行的N个子事务,其中,N为大于1的正整数;The transaction dividing unit divides the transaction into N sub-transactions executed sequentially, where N is a positive integer greater than one;
    所述执行单元顺序执行所述N个子事务;The execution unit sequentially executes the N sub-transactions;
    所述保存点创建单元在执行所述N个子事务中的每一个子事务之前创建保存点;The savepoint creation unit creates a savepoint before executing each of the N subtransactions;
    当所述N个子事务中的第n个子事务发生锁等待且等待时间大于所述第n个子事务对应的第一等待时间时,所述事务回滚单元将所述事务回滚到回滚保存点,其中,n为小于等于N的正整数,所述回滚保存点为执行所述第n个子事务之前创建的一个保存点;When the nth sub-transaction of the N sub-transactions has a lock wait and the waiting time is greater than the first waiting time corresponding to the n-th sub-transaction, the transaction rollback unit rolls back the transaction to the roll-back savepoint Where n is a positive integer less than or equal to N, and the rollback savepoint is a savepoint created before the execution of the nth child transaction;
    所述执行单元还在所述事务回滚单元将所述事务回滚到所述回滚保存点之后,继续顺序执行所述N个子事务中在所述回滚保存点之后的子事务。The execution unit further continues to sequentially execute the sub-transactions of the N sub-transactions after the rollback savepoint after the transaction rollback unit rolls back the transaction to the rollback savepoint.
  11. 如权利要求10所述的装置,其特征在于,所述装置还包括确定单元,The device according to claim 10, wherein said device further comprises a determining unit,
    当所述N个子事务中的第n个子事务第i次发生锁等待且等待时间大于所述第n个子事务对应的第一等待时间,所述确定单元根据第i次锁等待对应的需要回滚的子事务个数s,确定所述回滚保存点,s与i的映射关系是预设的,i、s都为正整数。When the nth sub-transaction of the N sub-transactions has a lock waiting for the i-th time and the waiting time is greater than the first waiting time corresponding to the n-th sub-transaction, the determining unit needs to roll back according to the need of the i-th lock waiting The number of child transactions s, determine the rollback savepoint, the mapping relationship between s and i is preset, and i and s are both positive integers.
  12. 如权利要求11所述的装置,其特征在于,所述确定单元根据第i次锁等待对应的需要回滚的子事务个数s,确定所述回滚保存点包括:The apparatus according to claim 11, wherein the determining unit determines, according to the number of sub-transactions s that need to be rolled back corresponding to the i-th lock, determining that the rollback savepoint comprises:
    所述确定单元确定第n-s+1个子事务之前的第一个保存点为所述回滚保存点,其中,s<n;或者The determining unit determines that the first save point before the n-s+1th sub-transaction is the rollback save point, where s<n;
    所述确定单元确定第1个子事务之前的保存点为所述回滚保存点,其中,s≥n。The determining unit determines that the save point before the first sub-transaction is the roll-back save point, where s ≥ n.
  13. 如权利要求10-12任一项所述的装置,其特征在于, A device according to any of claims 10-12, wherein
    所述第一等待时间是所述事务所在的数据库系统的用户设置的;或者The first waiting time is set by a user of the database system in which the firm is located; or
    所述第一等待时间是按照随机数设置的。The first waiting time is set according to a random number.
  14. 如权利要求13所述的装置,其特征在于,所述执行单元具体在回滚到所述回滚保存点且等待第二等待时间之后,继续顺序执行所述N个子事务中在所述回滚保存点之后的子事务。The apparatus according to claim 13, wherein the execution unit continues to sequentially perform the rollback in the N sub-transactions after rolling back to the rollback savepoint and waiting for a second waiting time. Save the child transaction after the point.
  15. 如权利要求14所述的装置,其特征在于,The device of claim 14 wherein:
    所述第二等待时间是根据所述事务所涉及的结构化查询语言SQL类型设定的;或者The second waiting time is set according to a SQL type of a structured query language involved in the office; or
    所述第二等待时间是所述事务所在的数据库系统的用户设置的;或者The second waiting time is set by a user of the database system of the firm; or
    所述第二等待时间按照随机数设置的。The second waiting time is set according to a random number.
  16. 如权利要求15所述的装置,其特征在于,所述装置还包括删除单元,其中,The device according to claim 15, wherein said device further comprises a deleting unit, wherein
    所述保存点创建单元还在创建所述N个子事务中的每一个子事务对应的保存点时,按顺序记录所述保存点;The savepoint creation unit further records the savepoints in sequence when creating a savepoint corresponding to each of the N child transactions;
    所述删除单元还在所述事务回滚单元将所述事务回滚到所述回滚保存点时,删除所述回滚保存点之后创建的保存点的记录。The deleting unit further deletes the record of the save point created after the rollback save point when the transaction rollback unit rolls back the transaction to the rollback savepoint.
  17. 如权利要求16所述的装置,其特征在于,The device of claim 16 wherein:
    所述N个子事务中的每一个子事务在执行之前创建的保存点按先后顺序存储于链表中,所述回滚保存点是通过查找所述链表确定的。The save points created by each of the N sub-transactions before execution are stored in a linked list in a sequential order, and the roll-back save points are determined by looking up the linked list.
  18. 如权利要求17所述的装置,其特征在于,The device of claim 17 wherein:
    所述N个子事务中的每一个子事务在执行之前创建的保存点是根据保存点的序号和预定规则命名的,所述回滚保存点是根据所述回滚保存点的序号和所述预定规则确定的。 The savepoint created by each of the N sub-transactions before execution is named according to the sequence number of the savepoint and a predetermined rule, and the rollback savepoint is based on the sequence number of the rollback savepoint and the predetermined The rules are determined.
PCT/CN2017/115191 2016-12-20 2017-12-08 Database deadlock processing method and apparatus, and database system WO2018113534A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201611183503.2 2016-12-20
CN201611183503.2A CN108205464B (en) 2016-12-20 2016-12-20 Database deadlock processing method and device and database system

Publications (1)

Publication Number Publication Date
WO2018113534A1 true WO2018113534A1 (en) 2018-06-28

Family

ID=62603423

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/115191 WO2018113534A1 (en) 2016-12-20 2017-12-08 Database deadlock processing method and apparatus, and database system

Country Status (2)

Country Link
CN (1) CN108205464B (en)
WO (1) WO2018113534A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111984625A (en) * 2020-08-24 2020-11-24 北京人大金仓信息技术股份有限公司 Database load characteristic processing method, device, medium and electronic equipment
CN113872781A (en) * 2020-06-30 2021-12-31 阿里巴巴集团控股有限公司 Transaction processing method, device, equipment and storage medium

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111221869A (en) * 2018-11-27 2020-06-02 北京京东振世信息技术有限公司 Method and device for tracking database transaction time and analyzing database lock
CN112749156A (en) * 2019-10-29 2021-05-04 华为技术有限公司 Data processing method, database management system and data processing equipment
CN110865977A (en) * 2019-11-05 2020-03-06 中盈优创资讯科技有限公司 Method and device for operating HDFS directory by multiple programs
CN110888717A (en) * 2019-11-05 2020-03-17 中盈优创资讯科技有限公司 Transaction control method and device for directory operation of HDFS (Hadoop distributed File System)
CN112100192A (en) * 2020-09-27 2020-12-18 中国建设银行股份有限公司 Database lock waiting processing method and device
CN112883045B (en) * 2021-03-31 2024-05-17 中国工商银行股份有限公司 Database transaction splitting execution method and device
CN115576969B (en) * 2022-12-07 2023-03-10 北京奥星贝斯科技有限公司 Method, device, medium and equipment for executing database tasks in parallel
CN117076147B (en) * 2023-10-13 2024-04-16 支付宝(杭州)信息技术有限公司 Deadlock detection method, device, equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102073540A (en) * 2010-12-15 2011-05-25 北京新媒传信科技有限公司 Distributed affair submitting method and device thereof
CN103077006A (en) * 2012-12-27 2013-05-01 浙江工业大学 Multithreading-based parallel executing method for long transaction
CN104317850A (en) * 2014-10-14 2015-01-28 北京国双科技有限公司 Data processing method and device

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5630124A (en) * 1993-12-06 1997-05-13 International Business Machines Corporation System and method for assuring atomicity of distributed update requests in a parallel database
US8560524B2 (en) * 2008-10-30 2013-10-15 Hewlett-Packard Development Company, L.P. Allocating priorities to prevent deadlocks in a storage system
US9569254B2 (en) * 2009-07-28 2017-02-14 International Business Machines Corporation Automatic checkpointing and partial rollback in software transaction memory
CN101739291B (en) * 2009-12-02 2013-01-30 北京航空航天大学 Hardware transactional nesting method for supporting rollback of conditional part
US20130290243A1 (en) * 2012-04-26 2013-10-31 Cloudtree, Inc. Method and system for transaction representation in append-only datastores
CN102831156B (en) * 2012-06-29 2014-12-31 浙江大学 Distributed transaction processing method on cloud computing platform
US20140040219A1 (en) * 2012-07-31 2014-02-06 Hideaki Kimura Methods and systems for a deadlock resolution engine
CN103294479A (en) * 2013-06-19 2013-09-11 成都市欧冠信息技术有限责任公司 Distribution type transaction processing method and system
CN103761182A (en) * 2013-12-26 2014-04-30 上海华为技术有限公司 Method and device for deadlock detection

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102073540A (en) * 2010-12-15 2011-05-25 北京新媒传信科技有限公司 Distributed affair submitting method and device thereof
CN103077006A (en) * 2012-12-27 2013-05-01 浙江工业大学 Multithreading-based parallel executing method for long transaction
CN104317850A (en) * 2014-10-14 2015-01-28 北京国双科技有限公司 Data processing method and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
LIU YANG: "Key Technology for Transaction Process on Object relationship Model Database", 18 August 2011 (2011-08-18) *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113872781A (en) * 2020-06-30 2021-12-31 阿里巴巴集团控股有限公司 Transaction processing method, device, equipment and storage medium
CN111984625A (en) * 2020-08-24 2020-11-24 北京人大金仓信息技术股份有限公司 Database load characteristic processing method, device, medium and electronic equipment
CN111984625B (en) * 2020-08-24 2023-09-15 北京人大金仓信息技术股份有限公司 Database load characteristic processing method and device, medium and electronic equipment

Also Published As

Publication number Publication date
CN108205464B (en) 2022-05-06
CN108205464A (en) 2018-06-26

Similar Documents

Publication Publication Date Title
WO2018113534A1 (en) Database deadlock processing method and apparatus, and database system
US11556396B2 (en) Structure linked native query database management system and methods
US10678808B2 (en) Eager replication of uncommitted transactions
CA2981476C (en) Processing database transactions in a distributed computing system
US9881041B2 (en) Multiple RID spaces in a delta-store-based database to support long running transactions
EP3213230B1 (en) Efficient maintenance of column store indexes on memory-optimized tables
EP3528451A1 (en) Blockchain-based data processing method and device
US6807541B2 (en) Weak record locks in database query read processing
US8108696B2 (en) Optimizing non-preemptible read-copy update for low-power usage by avoiding unnecessary wakeups
US8972801B2 (en) Motivating lazy RCU callbacks under out-of-memory conditions
US20140025651A1 (en) Lock-Free, Scalable Read Access to Shared Data Structures
US20140281295A1 (en) Expediting RCU Grace Periods Under User Mode Control
US20090070330A1 (en) Dual access to concurrent data in a database management system
US20130061071A1 (en) Energy Efficient Implementation Of Read-Copy Update For Light Workloads Running On Systems With Many Processors
TW201715381A (en) Method for efficient task scheduling in the presence of conflicts
US11269829B2 (en) Row level locking for columnar data
US9824039B2 (en) Signal interrupts in a transactional memory system
US20240126465A1 (en) Data storage methods, apparatuses, devices, and storage media
CN109800062B (en) Distributed database transaction processing system
US20150100730A1 (en) Freeing Memory Safely with Low Performance Overhead in a Concurrent Environment
US20240134840A1 (en) Distributed table lock application methods, apparatuses, storage media, and electronic devices
US20220043821A1 (en) Method for performing multi-caching on data sources of same type and different types by using cluster-based processing system and device using the same
CN109388645B (en) Instruction execution method, instruction execution device, and storage medium
US20230394028A1 (en) Method and system for lock after qualification for update queries
US11113262B2 (en) Time-efficient lock release in database systems

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17884918

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17884918

Country of ref document: EP

Kind code of ref document: A1