Skip to content

Commit

Permalink
updated test
Browse files Browse the repository at this point in the history
  • Loading branch information
Sourav Maji committed Apr 26, 2024
1 parent 7c14f1c commit 9fac431
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Expand Up @@ -3533,10 +3533,12 @@ private OfflinePushStatusInfo getOffLineJobStatus(
ReadWriteStoreRepository repository = resources.getStoreMetadataRepository();
Store parentStore = repository.getStore(storeName);
boolean isTargetRegionPush = !StringUtils.isEmpty(targetedRegions);
boolean isVersionPushed =
parentStore.getVersion(versionNum).map(v -> v.getStatus().equals(PUSHED)).orElse(false);
// Truncate topic after push is in terminal state if
// 1. Its a hybrid store or regular push
// 3. If target push is enabled and its previously pushed by previous colo push (status == PUSHED)
if (!isTargetRegionPush || parentStore.getVersion(versionNum).get().getStatus().equals(PUSHED)
if (!isTargetRegionPush || isVersionPushed
|| parentStore.getVersion(versionNum).get().getHybridStoreConfig() != null) {
LOGGER
.info("Truncating parent VT {} after push status {}", kafkaTopic, currentReturnStatus.getRootStatus());
Expand All @@ -3546,10 +3548,10 @@ private OfflinePushStatusInfo getOffLineJobStatus(
incrementalPushVersion,
currentReturnStatus,
currentReturnStatusDetails);
} else {
int version = Version.parseVersionFromKafkaTopicName(kafkaTopic);
parentStore.updateVersionStatus(version, PUSHED);
repository.updateStore(parentStore);
if (!isVersionPushed) {
parentStore.updateVersionStatus(versionNum, PUSHED);
repository.updateStore(parentStore);
}
}
}
}
Expand Down
Expand Up @@ -66,6 +66,7 @@
import com.linkedin.venice.meta.StoreInfo;
import com.linkedin.venice.meta.Version;
import com.linkedin.venice.meta.VersionImpl;
import com.linkedin.venice.meta.VersionStatus;
import com.linkedin.venice.meta.ViewConfigImpl;
import com.linkedin.venice.meta.ZKStore;
import com.linkedin.venice.offsets.OffsetRecord;
Expand Down Expand Up @@ -1568,6 +1569,10 @@ public void testGetExecutionStatus() {
ReadWriteStoreRepository repository = mock(ReadWriteStoreRepository.class);
doReturn(repository).when(resources).getStoreMetadataRepository();
doReturn(store).when(repository).getStore(anyString());
Version version = mock(Version.class);
doReturn(Optional.of(version)).when(store).getVersion(anyInt());
doReturn(VersionStatus.CREATED).when(version).getStatus();
doReturn(Version.PushType.BATCH).when(version).getPushType();
Admin.OfflinePushStatusInfo offlineJobStatus = parentAdmin.getOffLineJobStatus("IGNORED", "topic1_v1", completeMap);
Map<String, String> extraInfo = offlineJobStatus.getExtraInfo();
Assert.assertEquals(offlineJobStatus.getExecutionStatus(), ExecutionStatus.COMPLETED);
Expand Down

0 comments on commit 9fac431

Please sign in to comment.