Goal

In this article we will try to understand and answer to the below two question.

How to understand the segment mode and status of gp_segment_configuration table ?

What does 'c', 'r', 's' mean in mode column of gp_segment_configuration table? 

Solution

This article explains the meaning of 'c', 'r', 's' in the mode column, and the meaning of 'u', 'd' in the status column of gp_segment_configuration table.

The meaning is explained in two examples.

Example 1: Kill a mirror instance

-- This is a healthy instance, and all segments are up and running as their perferred roles. The segments' status is 'u' (up), mode is 's' (synchronized). 'synchronized' means all changes happening in primary instance are already synchronized in mirror instances, so in this condition, if the primary or mirror instance is down, there will be no data loss since the corresponding mirror/primary instance already has the same data.

template1=# select * from gp_segment_configuration;
dbid " content " role " preferred_role " mode " status " port  " hostname " address " replication_port " san_mounts
------+---------+------+----------------+------+--------+-------+----------+---------+------------------+------------
    1 "      -1 " p    " p              " s    " u      "  5582 " mdw      " mdw     "                  "
    2 "       0 " p    " p              " s    " u      " 48212 " sdw1     " sdw1-1  "            42182 "
    4 "       2 " p    " p              " s    " u      " 48212 " sdw3     " sdw3-1  "            42182 "
    3 "       1 " p    " p              " s    " u      " 48213 " sdw1     " sdw1-2  "            42183 "
    5 "       3 " p    " p              " s    " u      " 48213 " sdw3     " sdw3-2  "            42183 "
   10 "       0 " m    " m              " s    " u      " 58212 " sdw3     " sdw3-2  "            52820 "
   11 "       1 " m    " m              " s    " u      " 58213 " sdw3     " sdw3-1  "            52821 "
   12 "       2 " m    " m              " s    " u      " 58212 " sdw4     " sdw4-2  "            52820 "
   13 "       3 " m    " m              " s    " u      " 58213 " sdw4     " sdw4-1  "            52821 "
    6 "       4 " p    " p              " s    " u      " 48212 " sdw4     " sdw4-1  "            42182 "
   14 "       4 " m    " m              " s    " u      " 58212 " sdw5     " sdw5-2  "            52820 "
    7 "       5 " p    " p              " s    " u      " 48213 " sdw4     " sdw4-2  "            42183 "
   15 "       5 " m    " m              " s    " u      " 58213 " sdw5     " sdw5-1  "            52821 "
    8 "       6 " p    " p              " s    " u      " 48212 " sdw5     " sdw5-1  "            42182 "
   16 "       6 " m    " m              " s    " u      " 58212 " sdw1     " sdw1-2  "            52820 "
   17 "       7 " m    " m              " s    " u      " 58213 " sdw1     " sdw1-1  "            52821 "
    9 "       7 " p    " p              " s    " u      " 48213 " sdw5     " sdw5-2  "            42183 "
(17 rows)

-- Run SSH to one of the segment server, for example, sdw1, and kill a mirror instance, for example, with dbid 16.

