Backend Development 6 min read

Using Arthas for Hot Updating dble: A Step‑by‑Step Guide

This article explains how to install and use the Arthas Java diagnostic tool to perform hot‑code updates in the dble middleware, covering environment preparation, decompiling classes, modifying source, recompiling with memory‑compile, and applying the changes via both interactive and non‑interactive commands.

Aikesheng Open Source Community
Aikesheng Open Source Community
Aikesheng Open Source Community
Using Arthas for Hot Updating dble: A Step‑by‑Step Guide

The author, a member of the dble development team, compares two tools for hot‑updating small dble versions—Arthas and JRebel—concluding that Arthas is more effective for modifying static classes and proceeds to demonstrate its usage.

Prerequisites

JRE used by dble

A running dble instance version 3.20.10.0

Arthas Installation

Download the latest release from the official GitHub page (e.g., version 3.4.5) and unzip it:

$ cd /opt/arthas
$ wget https://github.com/alibaba/arthas/releases/download/arthas-all-3.4.5/arthas-bin.zip
$ unzip arthas-bin.zip

Other installation methods are documented at the Arthas website.

Running Arthas

Start the interactive console by attaching to the dble process ID:

$ java -jar arthas-boot.jar <dble_pid>

For example, to modify a log message generated when an unsupported SQL statement is encountered, the following steps are performed inside the Arthas console.

Decompile with jad

$ jad --source-only com.actiontech.dble.server.ServerQueryHandler > /tmp/ServerQueryHandler.java

The relevant snippet from the decompiled file shows the log statement:

case 254: {
    LOGGER.info("Unsupported statement:" + sql);
    this.service.writeErrMessage(1149, "Unsupported statement");
    return;
}

Find Class Loader with sc

$ sc -d com.actiontech.dble.server.ServerQueryHandler | grep classLoaderHash
classLoaderHash   18b4aac2

Modify Source and Recompile with mc

After editing the decompiled file (e.g., changing the log text), recompile the class in memory:

case 254: {
    LOGGER.info("Unsupported statement test test test test test:" + sql);
    this.service.writeErrMessage(1149, "Unsupported statement");
    return;
}

Use the hash obtained from sc as the -c argument:

$ mc -c 18b4aac2 /tmp/ServerQueryHandler.java

Apply the Change with redefine

$ redefine /tmp/com/actiontech/dble/server/ServerQueryHandler.class
redefine success, size: 1, classes:
com.actiontech.dble.server.ServerQueryHandler

The updated class now produces the modified log output, as shown in the accompanying screenshots.

Non‑Interactive Execution

The same redefine command can be run without entering the Arthas console, enabling script automation:

$ java -jar arthas-boot.jar <dble_pid> -c "redefine /tmp/com/actiontech/dble/server/ServerQueryHandler.class" > /dev/null

This approach simplifies batch updates and integration into deployment pipelines.

BackendJavaDevOpsArthasHot UpdateDBLE
Aikesheng Open Source Community
Written by

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.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.