denis-chudov commented on code in PR #1665:
URL: https://github.com/apache/ignite-3/pull/1665#discussion_r1107652531
##########
modules/schema/src/main/java/org/apache/ignite/internal/schema/SchemaManager.java:
##########
@@ -117,119 +120,105 @@ private CompletableFuture<?>
onSchemaChange(ConfigurationNotificationEvent<Named
try {
ExtendedTableView tblCfg = (ExtendedTableView)
ctx.config(ExtendedTableConfiguration.class).value();
- int verFromUpdate = tblCfg.schemaId();
+ int newSchemaVersion = tblCfg.schemaId();
UUID tblId = tblCfg.id();
- String tableName = tblCfg.name();
-
- SchemaDescriptor schemaDescFromUpdate =
SchemaUtils.prepareSchemaDescriptor(verFromUpdate, tblCfg);
-
- if (searchSchemaByVersion(tblId, schemaDescFromUpdate.version())
!= null) {
+ if (searchSchemaByVersion(tblId, newSchemaVersion) != null) {
return completedFuture(null);
}
- if (verFromUpdate != INITIAL_SCHEMA_VERSION) {
- SchemaDescriptor oldSchema = searchSchemaByVersion(tblId,
verFromUpdate - 1);
-
- if (oldSchema == null) {
- byte[] serPrevSchema = schemaByVersion(tblId,
verFromUpdate - 1);
-
- assert serPrevSchema != null;
-
- oldSchema =
SchemaSerializerImpl.INSTANCE.deserialize(serPrevSchema);
- }
+ SchemaDescriptor newSchema =
SchemaUtils.prepareSchemaDescriptor(newSchemaVersion, tblCfg);
-
schemaDescFromUpdate.columnMapping(SchemaUtils.columnMapper(oldSchema,
schemaDescFromUpdate));
+ // This is intentionally a blocking call to enforce configuration
listener execution order. Unfortunately it is not possible
+ // to execute this method asynchronously, because there is a race
between this listener and completion of associated
+ // VersionedValues.
Review Comment:
```suggestion
// This is intentionally a blocking call to enforce
configuration listener execution order. Unfortunately it is not possible
// to execute this method asynchronously, because the schema
descriptor is needed to fire event that shoud be
// fired within synchronous part of the configuration listener.
```
--
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]