[gpadmin@mdw alice]$ ssh sdw1
Last login: Sun Aug 14 21:54:02 2011 from mdw
[gpadmin@sdw1 ~]$ ps -ef " grep az " grep 4111
gpadmin    879     1  0 Aug07 ?        00:00:04 /usr/local/greenplum-db-4.1.1.1_JL/bin/postgres -D /data/azprimary4111/gpsegaz41111 -i -p 48213 --silent-mode=true -M quiescent -b 3 -C 1 -z 8
gpadmin    881     1  0 Aug07 ?        00:00:03 /usr/local/greenplum-db-4.1.1.1_JL/bin/postgres -D /data/azprimary4111/gpsegaz41110 -i -p 48212 --silent-mode=true -M quiescent -b 2 -C 0 -z 8
gpadmin    882     1  0 Aug07 ?        00:00:00 /usr/local/greenplum-db-4.1.1.1_JL/bin/postgres -D /data/azmirror4111/gpsegaz41117 -i -p 58213 --silent-mode=true -M quiescent -b 17 -C 7 -z 8
gpadmin    883     1  0 Aug07 ?        00:00:00 /usr/local/greenplum-db-4.1.1.1_JL/bin/postgres -D /data/azmirror4111/gpsegaz41116 -i -p 58212 --silent-mode=true -M quiescent -b 16 -C 6 -z 8
[gpadmin@sdw1 ~]$ kill 883
[gpadmin@sdw1 ~]$ ps -ef " grep az " grep 4111
gpadmin    879     1  0 Aug07 ?        00:00:04 /usr/local/greenplum-db-4.1.1.1_JL/bin/postgres -D /data/azprimary4111/gpsegaz41111 -i -p 48213 --silent-mode=true -M quiescent -b 3 -C 1 -z 8
gpadmin    881     1  0 Aug07 ?        00:00:03 /usr/local/greenplum-db-4.1.1.1_JL/bin/postgres -D /data/azprimary4111/gpsegaz41110 -i -p 48212 --silent-mode=true -M quiescent -b 2 -C 0 -z 8
gpadmin    882     1  0 Aug07 ?        00:00:00 /usr/local/greenplum-db-4.1.1.1_JL/bin/postgres -D /data/azmirror4111/gpsegaz41117 -i -p 58213 --silent-mode=true -M quiescent -b 17 -C 7 -z 8
[gpadmin@sdw1 ~]$ exit
logout

-- Check the gpstate and gp_segment_configuration table again.

[gpadmin@mdw alice]$ gpstate
20110815:13:27:16:gpstate:mdw:gpadmin-[INFO]:-Starting gpstate with args:
20110815:13:27:16:gpstate:mdw:gpadmin-[INFO]:-local Greenplum Version: 'postgres (Greenplum Database) 4.1.1.1 build 1'
20110815:13:27:16:gpstate:mdw:gpadmin-[INFO]:-Obtaining Segment details from master...
20110815:13:27:16:gpstate:mdw:gpadmin-[INFO]:-Gathering data from segments...
.
20110815:13:27:17:gpstate:mdw:gpadmin-[INFO]:-Greenplum instance status summary
20110815:13:27:17:gpstate:mdw:gpadmin-[INFO]:-----------------------------------------------------
20110815:13:27:17:gpstate:mdw:gpadmin-[INFO]:-   Master instance                                           = Active
20110815:13:27:17:gpstate:mdw:gpadmin-[INFO]:-   Master standby                                            = No master standby configured
20110815:13:27:17:gpstate:mdw:gpadmin-[INFO]:-   Total segment instance count from metadata                = 16
20110815:13:27:17:gpstate:mdw:gpadmin-[INFO]:-----------------------------------------------------
20110815:13:27:17:gpstate:mdw:gpadmin-[INFO]:-   Primary Segment Status
20110815:13:27:17:gpstate:mdw:gpadmin-[INFO]:-----------------------------------------------------
20110815:13:27:17:gpstate:mdw:gpadmin-[INFO]:-   Total primary segments                                    = 8
20110815:13:27:17:gpstate:mdw:gpadmin-[INFO]:-   Total primary segment valid (at master)                   = 8
20110815:13:27:17:gpstate:mdw:gpadmin-[INFO]:-   Total primary segment failures (at master)                = 0
20110815:13:27:17:gpstate:mdw:gpadmin-[INFO]:-   Total number of postmaster.pid files missing              = 0
20110815:13:27:17:gpstate:mdw:gpadmin-[INFO]:-   Total number of postmaster.pid files found                = 8
20110815:13:27:17:gpstate:mdw:gpadmin-[INFO]:-   Total number of postmaster.pid PIDs missing               = 0
20110815:13:27:17:gpstate:mdw:gpadmin-[INFO]:-   Total number of postmaster.pid PIDs found                 = 8
20110815:13:27:17:gpstate:mdw:gpadmin-[INFO]:-   Total number of /tmp lock files missing                   = 0
20110815:13:27:17:gpstate:mdw:gpadmin-[INFO]:-   Total number of /tmp lock files found                     = 8
20110815:13:27:17:gpstate:mdw:gpadmin-[INFO]:-   Total number postmaster processes missing                 = 0
20110815:13:27:17:gpstate:mdw:gpadmin-[INFO]:-   Total number postmaster processes found                   = 8
20110815:13:27:17:gpstate:mdw:gpadmin-[INFO]:-----------------------------------------------------
20110815:13:27:17:gpstate:mdw:gpadmin-[INFO]:-   Mirror Segment Status
20110815:13:27:17:gpstate:mdw:gpadmin-[INFO]:-----------------------------------------------------
20110815:13:27:17:gpstate:mdw:gpadmin-[INFO]:-   Total mirror segments                                     = 8
20110815:13:27:17:gpstate:mdw:gpadmin-[INFO]:-   Total mirror segment valid (at master)                    = 8
20110815:13:27:17:gpstate:mdw:gpadmin-[INFO]:-   Total mirror segment failures (at master)                 = 0
20110815:13:27:17:gpstate:mdw:gpadmin-[INFO]:-   Total number of postmaster.pid files missing              = 0
20110815:13:27:17:gpstate:mdw:gpadmin-[INFO]:-   Total number of postmaster.pid files found                = 8
20110815:13:27:17:gpstate:mdw:gpadmin-[INFO]:-   Total number of postmaster.pid PIDs missing               = 0
20110815:13:27:17:gpstate:mdw:gpadmin-[INFO]:-   Total number of postmaster.pid PIDs found                 = 8
20110815:13:27:17:gpstate:mdw:gpadmin-[INFO]:-   Total number of /tmp lock files missing                   = 0
20110815:13:27:17:gpstate:mdw:gpadmin-[INFO]:-   Total number of /tmp lock files found                     = 8
20110815:13:27:17:gpstate:mdw:gpadmin-[WARNING]:-Total number postmaster processes missing                 = 1                              <<<<<<<<
20110815:13:27:17:gpstate:mdw:gpadmin-[INFO]:-   Total number postmaster processes found                   = 7
20110815:13:27:17:gpstate:mdw:gpadmin-[INFO]:-   Total number mirror segments acting as primary segments   = 0
20110815:13:27:17:gpstate:mdw:gpadmin-[INFO]:-   Total number mirror segments acting as mirror segments    = 8
20110815:13:27:17:gpstate:mdw:gpadmin-[INFO]:-----------------------------------------------------

