IP Library › Granted Patent US 11,520,747
Granted Patent B2
US 11,520,747 · App. 16/700,459 · Granted Dec 6, 2022

Method and system for detecting and resolving a write conflict

Inventors: Yuk Kuen Chan (Markham, CA); Wenbin Ma (Sammamish, WA); Emad Boctor (Toronto, CA); Huaxin Zhang (Markham, CA)
Assignee: HUAWEI TECHNOLOGIES CO., LTD.
G06F16/178G06F16/1865G06F16/2255G06F16/2308G06F9/544
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 11,520,747
App. No.
16/700,459
Granted
Dec 6, 2022
Kind
B2
Abstract

The disclosed systems and methods are directed for detecting and resolving write-write conflicts among a plurality of transactions received from master nodes of a multi-writer database system. The method includes receiving a plurality of REDO logs and storing the plurality of REDO logs in a buffer, each REDO log associated with the one of the plurality of transactions, selecting one REDO log of the plurality of REDO logs; persisting the transaction associated with the one REDO log in a local storage when a write-write conflict is detected between the one REDO log and at least one other REDO log of the plurality of REDO logs prior to committing the transaction associated with the one REDO log; and transmitting a status of the transaction associated with the one REDO log to a global transaction manager (GTM).

Claims (44)

1. A method for detecting and resolving write-write conflicts among a plurality of transactions received from master nodes of a multi-writer database system, the method comprising:

receiving, by a common log module (CLM), a plurality of REDO logs and storing the plurality of REDO logs in a buffer, each REDO log associated with the one of the plurality of transactions;

selecting one REDO log of the plurality of REDO logs;

persisting the transaction associated with the one REDO log in a local storage associated with the CLM when a write-write conflict is detected between the one REDO log and at least one other REDO log of the plurality of REDO logs prior to committing the transaction associated with the one REDO log; and

transmitting a status of the transaction associated with the one REDO log to a global transaction manager (GTM);

wherein detecting a write-write conflict further comprises:

extracting from the one REDO log a master node identity (ID), a base log sequence number (LSN), and a block number associated with the one REDO log;

extracting a current status of a hash table, wherein the hash table contains block numbers, master node IDs and the corresponding LSNs;

checking for the presence of the block number associated with the one REDO log in the hash table; and

when the block number associated with the one REDO log is not present in the hash table, a write-write conflict is not detected and the block number, master node ID and the end LSN associated with the one REDO log in the hash table are updated.

2. The method of claim 1 , wherein the selecting, persisting, and transmitting are repeated for each REDO log stored in the buffer.

3. The method of claim 2 , further comprising transmitting the transactions persisted in the local storage associated with the CLM to the GTM in a group manner.

4. The method of claim 1 , further comprising mapping a local log sequence number (LSN) associated with the plurality of master nodes to a global LSN.

5. The method of claim 4 , further comprising transmitting the global LSN to the GTM.

6. The method of claim 1 , further comprising mapping a local log sequence number (LSN) associated with the plurality of master nodes to a global LSN.

7. The method of claim 1 , wherein detecting a write-write conflict further comprises:

when the block number associated with the one REDO log is present in the hash table, checking the master node IDs associated with the one REDO log and the hash table;

when both the master node IDs are same, a write-write conflict is not detected and the latest LSN is updated with the end LSN associated with the one REDO log; when both the master IDs are different, comparing the base LSN and the latest LSN;

when the base LSN is greater than the latest LSN, a write-write conflict is not detected and the latest LSN is updated with the end LSN associated with the one REDO log; and

when the base LSN is smaller than the latest LSN, a write-write conflict is detected and the transaction associated with the one REDO log is aborted.

8. The method of claim 7 , further comprising persisting the transaction associated with the one REDO log in a common storage when a write-write conflict is not detected between the one REDO log and any other REDO log of the plurality of REDO logs prior to committing the transaction associated with the one REDO log.

9. A system comprising:

a processor;

a non-transitory memory storing instructions which, when executed by the processor, cause the system to detect and resolve write-write conflicts among a plurality of transactions received from master nodes of a multi-writer database system by:

receiving a plurality of REDO logs and storing the plurality of REDO logs in a buffer, each REDO log associated with the one of the plurality of transactions;

selecting one REDO log of the plurality of REDO logs;

persisting the transaction associated with the one REDO log in a local storage associated with a common log module (CLM) when a write-write conflict is detected between the one REDO log and at least one other REDO log of the plurality of REDO logs prior to committing the transaction associated with the one REDO log; and

transmitting a status of the transaction associated with the one REDO log to a global transaction manager (GTM);

wherein a write-write conflict is detected by:

extracting from the one REDO log a master node identity (ID), a base log sequence number (LSN), and a block number associated with the one REDO log;

extracting a current status of a hash table, wherein the hash table contains block numbers, master node IDs and the corresponding LSNs;

checking for the presence of the block number associated with the one REDO log in the hash table; and

when the block number associated with the one REDO log is not present in the hash table, a write-write conflict is not detected and the block number, master node ID and the end LSN associated with the one REDO log in the hash table are updated.

10. The system of claim 9 , wherein the selecting, the persisting, and the transmitting are repeated for each REDO log stored in the buffer.

11. The system of claim 10 , wherein the transactions persisted in the local storage to the CLM in a group manner.

12. The system of claim 9 , wherein the instructions, when executed by the processor, cause the system to detect and resolve write-write conflicts further by: mapping of a local log sequence number (LSN) associated with the plurality of master nodes to a global LSN.

13. The system of claim 12 , wherein the instructions, when executed by the processor, cause the system to detect and resolve write-write conflicts further by: transmitting the global LSN to the plurality of master of master nodes.

14. The system of claim 12 , wherein the instructions, when executed by the processor, cause the system to detect and resolve write-write conflicts further by: transmitting the global LSN to the GTM.

15. The system of claim 9 , wherein a write-write conflict is detected by:

when the block number associated with the one REDO log is present in the hash table, checking the master node IDs associated with the one REDO log and the hash table;

when both the master node IDs are same, a write-write conflict is not detected and the latest LSN is updated with the end LSN associated with the one REDO log; when both the master IDs are different, comparing the base LSN and the latest LSN;

when the base LSN is greater than the latest LSN, a write-write conflict is not detected and the latest LSN is updated with the end LSN associated with the one REDO log; and

when the base LSN is smaller than the latest LSN, a write-write conflict is detected and the transaction associated with the one REDO log is aborted.

16. The system of claim 15 , wherein the instructions, when executed by the processor, cause the system to detect and resolve write-write conflicts further by: persisting the transaction associated with the one REDO log in a common storage when a write-write conflict is not detected between the one REDO log and any other REDO log of the plurality of REDO logs prior to committing the transaction associated with the one REDO log.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Jul 17, 2020
From: CHAN, YUK KUEN; MA, WENBIN; BOCTOR, EMAD; ZHANG, HUAXIN
To: HUAWEI TECHNOLOGIES CO., LTD.
Reel/Frame 053237/0078 →
Continuity (1)
Related Publication 20210165762A1 · Jun 3, 2021