You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2021/04/28 14:06:57 UTC

[GitHub] [ignite-3] vldpyatkov opened a new pull request #112: IGNITE-14238 Creating and destroying tables

vldpyatkov opened a new pull request #112:
URL: https://github.com/apache/ignite-3/pull/112


   


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite-3] alievmirza commented on a change in pull request #112: IGNITE-14238 Creating and destroying tables

Posted by GitBox <gi...@apache.org>.
alievmirza commented on a change in pull request #112:
URL: https://github.com/apache/ignite-3/pull/112#discussion_r623814501



##########
File path: modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java
##########
@@ -275,21 +327,40 @@ private void unsubscribeForTableCreation() {
 //            change.initPartitions(1_000);

Review comment:
       What is this? 




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite-3] kgusakov commented on a change in pull request #112: IGNITE-14238 Creating and destroying tables

Posted by GitBox <gi...@apache.org>.
kgusakov commented on a change in pull request #112:
URL: https://github.com/apache/ignite-3/pull/112#discussion_r623444982



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/manager/Producer.java
##########
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.manager;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.function.BiPredicate;
+
+/**
+ * Interface which can to produce own event.
+ */
+public abstract class Producer<T extends Event> {
+    /** All listeners. */
+    private ConcurrentHashMap<T, ConcurrentLinkedQueue<BiPredicate<List<Object>, Exception>>> listeners = new ConcurrentHashMap<>();
+
+    /**
+     * Registers an event listener.
+     *
+     * @param evt Event.
+     * @param closure Closure.
+     */
+    public void listen(T evt, BiPredicate<List<Object>, Exception> closure) {

Review comment:
       Could you extend javadoc with behavior of listeners if closure returns false or true?

##########
File path: modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java
##########
@@ -77,23 +80,15 @@
     private CompletableFuture<Long> tableCreationSubscriptionFut;
 
     /** Tables. */
-    private Map<String, Table> tables;
+    private Map<String, Table> tables = new HashMap<>();
 
-    /**

Review comment:
       Was docs removed by mistake?




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite-3] alievmirza commented on a change in pull request #112: IGNITE-14238 Creating and destroying tables

Posted by GitBox <gi...@apache.org>.
alievmirza commented on a change in pull request #112:
URL: https://github.com/apache/ignite-3/pull/112#discussion_r623813669



##########
File path: modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java
##########
@@ -275,21 +327,40 @@ private void unsubscribeForTableCreation() {
 //            change.initPartitions(1_000);
 //        });
 
-        //TODO: IGNITE-14646 Support asynchronous table creation
-        Table tbl = null;
+        return tblFut.join();
+    }
 
-        while (tbl == null) {
-            try {
-                Thread.sleep(50);
+    /** {@inheritDoc} */
+    @Override public void dropTable(String name) {
+        CompletableFuture<Void> dropTblFut = new CompletableFuture<>();
 
-                tbl = table(name);
-            }
-            catch (InterruptedException e) {
-                LOG.error("Waiting of creation of table was interrupted.", e);
+        listen(TableEvent.DROP, new BiPredicate<List<Object>, Exception>() {
+            @Override public boolean test(List<Object> params, Exception e) {
+                String tableName = (String)params.get(0);
+
+                if (!name.equals(tableName))
+                    return false;
+
+                if (e == null) {
+                    Table drppedTable = tables.remove(tableName);

Review comment:
       dropped 




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite-3] vldpyatkov commented on a change in pull request #112: IGNITE-14238 Creating and destroying tables

Posted by GitBox <gi...@apache.org>.
vldpyatkov commented on a change in pull request #112:
URL: https://github.com/apache/ignite-3/pull/112#discussion_r623969600



##########
File path: modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java
##########
@@ -181,6 +188,17 @@ public TableManager(
         });
     }
 
+    /**
+     * Compuuses a RAFT group unique name.

Review comment:
       Corrected it.




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite-3] sanpwc commented on a change in pull request #112: IGNITE-14238 Creating and destroying tables

Posted by GitBox <gi...@apache.org>.
sanpwc commented on a change in pull request #112:
URL: https://github.com/apache/ignite-3/pull/112#discussion_r623986448



##########
File path: modules/table/src/main/java/org/apache/ignite/internal/table/event/TableEventParameters.java
##########
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.table.event;
+
+import java.util.UUID;
+import org.apache.ignite.internal.manager.EventParameters;
+import org.apache.ignite.internal.table.InternalTable;
+import org.apache.ignite.internal.table.TableSchemaView;
+
+/**
+ * Table event parameters.
+ * There are properties which associate with a concrete table.
+ */
+public class TableEventParameters implements EventParameters {
+    /** Table identifier. */
+    private UUID tableId;

Review comment:
       lets add final @Nullable @NotNull, etc

##########
File path: modules/table/src/main/java/org/apache/ignite/internal/table/event/TableEventParameters.java
##########
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.table.event;
+
+import java.util.UUID;
+import org.apache.ignite.internal.manager.EventParameters;
+import org.apache.ignite.internal.table.InternalTable;
+import org.apache.ignite.internal.table.TableSchemaView;
+
+/**
+ * Table event parameters.
+ * There are properties which associate with a concrete table.
+ */
+public class TableEventParameters implements EventParameters {
+    /** Table identifier. */
+    private UUID tableId;

Review comment:
       Lets add final @Nullable @NotNull, etc




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite-3] alievmirza commented on a change in pull request #112: IGNITE-14238 Creating and destroying tables

Posted by GitBox <gi...@apache.org>.
alievmirza commented on a change in pull request #112:
URL: https://github.com/apache/ignite-3/pull/112#discussion_r623808344



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/manager/Event.java
##########
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.manager;
+
+/**
+ * Producer event.

Review comment:
       Javadoc is not clear. Let add link to Producer at least 

##########
File path: modules/core/src/main/java/org/apache/ignite/internal/manager/Producer.java
##########
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.manager;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.function.BiPredicate;
+
+/**
+ * Interface which can to produce own event.

Review comment:
       ```suggestion
    * Interface which can produce its own event.
   ```

##########
File path: modules/core/src/main/java/org/apache/ignite/internal/manager/Producer.java
##########
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.manager;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.function.BiPredicate;
+
+/**
+ * Interface which can to produce own event.
+ */
+public abstract class Producer<T extends Event> {
+    /** All listeners. */
+    private ConcurrentHashMap<T, ConcurrentLinkedQueue<BiPredicate<List<Object>, Exception>>> listeners = new ConcurrentHashMap<>();
+
+    /**
+     * Registers an event listener.
+     * When the event predicate return true it would never invoke after,
+     * otherwise this predicate would receive an event again.
+     *
+     * @param evt Event.
+     * @param closure Closure.
+     */
+    public void listen(T evt, BiPredicate<List<Object>, Exception> closure) {
+        listeners.computeIfAbsent(evt, evtKey -> new ConcurrentLinkedQueue<>())
+            .offer(closure);
+    }
+
+    /**
+     * Notifies every listener with subscribed before.

Review comment:
       If I understand that method correctly, there should be `Notifies every listener that was subscribed before.`

##########
File path: modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java
##########
@@ -181,6 +188,17 @@ public TableManager(
         });
     }
 
+    /**
+     * Compuuses a RAFT group unique name.

Review comment:
       I didn't get Javadoc

##########
File path: modules/core/src/main/java/org/apache/ignite/internal/manager/Producer.java
##########
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.manager;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.function.BiPredicate;
+
+/**
+ * Interface which can to produce own event.
+ */
+public abstract class Producer<T extends Event> {
+    /** All listeners. */
+    private ConcurrentHashMap<T, ConcurrentLinkedQueue<BiPredicate<List<Object>, Exception>>> listeners = new ConcurrentHashMap<>();
+
+    /**
+     * Registers an event listener.
+     * When the event predicate return true it would never invoke after,

Review comment:
       ```suggestion
        * When the event predicate returns true it would never invoke after,
   ```




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite-3] vldpyatkov commented on a change in pull request #112: IGNITE-14238 Creating and destroying tables

Posted by GitBox <gi...@apache.org>.
vldpyatkov commented on a change in pull request #112:
URL: https://github.com/apache/ignite-3/pull/112#discussion_r624022846



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/manager/Event.java
##########
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.manager;
+
+/**
+ * The event cas whcih is produced by event producer component.
+ * @see Producer#onEvent(Event, EventParameters, Exception)
+ */
+public interface Event {

Review comment:
       I added a final modifier.




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite-3] vldpyatkov commented on a change in pull request #112: IGNITE-14238 Creating and destroying tables

Posted by GitBox <gi...@apache.org>.
vldpyatkov commented on a change in pull request #112:
URL: https://github.com/apache/ignite-3/pull/112#discussion_r624022575



##########
File path: modules/table/src/main/java/org/apache/ignite/internal/table/event/TableEventParameters.java
##########
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.table.event;
+
+import java.util.UUID;
+import org.apache.ignite.internal.manager.EventParameters;
+import org.apache.ignite.internal.table.InternalTable;
+import org.apache.ignite.internal.table.TableSchemaView;
+
+/**
+ * Table event parameters.
+ * There are properties which associate with a concrete table.
+ */
+public class TableEventParameters implements EventParameters {
+    /** Table identifier. */
+    private UUID tableId;
+
+    /** Table name. */
+    private String tableName;
+
+    /** Table schema view. */
+    private TableSchemaView tableSchemaView;
+
+    /** Internal table. */
+    private InternalTable internalTable;
+

Review comment:
       There is not an assignment field.
   Is it definitely needed? 




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite-3] sanpwc commented on a change in pull request #112: IGNITE-14238 Creating and destroying tables

Posted by GitBox <gi...@apache.org>.
sanpwc commented on a change in pull request #112:
URL: https://github.com/apache/ignite-3/pull/112#discussion_r623988447



##########
File path: modules/table/src/main/java/org/apache/ignite/internal/table/event/TableEventParameters.java
##########
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.table.event;
+
+import java.util.UUID;
+import org.apache.ignite.internal.manager.EventParameters;
+import org.apache.ignite.internal.table.InternalTable;
+import org.apache.ignite.internal.table.TableSchemaView;
+
+/**
+ * Table event parameters.
+ * There are properties which associate with a concrete table.
+ */
+public class TableEventParameters implements EventParameters {
+    /** Table identifier. */
+    private UUID tableId;
+
+    /** Table name. */
+    private String tableName;
+
+    /** Table schema view. */
+    private TableSchemaView tableSchemaView;
+
+    /** Internal table. */
+    private InternalTable internalTable;
+

Review comment:
       What about affinity assignments?




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite-3] vldpyatkov commented on a change in pull request #112: IGNITE-14238 Creating and destroying tables

Posted by GitBox <gi...@apache.org>.
vldpyatkov commented on a change in pull request #112:
URL: https://github.com/apache/ignite-3/pull/112#discussion_r623966466



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/manager/Producer.java
##########
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.manager;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.function.BiPredicate;
+
+/**
+ * Interface which can to produce own event.

Review comment:
       Done.




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite-3] vldpyatkov commented on a change in pull request #112: IGNITE-14238 Creating and destroying tables

Posted by GitBox <gi...@apache.org>.
vldpyatkov commented on a change in pull request #112:
URL: https://github.com/apache/ignite-3/pull/112#discussion_r624022931



##########
File path: modules/table/src/main/java/org/apache/ignite/internal/table/TableSchemaViewImpl.java
##########
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.table;
+
+import java.util.UUID;
+import org.apache.ignite.internal.schema.SchemaDescriptor;
+import org.apache.ignite.internal.schema.SchemaManager;
+
+/**
+ * Schena view implementation.
+ */
+public class TableSchemaViewImpl implements TableSchemaView {
+    /** Table identifier. */
+    UUID tableId;

Review comment:
       I added a final modifier




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite-3] alievmirza commented on a change in pull request #112: IGNITE-14238 Creating and destroying tables

Posted by GitBox <gi...@apache.org>.
alievmirza commented on a change in pull request #112:
URL: https://github.com/apache/ignite-3/pull/112#discussion_r623808344



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/manager/Event.java
##########
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.manager;
+
+/**
+ * Producer event.

Review comment:
       Javadoc is not clear. Let's add link to Producer at least  




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite-3] vldpyatkov commented on a change in pull request #112: IGNITE-14238 Creating and destroying tables

Posted by GitBox <gi...@apache.org>.
vldpyatkov commented on a change in pull request #112:
URL: https://github.com/apache/ignite-3/pull/112#discussion_r623967815



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/manager/Producer.java
##########
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.manager;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.function.BiPredicate;
+
+/**
+ * Interface which can to produce own event.
+ */
+public abstract class Producer<T extends Event> {
+    /** All listeners. */
+    private ConcurrentHashMap<T, ConcurrentLinkedQueue<BiPredicate<List<Object>, Exception>>> listeners = new ConcurrentHashMap<>();
+
+    /**
+     * Registers an event listener.
+     * When the event predicate return true it would never invoke after,
+     * otherwise this predicate would receive an event again.
+     *
+     * @param evt Event.
+     * @param closure Closure.
+     */
+    public void listen(T evt, BiPredicate<List<Object>, Exception> closure) {
+        listeners.computeIfAbsent(evt, evtKey -> new ConcurrentLinkedQueue<>())
+            .offer(closure);
+    }
+
+    /**
+     * Notifies every listener with subscribed before.

Review comment:
       Done.




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite-3] sanpwc commented on a change in pull request #112: IGNITE-14238 Creating and destroying tables

Posted by GitBox <gi...@apache.org>.
sanpwc commented on a change in pull request #112:
URL: https://github.com/apache/ignite-3/pull/112#discussion_r623991427



##########
File path: modules/table/src/main/java/org/apache/ignite/internal/table/TableSchemaViewImpl.java
##########
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.table;
+
+import java.util.UUID;
+import org.apache.ignite.internal.schema.SchemaDescriptor;
+import org.apache.ignite.internal.schema.SchemaManager;
+
+/**
+ * Schena view implementation.
+ */
+public class TableSchemaViewImpl implements TableSchemaView {
+    /** Table identifier. */
+    UUID tableId;

Review comment:
       private, final, @NotNull, @Nullable, etc ?




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite-3] vldpyatkov commented on a change in pull request #112: IGNITE-14238 Creating and destroying tables

Posted by GitBox <gi...@apache.org>.
vldpyatkov commented on a change in pull request #112:
URL: https://github.com/apache/ignite-3/pull/112#discussion_r623970009



##########
File path: modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java
##########
@@ -275,21 +327,40 @@ private void unsubscribeForTableCreation() {
 //            change.initPartitions(1_000);
 //        });
 
-        //TODO: IGNITE-14646 Support asynchronous table creation
-        Table tbl = null;
+        return tblFut.join();
+    }
 
-        while (tbl == null) {
-            try {
-                Thread.sleep(50);
+    /** {@inheritDoc} */
+    @Override public void dropTable(String name) {
+        CompletableFuture<Void> dropTblFut = new CompletableFuture<>();
 
-                tbl = table(name);
-            }
-            catch (InterruptedException e) {
-                LOG.error("Waiting of creation of table was interrupted.", e);
+        listen(TableEvent.DROP, new BiPredicate<List<Object>, Exception>() {
+            @Override public boolean test(List<Object> params, Exception e) {
+                String tableName = (String)params.get(0);
+
+                if (!name.equals(tableName))
+                    return false;
+
+                if (e == null) {
+                    Table drppedTable = tables.remove(tableName);

Review comment:
       Done.




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite-3] asfgit closed pull request #112: IGNITE-14238 Creating and destroying tables

Posted by GitBox <gi...@apache.org>.
asfgit closed pull request #112:
URL: https://github.com/apache/ignite-3/pull/112


   


-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite-3] kgusakov commented on a change in pull request #112: IGNITE-14238 Creating and destroying tables

Posted by GitBox <gi...@apache.org>.
kgusakov commented on a change in pull request #112:
URL: https://github.com/apache/ignite-3/pull/112#discussion_r622998047



##########
File path: modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java
##########
@@ -77,23 +80,15 @@
     private CompletableFuture<Long> tableCreationSubscriptionFut;
 
     /** Tables. */
-    private Map<String, Table> tables;
+    private Map<String, Table> tables = new HashMap<>();
 
-    /**

Review comment:
       Was doc removed by mistake?




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite-3] vldpyatkov commented on a change in pull request #112: IGNITE-14238 Creating and destroying tables

Posted by GitBox <gi...@apache.org>.
vldpyatkov commented on a change in pull request #112:
URL: https://github.com/apache/ignite-3/pull/112#discussion_r624022173



##########
File path: modules/table/src/main/java/org/apache/ignite/internal/table/event/TableEventParameters.java
##########
@@ -0,0 +1,95 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.table.event;
+
+import java.util.UUID;
+import org.apache.ignite.internal.manager.EventParameters;
+import org.apache.ignite.internal.table.InternalTable;
+import org.apache.ignite.internal.table.TableSchemaView;
+
+/**
+ * Table event parameters.
+ * There are properties which associate with a concrete table.
+ */
+public class TableEventParameters implements EventParameters {
+    /** Table identifier. */
+    private UUID tableId;

Review comment:
       I added a final modifier, but I don't know which fields may be null or not.
   It depends on the situation where the events will be triggered after.




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite-3] vldpyatkov commented on a change in pull request #112: IGNITE-14238 Creating and destroying tables

Posted by GitBox <gi...@apache.org>.
vldpyatkov commented on a change in pull request #112:
URL: https://github.com/apache/ignite-3/pull/112#discussion_r623967011



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/manager/Producer.java
##########
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.manager;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.function.BiPredicate;
+
+/**
+ * Interface which can to produce own event.
+ */
+public abstract class Producer<T extends Event> {
+    /** All listeners. */
+    private ConcurrentHashMap<T, ConcurrentLinkedQueue<BiPredicate<List<Object>, Exception>>> listeners = new ConcurrentHashMap<>();
+
+    /**
+     * Registers an event listener.
+     * When the event predicate return true it would never invoke after,

Review comment:
       Done.




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite-3] vldpyatkov commented on a change in pull request #112: IGNITE-14238 Creating and destroying tables

Posted by GitBox <gi...@apache.org>.
vldpyatkov commented on a change in pull request #112:
URL: https://github.com/apache/ignite-3/pull/112#discussion_r623970894



##########
File path: modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java
##########
@@ -275,21 +327,40 @@ private void unsubscribeForTableCreation() {
 //            change.initPartitions(1_000);

Review comment:
       Removed this.




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite-3] vldpyatkov commented on a change in pull request #112: IGNITE-14238 Creating and destroying tables

Posted by GitBox <gi...@apache.org>.
vldpyatkov commented on a change in pull request #112:
URL: https://github.com/apache/ignite-3/pull/112#discussion_r624022662



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/manager/Event.java
##########
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.manager;
+
+/**
+ * The event cas whcih is produced by event producer component.
+ * @see Producer#onEvent(Event, EventParameters, Exception)
+ */
+public interface Event {

Review comment:
       Is it definitely needed? 




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite-3] sanpwc commented on a change in pull request #112: IGNITE-14238 Creating and destroying tables

Posted by GitBox <gi...@apache.org>.
sanpwc commented on a change in pull request #112:
URL: https://github.com/apache/ignite-3/pull/112#discussion_r623989920



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/manager/Event.java
##########
@@ -0,0 +1,25 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.manager;
+
+/**
+ * The event cas whcih is produced by event producer component.
+ * @see Producer#onEvent(Event, EventParameters, Exception)
+ */
+public interface Event {

Review comment:
       Let's move given and other Event related classes to either internal ignite-api, or new ignite event module.
   Cause currently concept of events is not stable yet, I believe that internal ignite-api is a better place for now.




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite-3] vldpyatkov commented on a change in pull request #112: IGNITE-14238 Creating and destroying tables

Posted by GitBox <gi...@apache.org>.
vldpyatkov commented on a change in pull request #112:
URL: https://github.com/apache/ignite-3/pull/112#discussion_r623877247



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/manager/Event.java
##########
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.manager;
+
+/**
+ * Producer event.

Review comment:
       Done.




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite-3] vldpyatkov commented on a change in pull request #112: IGNITE-14238 Creating and destroying tables

Posted by GitBox <gi...@apache.org>.
vldpyatkov commented on a change in pull request #112:
URL: https://github.com/apache/ignite-3/pull/112#discussion_r623702185



##########
File path: modules/table/src/main/java/org/apache/ignite/internal/table/distributed/TableManager.java
##########
@@ -77,23 +80,15 @@
     private CompletableFuture<Long> tableCreationSubscriptionFut;
 
     /** Tables. */
-    private Map<String, Table> tables;
+    private Map<String, Table> tables = new HashMap<>();
 
-    /**

Review comment:
       Reverted this.




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [ignite-3] vldpyatkov commented on a change in pull request #112: IGNITE-14238 Creating and destroying tables

Posted by GitBox <gi...@apache.org>.
vldpyatkov commented on a change in pull request #112:
URL: https://github.com/apache/ignite-3/pull/112#discussion_r623702871



##########
File path: modules/core/src/main/java/org/apache/ignite/internal/manager/Producer.java
##########
@@ -0,0 +1,68 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.manager;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.function.BiPredicate;
+
+/**
+ * Interface which can to produce own event.
+ */
+public abstract class Producer<T extends Event> {
+    /** All listeners. */
+    private ConcurrentHashMap<T, ConcurrentLinkedQueue<BiPredicate<List<Object>, Exception>>> listeners = new ConcurrentHashMap<>();
+
+    /**
+     * Registers an event listener.
+     *
+     * @param evt Event.
+     * @param closure Closure.
+     */
+    public void listen(T evt, BiPredicate<List<Object>, Exception> closure) {

Review comment:
       Added additional explanation about listen predicate.




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org