Redesign of Global Table Check in DBLE 2.19.11.0 Using Quartz Scheduler
The article explains how DBLE 2.19.11.0 replaces the server‑level global table check with a table‑level, Quartz‑driven mechanism that allows precise scheduling, customizable check methods, and easier result handling, and provides configuration examples for the built‑in CHECKSUM and COUNT checks.
Background : In DBLE versions prior to 2.19.11.0, the global table check inherited from Mycat was implemented as a server‑level feature that relied on adding a dble_op_time column when creating a global table, which caused inconvenient toggling, result‑set handling, and data‑import issues.
Redesign Requirements : Starting with DBLE 2.19.11.0, the global table check was redesigned to meet four main requirements: (1) the check switch should be configurable at the table level, (2) the trigger time must be precisely definable, (3) the checking method should be customizable, and (4) the customization should be simple and clear.
Implementation Principle : The new design introduces the Quartz framework for scheduling and adds three optional attributes to the schema.table definition: globalCheck, cron, and globalCheckClass. Each table’s global check is loaded as an independent Quartz job during startup or reload.
During execution, users can customize the following methods:
getCountSQL – defines the SQL used for the global check.
getFetchCols – defines which columns to fetch from the result set.
resultEquals – compares results from different MySQL nodes.
failResponse – handles failure feedback.
resultResponse – handles normal result feedback.
Execution Flow (illustrated in the original diagram):
When start/reload is invoked, the configured tasks are added to Quartz.
Quartz triggers the scheduled task.
An AbstractConsistencyChecker instance is created and executed.
The getCountSQL method determines the SQL to run and dispatches it.
The getFetchCols method determines which result columns to retrieve.
The resultEquals method compares results across MySQL nodes.
The failResponse and resultResponse methods provide feedback.
Global Table Check Usage Example : DBLE provides two built‑in check methods, CHECKSUM and COUNT, each with a short alias. They can be configured as follows:
<!-- DBLE built‑in CHECKSUM check method -->
<table name="tb_global1" dataNode="dn1,dn2" type="global" globalCheck="true" cron="0 * * * * ?" globalCheckClass="CHECKSUM"/>
<!-- DBLE built‑in COUNT check method -->
<table name="tb_global2" dataNode="dn1,dn2" type="global" globalCheck="true" cron="0 * * * * ?" globalCheckClass="COUNT"/>The article concludes with community updates and a call to read the original source for more details.
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.
Aikesheng Open Source Community
The Aikesheng Open Source Community provides stable, enterprise‑grade MySQL open‑source tools and services, releases a premium open‑source component each year (1024), and continuously operates and maintains them.
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.
