[ 
https://issues.apache.org/jira/browse/GEODE-7953?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17090736#comment-17090736
 ] 

ASF GitHub Bot commented on GEODE-7953:
---------------------------------------

jhuynh1 commented on a change in pull request #4909:
URL: https://github.com/apache/geode/pull/4909#discussion_r413940221



##########
File path: 
geode-core/src/main/java/org/apache/geode/cache/control/RestoreRedundancyResults.java
##########
@@ -0,0 +1,148 @@
+/*
+ * 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.geode.cache.control;
+
+import java.util.Map;
+
+import org.apache.geode.cache.partition.PartitionRebalanceInfo;
+import org.apache.geode.internal.cache.control.RegionRedundancyStatus;
+import 
org.apache.geode.internal.cache.partitioned.PartitionedRegionRebalanceOp;
+
+/**
+ * A class to collect the results of restore redundancy operations for one or 
more regions and
+ * determine the success of failure of the operation.
+ */
+public interface RestoreRedundancyResults {
+
+  /**
+   * {@link #SUCCESS} is defined as every included region having fully 
satisfied redundancy.
+   * {@link #FAILURE} is defined as at least one region that is configured to 
have redundant copies
+   * having fewer than its configured number of redundant copies.
+   * {@link #ERROR} is for cases when the restore redundancy operation was 
unable to begin or threw
+   * an exception.
+   */
+  enum Status {
+    SUCCESS,
+    FAILURE,
+    ERROR
+  }
+
+  /**
+   * Adds the contents of another {@link RestoreRedundancyResults} object to 
this one, including
+   * both {@link RegionRedundancyStatus} objects and information on the number 
of primaries
+   * reassigned and the time taken to reassign them.
+   *
+   * @param results a {@link RestoreRedundancyResults} object whose contents 
will be added to this
+   *        one.
+   */
+  void addRegionResults(RestoreRedundancyResults results);
+
+  /**
+   * Adds information regarding the number of primaries reassigned and the 
time taken to reassign
+   * them during a restore redundancy operation.
+   *
+   * @param details a {@link PartitionRebalanceInfo} generated by a
+   *        {@link PartitionedRegionRebalanceOp} operation.
+   */
+  void addPrimaryReassignmentDetails(PartitionRebalanceInfo details);
+
+  /**
+   * Adds one {@link RegionRedundancyStatus} to the result set.
+   *
+   * @param regionResult The {@link RegionRedundancyStatus} to be added to the 
result set.
+   */
+  void addRegionResult(RegionRedundancyStatus regionResult);
+
+  /**
+   * Returns the {@link Status} of this restore redundancy operation. Possible 
statuses are
+   * {@link Status#SUCCESS}, {@link Status#FAILURE} and {@link Status#ERROR}.
+   *
+   * @return The {@link Status} of this restore redundancy operation.
+   */
+  Status getStatus();
+
+  /**
+   * Returns a message describing the results of this restore redundancy 
operation.
+   *
+   * @return A {@link String} describing the results of this restore 
redundancy operation.
+   */
+  String getMessage();
+
+  /**
+   * Returns the {@link RegionRedundancyStatus} for a specific region or null 
if that region
+   * is not present in this {@link RestoreRedundancyResults}.
+   *
+   * @param regionName The region to which the {@link RegionRedundancyStatus} 
to be returned
+   *        belongs.
+   * @return A {@link RegionRedundancyStatus} for the specified region or null 
if that region is not
+   *         present in this {@link RestoreRedundancyResults}.
+   */
+  RegionRedundancyStatus getRegionResult(String regionName);
+
+  /**
+   * Returns all the {@link RegionRedundancyStatus RegionRedundancyStatuses} 
for regions with
+   * configured redundancy but zero actual redundant copies.
+   *
+   * @return A {@link Map} of {@link String} region name to {@link 
RegionRedundancyStatus} for every
+   *         region contained in this {@link RestoreRedundancyResults} with 
configured redundancy
+   *         but zero actual redundant copies.
+   */
+  Map<String, RegionRedundancyStatus> getZeroRedundancyRegionResults();
+
+  /**
+   * Returns all the {@link RegionRedundancyStatus RegionRedundancyStatuses} 
for regions with with
+   * at least one redundant copy, but fewer than the configured number of 
redundant copies.
+   *
+   * @return A {@link Map} of {@link String} region name to {@link 
RegionRedundancyStatus} for every
+   *         region contained in this {@link RestoreRedundancyResults} with at 
least one redundant
+   *         copy, but fewer than the configured number of redundant copies.
+   */
+  Map<String, RegionRedundancyStatus> getUnderRedundancyRegionResults();
+
+  /**
+   * Returns all the {@link RegionRedundancyStatus RegionRedundancyStatuses} 
for regions with
+   * redundancy satisfied.
+   *
+   * @return A {@link Map} of {@link String} region name to {@link 
RegionRedundancyStatus} for every
+   *         region contained in this {@link RestoreRedundancyResults} with 
redundancy satisfied.
+   */
+  Map<String, RegionRedundancyStatus> getSatisfiedRedundancyRegionResults();
+
+  /**
+   * Returns all the {@link RegionRedundancyStatus RegionRedundancyStatuses} 
contained in this
+   * {@link RestoreRedundancyResults}. This method may return the actual 
backing map depending on
+   * implementation.
+   *
+   * @return A {@link Map} of {@link String} region name to {@link 
RegionRedundancyStatus} for every
+   *         region contained in this {@link RestoreRedundancyResults}.
+   */
+  Map<String, RegionRedundancyStatus> getRegionResults();
+
+  /**
+   * Returns the total number of primaries that were transferred as part of 
the restore redundancy
+   * operations.
+   *
+   * @return the total number of primaries that were transferred
+   */
+  int getTotalPrimaryTransfersCompleted();

Review comment:
       I would hope we don't have to transfer that many primaries... ever...Can 
we even handle that many buckets (not theoretically but do we know of any cases 
where we have over 100 million bucketsâť“) 




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


> Create Restore Redundancy Internal API
> --------------------------------------
>
>                 Key: GEODE-7953
>                 URL: https://issues.apache.org/jira/browse/GEODE-7953
>             Project: Geode
>          Issue Type: New Feature
>          Components: regions
>            Reporter: Donal Evans
>            Assignee: Donal Evans
>            Priority: Major
>          Time Spent: 3.5h
>  Remaining Estimate: 0h
>
> Introduce an internal API to allow redundancy to be restored and primary 
> bucket hosts reassigned without necessitating a full rebalance.
> As described in the RFC found here: 
> https://cwiki.apache.org/confluence/display/GEODE/Redundancy+Gfsh+Commands



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to