[gpadmin@mdw alice]$ psql template1
Timing is on.
psql (8.2.15)
Type "help" for help.

template1=# select * from gp_segment_configuration;
dbid " content " role " preferred_role " mode " status " port  " hostname " address " replication_port " san_mounts
------+---------+------+----------------+------+--------+-------+----------+---------+------------------+------------
    1 "      -1 " p    " p              " s    " u      "  5582 " mdw      " mdw     "                  "
    2 "       0 " p    " p              " s    " u      " 48212 " sdw1     " sdw1-1  "            42182 "
    4 "       2 " p    " p              " s    " u      " 48212 " sdw3     " sdw3-1  "            42182 "
    3 "       1 " p    " p              " s    " u      " 48213 " sdw1     " sdw1-2  "            42183 "
    5 "       3 " p    " p              " s    " u      " 48213 " sdw3     " sdw3-2  "            42183 "
   10 "       0 " m    " m              " s    " u      " 58212 " sdw3     " sdw3-2  "            52820 "
   11 "       1 " m    " m              " s    " u      " 58213 " sdw3     " sdw3-1  "            52821 "
   12 "       2 " m    " m              " s    " u      " 58212 " sdw4     " sdw4-2  "            52820 "
   13 "       3 " m    " m              " s    " u      " 58213 " sdw4     " sdw4-1  "            52821 "
    6 "       4 " p    " p              " s    " u      " 48212 " sdw4     " sdw4-1  "            42182 "
   14 "       4 " m    " m              " s    " u      " 58212 " sdw5     " sdw5-2  "            52820 "
    7 "       5 " p    " p              " s    " u      " 48213 " sdw4     " sdw4-2  "            42183 "
   15 "       5 " m    " m              " s    " u      " 58213 " sdw5     " sdw5-1  "            52821 "
    8 "       6 " p    " p              " c    " u      " 48212 " sdw5     " sdw5-1  "            42182 "
   16 "       6 " m    " m              " s    " d      " 58212 " sdw1     " sdw1-2  "            52820 "
   17 "       7 " m    " m              " s    " u      " 58213 " sdw1     " sdw1-1  "            52821 "
    9 "       7 " p    " p              " s    " u      " 48213 " sdw5     " sdw5-2  "            42183 "
(17 rows)

You can see that the instance with port=58212 status is 'd' (down), its primary instance status is still 'u', but the mode is changed 'c' (change tracking). At this time, the primary instance is logging all transactional changes made to the database, these are tracked via the files available at $SEG_DATA_DIRECTORY/pg_changetracking location, but its not synchronized to the mirror instance because it is down.

-- Run gprecoverseg to recover the down instance.

To recover ths mirror instance, run the gprecoverseg command then check the status again. You can see both instance are up now, but the mode is 'r' (resynchronization), which means the resynchronization process is applying changes that is recorded in change tracking log file to mirror segment.

template1=# select * from gp_segment_configuration;
dbid " content " role " preferred_role " mode " status " port  " hostname " address " replication_port " san_mounts
------+---------+------+----------------+------+--------+-------+----------+---------+------------------+------------
    1 "      -1 " p    " p              " s    " u      "  5582 " mdw      " mdw     "                  "
    2 "       0 " p    " p              " s    " u      " 48212 " sdw1     " sdw1-1  "            42182 "
    4 "       2 " p    " p              " s    " u      " 48212 " sdw3     " sdw3-1  "            42182 "
    3 "       1 " p    " p              " s    " u      " 48213 " sdw1     " sdw1-2  "            42183 "
    5 "       3 " p    " p              " s    " u      " 48213 " sdw3     " sdw3-2  "            42183 "
   10 "       0 " m    " m              " s    " u      " 58212 " sdw3     " sdw3-2  "            52820 "
   11 "       1 " m    " m              " s    " u      " 58213 " sdw3     " sdw3-1  "            52821 "
   12 "       2 " m    " m              " s    " u      " 58212 " sdw4     " sdw4-2  "            52820 "
   13 "       3 " m    " m              " s    " u      " 58213 " sdw4     " sdw4-1  "            52821 "
    6 "       4 " p    " p              " s    " u      " 48212 " sdw4     " sdw4-1  "            42182 "
   14 "       4 " m    " m              " s    " u      " 58212 " sdw5     " sdw5-2  "            52820 "
    7 "       5 " p    " p              " s    " u      " 48213 " sdw4     " sdw4-2  "            42183 "
   15 "       5 " m    " m              " s    " u      " 58213 " sdw5     " sdw5-1  "            52821 "
   17 "       7 " m    " m              " s    " u      " 58213 " sdw1     " sdw1-1  "            52821 "
    9 "       7 " p    " p              " s    " u      " 48213 " sdw5     " sdw5-2  "            42183 "
    8 "       6 " p    " p              " r    " u      " 48212 " sdw5     " sdw5-1  "            42182 "
   16 "       6 " m    " m              " r    " u      " 58212 " sdw1     " sdw1-2  "            52820 "
(17 rows)

After a while, check the table again, you can see both of them are synchronized.

