IP Library Granted Patent US 12,153,570
Granted Patent B2
US 12,153,570 · App. 17/743,293 · Granted Nov 26, 2024

Database transaction processing method and apparatus, server, and storage medium

Inventors: Haoqiong Bian (Shenzhen, CN); Sheng Ye (Shenzhen, CN); Hailin Lei (Shenzhen, CN); Kang Sun (Shenzhen, CN); Haixiang Li (Shenzhen, CN); Anqun Pan (Shenzhen, CN)
Assignee: TENCENT TECHNOLOGY (SHENZHEN) COMPANY LIMITED
G06F16/2379G06F16/219G06F16/27
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 12,153,570
App. No.
17/743,293
Granted
Nov 26, 2024
Kind
B2
Abstract

This application discloses a database transaction processing method performed by a computer device. The method includes: in a case of starting a target transaction, obtaining, by a working node in a distributed database system, a transaction timestamp of the target transaction and current global latest version information, the target transaction including at least one operation statement for a target data object, and the global latest version information being version information of latest generated metadata of metadata stored in the distributed database system; determining latest-version metadata of the target data object according to the current global latest version information, and determining to-be-accessed user data of the target transaction according to the transaction timestamp; and executing an operation statement of the target transaction on the to-be-accessed user data based on the latest-version metadata of the target data object.

Claims (69)

1. A database transaction processing method performed by a working node in a distributed database system, the method comprising:

in a case of starting a target transaction on user data stored in the distributed database system, obtaining a transaction timestamp of the target transaction and current global latest version information of the distributed database system, the target transaction comprising at least one operation statement for a target data object of the user data stored in the database system, and the current global latest version information being version information of latest generated metadata stored in the distributed database system for describing logical structures and features of the user data stored in the database system;

determining latest-version metadata of the target data object according to the current global latest version information;

determining, among the user data stored in the distributed data system, to-be-accessed user data of the target data object according to the transaction timestamp, wherein the to-be-accessed user data of the target data object is user data associated with the target transaction whose version information is lower than or equal to version information of a user data snapshot obtained at the transaction timestamp; and

executing an operation statement of the target transaction on the to-be-accessed user data of the target data object based on the latest-version metadata of the target data object.

2. The method according to claim 1 , wherein the method further comprises:

receiving a modification instruction for metadata of a data object, and generating modified metadata of the data object according to the modification instruction;

committing the modified metadata to a global metadata storage; and

updating the global latest version information to version information of the modified metadata when the modified metadata is successfully committed.

3. The method according to claim 2 , wherein before the committing the modified metadata to a global metadata storage, the method further comprises:

transmitting a first timestamp allocation request to a global timestamp manager when the modified metadata is generated; and

receiving a timestamp returned by the global timestamp manager based on the first timestamp allocation request, and determining the timestamp as the version information of the modified metadata.

4. The method according to claim 2 , wherein the global latest version information is stored in a global timestamp manager, and the updating the global latest version information to version information of the modified metadata comprises:

transmitting a commit success notification to the global timestamp manager, so that the global timestamp manager updates the stored global latest version information to the version information of the modified metadata according to the commit success notification.

5. The method according to claim 2 , wherein a local cache of the working node stores version information of latest local metadata of a data object, and the method further comprises:

writing the modified metadata to the local cache when the modified metadata is successfully committed; and

updating version information of latest local metadata of a data object whose metadata is modified to the version information of the modified metadata in the local cache.

6. The method according to claim 1 , wherein the determining latest-version metadata of the target data object according to the current global latest version information comprises:

determining to-be-accessed metadata in the global metadata storage of the distributed database system according to the current global latest version information, and searching for the latest-version metadata of the target data object from the determined to-be-accessed metadata, wherein the to-be-accessed metadata is metadata whose version information is lower than or equal to the current global latest version information in the global metadata storage.

7. The method according to claim 1 , wherein the determining latest-version metadata of the target data object according to the current global latest version information comprises:

obtaining version information of latest local metadata of the target data object from the local cache;

comparing to determine whether the version information of the latest local metadata of the target data object is the same as the current global latest version information; and

in a case of yes, obtaining the latest local metadata of the target data object as the latest-version metadata of the target data object from metadata stored in the local cache.

8. The method according to claim 7 , wherein the determining latest-version metadata of the target data object according to the current global latest version information further comprises:

when the version information of the latest local metadata of the target data object is different from the current global latest version information, searching metadata of various versions of the target data object stored in the local cache and the global metadata storage, to determine whether target metadata exists, wherein version information of the found target metadata is higher than the version information of the latest local metadata of the target data object, and is not higher than the current global latest version information; and

determining target metadata having latest version information of the found target metadata as the latest-version metadata of the target data object when the target metadata exists.

9. The method according to claim 8 , wherein after the determining target metadata having latest version information of the found target metadata as the latest-version metadata of the target data object, the method further comprises:

updating the target metadata having the latest version information to the local cache; and

updating the version information of the latest local metadata of the target data object to version information corresponding to the target metadata having the latest version information.

10. The method according to claim 8 , wherein the determining latest-version metadata of the target data object according to the current global latest version information further comprises:

determining the latest local metadata of the target data object as the latest-version metadata of the target data object when the target metadata does not exist.

11. The method according to claim 10 , wherein the method further comprises:

