Skip to content

Commit eac4a66

Browse files
committed
Try setting bootstrapToOnlineTimeoutInHours directly, instead of relying on storeResponse. 🥸
1 parent 210c28c commit eac4a66

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

clients/venice-push-job/src/main/java/com/linkedin/venice/hadoop/VenicePushJob.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -668,8 +668,7 @@ public void run() {
668668
pushJobSetting.storeName,
669669
pushJobSetting.clusterName);
670670

671-
long bootstrapToOnlineTimeoutInHours =
672-
getStoreResponse(pushJobSetting.storeName).getStore().getBootstrapToOnlineTimeoutInHours();
671+
long bootstrapToOnlineTimeoutInHours = getBootstrapToOnlineTimeoutInHours();
673672
timeoutExecutor.schedule(() -> {
674673
cancel();
675674
throw new VeniceException(
@@ -2645,6 +2644,12 @@ public String getTopicToMonitor() {
26452644
return getTopicToMonitor(this.pushJobSetting);
26462645
}
26472646

2647+
// Visible for testing
2648+
public long getBootstrapToOnlineTimeoutInHours() {
2649+
// getStoreResponse() is necessary because this is called at the very start of the job
2650+
return getStoreResponse(pushJobSetting.storeName).getStore().getBootstrapToOnlineTimeoutInHours();
2651+
}
2652+
26482653
private String getTopicToMonitor(PushJobSetting pushJobSetting) {
26492654
return Version.isRealTimeTopic(pushJobSetting.topic)
26502655
? Version.composeKafkaTopic(pushJobSetting.storeName, pushJobSetting.version)

clients/venice-push-job/src/test/java/com/linkedin/venice/hadoop/VenicePushJobTest.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -335,11 +335,6 @@ public void testDataWriterComputeJobTimeout(Class<? extends DataWriterComputeJob
335335
doReturn(response).when(client).killOfflinePushJob(anyString());
336336

337337
try (VenicePushJob pushJob = getSpyVenicePushJob(props, client)) {
338-
StoreInfo storeInfo = new StoreInfo();
339-
storeInfo.setBootstrapToOnlineTimeoutInHours(0);
340-
PushJobSetting pushJobSetting = pushJob.getPushJobSetting();
341-
pushJobSetting.storeResponse = new StoreResponse();
342-
pushJobSetting.storeResponse.setStore(storeInfo);
343338
CountDownLatch runningJobLatch = new CountDownLatch(1);
344339
CountDownLatch killedJobLatch = new CountDownLatch(1);
345340
skipVPJValidation(pushJob);
@@ -369,6 +364,7 @@ public void testDataWriterComputeJobTimeout(Class<? extends DataWriterComputeJob
369364

370365
try {
371366
doCallRealMethod().when(pushJob).runJobAndUpdateStatus();
367+
doReturn(0L).when(pushJob).getBootstrapToOnlineTimeoutInHours(); // timeoutExecutor can immediately run
372368
DataWriterComputeJob dataWriterJob = spy(pushJob.getDataWriterComputeJob());
373369
pushJob.setDataWriterComputeJob(dataWriterJob);
374370
doNothing().when(dataWriterJob).validateJob();

0 commit comments

Comments
 (0)