ignite-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [ignite] timoninmaxim commented on a change in pull request #9081: IGNITE-14703. Add MergeSort distributed cache query reducer.
Date Wed, 08 Sep 2021 17:01:27 GMT

timoninmaxim commented on a change in pull request #9081:
URL: https://github.com/apache/ignite/pull/9081#discussion_r704600305

File path: modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/reducer/AbstractDistributedCacheQueryReducer.java
@@ -0,0 +1,165 @@
+ * 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.processors.cache.query.reducer;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CountDownLatch;
+import org.apache.ignite.cluster.ClusterNode;
+import org.apache.ignite.internal.IgniteInterruptedCheckedException;
+import org.apache.ignite.internal.processors.cache.query.CacheQueryPageRequester;
+import org.apache.ignite.internal.processors.cache.query.DistributedCacheQueryReducer;
+import org.apache.ignite.internal.processors.cache.query.GridCacheQueryFutureAdapter;
+import org.apache.ignite.internal.util.GridConcurrentHashSet;
+import org.apache.ignite.internal.util.typedef.internal.U;
+ * Abstract class for distributed reducer implementations.
+ */
+abstract class AbstractDistributedCacheQueryReducer<R> implements DistributedCacheQueryReducer<R>
+    /** Collection of streams that don't deliver all pages yet. */
+    private final Map<UUID, NodePageStream<R>> remoteStreams;

Review comment:
       The `streams` collection's goals are:
   1. `hasNext()` and `next()` in a user thread use thread local variable `streams`. 
   2. When a stream is fully done (remote pages and local iterator), then we remove it from
the `stream` collection.
   The `remoteStreams` collection's goals are different:
   1. Ignite's utility threads use it for handling new remote pages.
   2. When remote pages finish (but not local iterator), then we remove this stream from the
   3. Some background actions (cancel, onNodeLeft) bases on this collection. Then we need
track set of remote node ids.
   Then the idea was to have `streams` thread locally, and `remoteStreams` concurrently. It
simplified a sync logic between collections as they should be independent from each other,
also it helps to avoid one more lock in user thread.
   It's possible to share single collection for all threads. But we will still have another
collection for tracking remote nodes with alive pages. This tracking collection can be a Set<UUID>,
and then we will get NodePageStream from the main collection (`stream`), and the both collections
will be concurrent. We won't win any from this. I think it's fine to track NodePageStream
in 2 independent collectios. WDYT?
   BUT. There was a little bug, `onError` uses `streams` and runs in non-user thread, I'll
replace it with the `remoteStreams`, and this will be fine. 

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: notifications-unsubscribe@ignite.apache.org

For queries about this service, please contact Infrastructure at:

View raw message