template1=# select * from gp_segment_configuration;
dbid " content " role " preferred_role " mode " status " port  " hostname " address " replication_port " san_mounts
------+---------+------+----------------+------+--------+-------+----------+---------+------------------+------------
    1 "      -1 " p    " p              " s    " u      "  5582 " mdw      " mdw     "                  "
    2 "       0 " p    " p              " s    " u      " 48212 " sdw1     " sdw1-1  "            42182 "
    4 "       2 " p    " p              " s    " u      " 48212 " sdw3     " sdw3-1  "            42182 "
    3 "       1 " p    " p              " s    " u      " 48213 " sdw1     " sdw1-2  "            42183 "
    5 "       3 " p    " p              " s    " u      " 48213 " sdw3     " sdw3-2  "            42183 "
   10 "       0 " m    " m              " s    " u      " 58212 " sdw3     " sdw3-2  "            52820 "
   11 "       1 " m    " m              " s    " u      " 58213 " sdw3     " sdw3-1  "            52821 "
   12 "       2 " m    " m              " s    " u      " 58212 " sdw4     " sdw4-2  "            52820 "
   13 "       3 " m    " m              " s    " u      " 58213 " sdw4     " sdw4-1  "            52821 "
    6 "       4 " p    " p              " s    " u      " 48212 " sdw4     " sdw4-1  "            42182 "
   14 "       4 " m    " m              " s    " u      " 58212 " sdw5     " sdw5-2  "            52820 "
    7 "       5 " p    " p              " s    " u      " 48213 " sdw4     " sdw4-2  "            42183 "
   15 "       5 " m    " m              " s    " u      " 58213 " sdw5     " sdw5-1  "            52821 "
   17 "       7 " m    " m              " s    " u      " 58213 " sdw1     " sdw1-1  "            52821 "
    9 "       7 " p    " p              " s    " u      " 48213 " sdw5     " sdw5-2  "            42183 "
    8 "       6 " p    " p              " s    " u      " 48212 " sdw5     " sdw5-1  "            42182 "
   16 "       6 " m    " m              " s    " u      " 58212 " sdw1     " sdw1-2  "            52820 "
(17 rows)

Example 2: Kill a primary instance

-- Kill a primary instance with dbid=3.

template1=# select * from gp_segment_configuration;
dbid " content " role " preferred_role " mode " status " port  " hostname " address " replication_port " san_mounts
------+---------+------+----------------+------+--------+-------+----------+---------+------------------+------------
    1 "      -1 " p    " p              " s    " u      "  5582 " mdw      " mdw     "                  "
    2 "       0 " p    " p              " s    " u      " 48212 " sdw1     " sdw1-1  "            42182 "
    4 "       2 " p    " p              " s    " u      " 48212 " sdw3     " sdw3-1  "            42182 "
    5 "       3 " p    " p              " s    " u      " 48213 " sdw3     " sdw3-2  "            42183 "
   10 "       0 " m    " m              " s    " u      " 58212 " sdw3     " sdw3-2  "            52820 "
   12 "       2 " m    " m              " s    " u      " 58212 " sdw4     " sdw4-2  "            52820 "
   13 "       3 " m    " m              " s    " u      " 58213 " sdw4     " sdw4-1  "            52821 "
    6 "       4 " p    " p              " s    " u      " 48212 " sdw4     " sdw4-1  "            42182 "
   14 "       4 " m    " m              " s    " u      " 58212 " sdw5     " sdw5-2  "            52820 "
    7 "       5 " p    " p              " s    " u      " 48213 " sdw4     " sdw4-2  "            42183 "
   15 "       5 " m    " m              " s    " u      " 58213 " sdw5     " sdw5-1  "            52821 "
   17 "       7 " m    " m              " s    " u      " 58213 " sdw1     " sdw1-1  "            52821 "
    9 "       7 " p    " p              " s    " u      " 48213 " sdw5     " sdw5-2  "            42183 "
    8 "       6 " p    " p              " s    " u      " 48212 " sdw5     " sdw5-1  "            42182 "
   16 "       6 " m    " m              " s    " u      " 58212 " sdw1     " sdw1-2  "            52820 "
    3 "       1 " m    " p              " s    " d      " 48213 " sdw1     " sdw1-2  "            42183 "
   11 "       1 " p    " m              " c    " u      " 58213 " sdw3     " sdw3-1  "            52821 "
(17 rows)

You can see the primary instance dbid=3 status is down now, its mirror instance is up, and the mode is change tracking.

-- Run gprecoverseg command again.

