Skip to content

Commit 3c9b2f2

Browse files
pthirunclaude
andcommitted
[controller] Register PARTITION_STATE and STORE_VERSION_STATE schemas at
startup Add ControllerClientBackedSystemSchemaInitializer for PARTITION_STATE and STORE_VERSION_STATE, matching the existing pattern for KAFKA_MESSAGE_ENVELOPE. This allows any child controller to register new schema versions at startup, removing the dependency on deploying the system schema cluster controller first. Gated by new config controller.storage.protocol.schema.startup.registration.enabled (default: false) for intentional rollout. Requires the existing system.schema.initialization.at.start.time.enabled to also be true. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 49e1978 commit 3c9b2f2

3 files changed

Lines changed: 50 additions & 0 deletions

File tree

internal/venice-common/src/main/java/com/linkedin/venice/ConfigKeys.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,15 @@ private ConfigKeys() {
716716
public static final String SYSTEM_SCHEMA_INITIALIZATION_AT_START_TIME_ENABLED =
717717
"system.schema.initialization.at.start.time.enabled";
718718

719+
/**
720+
* Whether to register PARTITION_STATE and STORE_VERSION_STATE schemas via
721+
* ControllerClientBackedSystemSchemaInitializer at controller startup.
722+
* Requires {@link #SYSTEM_SCHEMA_INITIALIZATION_AT_START_TIME_ENABLED} to also be true.
723+
* Default: false.
724+
*/
725+
public static final String CONTROLLER_STORAGE_PROTOCOL_SCHEMA_STARTUP_REGISTRATION_ENABLED =
726+
"controller.storage.protocol.schema.startup.registration.enabled";
727+
719728
public static final String KME_REGISTRATION_FROM_MESSAGE_HEADER_ENABLED =
720729
"kme.registration.from.message.header.enabled";
721730

services/venice-controller/src/main/java/com/linkedin/venice/controller/VeniceController.java

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,38 @@ private void initializeSystemSchema(Admin admin) {
515515
d2ZkHost,
516516
sslOnly);
517517
kmeSchemaInitializer.execute();
518+
519+
if (systemStoreClusterConfig.isStorageProtocolSchemaStartupRegistrationEnabled()) {
520+
ControllerClientBackedSystemSchemaInitializer partitionStateSchemaInitializer =
521+
new ControllerClientBackedSystemSchemaInitializer(
522+
AvroProtocolDefinition.PARTITION_STATE,
523+
systemStoreCluster,
524+
null,
525+
null,
526+
false,
527+
((VeniceHelixAdmin) admin).getSslFactory(),
528+
childControllerUrl,
529+
d2ServiceName,
530+
regionD2Client,
531+
d2ZkHost,
532+
sslOnly);
533+
partitionStateSchemaInitializer.execute();
534+
535+
ControllerClientBackedSystemSchemaInitializer storeVersionStateSchemaInitializer =
536+
new ControllerClientBackedSystemSchemaInitializer(
537+
AvroProtocolDefinition.STORE_VERSION_STATE,
538+
systemStoreCluster,
539+
null,
540+
null,
541+
false,
542+
((VeniceHelixAdmin) admin).getSslFactory(),
543+
childControllerUrl,
544+
d2ServiceName,
545+
regionD2Client,
546+
d2ZkHost,
547+
sslOnly);
548+
storeVersionStateSchemaInitializer.execute();
549+
}
518550
}
519551
}
520552

services/venice-controller/src/main/java/com/linkedin/venice/controller/VeniceControllerClusterConfig.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@
101101
import static com.linkedin.venice.ConfigKeys.CONTROLLER_SCHEMA_VALIDATION_ENABLED;
102102
import static com.linkedin.venice.ConfigKeys.CONTROLLER_SSL_ENABLED;
103103
import static com.linkedin.venice.ConfigKeys.CONTROLLER_STORAGE_CLUSTER_HELIX_CLOUD_ENABLED;
104+
import static com.linkedin.venice.ConfigKeys.CONTROLLER_STORAGE_PROTOCOL_SCHEMA_STARTUP_REGISTRATION_ENABLED;
104105
import static com.linkedin.venice.ConfigKeys.CONTROLLER_STORE_GRAVEYARD_CLEANUP_DELAY_MINUTES;
105106
import static com.linkedin.venice.ConfigKeys.CONTROLLER_STORE_GRAVEYARD_CLEANUP_ENABLED;
106107
import static com.linkedin.venice.ConfigKeys.CONTROLLER_STORE_GRAVEYARD_CLEANUP_SLEEP_INTERVAL_BETWEEN_LIST_FETCH_MINUTES;
@@ -481,6 +482,8 @@ public class VeniceControllerClusterConfig {
481482

482483
private final boolean systemSchemaInitializationAtStartTimeEnabled;
483484

485+
private final boolean storageProtocolSchemaStartupRegistrationEnabled;
486+
484487
private final boolean isKMERegistrationFromMessageHeaderEnabled;
485488
private final boolean producerTimestampFallbackEnabled;
486489
private final boolean unusedValueSchemaCleanupServiceEnabled;
@@ -1194,6 +1197,8 @@ public VeniceControllerClusterConfig(VeniceProperties props) {
11941197
props.getBoolean(CONTROLLER_PARENT_EXTERNAL_SUPERSET_SCHEMA_GENERATION_ENABLED, false);
11951198
this.systemSchemaInitializationAtStartTimeEnabled =
11961199
props.getBoolean(SYSTEM_SCHEMA_INITIALIZATION_AT_START_TIME_ENABLED, false);
1200+
this.storageProtocolSchemaStartupRegistrationEnabled =
1201+
props.getBoolean(CONTROLLER_STORAGE_PROTOCOL_SCHEMA_STARTUP_REGISTRATION_ENABLED, false);
11971202
this.isKMERegistrationFromMessageHeaderEnabled =
11981203
props.getBoolean(KME_REGISTRATION_FROM_MESSAGE_HEADER_ENABLED, false);
11991204
this.producerTimestampFallbackEnabled = props.getBoolean(PUBSUB_PRODUCER_TIMESTAMP_FALLBACK_ENABLED, true);
@@ -2206,6 +2211,10 @@ public boolean isSystemSchemaInitializationAtStartTimeEnabled() {
22062211
return systemSchemaInitializationAtStartTimeEnabled;
22072212
}
22082213

2214+
public boolean isStorageProtocolSchemaStartupRegistrationEnabled() {
2215+
return storageProtocolSchemaStartupRegistrationEnabled;
2216+
}
2217+
22092218
public boolean isKMERegistrationFromMessageHeaderEnabled() {
22102219
return isKMERegistrationFromMessageHeaderEnabled;
22112220
}

0 commit comments

Comments
 (0)