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

[v24.2.x] rptest: make target_min_capacity_wanted more deterministic #23606

Merged
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
9 changes: 6 additions & 3 deletions tests/rptest/clients/kafka_cli_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,8 @@ def produce(self,
record_size: int,
acks: int = -1,
throughput: int = -1,
batch_size: int = 81960):
batch_size: int = 81960,
linger_ms: int = 0):
self._redpanda.logger.debug("Producing to topic: %s", topic)
cmd = [self._script("kafka-producer-perf-test.sh")]
cmd += ["--topic", topic]
Expand All @@ -329,9 +330,11 @@ def produce(self,
cmd += ["--throughput", str(throughput)]
cmd += [
"--producer-props",
"acks=%d" % acks, "client.id=ducktape",
"acks=%d" % acks,
"client.id=ducktape",
"batch.size=%d" % batch_size,
"bootstrap.servers=%s" % self._redpanda.brokers()
"bootstrap.servers=%s" % self._redpanda.brokers(),
"linger.ms=%d" % linger_ms,
]
if self._command_config:
cmd += ["--producer.config", self._command_config.name]
Expand Down
33 changes: 22 additions & 11 deletions tests/rptest/tests/full_disk_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,35 +368,46 @@ def __init__(self, test_ctx):
def test_target_min_capacity_wanted_time_based(self):
admin = Admin(self.redpanda)
default_segment_size = admin.get_cluster_config()["log_segment_size"]
storage_reserve_min_segments = admin.get_cluster_config(
)["storage_reserve_min_segments"]

# produce roughly 30mb at 0.5mb/sec
kafka_tools = KafkaCliTools(self.redpanda)
kafka_tools.produce(self.topic,
30 * 1024,
1024,
throughput=500,
acks=-1)
acks=-1,
linger_ms=50)

node = self.redpanda.nodes[0]
reported = admin.get_local_storage_usage(
node)["target_min_capacity_wanted"]

# params. the size is about 900k larger than what was written,
# attributable to per record overheads etc... and determined emperically
# by looking at trace log stats.
# The size is slightly larger than what was written, attributable to
# per record overheads, indices, fallocation, etc... The expected size
# is determined empirically by looking at trace log stats.
size = 32664482
time = 61
retention = 3600
expected = retention * (size / time)

# factor in the 2 segments worth of space for controller log
diff = abs(reported - expected - 2 * default_segment_size)
# Factor in the full segments worth of space for controller log.
# This mirrors the math in disk_log_impl.cc
controller_want_size = storage_reserve_min_segments * default_segment_size

# there is definitely going to be some fuzz factor needed here and may
# need updated, but after many runs 50mb was a good amount of slack.
assert diff <= (
100 * 2**20
), f"diff {diff} reported {reported} expected {expected} default seg size {default_segment_size}"
diff = reported - controller_want_size - expected

# There is definitely going to be some fuzz factor needed here and may
# need updated.
diff_threshold = 100 * 2**20

self.logger.info(
f"{diff=} {diff_threshold=} {reported=} {expected=} {controller_want_size=}"
)
assert abs(
diff
) <= diff_threshold, f"abs({diff=}) <= {diff_threshold=} {reported=} {expected=} {controller_want_size=}"


class LocalDiskReportTest(RedpandaTest):
Expand Down