template1=# select * from gp_segment_configuration;
dbid " content " role " preferred_role " mode " status " port  " hostname " address " replication_port " san_mounts
------+---------+------+----------------+------+--------+-------+----------+---------+------------------+------------
    1 "      -1 " p    " p              " s    " u      "  5582 " mdw      " mdw     "                  "
    2 "       0 " p    " p              " s    " u      " 48212 " sdw1     " sdw1-1  "            42182 "
    4 "       2 " p    " p              " s    " u      " 48212 " sdw3     " sdw3-1  "            42182 "
    5 "       3 " p    " p              " s    " u      " 48213 " sdw3     " sdw3-2  "            42183 "
   10 "       0 " m    " m              " s    " u      " 58212 " sdw3     " sdw3-2  "            52820 "
   12 "       2 " m    " m              " s    " u      " 58212 " sdw4     " sdw4-2  "            52820 "
   13 "       3 " m    " m              " s    " u      " 58213 " sdw4     " sdw4-1  "            52821 "
    6 "       4 " p    " p              " s    " u      " 48212 " sdw4     " sdw4-1  "            42182 "
   14 "       4 " m    " m              " s    " u      " 58212 " sdw5     " sdw5-2  "            52820 "
    7 "       5 " p    " p              " s    " u      " 48213 " sdw4     " sdw4-2  "            42183 "
   15 "       5 " m    " m              " s    " u      " 58213 " sdw5     " sdw5-1  "            52821 "
   17 "       7 " m    " m              " s    " u      " 58213 " sdw1     " sdw1-1  "            52821 "
    9 "       7 " p    " p              " s    " u      " 48213 " sdw5     " sdw5-2  "            42183 "
    8 "       6 " p    " p              " s    " u      " 48212 " sdw5     " sdw5-1  "            42182 "
   16 "       6 " m    " m              " s    " u      " 58212 " sdw1     " sdw1-2  "            52820 "
    3 "       1 " m    " p              " r    " u      " 48213 " sdw1     " sdw1-2  "            42183 "
   11 "       1 " p    " m              " r    " u      " 58213 " sdw3     " sdw3-1  "            52821 "
(17 rows)

After a while, they are synchronized

template1=# select * from gp_segment_configuration;
dbid " content " role " preferred_role " mode " status " port  " hostname " address " replication_port " san_mounts
------+---------+------+----------------+------+--------+-------+----------+---------+------------------+------------
    1 "      -1 " p    " p              " s    " u      "  5582 " mdw      " mdw     "                  "
    2 "       0 " p    " p              " s    " u      " 48212 " sdw1     " sdw1-1  "            42182 "
    4 "       2 " p    " p              " s    " u      " 48212 " sdw3     " sdw3-1  "            42182 "
    5 "       3 " p    " p              " s    " u      " 48213 " sdw3     " sdw3-2  "            42183 "
   10 "       0 " m    " m              " s    " u      " 58212 " sdw3     " sdw3-2  "            52820 "
   12 "       2 " m    " m              " s    " u      " 58212 " sdw4     " sdw4-2  "            52820 "
   13 "       3 " m    " m              " s    " u      " 58213 " sdw4     " sdw4-1  "            52821 "
    6 "       4 " p    " p              " s    " u      " 48212 " sdw4     " sdw4-1  "            42182 "
   14 "       4 " m    " m              " s    " u      " 58212 " sdw5     " sdw5-2  "            52820 "
    7 "       5 " p    " p              " s    " u      " 48213 " sdw4     " sdw4-2  "            42183 "
   15 "       5 " m    " m              " s    " u      " 58213 " sdw5     " sdw5-1  "            52821 "
   17 "       7 " m    " m              " s    " u      " 58213 " sdw1     " sdw1-1  "            52821 "
    9 "       7 " p    " p              " s    " u      " 48213 " sdw5     " sdw5-2  "            42183 "
    8 "       6 " p    " p              " s    " u      " 48212 " sdw5     " sdw5-1  "            42182 "
   16 "       6 " m    " m              " s    " u      " 58212 " sdw1     " sdw1-2  "            52820 "
   11 "       1 " p    " m              " s    " u      " 58213 " sdw3     " sdw3-1  "            52821 "
    3 "       1 " m    " p              " s    " u      " 48213 " sdw1     " sdw1-2  "            42183 "
(17 rows)

-- Run the gprecoverseg -r command to bring the segment to its preferred role.

