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

[BugFix] fix stack use after scope when get extra file size (backport #39704) #39741

Merged
merged 1 commit into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions be/src/storage/tablet_updates.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2813,7 +2813,7 @@ size_t TabletUpdates::_get_rowset_num_deletes(const Rowset& rowset) {
}

Status TabletUpdates::_get_extra_file_size(int64_t* pindex_size, int64_t* col_size) const {
const std::string tablet_path = _tablet.schema_hash_path();
std::filesystem::path tablet_path(_tablet.schema_hash_path().c_str());
try {
for (const auto& entry : std::filesystem::directory_iterator(tablet_path)) {
if (entry.is_regular_file()) {
Expand All @@ -2832,13 +2832,13 @@ Status TabletUpdates::_get_extra_file_size(int64_t* pindex_size, int64_t* col_si
}
}
} catch (const std::filesystem::filesystem_error& ex) {
std::string err_msg = "Iterate dir " + tablet_path + " Filesystem error: " + ex.what();
std::string err_msg = "Iterate dir " + tablet_path.string() + " Filesystem error: " + ex.what();
return Status::InternalError(err_msg);
} catch (const std::exception& ex) {
std::string err_msg = "Iterate dir " + tablet_path + " Standard error: " + ex.what();
std::string err_msg = "Iterate dir " + tablet_path.string() + " Standard error: " + ex.what();
return Status::InternalError(err_msg);
} catch (...) {
std::string err_msg = "Iterate dir " + tablet_path + " Unknown exception occurred.";
std::string err_msg = "Iterate dir " + tablet_path.string() + " Unknown exception occurred.";
return Status::InternalError(err_msg);
}
return Status::OK();
Expand Down
4 changes: 4 additions & 0 deletions be/test/storage/tablet_updates_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1063,6 +1063,10 @@ void TabletUpdatesTest::test_writeread(bool enable_persistent_index) {
ASSERT_EQ(N, read_tablet(_tablet, 3));
ASSERT_EQ(N, read_tablet(_tablet, 2));
ASSERT_TRUE(read_with_cancel(_tablet, 4).is_cancelled());

// get tablet info
TTabletInfo tablet_info;
_tablet->updates()->get_tablet_info_extra(&tablet_info);
}

TEST_F(TabletUpdatesTest, writeread) {
Expand Down
Loading