Skip to content

KVStore: Fix fail to restore tikv value larger than 16MiB (#10055)#10069

Merged
ti-chi-bot[bot] merged 4 commits intopingcap:release-7.5from
ti-chi-bot:cherry-pick-10055-to-release-7.5
Apr 2, 2025
Merged

KVStore: Fix fail to restore tikv value larger than 16MiB (#10055)#10069
ti-chi-bot[bot] merged 4 commits intopingcap:release-7.5from
ti-chi-bot:cherry-pick-10055-to-release-7.5

Conversation

@ti-chi-bot
Copy link
Member

This is an automated cherry-pick of #10055

What problem does this PR solve?

Issue Number: close #10052

Problem Summary:

# tidb.toml
[performance]
txn-entry-size-limit = 125829120
# tiup edit
#    performance.txn-entry-size-limit: 125829120
# tikv.toml
[raftstore]
raft-entry-max-size = '120MiB'
# tiup edit
#     raftstore.raft-entry-max-size: '120MiB'
set global max_allowed_packet = 1073741824;
CREATE TABLE `t` (
  `id` bigint(21) unsigned NOT NULL,
  `text` longtext DEFAULT NULL
);

TiDB could allow a raft-log with 120MiB at max, while TiFlash Region::deserialize use readBinary2<std::string> only allow 16MiB at max. So if there are some raftlog larger than 16MiB and flushed to RegionData, then TiFlash could fail to restart when restoring Region data from disk.
If the raftlog is committed, the rows are decoded into Block and write down to IStorage. Reading/writing rows larger than 16MiB in the IStorage layer does not cause any error.

What is changed and how it works?

KVStore: Fix restoring large tikv value
Add function `readTiKVStringBinary` for `TiKVValue::deserialize` and `TiKVKey::deserialize` to allow restoring tikv key/values at most 120MiB

Check List

Tests

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

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Fix an issue that TiFlash may fail to restart when user write rows larger than 16MiB

Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
@ti-chi-bot ti-chi-bot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. 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. type/cherry-pick-for-release-7.5 This PR is cherry-picked to release-7.5 from a source PR. labels Apr 1, 2025
@ti-chi-bot
Copy link
Member Author

@JaySon-Huang This PR has conflicts, I have hold it.
Please resolve them or ask others to resolve them, then comment /unhold to remove the hold label.

@ti-chi-bot ti-chi-bot bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Apr 1, 2025
Signed-off-by: JaySon-Huang <tshent@qq.com>
@ti-chi-bot ti-chi-bot bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Apr 1, 2025
Signed-off-by: JaySon-Huang <tshent@qq.com>
@ti-chi-bot ti-chi-bot bot added cherry-pick-approved Cherry pick PR approved by release team. and removed do-not-merge/cherry-pick-not-approved labels Apr 1, 2025
Signed-off-by: JaySon-Huang <tshent@qq.com>
@JaySon-Huang JaySon-Huang removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 2, 2025
@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Apr 2, 2025
Copy link
Member

@CalvinNeo CalvinNeo left a comment

Choose a reason for hiding this comment

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

lgtm

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Apr 2, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: CalvinNeo, JaySon-Huang

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

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [CalvinNeo,JaySon-Huang]

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

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Apr 2, 2025
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Apr 2, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-04-02 02:46:11.147502966 +0000 UTC m=+1619664.831739062: ☑️ agreed by JaySon-Huang.
  • 2025-04-02 02:56:29.420259732 +0000 UTC m=+1620283.104495822: ☑️ agreed by CalvinNeo.

@ti-chi-bot ti-chi-bot bot merged commit e60cf00 into pingcap:release-7.5 Apr 2, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved cherry-pick-approved Cherry pick PR approved by release team. lgtm 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. type/cherry-pick-for-release-7.5 This PR is cherry-picked to release-7.5 from a source PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants