Skip to content

Commit 802fb8a

Browse files
authored
Limit max number of tpcc rows per batch #28106 (#28181)
1 parent 0004636 commit 802fb8a

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

ydb/library/workload/tpcc/constants.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,6 @@ constexpr const size_t WAREHOUSES_PER_CPU_CORE = 1500;
107107
constexpr const size_t SESSIONS_PER_COMPUTE_CORE = 15;
108108
constexpr const size_t COMPUTE_CORES_PER_IMPORT_THREAD = 4;
109109

110+
constexpr const int MAX_WAREHOUSES_PER_IMPORT_BATCH = 20000;
111+
110112
} // namespace NYdb::NTPCC

ydb/library/workload/tpcc/import.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -630,12 +630,16 @@ void LoadSmallTables(
630630
ExecuteWithRetry("LoadItems", [&]() {
631631
return LoadItems(tableClient, itemTablePath, arena, fastRng, Log);
632632
}, arena, Log);
633-
ExecuteWithRetry("LoadWarehouses", [&]() {
634-
return LoadWarehouses(tableClient, warehouseTablePath, 1, warehouseCount, arena, fastRng, Log);
635-
}, arena, Log);
636-
ExecuteWithRetry("LoadDistricts", [&]() {
637-
return LoadDistricts(tableClient, districtTablePath, 1, warehouseCount, arena, fastRng, Log);
638-
}, arena, Log);
633+
634+
for (int wh = 1; wh <= warehouseCount; wh += MAX_WAREHOUSES_PER_IMPORT_BATCH) {
635+
int lastId = Min(wh + MAX_WAREHOUSES_PER_IMPORT_BATCH - 1, warehouseCount);
636+
ExecuteWithRetry("LoadWarehouses", [&]() {
637+
return LoadWarehouses(tableClient, warehouseTablePath, wh, lastId, arena, fastRng, Log);
638+
}, arena, Log);
639+
ExecuteWithRetry("LoadDistricts", [&]() {
640+
return LoadDistricts(tableClient, districtTablePath, wh, lastId, arena, fastRng, Log);
641+
}, arena, Log);
642+
}
639643
}
640644

641645
//-----------------------------------------------------------------------------

0 commit comments

Comments
 (0)