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 pageworklaod #5165

Merged
merged 4 commits into from
Jun 20, 2022
Merged
Show file tree
Hide file tree
Changes from 3 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
3 changes: 1 addition & 2 deletions dbms/src/Storages/Page/workload/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@

include_directories (${CMAKE_CURRENT_BINARY_DIR})

set (page-workload-src HeavyMemoryCostInGC.cpp HeavyRead.cpp HeavySkewWriteRead.cpp HeavyWrite.cpp HighValidBigFileGC.cpp HoldSnapshotsLongTime.cpp Normal.cpp
PageStorageInMemoryCapacity.cpp ThousandsOfOffset.cpp MainEntry.cpp Normal.cpp PageStorageInMemoryCapacity.cpp PSBackground.cpp PSRunnable.cpp PSStressEnv.cpp PSWorkload.cpp)
set (page-workload-src MainEntry.cpp PSBackground.cpp PSRunnable.cpp PSStressEnv.cpp PSWorkload.cpp)

add_library (page-workload-lib ${page-workload-src})
target_link_libraries (page-workload-lib dbms clickhouse_functions clickhouse-server-lib)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,4 @@ class HeavyMemoryCostInGC
fmt::format("Memory Peak is {} , it should not bigger than {} ", metrics_dumper->getMemoryPeak(), 5 * 1024 * 1024));
}
};

REGISTER_WORKLOAD(HeavyMemoryCostInGC)
} // namespace DB::PS::tests
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,4 @@ class HeavyRead : public StressWorkload
}
}
};

REGISTER_WORKLOAD(HeavyRead)
} // namespace DB::PS::tests
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,4 @@ class HeavySkewWriteRead : public StressWorkload
return true;
}
};

REGISTER_WORKLOAD(HeavySkewWriteRead)
} // namespace DB::PS::tests
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,4 @@ class HeavyWrite : public StressWorkload
return true;
}
};

REGISTER_WORKLOAD(HeavyWrite)
} // namespace DB::PS::tests
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,4 @@ class HighValidBigFileGCWorkload
private:
UInt64 gc_time_ms = 0;
};

REGISTER_WORKLOAD(HighValidBigFileGCWorkload)
} // namespace DB::PS::tests
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,4 @@ class HoldSnapshotsLongTime : public StressWorkload
return true;
}
};

REGISTER_WORKLOAD(HoldSnapshotsLongTime)
} // namespace DB::PS::tests
48 changes: 18 additions & 30 deletions dbms/src/Storages/Page/workload/MainEntry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,44 +11,32 @@
// 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.
#include <Storages/Page/workload/HeavyMemoryCostInGC.h>
#include <Storages/Page/workload/HeavyRead.h>
#include <Storages/Page/workload/HeavySkewWriteRead.h>
#include <Storages/Page/workload/HeavyWrite.h>
#include <Storages/Page/workload/HighValidBigFileGC.h>
#include <Storages/Page/workload/HoldSnapshotsLongTime.h>
#include <Storages/Page/workload/Normal.h>
#include <Storages/Page/workload/PSStressEnv.h>
#include <Storages/Page/workload/PSWorkload.h>
#include <Storages/Page/workload/PageStorageInMemoryCapacity.h>
#include <Storages/Page/workload/ThousandsOfOffset.h>

using namespace DB::PS::tests;

int StressWorkload::mainEntry(int argc, char ** argv)
{
{
// maybe due to sequence of linking, REGISTER_WORKLOAD is not visible to main function in dbms/src/Server/main.cpp
// cause that REGISTER_WORKLOAD will not be triggered before mainEntry
// we do this to trigger REGISTER_WORKLOAD explicitly.
void _work_load_register_named_HeavyMemoryCostInGC();
void (*f)() = _work_load_register_named_HeavyMemoryCostInGC;
(void)f;
void _work_load_register_named_HeavyRead();
f = _work_load_register_named_HeavyRead;
(void)f;
void _work_load_register_named_HeavySkewWriteRead();
f = _work_load_register_named_HeavySkewWriteRead;
(void)f;
void _work_load_register_named_HeavyWrite();
f = _work_load_register_named_HeavyWrite;
(void)f;
void _work_load_register_named_HighValidBigFileGCWorkload();
f = _work_load_register_named_HighValidBigFileGCWorkload;
(void)f;
void _work_load_register_named_HoldSnapshotsLongTime();
f = _work_load_register_named_HoldSnapshotsLongTime;
(void)f;
void _work_load_register_named_PageStorageInMemoryCapacity();
f = _work_load_register_named_PageStorageInMemoryCapacity;
(void)f;
void _work_load_register_named_NormalWorkload();
f = _work_load_register_named_NormalWorkload;
(void)f;
void _work_load_register_named_ThousandsOfOffset();
f = _work_load_register_named_ThousandsOfOffset;
(void)f;
work_load_register<HeavyMemoryCostInGC>();
work_load_register<HeavyRead>();
work_load_register<HeavySkewWriteRead>();
work_load_register<HeavyWrite>();
work_load_register<HighValidBigFileGCWorkload>();
work_load_register<HoldSnapshotsLongTime>();
work_load_register<PageStorageInMemoryCapacity>();
work_load_register<NormalWorkload>();
work_load_register<ThousandsOfOffset>();
}
try
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,4 @@ class NormalWorkload
stop_watch.stop();
}
};

REGISTER_WORKLOAD(NormalWorkload)
} // namespace DB::PS::tests
20 changes: 10 additions & 10 deletions dbms/src/Storages/Page/workload/PSWorkload.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,15 @@ class StressWorkloadManger
StressEnv options;
};

#define REGISTER_WORKLOAD(WORKLOAD) \
void __attribute__((constructor)) _work_load_register_named_##WORKLOAD(void) \
{ \
StressWorkloadManger::getInstance().reg( \
WORKLOAD::nameFunc(), \
WORKLOAD::maskFunc(), \
[](const StressEnv & opts) -> std::shared_ptr<StressWorkload> { \
return std::make_shared<WORKLOAD>(opts); \
}); \
}
template <class Workload>
void work_load_register()
{
StressWorkloadManger::getInstance().reg(
Workload::nameFunc(),
Workload::maskFunc(),
[](const StressEnv & opts) -> std::shared_ptr<StressWorkload> {
return std::make_shared<Workload>(opts);
});
}

} // namespace DB::PS::tests
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,4 @@ class PageStorageInMemoryCapacity : public StressWorkload
std::round(resident_used) ? (total_mem / ((double)resident_used / page_writen)) : 0));
}
};

REGISTER_WORKLOAD(PageStorageInMemoryCapacity)
} // namespace DB::PS::tests
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,4 @@ class ThousandsOfOffset : public StressWorkload
return true;
}
};

REGISTER_WORKLOAD(ThousandsOfOffset)
} // namespace DB::PS::tests