Skip to content

Fix REQUESTED_TABLE_NOT_EXISTS error#337

Merged
yi-xmu merged 1 commit into
mainfrom
fix_table_not_exist
Jan 8, 2026
Merged

Fix REQUESTED_TABLE_NOT_EXISTS error#337
yi-xmu merged 1 commit into
mainfrom
fix_table_not_exist

Conversation

@yi-xmu

@yi-xmu yi-xmu commented Jan 5, 2026

Copy link
Copy Markdown
Collaborator

Here are some reminders before you submit the pull request

  • Add tests for the change
  • Document changes
  • Reference the link of issue using fixes eloqdb/tx_service#issue_id
  • Reference the link of RFC if exists
  • Pass ./mtr --suite=mono_main,mono_multi,mono_basic

Summary by CodeRabbit

  • Bug Fixes

    • Enhanced error handling to properly manage table-related failure scenarios during request retry operations.
  • Documentation

    • Added clarifying comments explaining edge case handling during DDL operations.

✏️ Tip: You can customize this high-level summary in your review settings.

@yi-xmu yi-xmu self-assigned this Jan 5, 2026
@coderabbitai

coderabbitai Bot commented Jan 5, 2026

Copy link
Copy Markdown

Walkthrough

This PR adds documentation and expands error-handling logic in transaction operations. A descriptive comment clarifies behavior when schema information is unavailable during DDL commits. Error handling in ReadLocalOperation::Forward is broadened to treat REQUESTED_TABLE_NOT_EXISTS alongside NG_TERM_CHANGED as retry-eligible errors.

Changes

Cohort / File(s) Summary
Documentation & Comments
tx_service/include/cc/cc_request.h
Added multi-line comment documenting the null-schema scenario during range partition path handling, explaining it can occur during DDL commit phases with subsequent retry via Forward(). No behavioral changes.
Error Handling Expansion
tx_service/src/tx_operation.cpp
Expanded ReadLocalOperation::Forward to treat REQUESTED_TABLE_NOT_EXISTS in addition to NG_TERM_CHANGED as error conditions eligible for retry logic when processing finished hd_result_.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • PR #334: Modifies ReadLocalOperation::Forward's finished-error handling to include NG_TERM_CHANGED in the retry path—overlaps with the same function and error-code branch as this PR.
  • PR #331: Modifies ReadLocalOperation::Forward's error-handling logic by adding different error codes to the retry/abort path—directly related to this PR's error-handling expansion.

Suggested reviewers

  • thweetkomputer

Poem

🐰 A schema that vanishes, a term that has changed,
Now caught by our Forward with logic rearranged!
When tables are missing, we retry with care,
Through DDL phases, hopping everywhere! 🌟

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description only contains a template checklist with no actual description content, missing explanation of what was changed, why, or issue references. Add a detailed description explaining the fix, why REQUESTED_TABLE_NOT_EXISTS needed to be treated as a retryable error, and reference the issue using 'fixes eloqdb/tx_service#issue_id'.
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Fix REQUESTED_TABLE_NOT_EXISTS error' directly corresponds to the main changes in the PR, which broaden error handling for the REQUESTED_TABLE_NOT_EXISTS error code in the retry logic.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix_table_not_exist

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 and usage tips.

@yi-xmu yi-xmu requested a review from liunyl January 5, 2026 11:04

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
tx_service/include/cc/catalog_cc_map.h (1)

2418-2422: Early return creates unreachable code at lines 2435-2439.

The new early return for Deleted status (lines 2418-2422) makes the subsequent check at lines 2435-2439 unreachable for the Deleted case. The early return is beneficial as it avoids unnecessary write-lock checks, but the redundant check should be removed.

🔎 Proposed refactor to remove redundant check
 const auto keylock = catalog_cce->GetKeyLock();
 if (keylock != nullptr && keylock->HasWriteLock())
 {
     DLOG(WARNING)
         << "InitCcm failure, target table: " << table_name.StringView()
         << " has write lock on catalog_cc_map, which means, it is "
            "being modified on this shard.";
     return InitCcmResult::Failure(CcErrorCode::READ_CATALOG_CONFLICT);
 }

