Skip to content

Commit c5a8012

Browse files
committed
append test to verify update store will behave as expected
1 parent a45711d commit c5a8012

2 files changed

Lines changed: 57 additions & 0 deletions

File tree

internal/venice-test-common/src/integrationTest/java/com/linkedin/venice/controller/VeniceParentHelixAdminTest.java

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
import com.linkedin.venice.pubsub.manager.TopicManager;
5353
import com.linkedin.venice.pubsub.manager.TopicManagerRepository;
5454
import com.linkedin.venice.schema.AvroSchemaParseUtils;
55+
import com.linkedin.venice.schema.SchemaData;
5556
import com.linkedin.venice.schema.writecompute.WriteComputeSchemaConverter;
5657
import com.linkedin.venice.security.SSLFactory;
5758
import com.linkedin.venice.utils.IntegrationTestPushUtils;
@@ -1758,6 +1759,52 @@ public void testSupersetSchemaUpdateBehaviorWhenComputeDisabled() {
17581759
Assert.assertNotNull(supersetSchemaAfterDisable.getField("f3"), "Superset schema should still contain f3");
17591760
Assert.assertNotNull(supersetSchemaAfterDisable.getField("f4"), "Superset schema should still contain f4");
17601761
Assert.assertNotNull(supersetSchemaAfterDisable.getField("f5"), "Superset schema should still contain f5");
1762+
1763+
// ==================== PART 3: Clear superset schema via updateStore ====================
1764+
// Verify that setting latestSupersetSchemaId to INVALID_VALUE_SCHEMA_ID completely removes
1765+
// the superset schema from the store, and subsequent schema additions don't recreate it
1766+
// (since compute is still disabled).
1767+
1768+
// Step 7: Clear the superset schema by setting it to INVALID_VALUE_SCHEMA_ID
1769+
params = new UpdateStoreQueryParams();
1770+
params.setLatestSupersetSchemaId(SchemaData.INVALID_VALUE_SCHEMA_ID);
1771+
updateStoreResponse = parentControllerClient.updateStore(storeName, params);
1772+
Assert.assertNotNull(updateStoreResponse);
1773+
Assert.assertFalse(
1774+
updateStoreResponse.isError(),
1775+
"error in updateStoreResponse: " + updateStoreResponse.getError());
1776+
1777+
// Verify the superset schema ID is now INVALID (-1)
1778+
storeResponse = parentControllerClient.getStore(storeName);
1779+
Assert.assertFalse(storeResponse.isError(), "error in storeResponse: " + storeResponse.getError());
1780+
Assert.assertEquals(
1781+
storeResponse.getStore().getLatestSuperSetValueSchemaId(),
1782+
SchemaData.INVALID_VALUE_SCHEMA_ID,
1783+
"Superset schema ID should be INVALID after clearing it via updateStore");
1784+
1785+
// Verify compute is still disabled
1786+
Assert.assertFalse(
1787+
storeResponse.getStore().isReadComputationEnabled(),
1788+
"Read computation should still be disabled");
1789+
Assert.assertFalse(
1790+
storeResponse.getStore().isWriteComputationEnabled(),
1791+
"Write computation should still be disabled");
1792+
1793+
// Step 8: Add a new schema (ValueV9 with f2, f3, f7) after clearing the superset schema
1794+
// Since compute is disabled AND the superset schema was cleared, no new superset should be created
1795+
Schema valueSchemaV9 =
1796+
AvroCompatibilityHelper.parse(TestWriteUtils.loadFileAsString("valueSchema/supersetschemas/ValueV9.avsc"));
1797+
addSchemaResponse = parentControllerClient.addValueSchema(storeName, valueSchemaV9.toString());
1798+
Assert.assertNotNull(addSchemaResponse);
1799+
Assert.assertFalse(addSchemaResponse.isError(), "error in addSchemaResponse: " + addSchemaResponse.getError());
1800+
1801+
// Verify no superset schema was recreated
1802+
storeResponse = parentControllerClient.getStore(storeName);
1803+
Assert.assertFalse(storeResponse.isError(), "error in storeResponse: " + storeResponse.getError());
1804+
Assert.assertEquals(
1805+
storeResponse.getStore().getLatestSuperSetValueSchemaId(),
1806+
SchemaData.INVALID_VALUE_SCHEMA_ID,
1807+
"No superset schema should be created after clearing it when compute is disabled");
17611808
}
17621809
}
17631810

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"type" : "record",
3+
"namespace" : "example.avro",
4+
"name" : "ValueRecordName",
5+
"fields" : [
6+
{ "name" : "f2", "type" : "int", "default" : -1 },
7+
{ "name" : "f3", "type" : "int", "default" : -1 },
8+
{ "name" : "f7", "type" : "int", "default" : -1 }
9+
]
10+
}

0 commit comments

Comments
 (0)