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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion be/src/olap/compaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.

RowsetSharedPtr max_rowset = _tablet->rowset_with_max_version();
if (max_rowset == nullptr) {
current_max_version = -1;
} else {
current_max_version = _tablet->rowset_with_max_version()->end_version();
}
}

LOG(INFO) << "succeed to do " << merge_type << compaction_name()
Expand Down