Skip to content

disagg: Fix error when there are empty partitions#8221

Merged
ti-chi-bot[bot] merged 3 commits intopingcap:masterfrom
JaySon-Huang:fix_error_part_table
Oct 19, 2023
Merged

disagg: Fix error when there are empty partitions#8221
ti-chi-bot[bot] merged 3 commits intopingcap:masterfrom
JaySon-Huang:fix_error_part_table

Conversation

@JaySon-Huang
Copy link
Contributor

@JaySon-Huang JaySon-Huang commented Oct 19, 2023

What problem does this PR solve?

Issue Number: close #8220

Problem Summary:

When there are empty partition tables, we may receive EstablishDisaggTaskResponse with empty segment read tasks because the SchemaBuilder won't construct a table with a segment without any rows inside it.

create database if not exists partition360;
create table if not exists `partition360`.`partition360_8` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '自增id',
  `m_req_all` bigint(20) unsigned NOT NULL DEFAULT '0',
  `text` varchar(2048)        NOT NULL default '',
  `create_date` date NOT NULL DEFAULT '2000-01-01',
  `aid` int(11) unsigned NOT NULL DEFAULT '0',
  `atime` time NOT NULL DEFAULT '-01:00:00',
  `create_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`,`create_date`) /*T![clustered_index] NONCLUSTERED */,
  UNIQUE KEY `unq_p` (`aid`, `atime`, `create_date`)
  ) PARTITION BY RANGE COLUMNS(create_date) (
  PARTITION `p20210506` VALUES LESS THAN ("20210507"),
  PARTITION `p20210507` VALUES LESS THAN ("20210508")
  )
alter table partition360_8 set tiflash replica 2;
select * from partition360_8;
(1105, 'other error for mpp stream: Code: 49, e.displayText() = DB::Exception: Check n > 0 failed, n = 0, e.what() = DB::Exception,')

What is changed and how it works?

Add an empty channel for RNWorkers in this situation

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 the issue that executing queries on empty partitions causes query failure

@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-linked-issue release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Oct 19, 2023
@JaySon-Huang JaySon-Huang changed the title Fix error when there are empty partitions disagg: Fix error when there are empty partitions Oct 19, 2023
@ti-chi-bot ti-chi-bot bot added needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/needs-linked-issue release-note-none Denotes a PR that doesn't merit a release note. labels Oct 19, 2023
@JaySon-Huang
Copy link
Contributor Author

/run-all-tests

@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Oct 19, 2023
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Oct 19, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JinheLin, Lloyd-Pottiger

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 [JinheLin,Lloyd-Pottiger]

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 Oct 19, 2023
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Oct 19, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-10-19 08:46:37.128579089 +0000 UTC m=+1905994.715689234: ☑️ agreed by JinheLin.
  • 2023-10-19 08:49:11.841407477 +0000 UTC m=+1906149.428517622: ☑️ agreed by Lloyd-Pottiger.

@JaySon-Huang
Copy link
Contributor Author

/hold

@ti-chi-bot ti-chi-bot bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 19, 2023
@ti-chi-bot ti-chi-bot bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Oct 19, 2023
@JaySon-Huang
Copy link
Contributor Author

/hold cancel

@ti-chi-bot ti-chi-bot bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 19, 2023
@JaySon-Huang
Copy link
Contributor Author

/run-all-tests

@JaySon-Huang
Copy link
Contributor Author

/run-integration-test

@ti-chi-bot ti-chi-bot bot merged commit fea463e into pingcap:master Oct 19, 2023
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-7.5: #8224.

@JaySon-Huang JaySon-Huang deleted the fix_error_part_table branch October 19, 2023 10:34
guo-shaoge pushed a commit to guo-shaoge/tiflash that referenced this pull request Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved lgtm needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. 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.

disagg: Failed to query on empty partition table

4 participants