Primary-Mirror Mirroring Strategies

This document describes the mirroring strategies used in the YMatrix database system.

When deploying a YMatrix database system, mirror segments (Mirror) can be configured on separate hosts.

  • Functionality:
    • If a primary segment (Primary) fails, the mirror segment takes over query processing.
    • Mirrors stay synchronized with their corresponding primaries through transaction log replication.
  • Best Practice:
    • Each mirror segment instance must be deployed on a different host than its primary to avoid single-point host failures.

Note!
Mirroring is strongly recommended for production environments.

1 Greenplum Mirroring Strategies

Before discussing YMatrix's mirroring strategy, this section provides background on Greenplum’s mirroring configurations. Greenplum supports two standard mirroring configurations: Group Mirroring and Spread Mirroring. Group Mirroring is the default.

1.1 Spread Mirroring

In Spread Mirroring, mirrors from each host are distributed across the remaining hosts in the cluster. This configuration requires that the number of hosts in the cluster exceeds the number of primary segments per host.
To ensure even distribution, the number of independent hosts in the array must be greater than the number of segment instances per host.

1.2 Group Mirroring

In Group Mirroring, all mirrors for primary segments on a single host are grouped together and placed on another host in the cluster.
This is the default mirroring strategy in Greenplum.

2 YMatrix Mirroring Strategy

YMatrix uses Ring Mirroring as the default strategy. With at least two hosts, the primary segment sequence on one host is treated as a one-dimensional tape, folded in half. Starting from the middle segment ID on the second host, mirrors are placed clockwise and evenly distributed across the other hosts.
When expanding the cluster by adding new primary segments, the existing mirror ring remains unchanged, and a new mirror ring is created.

This is the default mirroring strategy in YMatrix.

This strategy balances the trade-offs of the two Greenplum approaches, offering a compromise between stability and load distribution. The following table compares the three strategies:

Spread Group Ring
System Stability Unstable Stable Moderately Stable
Load Balance Balanced Unbalanced Moderately Balanced

Note!
If you wish to use a mirroring strategy other than Ring Mirroring in YMatrix, you can achieve this through custom configuration using mxaddmirrors.