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

*: Support generating adhoc heap profiling in svg format #9273

Merged
merged 2 commits into from
Jul 31, 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
2 changes: 1 addition & 1 deletion dbms/src/Storages/KVStore/tests/gtest_async_tasks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ try
auto async_tasks = std::make_unique<TestAsyncTasks>(1, 1, 2);

int total = 5;
int max_steps = 10;
int max_steps = 15;
int current_step = 0;
std::vector<char> f(total, false);
std::vector<char> s(total, false);
Expand Down
10 changes: 10 additions & 0 deletions dbms/src/Storages/Page/V3/Universal/UniversalWriteBatchImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ namespace ErrorCodes
extern const int LOGICAL_ERROR;
} // namespace ErrorCodes

namespace tests
{
class UniPageStorageIdTest;
}

class UniversalWriteBatch : private boost::noncopyable
{
private:
Expand Down Expand Up @@ -266,6 +271,7 @@ class UniversalWriteBatch : private boost::noncopyable
void merge(UniversalWriteBatch & rhs)
{
writes.reserve(writes.size() + rhs.writes.size());
PS::PageStorageMemorySummary::universal_write_count.fetch_add(rhs.writes.size());
for (const auto & r : rhs.writes)
{
writes.emplace_back(r);
Expand All @@ -276,6 +282,7 @@ class UniversalWriteBatch : private boost::noncopyable

[[clang::reinitializes]] void clear()
{
PS::PageStorageMemorySummary::universal_write_count.fetch_sub(writes.size());
Writes tmp;
writes.swap(tmp);
total_data_size = 0;
Expand All @@ -302,6 +309,9 @@ class UniversalWriteBatch : private boost::noncopyable
std::swap(remote_lock_disabled, o.remote_lock_disabled);
}

private:
friend class UniPageStorageIdTest;

private:
String prefix;
Writes writes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,50 @@ TEST(UniPageStorageIdTest, UniversalWriteBatchMemory)
ASSERT_EQ(PageStorageMemorySummary::universal_write_count.load(), 1);
}
ASSERT_EQ(PageStorageMemorySummary::universal_write_count.load(), 0);
{
UniversalWriteBatch wb;
wb.putPage(
UniversalPageIdFormat::toFullPageId(prefix, 0),
tag,
std::make_shared<ReadBufferFromMemory>(c_buff, buf_sz),
buf_sz);
UniversalWriteBatch wb2;
wb2.merge(wb);
ASSERT_EQ(PageStorageMemorySummary::universal_write_count.load(), 2);
}
{
UniversalWriteBatch wb;
wb.putPage(
UniversalPageIdFormat::toFullPageId(prefix, 0),
tag,
std::make_shared<ReadBufferFromMemory>(c_buff, buf_sz),
buf_sz);
wb.clear();
ASSERT_EQ(PageStorageMemorySummary::universal_write_count.load(), 0);
}
{
UniversalWriteBatch wb;
wb.putPage(
UniversalPageIdFormat::toFullPageId(prefix, 0),
tag,
std::make_shared<ReadBufferFromMemory>(c_buff, buf_sz),
buf_sz);
ASSERT_EQ(PageStorageMemorySummary::universal_write_count.load(), 1);
UniversalWriteBatch wb2;
wb.putPage(
UniversalPageIdFormat::toFullPageId(prefix, 1),
tag,
std::make_shared<ReadBufferFromMemory>(c_buff, buf_sz),
buf_sz);
wb.putPage(
UniversalPageIdFormat::toFullPageId(prefix, 2),
tag,
std::make_shared<ReadBufferFromMemory>(c_buff, buf_sz),
buf_sz);
ASSERT_EQ(PageStorageMemorySummary::universal_write_count.load(), 3);
wb.swap(wb2);
ASSERT_EQ(PageStorageMemorySummary::universal_write_count.load(), 3);
}
}

} // namespace PS::universal::tests
Expand Down