Tencent TDSQL Reveals Infinite Database Anomalies and a Hands‑On Learning Tool
Tencent’s TDSQL team introduces a groundbreaking theory that precisely classifies an infinite set of database transaction anomalies, defines their categories via conflict‑graph analysis, and provides an open‑source Linux tool with step‑by‑step compilation instructions for interactive anomaly exploration.
Background
Traditional concurrency control algorithms can prevent or eliminate data anomalies but cannot identify each specific anomaly. Tencent’s TDSQL team has proposed the first global definition of data anomalies based on conflict‑graph cycles, enabling precise identification of any anomaly.
Definition of Data Anomaly
A data anomaly occurs when, in the history of concurrent transactions, the conflict‑graph (a directed graph whose vertices are transactions and edges represent conflict‑order relations) contains a directed cycle. This definition unifies all previously studied anomalies such as dirty read, non‑repeatable read, phantom read, lost update, etc.
Classification
According to the types of partial orders present in the cycle, anomalies are divided into three primary classes:
Write Anomaly (WAT) : the cycle contains a write‑write partial order.
Read Anomaly (RAT) : the cycle contains one or more write‑read partial orders but no write‑write partial order.
Intersection Anomaly (IAT) : any anomaly that is neither WAT nor RAT.
A finer‑grained taxonomy adds:
Single‑Data‑Item Anomaly (SDA): the anomaly involves two transactions on a single variable.
Dual‑Data‑Item Anomaly (DDA): the anomaly involves two transactions on two variables.
Multi‑Data‑Item Anomaly (MDA): all other cases.
Although the number of possible anomalies is infinite, the number of categories is finite.
Conflict‑Graph Illustration
The following figure shows a conflict‑graph for a non‑repeatable‑read anomaly. Each vertex represents a transaction; each directed edge denotes a conflict order (e.g., read‑write or write‑read).
Tool for Interactive Exploration
TDSQL provides an open‑source Linux tool (source code hosted at https://github.com/Tencent/3TS) that can recognize and display data anomalies from a user‑supplied history.
Create a project directory: mkdir 3TS Download the source:
wget https://github.com/Tencent/3TS/archive/refs/heads/master.zipUnzip the archive: unzip master.zip Enter the source root: cd 3TS-master Compile (requires a C++17‑compatible compiler): ./make.sh Run the binary: ./3TS-DAI If the compiler reports “g++: error: unrecognized command line option ‘--std=c++17’”, install a newer GCC (version 8 or later).
Using the Tool
After launching, type help or h for a command list. Key commands: \d [definition] – show the definition of a term (e.g., \d History). \a [anomaly name] – display information about a specific anomaly (e.g., \a Dirty Read). \t [table name] – view the anomaly table (e.g., \t Anomalies). \A – show author information. \q – quit.
History Format and Example
A History is a sequence of operations. Each operation is a three‑character token: R (read), W (write), C (commit), A (abort), followed by a transaction ID (digit) and a data item (lower‑case letter). For example, R0a means transaction 0 reads item a.
Dirty‑read example: R0a R1a W0a R0a W0a W1a A1 C0 Entering this history into the tool produces the corresponding anomaly description and conflict‑graph (shown in the next figure).
Conclusion
The TDSQL research demonstrates that while data anomalies are infinite in number, they can be systematically classified and automatically identified using conflict‑graph analysis. The accompanying tool enables developers and students to experiment with histories, observe anomalies, and deepen their understanding of transaction isolation.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
ITPUB
Official ITPUB account sharing technical insights, community news, and exciting events.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
