Skip to content

do not return error always nil#5186

Open
3AceShowHand wants to merge 1 commit into
pingcap:masterfrom
3AceShowHand:remove-nil-error
Open

do not return error always nil#5186
3AceShowHand wants to merge 1 commit into
pingcap:masterfrom
3AceShowHand:remove-nil-error

Conversation

@3AceShowHand
Copy link
Copy Markdown
Collaborator

@3AceShowHand 3AceShowHand commented Jun 2, 2026

What problem does this PR solve?

Issue Number: close #xxx

What is changed and how it works?

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Questions

Will it cause performance regression or break compatibility?
Do you need to update user documentation, design documentation or monitoring documentation?

Release note

Please refer to [Release Notes Language Style Guide](https://pingcap.github.io/tidb-dev-guide/contribute-to-tidb/release-notes-style-guide.html) to write a quality release note.

If you don't think this PR needs a release note then fill it with `None`.

Summary by CodeRabbit

  • Refactor
    • Updated internal error handling in schema storage operations to streamline initialization and table loading processes.

@ti-chi-bot ti-chi-bot Bot added do-not-merge/needs-linked-issue release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Jun 2, 2026
@ti-chi-bot
Copy link
Copy Markdown

ti-chi-bot Bot commented Jun 2, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign lidezhu for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 2, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 53647656-a485-46ec-8731-8186790508b5

📥 Commits

Reviewing files that changed from the base of the PR and between e42d96d and 45f867c.

📒 Files selected for processing (2)
  • logservice/schemastore/disk_format.go
  • logservice/schemastore/persist_storage.go

📝 Walkthrough

Walkthrough

The PR systematically removes error returns from snapshot loading and storage initialization functions across two files. Internal helpers in disk_format.go no longer propagate errors; the public loadAllPhysicalTablesAtTs is simplified to match. persist_storage.go updates its table building and initialization methods to work without error handling from the refactored loaders.

Changes

Snapshot Loading and Storage Error Handling Removal

Layer / File(s) Summary
Internal snapshot loader functions
logservice/schemastore/disk_format.go
loadDatabasesInKVSnap, loadTablesInKVSnap, loadFullTablesInKVSnap, and loadAndApplyDDLHistory signatures are updated to remove trailing error returns. Functions now return only the constructed maps/slices and rely on existing log.Fatal calls for error handling.
Public snapshot loader entry point
logservice/schemastore/disk_format.go
loadAllPhysicalTablesAtTs changes from ([]commonEvent.Table, error) to []commonEvent.Table. Error checking at loader call sites is eliminated; the function returns only the table slice.
Table info store building and snapshot integration
logservice/schemastore/persist_storage.go
buildVersionedTableInfoStore and addTableInfoFromKVSnap signatures remove error returns. buildVersionedTableInfoStore now calls addTableInfoFromKVSnap without error handling and proceeds to apply persisted DDLs and mark initialization complete.
Storage method updates
logservice/schemastore/persist_storage.go
initializeFromDisk loads snapshot metadata without capturing errors from loaders. getAllPhysicalTables returns the snapshot loader result directly. registerTable adapts to buildVersionedTableInfoStore no longer returning an error.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 Error returns hop away today,
Fatal logs now have their say,
Snapshots load without a care,
Storage builds with simple flair,
Simpler paths through the air!

🚥 Pre-merge checks | ✅ 2 | ❌ 3

❌ Failed checks (2 warnings, 1 inconclusive)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is a largely unfilled template with placeholder values like 'close #xxx' and empty critical sections for problem statement and implementation details. Complete the description by: specifying the actual issue number, explaining the problem and motivation, detailing what changed and how it works, indicating test coverage, and providing a release note.
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'do not return error always nil' is vague and generic, using non-descriptive phrasing that doesn't convey what the changeset accomplishes. Clarify the title to describe the actual change, such as 'Remove unnecessary error returns from schema store functions' or similar.
✅ Passed checks (2 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

Command failed


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.

@ti-chi-bot ti-chi-bot Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jun 2, 2026
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request simplifies the codebase by removing unnecessary error return values from several internal functions in logservice/schemastore (such as loadDatabasesInKVSnap, loadTablesInKVSnap, loadFullTablesInKVSnap, loadAndApplyDDLHistory, loadAllPhysicalTablesAtTs, buildVersionedTableInfoStore, and addTableInfoFromKVSnap) that previously always returned nil errors. This cleanup simplifies the call sites and improves code readability. There are no review comments, so I have no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@ti-chi-bot
Copy link
Copy Markdown

ti-chi-bot Bot commented Jun 2, 2026

[FORMAT CHECKER NOTIFICATION]

Notice: To remove the do-not-merge/needs-linked-issue label, please provide the linked issue number on one line in the PR body, for example: Issue Number: close #123 or Issue Number: ref #456.

📖 For more info, you can check the "Contribute Code" section in the development guide.

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

Labels

do-not-merge/needs-linked-issue release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant