-
Notifications
You must be signed in to change notification settings - Fork 135
IGNITE-16377 Notification listeners of TableManager #678
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…usality tokens when referring to dependee components
...-engine/src/main/java/org/apache/ignite/internal/sql/engine/schema/SqlSchemaManagerImpl.java
Outdated
Show resolved
Hide resolved
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java
Outdated
Show resolved
Hide resolved
| tablesVv.update(causalityToken, previous -> { | ||
| var val = previous == null ? new HashMap() : new HashMap<>(previous); | ||
|
|
||
| val.put(name, table); | ||
|
|
||
| return val; | ||
| }, th -> { | ||
| throw new IgniteInternalException(IgniteStringFormatter.format("Cannot create a table [name={}, id={}]", name, tblId), | ||
| th); | ||
| }); | ||
|
|
||
| tablesByIdVv.update(causalityToken, previous -> { | ||
| var val = previous == null ? new HashMap() : new HashMap<>(previous); | ||
|
|
||
| val.put(tblId, table); | ||
|
|
||
| return val; | ||
| }, th -> { | ||
| throw new IgniteInternalException(IgniteStringFormatter.format("Cannot create a table [name={}, id={}]", name, tblId), | ||
| th); | ||
| }); | ||
|
|
||
| fireEvent(TableEvent.CREATE, new TableEventParameters(table), null); | ||
| completeApiCreateFuture(table); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the signature of update allows async completion, maybe we should rewrite these updates and final call of completeApiCreateFuture via thenCombine? This is also about dropTableLocally .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think, it might be implemented in a task of the update command.
Although we will even not finalize a token in the method, it will, should complete in storage revision update.
| CompletableFuture<Table> tblFut = tableCreateFuts.get(table.tableId()); | ||
|
|
||
| if (tblFut != null) { | ||
| tblFut.complete(table); | ||
|
|
||
| tableCreateFuts.values().removeIf(fut -> fut == tblFut); | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about using tableCreateFuts.remove to get the future?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This future can be repeated in the map (tableCreateFuts), because update closure may execute several times.
It is a tricky way to return a result after configuration update has handled.
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java
Show resolved
Hide resolved
| } | ||
|
|
||
| var tbl = tablesById.get(id); | ||
| Map<UUID, TableImpl> tablesById = tablesByIdVv.get().join(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure that such calls are NPE-safe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Below the line, I am checking the value to null.
modules/core/src/test/java/org/apache/ignite/internal/causality/VersionValueTest.java
Outdated
Show resolved
Hide resolved
…zed on start with a completed future.
No description provided.