From eb335d2c29ad1172413747d5073b05f199a673d0 Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Fri, 11 Jun 2021 10:52:14 +0300 Subject: [PATCH] lib/storage: consistency renaming: getMaxRawRowsPerPartition -> getMaxRawRowsPerShard --- lib/storage/partition.go | 6 +++--- lib/storage/table_search_timing_test.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/storage/partition.go b/lib/storage/partition.go index 139547758..3288112f2 100644 --- a/lib/storage/partition.go +++ b/lib/storage/partition.go @@ -79,8 +79,8 @@ const finalPartsToMerge = 3 // Higher number of shards reduces CPU contention and increases the max bandwidth on multi-core systems. var rawRowsShardsPerPartition = (cgroup.AvailableCPUs() + 7) / 8 -// getMaxRowsPerPartition returns the maximum number of rows that haven't been converted into parts yet. -func getMaxRawRowsPerPartition() int { +// getMaxRawRowsPerShard returns the maximum number of rows that haven't been converted into parts yet. +func getMaxRawRowsPerShard() int { maxRawRowsPerPartitionOnce.Do(func() { n := memory.Allowed() / rawRowsShardsPerPartition / 256 / int(unsafe.Sizeof(rawRow{})) if n < 1e4 { @@ -515,7 +515,7 @@ type rawRows struct { } func getRawRowsMaxSize() *rawRows { - size := getMaxRawRowsPerPartition() + size := getMaxRawRowsPerShard() return getRawRowsWithSize(size) } diff --git a/lib/storage/table_search_timing_test.go b/lib/storage/table_search_timing_test.go index 927b54c40..cbe939d4b 100644 --- a/lib/storage/table_search_timing_test.go +++ b/lib/storage/table_search_timing_test.go @@ -110,7 +110,7 @@ func createBenchTable(b *testing.B, path string, startTimestamp int64, rowsPerIn func benchmarkTableSearch(b *testing.B, rowsCount, tsidsCount, tsidsSearch int, fetchData bool) { startTimestamp := timestampFromTime(time.Now()) - 365*24*3600*1000 - rowsPerInsert := getMaxRawRowsPerPartition() + rowsPerInsert := getMaxRawRowsPerShard() tb := openBenchTable(b, startTimestamp, rowsPerInsert, rowsCount, tsidsCount) tr := TimeRange{