From 3199558da921bbb50dc3691f4a4dee2b25247e17 Mon Sep 17 00:00:00 2001
From: Aliaksandr Valialkin <valyala@victoriametrics.com>
Date: Tue, 23 Jan 2024 17:44:05 +0200
Subject: [PATCH] lib/{storage,mergeset}: reduce the maxium compression level
 for the stored data

This reduces CPU usage a bit, while doesn't increase resulting file sizes according to synthetic tests.
---
 lib/mergeset/table.go    | 5 +----
 lib/storage/partition.go | 8 +-------
 2 files changed, 2 insertions(+), 11 deletions(-)

diff --git a/lib/mergeset/table.go b/lib/mergeset/table.go
index 6cf6696151..ab82d123c5 100644
--- a/lib/mergeset/table.go
+++ b/lib/mergeset/table.go
@@ -1323,10 +1323,7 @@ func getCompressLevel(itemsCount uint64) int {
 	if itemsCount <= 1<<25 {
 		return 2
 	}
-	if itemsCount <= 1<<28 {
-		return 3
-	}
-	return 4
+	return 3
 }
 
 func (tb *Table) nextMergeIdx() uint64 {
diff --git a/lib/storage/partition.go b/lib/storage/partition.go
index acec2bb188..8861a0afaa 100644
--- a/lib/storage/partition.go
+++ b/lib/storage/partition.go
@@ -1542,13 +1542,7 @@ func getCompressLevel(rowsPerBlock float64) int {
 	if rowsPerBlock <= 1000 {
 		return 2
 	}
-	if rowsPerBlock <= 2000 {
-		return 3
-	}
-	if rowsPerBlock <= 4000 {
-		return 4
-	}
-	return 5
+	return 3
 }
 
 func (pt *partition) nextMergeIdx() uint64 {