You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "UladzislauBlok (via GitHub)" <gi...@apache.org> on 2025/11/10 14:13:40 UTC
[PR] MINOR: Clean up RemoteLogManagerTest.testCopyQuota [kafka]
UladzislauBlok opened a new pull request, #20853:
URL: https://github.com/apache/kafka/pull/20853
Follow up for https://github.com/apache/kafka/pull/20845
This PR brings clean up for dead code, and split parametrized `testCopyQuota` into two tests
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] MINOR: Clean up RemoteLogManagerTest.testCopyQuota [kafka]
Posted by "UladzislauBlok (via GitHub)" <gi...@apache.org>.
UladzislauBlok commented on PR #20853:
URL: https://github.com/apache/kafka/pull/20853#issuecomment-3771869576
@chia7712 Hello. Sorry for the ping. This PR was already waiting for some time. Could you please take a look, it's simple one
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] MINOR: Clean up RemoteLogManagerTest.testCopyQuota [kafka]
Posted by "UladzislauBlok (via GitHub)" <gi...@apache.org>.
UladzislauBlok closed pull request #20853: MINOR: Clean up RemoteLogManagerTest.testCopyQuota
URL: https://github.com/apache/kafka/pull/20853
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] MINOR: Clean up RemoteLogManagerTest.testCopyQuota [kafka]
Posted by "UladzislauBlok (via GitHub)" <gi...@apache.org>.
UladzislauBlok commented on code in PR #20853:
URL: https://github.com/apache/kafka/pull/20853#discussion_r2510744470
##########
storage/src/test/java/org/apache/kafka/server/log/remote/storage/RemoteLogManagerTest.java:
##########
@@ -3399,56 +3399,52 @@ public void testEpochEntriesAsByteBuffer() throws Exception {
assertEquals(expectedEpoch + " " + expectedStartOffset, bufferedReader.readLine());
}
- @ParameterizedTest
- @ValueSource(booleans = {false, true})
- public void testCopyQuota(boolean quotaExceeded) throws Exception {
- RemoteLogManager.RLMCopyTask task = setupRLMTask(quotaExceeded);
-
- if (quotaExceeded) {
- // Verify that the copy operation times out, since no segments can be copied due to quota being exceeded
- assertThrows(AssertionFailedError.class, () -> assertTimeoutPreemptively(Duration.ofMillis(200), () -> task.copyLogSegmentsToRemote(mockLog)));
-
- Map<org.apache.kafka.common.MetricName, KafkaMetric> allMetrics = metrics.metrics();
- KafkaMetric avgMetric = allMetrics.get(metrics.metricName("remote-copy-throttle-time-avg", "RemoteLogManager"));
- KafkaMetric maxMetric = allMetrics.get(metrics.metricName("remote-copy-throttle-time-max", "RemoteLogManager"));
- assertEquals(quotaExceededThrottleTime, ((Double) avgMetric.metricValue()).longValue());
- assertEquals(quotaExceededThrottleTime, ((Double) maxMetric.metricValue()).longValue());
-
- // Verify the highest offset in remote storage is updated only once
- ArgumentCaptor<Long> capture = ArgumentCaptor.forClass(Long.class);
- verify(mockLog, times(1)).updateHighestOffsetInRemoteStorage(capture.capture());
- // Verify the highest offset in remote storage was -1L before the copy started
- assertEquals(-1L, capture.getValue());
- } else {
- // Verify the copy operation completes within the timeout, since it does not need to wait for quota availability
- assertTimeoutPreemptively(Duration.ofMillis(1000), () -> task.copyLogSegmentsToRemote(mockLog));
-
- // Verify quota check was performed
- verify(rlmCopyQuotaManager, times(1)).getThrottleTimeMs();
- // Verify bytes to copy was recorded with the quota manager
- verify(rlmCopyQuotaManager, times(1)).record(10);
-
- Map<org.apache.kafka.common.MetricName, KafkaMetric> allMetrics = metrics.metrics();
- KafkaMetric avgMetric = allMetrics.get(metrics.metricName("remote-copy-throttle-time-avg", "RemoteLogManager"));
- KafkaMetric maxMetric = allMetrics.get(metrics.metricName("remote-copy-throttle-time-max", "RemoteLogManager"));
- if (quotaExceeded) {
- assertEquals(Double.NaN, avgMetric.metricValue());
- assertEquals(Double.NaN, maxMetric.metricValue());
Review Comment:
Remove this code, because this dead. We already verified this value here https://github.com/apache/kafka/pull/20853/files#diff-b1c88902ed00a1f69231484869415b83599a711d5e95dec19c396f0a350c31d9L3414
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] MINOR: Clean up RemoteLogManagerTest.testCopyQuota [kafka]
Posted by "UladzislauBlok (via GitHub)" <gi...@apache.org>.
UladzislauBlok commented on PR #20853:
URL: https://github.com/apache/kafka/pull/20853#issuecomment-3511933784
@chia7712 Hello, this is follow up I was talking about here: https://issues.apache.org/jira/browse/KAFKA-19578
Could you please take a look?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] MINOR: Clean up RemoteLogManagerTest.testCopyQuota [kafka]
Posted by "UladzislauBlok (via GitHub)" <gi...@apache.org>.
UladzislauBlok commented on code in PR #20853:
URL: https://github.com/apache/kafka/pull/20853#discussion_r2510744470
##########
storage/src/test/java/org/apache/kafka/server/log/remote/storage/RemoteLogManagerTest.java:
##########
@@ -3399,56 +3399,52 @@ public void testEpochEntriesAsByteBuffer() throws Exception {
assertEquals(expectedEpoch + " " + expectedStartOffset, bufferedReader.readLine());
}
- @ParameterizedTest
- @ValueSource(booleans = {false, true})
- public void testCopyQuota(boolean quotaExceeded) throws Exception {
- RemoteLogManager.RLMCopyTask task = setupRLMTask(quotaExceeded);
-
- if (quotaExceeded) {
- // Verify that the copy operation times out, since no segments can be copied due to quota being exceeded
- assertThrows(AssertionFailedError.class, () -> assertTimeoutPreemptively(Duration.ofMillis(200), () -> task.copyLogSegmentsToRemote(mockLog)));
-
- Map<org.apache.kafka.common.MetricName, KafkaMetric> allMetrics = metrics.metrics();
- KafkaMetric avgMetric = allMetrics.get(metrics.metricName("remote-copy-throttle-time-avg", "RemoteLogManager"));
- KafkaMetric maxMetric = allMetrics.get(metrics.metricName("remote-copy-throttle-time-max", "RemoteLogManager"));
- assertEquals(quotaExceededThrottleTime, ((Double) avgMetric.metricValue()).longValue());
- assertEquals(quotaExceededThrottleTime, ((Double) maxMetric.metricValue()).longValue());
-
- // Verify the highest offset in remote storage is updated only once
- ArgumentCaptor<Long> capture = ArgumentCaptor.forClass(Long.class);
- verify(mockLog, times(1)).updateHighestOffsetInRemoteStorage(capture.capture());
- // Verify the highest offset in remote storage was -1L before the copy started
- assertEquals(-1L, capture.getValue());
- } else {
- // Verify the copy operation completes within the timeout, since it does not need to wait for quota availability
- assertTimeoutPreemptively(Duration.ofMillis(1000), () -> task.copyLogSegmentsToRemote(mockLog));
-
- // Verify quota check was performed
- verify(rlmCopyQuotaManager, times(1)).getThrottleTimeMs();
- // Verify bytes to copy was recorded with the quota manager
- verify(rlmCopyQuotaManager, times(1)).record(10);
-
- Map<org.apache.kafka.common.MetricName, KafkaMetric> allMetrics = metrics.metrics();
- KafkaMetric avgMetric = allMetrics.get(metrics.metricName("remote-copy-throttle-time-avg", "RemoteLogManager"));
- KafkaMetric maxMetric = allMetrics.get(metrics.metricName("remote-copy-throttle-time-max", "RemoteLogManager"));
- if (quotaExceeded) {
- assertEquals(Double.NaN, avgMetric.metricValue());
- assertEquals(Double.NaN, maxMetric.metricValue());
Review Comment:
Remove this code, because it's dead. We already verified this value here https://github.com/apache/kafka/pull/20853/files#diff-b1c88902ed00a1f69231484869415b83599a711d5e95dec19c396f0a350c31d9L3414
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org