private void calculateStartingBucketIDs(PartitionRegionConfig prConfig) {
    if (BEFORE_CALCULATE_STARTING_BUCKET_FLAG) {
      PartitionedRegionObserver pro = PartitionedRegionObserverHolder.getInstance();
      pro.beforeCalculatingStartingBucketId();
    }
    List<FixedPartitionAttributesImpl> fpaList = getFixedPartitionAttributesImpl();

    if (getColocatedWith() == null) {
      Set<FixedPartitionAttributesImpl> elderFPAs = prConfig.getElderFPAs();
      int startingBucketID = 0;
      if (elderFPAs != null && !elderFPAs.isEmpty()) {
        int largestStartBucId = -1;
        for (FixedPartitionAttributesImpl fpa : elderFPAs) {
          if (fpa.getStartingBucketID() > largestStartBucId) {
            largestStartBucId = fpa.getStartingBucketID();
            startingBucketID = largestStartBucId + fpa.getNumBuckets();
          }
        }
      }
      for (FixedPartitionAttributesImpl fpaImpl : fpaList) {
        if (elderFPAs != null && elderFPAs.contains(fpaImpl)) {
          for (FixedPartitionAttributesImpl remotefpa : elderFPAs) {
            if (remotefpa.equals(fpaImpl)) {
              fpaImpl.setStartingBucketID(remotefpa.getStartingBucketID());
            }
          }
        } else {
          fpaImpl.setStartingBucketID(startingBucketID);
          startingBucketID += fpaImpl.getNumBuckets();
        }
      }
    }
    prConfig.addFPAs(fpaList);
    for (FixedPartitionAttributesImpl fxPrAttr : fpaList) {
      partitionsMap.put(fxPrAttr.getPartitionName(),
          new Integer[] {fxPrAttr.getStartingBucketID(), fxPrAttr.getNumBuckets()});
    }
  }
For the very first member, FPR's first partition has starting bucket id as 0 and other
partitions have starting bucket id as the sum of previous partition's starting bucket id and
previous partition's num-buckets.

For other members, all partitions defined previously with assigned starting bucket ids are
fetched from the metadata PartitionRegionConfig. Now for each partition defined for this
member, if this partition is already available in the list of the previously defined partitions
then starting bucket id is directly assigned from the same previously defined partition.

And if the partition on this member is not available in the previously defined partitions then
new starting bucket id is calculated as the sum of the largest starting bucket id from
previously defined partitions and corresponding num-buckets of the partition.

This data of the partitions (FixedPartitionAttributes with starting bucket id for the Fixed
Partitioned Region) is stored in metadata for each member.
geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegion.java