Skip to content

fix(eloq): parse a temporary table's node id in hex - #254

Open
liangjchen wants to merge 1 commit into
eloqdata:mainfrom
liangjchen:fix/tmp-table-node-id-hex
Open

liangjchen wants to merge 1 commit into
eloqdata:mainfrom
liangjchen:fix/tmp-table-node-id-hex

Conversation

@liangjchen

Copy link
Copy Markdown
Collaborator

Description

A temporary table's name ends with the id of the node that created it, so that after a crash the node can drop its own orphans at its next start (drop_orphan_tmp_tables() in ha_eloq.cc). build_tmptable_filename() writes that id in hex (%x), but is_tmp_table_of() in storage/eloq/eloq_catalog_name.h parsed it back in decimal (strtoul(..., 10)).

Ids 0 to 9 agree. From 10 on they name another node:

  • node 10 writes a, which parses as 0, so node 0's next start drops node 10's live temporary tables;
  • node 10 never matches its own tables, so its orphans stay in the catalog;
  • likewise node 16 writes 10, which node 10 takes for its own.

is_tmp_table_of() now parses the id in hex, as it is written.

How can this PR be tested?

The regex and the function body were checked in a standalone program against names produced with build_tmptable_filename()'s format, for every owner and node id from 0 to 300:

  • decimal parsing (before): 582 wrong owner/node attributions, and node 10's table is claimed by node 0;
  • hex parsing (after): none.

An end-to-end check needs a cluster with a node id of 10 or more: create a temporary table on that node, kill it, and restart node 0 and then that node. Node 0 must leave the table alone, and the owner must drop it.

Backward compatibility

No format change: names already written are hex, and they are now read the same way. After the upgrade, a node stops dropping other nodes' temporary tables and starts dropping its own orphans.

🤖 Generated with Claude Code

build_tmptable_filename() appends the creating node's id to a temporary
table's name in hex (%x), but is_tmp_table_of() parsed it back in decimal.
Ids 0 to 9 agree; from 10 on they name another node: node 10 writes "a",
which parses as 0, so node 0's drop_orphan_tmp_tables() at startup dropped
node 10's live temporary tables, and node 10 never dropped its own orphans.
is_tmp_table_of() now parses the id in hex, matching the writer and the
names existing servers have already written.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 20, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ffe9c6fe-186c-472d-a3e0-3c084400ecaf

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant