This is an automated email from the ASF dual-hosted git repository. amashenkov pushed a commit to branch ignite-17686 in repository https://gitbox.apache.org/repos/asf/ignite-3.git
commit 9d454fd5a467212502f0afee9c72023a9db994ff Author: amashenkov <[email protected]> AuthorDate: Fri Sep 23 16:18:12 2022 +0300 WIP. Code cleanup. --- .../sql/engine/schema/SqlSchemaManagerImpl.java | 30 ++++++++++------------ 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/schema/SqlSchemaManagerImpl.java b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/schema/SqlSchemaManagerImpl.java index 398b545685..cf07ef9ff2 100644 --- a/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/schema/SqlSchemaManagerImpl.java +++ b/modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/schema/SqlSchemaManagerImpl.java @@ -223,7 +223,7 @@ public class SqlSchemaManagerImpl implements SqlSchemaManager { Map<UUID, InternalIgniteTable> resTbls = new HashMap<>(tables); return igniteTableFuture - .thenApply(igniteTable -> inBusyLock(busyLock, () -> { + .thenApply(igniteTable -> { InternalIgniteTable oldTable = resTbls.put(igniteTable.id(), igniteTable); // looks like this is UPDATE operation @@ -234,17 +234,13 @@ public class SqlSchemaManagerImpl implements SqlSchemaManager { } return resTbls; - })); + }); })) - .thenCombine( - igniteTableFuture, - (v, igniteTable) -> inBusyLock(busyLock, () -> { - schema.addTable(objectSimpleName(schemaName, table.name()), igniteTable); - - return null; - } - )).thenCompose(v -> inBusyLock(busyLock, () -> completedFuture(res))); + .thenCombine(igniteTableFuture, (v, igniteTable) -> { + schema.addTable(objectSimpleName(schemaName, table.name()), igniteTable); + return res; + }); })); return calciteSchemaVv.get(causalityToken); @@ -305,7 +301,7 @@ public class SqlSchemaManagerImpl implements SqlSchemaManager { resTbls.remove(table.id()); return completedFuture(resTbls); - })).thenCompose(tables -> inBusyLock(busyLock, () -> completedFuture(res))); + })).thenCompose(tables -> completedFuture(res)); } return completedFuture(res); @@ -432,15 +428,17 @@ public class SqlSchemaManagerImpl implements SqlSchemaManager { return CompletableFuture.completedFuture(resIdxs); }) - ).thenRun(() -> inBusyLock(busyLock, () -> { + ).thenCompose(ignore -> { String tblName = tableNameById(schema, index.tableId()); table.addIndex(schemaIndex); schema.addTable(tblName, table); schema.addIndex(index.id(), schemaIndex); - })).thenCompose(ignored -> inBusyLock(busyLock, () -> completedFuture(resTbls))); + + return completedFuture(resTbls); + }); }) - ).thenCompose(v -> inBusyLock(busyLock, () -> completedFuture(res))); + ).thenCompose(v -> completedFuture(res)); })); return calciteSchemaVv.get(causalityToken); @@ -514,9 +512,9 @@ public class SqlSchemaManagerImpl implements SqlSchemaManager { return completedFuture(resIdxs); } - )).thenCompose(v -> inBusyLock(busyLock, () -> completedFuture(resTbls))); + )).thenCompose(v -> completedFuture(resTbls)); }) - ).thenCompose(v -> inBusyLock(busyLock, () -> completedFuture(res))); + ).thenCompose(v -> completedFuture(res)); } return completedFuture(res);
