Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ddl: use length to determine if the slice is empty #41862

Merged
merged 10 commits into from Mar 9, 2023

Conversation

tangenta
Copy link
Contributor

@tangenta tangenta commented Mar 2, 2023

What problem does this PR solve?

Issue Number: close #41559

Problem Summary:

pi.AddingDefinitions is possible to be an empty slice, which is not equal to nil.

What is changed and how it works?

Use len(pi.AddingDefinitions) to determine if the slice is empty.

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

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Mar 2, 2023

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • Benjamin2037
  • zimulala

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

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

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added do-not-merge/needs-linked-issue release-note-none size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Mar 2, 2023
@dbsid
Copy link
Contributor

dbsid commented Mar 2, 2023

/build

@@ -1870,7 +1870,7 @@ func getNextPartitionInfo(reorg *reorgInfo, t table.PartitionedTable, currPhysic
// During index re-creation, process data from partitions to be added
nextPartitionDefs = pi.AddingDefinitions
}
if nextPartitionDefs == nil {
if len(nextPartitionDefs) == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we have a test to test it? Like check txn-merge or lightning-merge.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated. PTAL

@Benjamin2037
Copy link
Collaborator

Why can not add a test? only manual test?

@tangenta
Copy link
Contributor Author

tangenta commented Mar 7, 2023

@zimulala @Benjamin2037 I think it is related to the BR restore:

table = table.Clone()

In the Clone() function of PartitionInfo, it initializes an empty slice:

newPi.AddingDefinitions = make([]PartitionDefinition, len(pi.AddingDefinitions))

It is not easy to write a unit test for this... Maybe we need an integration test or e2e test.

@ti-chi-bot ti-chi-bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Mar 7, 2023
@tangenta
Copy link
Contributor Author

tangenta commented Mar 7, 2023

/run-br-integration-test

@tangenta
Copy link
Contributor Author

tangenta commented Mar 7, 2023

/run-integration-br-test

@tangenta
Copy link
Contributor Author

tangenta commented Mar 7, 2023

/run-integration-br-test

Copy link
Collaborator

@Benjamin2037 Benjamin2037 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 ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Mar 8, 2023
@tangenta
Copy link
Contributor Author

tangenta commented Mar 8, 2023

/run-integration-br-test

@tangenta
Copy link
Contributor Author

tangenta commented Mar 8, 2023

/run-integration-br-test

@tangenta
Copy link
Contributor Author

tangenta commented Mar 8, 2023

/run-integration-br-test

@tangenta
Copy link
Contributor Author

tangenta commented Mar 8, 2023

/run-integration-br-test

@tangenta
Copy link
Contributor Author

tangenta commented Mar 8, 2023

I confirmed that error can be detected by adding integration test.

[2023-03-08T09:29:54.265Z] coverage: 12.6% of statements in github.com/pingcap/tidb/br/...
[2023-03-08T09:39:01.094Z] ERROR 1105 (HY000) at line 1: DDL job rollback, error msg: partition id not found 95

@tangenta
Copy link
Contributor Author

tangenta commented Mar 8, 2023

/run-integration-br-test

Copy link
Contributor

@zimulala zimulala 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 ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Mar 8, 2023
@tangenta
Copy link
Contributor Author

tangenta commented Mar 9, 2023

/retest

Copy link
Contributor

@3pointer 3pointer left a comment

Choose a reason for hiding this comment

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

rest LGTM

# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

Copy link
Contributor

Choose a reason for hiding this comment

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

please add the link about this issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

@tangenta
Copy link
Contributor Author

tangenta commented Mar 9, 2023

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 70a2caf

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Mar 9, 2023
@hawkingrei
Copy link
Member

/retest

@tangenta
Copy link
Contributor Author

tangenta commented Mar 9, 2023

/retest because of unstable test #42061.

@ti-chi-bot
Copy link
Member

@tangenta: The /retest command does not accept any targets.
The following commands are available to trigger required jobs:

  • /test build
  • /test check-dev
  • /test check-dev2
  • /test mysql-test
  • /test unit-test

Use /test all to run all jobs.

In response to this:

/retest because of unstable test #42061.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@ti-chi-bot ti-chi-bot merged commit 309f3aa into pingcap:master Mar 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note-none size/M Denotes a PR that changes 30-99 lines, ignoring generated files. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adding index on master branch is over 3x slower using tidb_ddl_enable_fast_reorg
7 participants