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 2022/11/03 11:03:09 UTC

[GitHub] [ignite-3] ptupitsyn commented on a diff in pull request #1306: IGNITE-16990 .NET: Add partition awareness to ExecuteColocated

ptupitsyn commented on code in PR #1306:
URL: https://github.com/apache/ignite-3/pull/1306#discussion_r1012757705


##########
modules/platforms/dotnet/Apache.Ignite/Internal/Table/Table.cs:
##########
@@ -172,10 +173,26 @@ internal async ValueTask<Schema> GetLatestSchemaAsync()
         }
 
         /// <summary>
-        /// Gets the latest schema.
+        /// Gets the preferred node by colocation hash.
         /// </summary>
-        /// <returns>Schema.</returns>
-        internal async ValueTask<string[]> GetPartitionAssignmentAsync()
+        /// <param name="colocationHash">Colocation hash.</param>
+        /// <param name="transaction">Transaction.</param>
+        /// <returns>Preferred node.</returns>
+        internal async ValueTask<PreferredNode> GetPreferredNode(int colocationHash, ITransaction? transaction)
+        {
+            if (transaction != null)
+            {
+                return default;
+            }
+
+            var assignment = await GetPartitionAssignmentAsync().ConfigureAwait(false);
+            var partition = Math.Abs(colocationHash % assignment.Length);
+            var nodeId = assignment[partition];
+
+            return PreferredNode.FromId(nodeId);
+        }
+
+        private async ValueTask<string[]> GetPartitionAssignmentAsync()

Review Comment:
   It is now private, and private methods don't require documentation.



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