updating the version information of the latest local metadata of the target data object as the current global latest version information when the target metadata does not exist.

12. The method according to claim 1 , wherein the global latest version information is stored in a global timestamp manager in the distributed database system, and the obtaining a transaction timestamp of the target transaction and current global latest version information of the distributed database system comprises:

transmitting a second timestamp allocation request corresponding to the target transaction to the global timestamp manager; and

receiving response information returned by the global timestamp manager based on the second timestamp allocation request, wherein the response information comprises the transaction timestamp of the target transaction and the current global latest version information.

13. The method according to claim 1 , wherein the executing an operation statement of the target transaction on the to-be-accessed user data of the target data object based on the latest-version metadata of the target data object comprises:

parsing the operation statement of the target transaction according to latest-version schema information of the target data object; and

processing the to-be-accessed user data of the target data object according to a parsing result.

14. A computer device acting as a working node in a distributed

database system, comprising:

one or more processors;

a memory; and

one or more programs, the one or more programs being stored in the memory and, when executed by the one or more processors, causing the computer device to perform a database transaction processing method including:

in a case of starting a target transaction on user data stored in the distributed database system, obtaining a transaction timestamp of the target transaction and current global latest version information of the distributed database system, the target transaction comprising at least one operation statement for a target data object of the user data stored in the database system, and the current global latest version information being version information of latest generated metadata stored in the distributed database system for describing logical structures and features of the user data stored in the database system;

determining latest-version metadata of the target data object according to the current global latest version information;

determining, among the user data stored in the distributed data system, to-be-accessed user data of the target data object according to the transaction times tamp, wherein the to-be-accessed user data of the target data object is user data associated with the target transaction whose version information is lower than or equal to version information of a user data snapshot obtained at the transaction timestamp; and

executing an operation statement of the target transaction on the to-be-accessed user data of the target data object based on the latest-version metadata of the target data object.

15. The computer device according to claim 14 , wherein the method further comprises:

receiving a modification instruction for metadata of a data object, and generating modified metadata of the data object according to the modification instruction;

committing the modified metadata to a global metadata storage; and

updating the global latest version information to version information of the modified metadata when the modified metadata is successfully committed.

16. The computer device according to claim 14 , wherein the determining latest-version metadata of the target data object according to the current global latest version information comprises:

determining to-be-accessed metadata in the global metadata storage of the distributed database system according to the current global latest version information, and searching for the latest-version metadata of the target data object from the determined to-be-accessed metadata, wherein the to-be-accessed metadata is metadata whose version information is lower than or equal to the current global latest version information in the global metadata storage.

17. The computer device according to claim 14 , wherein the determining latest-version metadata of the target data object according to the current global latest version information comprises:

obtaining version information of latest local metadata of the target data object from the local cache;

comparing to determine whether the version information of the latest local metadata of the target data object is the same as the current global latest version information; and

in a case of yes, obtaining the latest local metadata of the target data object as the latest-version metadata of the target data object from metadata stored in the local cache.

18. The computer device according to claim 14 , wherein the global latest version information is stored in a global timestamp manager in the distributed database system, and the obtaining a transaction timestamp of the target transaction and current global latest version information of the distributed database system comprises:

transmitting a second timestamp allocation request corresponding to the target transaction to the global timestamp manager; and

receiving response information returned by the global timestamp manager based on the second timestamp allocation request, wherein the response information comprises the transaction timestamp of the target transaction and the current global latest version information.

19. The computer device according to claim 14 , wherein the executing an operation statement of the target transaction on the to-be-accessed user data of the target data object based on the latest-version metadata of the target data object comprises:

parsing the operation statement of the target transaction according to latest-version schema information of the target data object; and

processing the to-be-accessed user data of the target data object according to a parsing result.

20. A non-transitory computer-readable storage medium, storing one or more programs, the one or more programs, when executed by a processor of a computer device acting as a working node in a distributed database system, causing the computer device to perform a database transaction processing method including:

in a case of starting a target transaction on user data stored in the distributed database system, obtaining a transaction timestamp of the target transaction and current global latest version information of the distributed database system, the target transaction comprising at least one operation statement for a target data object of the user data stored in the database system, and the current global latest version information being version information of latest generated metadata stored in the distributed database system for describing logical structures and features of the user data stored in the database system;

determining latest-version metadata of the target data object according to the current global latest version information;

determining, among the user data stored in the distributed data system, to-be-accessed user data of the target data object according to the transaction timestamp, wherein the to-be-accessed user data of the target data object is user data associated with the target transaction whose version information is lower than or equal to version information of a user data snapshot obtained at the transaction timestamp; and

executing an operation statement of the target transaction on the to-be-accessed user data of the target data object based on the latest-version metadata of the target data object.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded May 23, 2022
From: PAN, ANQUN; LEI, HAILIN; LI, HAIXIANG; BIAN, HAOQIONG; SUN, KANG; YE, SHENG
To: TENCENT TECHNOLOGY (SHENZHEN) COMPANY LIMITED
Reel/Frame 059990/0057 →
Priority Claims (1)
CN 202010520559.2 · Jun 10, 2020 · national
Continuity (2)
Continuation PCTCN2021096691 · May 28, 2021
Related Publication 20220276998A1 · Sep 1, 2022