frankgh commented on code in PR #160: URL: https://github.com/apache/cassandra-sidecar/pull/160#discussion_r1884618186
########## server/src/main/java/org/apache/cassandra/sidecar/db/schema/SidecarSchema.java: ########## @@ -181,4 +186,23 @@ protected void reportSidecarSchemaInitialized() { vertx.eventBus().publish(ON_SIDECAR_SCHEMA_INITIALIZED.address(), "SidecarSchema initialized"); } + + /** + * Returns true when the schema should be created by this Sidecar instance. This currently + * depends on whether the election of single instance executor process is available, and + * the schemas are of type {@link InitializeOnSingleInstanceExecutor}, and the local Sidecar + * is a single instance executor. For all other types of schemas or if the election of leader + * process is unavailable we initialize the schemas. + * + * @param schema the schema to test + * @return {@code true} if the schema should be created by this Sidecar instance, {@code false} otherwise + */ + protected boolean shouldCreateSchema(@Nullable AbstractSchema schema) + { + if (singleInstanceExecutor != null && schema instanceof InitializeOnSingleInstanceExecutor) + { + return singleInstanceExecutor.isLocalSidecarSingleInstanceExecutor(); + } + return true; + } Review Comment: you don't really need to inject an implantation, so I made it generic so you can omit this feature -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For additional commands, e-mail: pr-h...@cassandra.apache.org