|
52 | 52 | import com.linkedin.venice.pubsub.manager.TopicManager; |
53 | 53 | import com.linkedin.venice.pubsub.manager.TopicManagerRepository; |
54 | 54 | import com.linkedin.venice.schema.AvroSchemaParseUtils; |
| 55 | +import com.linkedin.venice.schema.SchemaData; |
55 | 56 | import com.linkedin.venice.schema.writecompute.WriteComputeSchemaConverter; |
56 | 57 | import com.linkedin.venice.security.SSLFactory; |
57 | 58 | import com.linkedin.venice.utils.IntegrationTestPushUtils; |
@@ -1758,6 +1759,52 @@ public void testSupersetSchemaUpdateBehaviorWhenComputeDisabled() { |
1758 | 1759 | Assert.assertNotNull(supersetSchemaAfterDisable.getField("f3"), "Superset schema should still contain f3"); |
1759 | 1760 | Assert.assertNotNull(supersetSchemaAfterDisable.getField("f4"), "Superset schema should still contain f4"); |
1760 | 1761 | 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"); |
1761 | 1808 | } |
1762 | 1809 | } |
1763 | 1810 |
|
|
0 commit comments