template1=# select * from gp_segment_configuration;
dbid " content " role " preferred_role " mode " status " port  " hostname " address " replication_port " san_mounts
------+---------+------+----------------+------+--------+-------+----------+---------+------------------+------------
    1 "      -1 " p    " p              " s    " u      "  5582 " mdw      " mdw     "                  "
    2 "       0 " p    " p              " s    " u      " 48212 " sdw1     " sdw1-1  "            42182 "
    4 "       2 " p    " p              " s    " u      " 48212 " sdw3     " sdw3-1  "            42182 "
    5 "       3 " p    " p              " s    " u      " 48213 " sdw3     " sdw3-2  "            42183 "
   10 "       0 " m    " m              " s    " u      " 58212 " sdw3     " sdw3-2  "            52820 "
   12 "       2 " m    " m              " s    " u      " 58212 " sdw4     " sdw4-2  "            52820 "
   13 "       3 " m    " m              " s    " u      " 58213 " sdw4     " sdw4-1  "            52821 "
    6 "       4 " p    " p              " s    " u      " 48212 " sdw4     " sdw4-1  "            42182 "
   14 "       4 " m    " m              " s    " u      " 58212 " sdw5     " sdw5-2  "            52820 "
    7 "       5 " p    " p              " s    " u      " 48213 " sdw4     " sdw4-2  "            42183 "
   15 "       5 " m    " m              " s    " u      " 58213 " sdw5     " sdw5-1  "            52821 "
   17 "       7 " m    " m              " s    " u      " 58213 " sdw1     " sdw1-1  "            52821 "
    9 "       7 " p    " p              " s    " u      " 48213 " sdw5     " sdw5-2  "            42183 "
    8 "       6 " p    " p              " s    " u      " 48212 " sdw5     " sdw5-1  "            42182 "
   16 "       6 " m    " m              " s    " u      " 58212 " sdw1     " sdw1-2  "            52820 "
    3 "       1 " p    " p              " r    " u      " 48213 " sdw1     " sdw1-2  "            42183 "
   11 "       1 " m    " m              " r    " u      " 58213 " sdw3     " sdw3-1  "            52821 "
(17 rows)

After a while, they are back to their preferred roles, and synchronized:

template1=# select * from gp_segment_configuration;
dbid " content " role " preferred_role " mode " status " port  " hostname " address " replication_port " san_mounts
------+---------+------+----------------+------+--------+-------+----------+---------+------------------+------------
    1 "      -1 " p    " p              " s    " u      "  5582 " mdw      " mdw     "                  "
    2 "       0 " p    " p              " s    " u      " 48212 " sdw1     " sdw1-1  "            42182 "
    4 "       2 " p    " p              " s    " u      " 48212 " sdw3     " sdw3-1  "            42182 "
    5 "       3 " p    " p              " s    " u      " 48213 " sdw3     " sdw3-2  "            42183 "
   10 "       0 " m    " m              " s    " u      " 58212 " sdw3     " sdw3-2  "            52820 "
   12 "       2 " m    " m              " s    " u      " 58212 " sdw4     " sdw4-2  "            52820 "
   13 "       3 " m    " m              " s    " u      " 58213 " sdw4     " sdw4-1  "            52821 "
    6 "       4 " p    " p              " s    " u      " 48212 " sdw4     " sdw4-1  "            42182 "
   14 "       4 " m    " m              " s    " u      " 58212 " sdw5     " sdw5-2  "            52820 "
    7 "       5 " p    " p              " s    " u      " 48213 " sdw4     " sdw4-2  "            42183 "
   15 "       5 " m    " m              " s    " u      " 58213 " sdw5     " sdw5-1  "            52821 "
   17 "       7 " m    " m              " s    " u      " 58213 " sdw1     " sdw1-1  "            52821 "
    9 "       7 " p    " p              " s    " u      " 48213 " sdw5     " sdw5-2  "            42183 "
    8 "       6 " p    " p              " s    " u      " 48212 " sdw5     " sdw5-1  "            42182 "
   16 "       6 " m    " m              " s    " u      " 58212 " sdw1     " sdw1-2  "            52820 "
    3 "       1 " p    " p              " s    " u      " 48213 " sdw1     " sdw1-2  "            42183 "
   11 "       1 " m    " m              " s    " u      " 58213 " sdw3     " sdw3-1  "            52821 "
(17 rows)

(原文地址:https://discuss.pivotal.io/hc/en-us/articles/202646953-What-are-mode-and-status-columns-under-gp-segment-configuration-table)