AMashenkov commented on code in PR #2369:
URL: https://github.com/apache/ignite-3/pull/2369#discussion_r1276390353
##########
modules/schema/src/main/java/org/apache/ignite/internal/schema/SchemaManager.java:
##########
@@ -187,126 +204,41 @@ private void setColumnMapping(SchemaDescriptor schema,
int tableId) throws Execu
}
/**
- * Registers the new schema in a Schema Registry.
+ * Gets a schema descriptor from the configuration storage.
*
- * @param registries Map of schema registries.
- * @param tableId Table id.
- * @param tableName Table name.
- * @param schema Schema descriptor.
- * @return Future that, when complete, will resolve into an updated map of
schema registries
- * (to be used in {@link IncrementalVersionedValue#update}).
+ * @param tableId Table ID.
+ * @param schemaVer Schema version.
+ * @return Schema descriptor.
*/
- private CompletableFuture<Map<Integer, SchemaRegistryImpl>> registerSchema(
- Map<Integer, SchemaRegistryImpl> registries,
- int tableId,
- String tableName,
- SchemaDescriptor schema
- ) {
- ByteArray key = schemaWithVerHistKey(tableId, schema.version());
-
- byte[] serializedSchema =
SchemaSerializerImpl.INSTANCE.serialize(schema);
-
- return metastorageMgr.invoke(notExists(key), put(key,
serializedSchema), noop())
- .thenApply(t -> {
- SchemaRegistryImpl reg = registries.get(tableId);
+ private CompletableFuture<SchemaDescriptor> loadSchemaDescriptor(int
tableId, int schemaVer) {
+ CompletableFuture<Entry> ent =
metastorageMgr.get(schemaWithVerHistKey(tableId, schemaVer));
- if (reg == null) {
- Map<Integer, SchemaRegistryImpl> copy = new
HashMap<>(registries);
+ return ent.thenApply(e ->
SchemaSerializerImpl.INSTANCE.deserialize(e.value()));
+ }
- copy.put(tableId, createSchemaRegistry(tableId,
tableName, schema));
+ private CompletableFuture<Boolean> saveSchemaDescriptor(int tableId,
SchemaDescriptor schema) {
Review Comment:
```suggestion
/** Saves a schema descriptor to the configuration storage. */
private CompletableFuture<Boolean> saveSchemaDescriptor(int tableId,
SchemaDescriptor schema) {
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]