managed/src/main/java/com/yugabyte/yw/common/PlacementInfoUtil.java
// Helper API to verify number of nodes and replication factor requirements.
Helper API to verify number of nodes and replication factor requirements.
Helper API to verify number of nodes and replication factor requirements .
public static void verifyNodesAndRF(ClusterType clusterType, int numNodes, int replicationFactor) {
    if ((clusterType == PRIMARY && !supportedRFs.contains(replicationFactor)) ||
        (clusterType == ASYNC && !supportedReadOnlyRFs.contains(replicationFactor))) {
      String errMsg = String.format("Replication factor %d not allowed, must be one of %s.",
                                    replicationFactor,
                                    Joiner.on(',').join(clusterType == PRIMARY ?
                                                        supportedRFs : supportedReadOnlyRFs));
      LOG.error(errMsg);
      throw new UnsupportedOperationException(errMsg);
    }
    if (numNodes > 0 && numNodes < replicationFactor) {
      String errMsg = String.format("Number of nodes %d cannot be less than the replication " +
          " factor %d.", numNodes, replicationFactor);
      LOG.error(errMsg);
      throw new UnsupportedOperationException(errMsg);
    }
  }
public static void verifyNodesAndRF ( ClusterType clusterType , int numNodes , int replicationFactor ) { if ( ( clusterType == PRIMARY && ! supportedRFs . contains ( replicationFactor ) ) || ( clusterType == ASYNC && ! supportedReadOnlyRFs . contains ( replicationFactor ) ) ) { String errMsg = String . format ( "Replication factor %d not allowed, must be one of %s." , replicationFactor , Joiner . on ( ',' ) . join ( clusterType == PRIMARY ? supportedRFs : supportedReadOnlyRFs ) ) ; LOG . error ( errMsg ) ; throw new UnsupportedOperationException ( errMsg ) ; } if ( numNodes > 0 && numNodes < replicationFactor ) { String errMsg = String . format ( "Number of nodes %d cannot be less than the replication " + " factor %d." , numNodes , replicationFactor ) ; LOG . error ( errMsg ) ; throw new UnsupportedOperationException ( errMsg ) ; } }
Helper API to verify number of nodes and replication factor requirements.
Helper API to verify number of nodes and replication factor requirements .
// We only support a replication factor of 1,3,5,7 for primary cluster. // And any value from 1 to 7 for read only cluster. // If not a fresh create, must have at least as many nodes as the replication factor.