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/09/23 07:47:14 UTC

[GitHub] [ignite-3] sanpwc commented on a change in pull request #348: IGNITE-15434

sanpwc commented on a change in pull request #348:
URL: https://github.com/apache/ignite-3/pull/348#discussion_r714548076



##########
File path: modules/table/src/main/java/org/apache/ignite/internal/table/distributed/raft/PartitionListener.java
##########
@@ -417,6 +436,80 @@ private void handleGetAndUpsertCommand(CommandClosure<GetAndUpsertCommand> clo)
         clo.result(new SingleRowResponse(response));
     }
 
+    /**
+     * Handler for the {@link ScanInitCommand}.
+     *
+     * @param clo Command closure.
+     */
+    private void handleScanInitCommand(CommandClosure<ScanInitCommand> clo) {
+        ScanInitCommand rangeCmd = clo.command();
+
+        IgniteUuid cursorId = rangeCmd.scanId();
+
+        Cursor<DataRow> cursor = storage.scan(key -> true);
+
+        cursors.put(
+            cursorId,
+            new CursorMeta(
+                cursor,
+                rangeCmd.requesterNodeId()
+            )
+        );
+
+        clo.result(null);
+    }
+
+    /**
+     * Handler for the {@link ScanRetrieveBatchCommand}.
+     *
+     * @param clo Command closure.
+     */
+    private void handleScanRetrieveBatchCommand(CommandClosure<ScanRetrieveBatchCommand> clo) {
+        CursorMeta cursorDesc = cursors.get(clo.command().scanId());
+
+        if (cursorDesc == null) {
+            clo.result(new NoSuchElementException("Corresponding cursor on server side not found."));
+
+            return;
+        }
+
+        List<BinaryRow> res = new ArrayList<>();
+
+        try {
+            for (int i = 0; i < clo.command().itemsToRetrieveCount() && cursorDesc.cursor().hasNext(); i++)
+                res.add(new ByteBufferRow(cursorDesc.cursor().next().valueBytes()));
+        }
+        catch (Exception e) {
+            clo.result(e);
+        }
+
+        clo.result(new MultiRowsResponse(res));
+    }
+
+    /**
+     * Handler for the {@link ScanCloseCommand}.
+     *
+     * @param clo Command closure.
+     */
+    private void handleScanCloseCommand(CommandClosure<ScanCloseCommand> clo) {
+        CursorMeta cursorDesc = cursors.get(clo.command().scanId());

Review comment:
       Fixed. There was the same bug in MetaStorageListener - also fixed.




-- 
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:
users@infra.apache.org