sergeyuttsel commented on code in PR #1968:
URL: https://github.com/apache/ignite-3/pull/1968#discussion_r1183553363
##########
modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java:
##########
@@ -1345,72 +1357,158 @@ private Set<Assignment>
calculateAssignments(TableConfiguration tableCfg, int pa
* </ul>
* @see TableAlreadyExistsException
*/
- public CompletableFuture<Table> createTableAsync(String name,
Consumer<TableChange> tableInitChange) {
+ public CompletableFuture<Table> createTableAsync(String name, String
zoneName, Consumer<TableChange> tableInitChange) {
if (!busyLock.enterBusy()) {
throw new IgniteException(new NodeStoppingException());
}
try {
- return createTableAsyncInternal(name, tableInitChange);
+ return createTableAsyncInternal(name, zoneName, tableInitChange);
} finally {
busyLock.leaveBusy();
}
}
- /** See {@link #createTableAsync(String, Consumer)} for details. */
- private CompletableFuture<Table> createTableAsyncInternal(String name,
Consumer<TableChange> tableInitChange) {
+ /** See {@link #createTableAsync(String, String, Consumer)} for details. */
+ private CompletableFuture<Table> createTableAsyncInternal(
+ String name,
+ String zoneName,
+ Consumer<TableChange> tableInitChange
+ ) {
CompletableFuture<Table> tblFut = new CompletableFuture<>();
- tableAsyncInternal(name).thenAccept(tbl -> {
- if (tbl != null) {
- tblFut.completeExceptionally(new
TableAlreadyExistsException(DEFAULT_SCHEMA_NAME, name));
- } else {
- tablesCfg.change(tablesChange ->
tablesChange.changeTables(tablesListChange -> {
- if (tablesListChange.get(name) != null) {
- throw new
TableAlreadyExistsException(DEFAULT_SCHEMA_NAME, name);
+ tableAsyncInternal(name)
+ .thenAccept(tbl -> {
+ if (tbl != null) {
+ tblFut.completeExceptionally(new
TableAlreadyExistsException(DEFAULT_SCHEMA_NAME, name));
+ } else {
+ if (!busyLock.enterBusy()) {
+ throw new IgniteException(new
NodeStoppingException());
+ }
+
+ try {
+
distributionZoneManager.zoneIdAsyncInternal(zoneName).handle((zoneId, ex) -> {
+ if (zoneId == null) {
+ tblFut.completeExceptionally(new
DistributionZoneNotFoundException(zoneName));
+ } else if (ex != null) {
+ tblFut.completeExceptionally(ex);
+ } else {
+ if (!busyLock.enterBusy()) {
+ throw new IgniteException(new
NodeStoppingException());
+ }
+
+ try {
+ cmgMgr.logicalTopology()
+ .handle((cmgTopology, e) -> {
+ if (e == null) {
+ if
(!busyLock.enterBusy()) {
Review Comment:
I cannot use inBusyLock because I need not only throw NodeStoppingException
but also complete tblFut with NodeStoppingException.
--
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]