Skip to content

Commit

Permalink
MINOR: Reduce the time taken to execute the TieredStorage tests. (#15780
Browse files Browse the repository at this point in the history
)

Reduce the time taken to execute the TieredStorage tests

Reviewers: Luke Chen <showuon@gmail.com>, Chia-Ping Tsai <chia7712@gmail.com>
  • Loading branch information
kamalcph committed Apr 23, 2024
1 parent b254e78 commit 18572f5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public final class ProduceAction implements TieredStorageTestAction {
* This timeout should exceed the {@link org.apache.kafka.tiered.storage.utils.TieredStorageTestUtils#STORAGE_WAIT_TIMEOUT_SEC}
* so that the test can verify that the active segment gets rolled and offloaded to the remote storage.
*/
private static final int OFFLOAD_WAIT_TIMEOUT_SEC = 40;
private static final int OFFLOAD_WAIT_TIMEOUT_SEC = 10;

private final TopicPartition topicPartition;
private final List<OffloadedSegmentSpec> offloadedSegmentSpecs;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;

import static org.apache.kafka.server.config.ServerLogConfigs.LOG_INITIAL_TASK_DELAY_MS_CONFIG;
import static org.apache.kafka.server.log.remote.metadata.storage.TopicBasedRemoteLogMetadataManagerConfig.REMOTE_LOG_METADATA_INITIALIZATION_RETRY_INTERVAL_MS_PROP;
import static org.apache.kafka.server.log.remote.storage.LocalTieredStorage.DELETE_ON_CLOSE_CONFIG;
import static org.apache.kafka.server.log.remote.storage.LocalTieredStorage.STORAGE_DIR_CONFIG;
Expand All @@ -52,12 +53,9 @@

public class TieredStorageTestUtils {

/**
* InitialTaskDelayMs is set to 30 seconds for the delete-segment scheduler in Apache Kafka.
* Hence, we need to wait at least that amount of time before segments eligible for deletion
* gets physically removed.
*/
public static final Integer STORAGE_WAIT_TIMEOUT_SEC = 35;
// Log cleanup interval is configured to be 500 ms. We need to wait at least that amount of time before
// segments eligible for deletion gets physically removed.
public static final Integer STORAGE_WAIT_TIMEOUT_SEC = 5;
// The default value of log cleanup interval is 30 secs, and it increases the test execution time.
private static final Integer LOG_CLEANUP_INTERVAL_MS = 500;
private static final Integer RLM_TASK_INTERVAL_MS = 500;
Expand Down Expand Up @@ -133,10 +131,11 @@ public static Properties createPropsForRemoteStorage(String testClassName,
overridingProps.setProperty(
metadataConfigPrefix(testClassName, TopicBasedRemoteLogMetadataManagerConfig.REMOTE_LOG_METADATA_TOPIC_REPLICATION_FACTOR_PROP),
String.valueOf(brokerCount));
// This configuration ensures inactive log segments are deleted fast enough so that
// The below two configurations ensures inactive log segments are deleted fast enough so that
// the integration tests can confirm a given log segment is present only in the second-tier storage.
// Note that this does not impact the eligibility of a log segment to be offloaded to the
// second-tier storage.
overridingProps.setProperty(LOG_INITIAL_TASK_DELAY_MS_CONFIG, LOG_CLEANUP_INTERVAL_MS.toString());
overridingProps.setProperty(LOG_CLEANUP_INTERVAL_MS_CONFIG, LOG_CLEANUP_INTERVAL_MS.toString());
// The directory of the second-tier storage needs to be constant across all instances of storage managers
// in every broker and throughout the test. Indeed, as brokers are restarted during the test.
Expand Down

0 comments on commit 18572f5

Please sign in to comment.