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/05/13 06:53:20 UTC

[GitHub] [ignite-3] sanpwc commented on a change in pull request #120: IGNITE-14237 Affinity function

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



##########
File path: modules/affinity/src/main/java/org/apache/ignite/internal/affinity/AffinityManager.java
##########
@@ -163,21 +113,43 @@ private void subscribeToAssignmentCalculation() {
     }
 
     /**
-     * Unsubscribes a listener form the affinity calculation.
+     * Calculates an assignment for a table which was specified by id.
+     *
+     * @param tblId Table identifier.
+     * @return A future which will complete when the assignment is calculated.
      */
-    private void unsubscribeFromAssignmentCalculation() {
-        if (affinityCalculateSubscriptionFut == null)
-            return;
-
-        try {
-            Long subscriptionId = affinityCalculateSubscriptionFut.get();
+    public CompletableFuture<Boolean> calculateAssignments(UUID tblId) {
+        return vaultManager.get(ByteArray.fromString(INTERNAL_PREFIX + tblId)).thenCompose(entry -> {
+            var tblConfig = configurationMgr.configurationRegistry().getConfiguration(TablesConfiguration.KEY).tables().get(new String(entry.value(), StandardCharsets.UTF_8));
+
+            var key = new Key(INTERNAL_PREFIX + tblId);
+
+            return metaStorageMgr.invoke(
+                Conditions.key(key).value().eq(null),

Review comment:
       Currently this will work, cause we don't support baseline changes, later we will need to generify
   `Conditions.key(key).value().eq(null),`
   to
   `Conditions.key(key).value().eq(oldAssignmentsValue),`
   where old assignments could be null, if it's table creation.




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