Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -1810,8 +1810,9 @@ public Version incrementVersionIdempotent(
return version;
}

boolean isExistingPushJobARepush = Version.isPushIdRePush(existingPushJobId);
boolean isIncomingPushJobARepush = Version.isPushIdRePush(pushJobId);
boolean isExistingPushJobARepush =
Version.isPushIdRePush(existingPushJobId) || Version.isPushIdTTLRePush(existingPushJobId);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we bundle this into a utility like Version.isSystemRepush() or something of that nature? That seems to be the intent and would mean only updating one place later should/when we add new variants like this.

boolean isIncomingPushJobARepush = Version.isPushIdRePush(pushJobId) || Version.isPushIdTTLRePush(pushJobId);

// If version swap is enabled, do not check for lingering push as user may swap at much later time.
if (!version.isVersionSwapDeferred() && getLingeringStoreVersionChecker()
Expand Down Expand Up @@ -1842,6 +1843,8 @@ public Version incrementVersionIdempotent(
// to be used.

// Kill the existing job if incoming push type is not an inc push and also not a repush job.
// This includes both regular repushes and TTL repushes (compliance repushes).
// User-initiated pushes should be able to kill compliance repushes (DEPEND-92712).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we currently do comments with internal LinkedIn jira? I guess it's not bad, but it's a little non-sequitor. I might prefer a github issue or something like that, but I understand that github issues never really made it into our process.

LOGGER.info(
"Found running repush job with push id: {} and incoming push is a batch job or stream reprocessing "
+ "job with push id: {}. Killing the repush job for store: {}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3440,4 +3440,71 @@ private AdminOperation verifyAndGetSingleAdminOperation() {
int schemaId = schemaCaptor.getValue();
return adminOperationSerializer.deserialize(ByteBuffer.wrap(valueBytes), schemaId);
}

/**
* Tests that a user-initiated batch push can kill an ongoing TTL repush (compliance repush).
* This is a fix for DEPEND-92712 where compliance repushes were blocking user-initiated pushes.
*
* This test verifies the logic in VeniceParentHelixAdmin.incrementVersionIdempotent() that checks:
* - if existing push is a TTL repush (isExistingPushJobARepush includes isPushIdTTLRePush check)
* - if incoming push is NOT a repush (!isIncomingPushJobARepush)
* - then it should kill the TTL repush
*/
@Test
public void testTTLRepushDetection() {
// Test that TTL repush IDs are correctly identified as repushes
String basePushJobId = System.currentTimeMillis() + "_job";
String ttlRepushJobId = Version.generateTTLRePushId(basePushJobId);
String regularRepushJobId = Version.generateRePushId(basePushJobId);
String regularPushJobId = basePushJobId;

// Verify the fix: TTL repush should be identified as a repush
boolean isTTLRepush = Version.isPushIdRePush(ttlRepushJobId) || Version.isPushIdTTLRePush(ttlRepushJobId);
boolean isRegularRepush =
Version.isPushIdRePush(regularRepushJobId) || Version.isPushIdTTLRePush(regularRepushJobId);
boolean isRegularPush = Version.isPushIdRePush(regularPushJobId) || Version.isPushIdTTLRePush(regularPushJobId);

Assert.assertTrue(isTTLRepush, "TTL repush should be identified as a repush");
Assert.assertTrue(isRegularRepush, "Regular repush should be identified as a repush");
Assert.assertFalse(isRegularPush, "Regular push should NOT be identified as a repush");

// Verify that the push ID prefixes are correct
Assert.assertTrue(ttlRepushJobId.startsWith("venice_ttl_re_push_"));
Assert.assertTrue(regularRepushJobId.startsWith("venice_re_push_"));
}

/**
* Tests the complete repush detection logic to ensure all repush types are correctly identified.
* This complements testTTLRepushDetection by verifying the fix in a different way.
*/
@Test
public void testRepushTypeIdentification() {
// Before the fix, this logic would only check Version.isPushIdRePush()
// After the fix, it checks both Version.isPushIdRePush() OR Version.isPushIdTTLRePush()

String baseId = "1234567890_job";

// Test all push types
String regularPush = baseId;
String regularRepush = Version.generateRePushId(baseId);
String ttlRepush = Version.generateTTLRePushId(baseId);
String regularPushWithTTL = Version.generateRegularPushWithTTLRePushId(baseId);

// Simulate the fixed logic in VeniceParentHelixAdmin.incrementVersionIdempotent()
boolean isRegularPushARepush = Version.isPushIdRePush(regularPush) || Version.isPushIdTTLRePush(regularPush);
boolean isRegularRepushARepush = Version.isPushIdRePush(regularRepush) || Version.isPushIdTTLRePush(regularRepush);
boolean isTTLRepushARepush = Version.isPushIdRePush(ttlRepush) || Version.isPushIdTTLRePush(ttlRepush);
boolean isRegularPushWithTTLARepush =
Version.isPushIdRePush(regularPushWithTTL) || Version.isPushIdTTLRePush(regularPushWithTTL);

// Verify expectations
Assert.assertFalse(isRegularPushARepush, "Regular push should not be identified as repush");
Assert.assertTrue(isRegularRepushARepush, "Regular repush should be identified as repush");
Assert.assertTrue(isTTLRepushARepush, "TTL repush should be identified as repush (this was the bug!)");
Assert.assertFalse(isRegularPushWithTTLARepush, "Regular push with TTL should not be identified as repush");

// Verify the specific fix: isPushIdTTLRePush correctly identifies TTL repush
Assert.assertFalse(Version.isPushIdRePush(ttlRepush), "isPushIdRePush alone doesn't catch TTL repush");
Assert.assertTrue(Version.isPushIdTTLRePush(ttlRepush), "isPushIdTTLRePush correctly identifies TTL repush");
}
}
Loading