-RecordStatus payload_status = catalog_cce->PayloadStatus();
-if (payload_status == RecordStatus::Deleted)
-{
-    return InitCcmResult::Failure(
-        CcErrorCode::REQUESTED_TABLE_NOT_EXISTS);
-}
-
-assert(payload_status == RecordStatus::Normal);
+assert(catalog_cce->PayloadStatus() == RecordStatus::Normal);
 CatalogRecord *catalog_rec = catalog_cce->payload_.cur_payload_.get();
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bc6852e and 1c1ad76.

📒 Files selected for processing (1)
  • tx_service/include/cc/catalog_cc_map.h
🧰 Additional context used
🧬 Code graph analysis (1)
tx_service/include/cc/catalog_cc_map.h (1)
tx_service/include/error_messages.h (1)
  • CcErrorCode (237-440)
🔇 Additional comments (1)
tx_service/include/cc/catalog_cc_map.h (1)

1233-1239: LGTM! Clean short-circuit for deleted catalog entries.

The early return when the payload status is Deleted is appropriate for the Read path, preventing unnecessary processing and clearly signaling that the catalog entry doesn't exist.

@yi-xmu yi-xmu force-pushed the fix_table_not_exist branch from 1c1ad76 to 39c542f Compare January 7, 2026 09:19

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
tx_service/src/tx_operation.cpp (1)

302-332: Assertion update for REQUESTED_TABLE_NOT_EXISTS looks correct

Extending the assert to include CcErrorCode::REQUESTED_TABLE_NOT_EXISTS keeps the debug-time expectations aligned with the errors the handler can now return, without changing runtime behavior. The retry/abort logic below is unchanged and will treat this condition consistently with the other retriable metadata errors.

If this error is specifically meant to represent the DDL-commit window for range-partitioned tables (as implied by the new comment in cc_request.h), consider expanding the nearby comment here to mention REQUESTED_TABLE_NOT_EXISTS as part of that DDL path to avoid future confusion for readers.

tx_service/include/cc/cc_request.h (1)

172-181: Clarify that this error is not exclusively tied to DDL commit and is caller-dependent

The added comment is useful, but it currently reads as if schema_ == nullptr only ever happens during a DDL commit phase and that every such request is retried via ReadLocalOperation::Forward(). In practice:

  • schema_ == nullptr can also represent a genuinely dropped/non‑existent table (likely with dirty_schema_ == nullptr), not just an in‑progress DDL.
  • TemplatedCcRequest::Execute is shared by many request types; only some are driven by ReadLocalOperation::Forward(). For others, retry behavior depends on their own callers.

To avoid misleading future readers, consider softening the wording to “can occur” and framing ReadLocalOperation::Forward() as an example of a caller that treats REQUESTED_TABLE_NOT_EXISTS as retriable, rather than implying that all callers do.

✏️ Suggested comment tweak
-                        // This error occurs when a DDL transaction is in its
+                        // This error can occur when a DDL transaction is in its
                         // commit phase: commit operations execute sequentially
                         // across all shards, but the dirty schema commit (which
                         // updates the table catalog entry in the localccshard)
                         // only happens on the last shard. Consequently,
                         // concurrent requests may encounter `schema_ ==
                         // nullptr` because the schema update hasn't been
-                        // applied to the localccshard yet. The request will be
-                        // automatically retried in
-                        // `ReadLocalOperation::Forward()`.
+                        // applied to the localccshard yet. In that case,
+                        // callers should treat `REQUESTED_TABLE_NOT_EXISTS`
+                        // as a retriable error (for example,
+                        // `ReadLocalOperation::Forward()` does this).
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1c1ad76 and 39c542f.

📒 Files selected for processing (2)
  • tx_service/include/cc/cc_request.h
  • tx_service/src/tx_operation.cpp
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2025-10-20T04:30:07.884Z
Learnt from: liunyl
Repo: eloqdata/tx_service PR: 149
File: include/cc/cc_request.h:1876-1927
Timestamp: 2025-10-20T04:30:07.884Z
Learning: ScanNextBatchCc in include/cc/cc_request.h is used only for hash-partition scans; range-partition scans are handled by ScanSliceCc.

Applied to files:

  • tx_service/include/cc/cc_request.h

@yi-xmu yi-xmu merged commit a8d63f6 into main Jan 8, 2026
4 checks passed
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.

2 participants