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

[fix][compaction] Rowset::end_version null pointer #9379

Merged
merged 1 commit into from
May 6, 2022

Conversation

xinyiZzz
Copy link
Contributor

@xinyiZzz xinyiZzz commented May 5, 2022

Proposed changes

Issue Number: close #9371

Problem Summary:

After compaction, get tablet max version rowset returns null.

Checklist(Required)

  1. Does it affect the original behavior: (Yes/No/I Don't know)
  2. Has unit tests been added: (Yes/No/No Need)
  3. Has document been added or modified: (Yes/No/No Need)
  4. Does it need to update dependencies: (Yes/No)
  5. Are there any changes that cannot be rolled back: (Yes/No)

Further comments

If this is a relatively large or complex change, kick off the discussion at [email protected] by explaining why you chose the solution you did and what alternatives you considered, etc...

@@ -136,7 +136,12 @@ Status Compaction::do_compaction_impl(int64_t permits) {
int64_t current_max_version;
{
std::shared_lock rdlock(_tablet->get_header_lock());
current_max_version = _tablet->rowset_with_max_version()->end_version();
Copy link
Contributor

Choose a reason for hiding this comment

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

when will rowset_with_max_version == nullptr?

Copy link
Contributor Author

@xinyiZzz xinyiZzz May 5, 2022

Choose a reason for hiding this comment

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

This seems to happen in two cases:

  1. The tablet has no rowset.
  2. The version of max version rowset no longer exists in the tablet.

In fact, I did not carefully analyze why it occurs. Because other tablet->rowset_with_max_version() all compare whether the return value is null, so I also compare here : )

And here current_max_version is only used to print the log, it will not affect the execution.

Copy link
Contributor

Choose a reason for hiding this comment

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

  1. The tablet should not have rowset because when the table is created BE will add 0-1 rowset to the tablet.
  2. I think we should be careful with this case... Maybe should deep dive some code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. The tablet should not have rowset because when the table is created BE will add 0-1 rowset to the tablet.
  2. I think we should be careful with this case... Maybe should deep dive some code.

I agree, these two cases are not normal, maybe the tablet was deleted during compaction, or invalid?

At present this is the previous solution, there may be a better way.

Copy link
Contributor

@yiguolei yiguolei left a comment

Choose a reason for hiding this comment

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

LGTM

@yiguolei yiguolei added approved Indicates a PR has been approved by one committer. compaction labels May 6, 2022
@github-actions
Copy link
Contributor

github-actions bot commented May 6, 2022

PR approved by anyone and no changes requested.

@yiguolei yiguolei merged commit e130d2f into apache:master May 6, 2022
@yiguolei yiguolei added the dev/backlog waiting to be merged in future dev branch label May 6, 2022
@morningman morningman added dev/1.0.1-deprecated should be merged into dev-1.0.1 branch and removed dev/backlog waiting to be merged in future dev branch labels May 6, 2022
@morningman morningman added dev/merged-1.0.1-deprecated PR has been merged into dev-1.0.1 and removed dev/1.0.1-deprecated should be merged into dev-1.0.1 branch labels May 16, 2022
starocean999 pushed a commit to starocean999/incubator-doris that referenced this pull request May 19, 2022
englefly pushed a commit to englefly/incubator-doris that referenced this pull request May 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by one committer. compaction dev/merged-1.0.1-deprecated PR has been merged into dev-1.0.1 reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Compaction Rowset::end_version null pointer
3 participants