Pivotal Knowledge Base

Follow

How to check if the database is in restricted mode.

Goal

This article provide a simple tip and various method to help identify if the database is in restricted mode or not.

Solution

-- step 1

Verify database startup log under gpAdminLogs directory on most recent gpstart_yyyymmdd.log. Below is the startup log on both normal and restricted mode.

  • Restricted mode startup log:

Note the indication of "RESTRICTED mode" keyword on the log.

cat /home/gpadmin/gpAdminLogs/gpstart_20130418.log
20130418:10:34:45:010414 gpstart:mdw:gpadmin-[INFO]:-Starting gpstart with args: -R
[.......]
[.......]
20130418:10:34:54:010414 gpstart:mdw:gpadmin-[INFO]:-Successfully started 8 of 8 segment instances
20130418:10:34:54:010414 gpstart:mdw:gpadmin-[INFO]:-----------------------------------------------------
20130418:10:34:54:010414 gpstart:mdw:gpadmin-[INFO]:-Starting Master instance mdw directory /data/master/gp42t/gp-1 in RESTRICTED mode
20130418:10:34:55:010414 gpstart:mdw:gpadmin-[INFO]:-Command pg_ctl reports Master mdw instance active
20130418:10:34:55:010414 gpstart:mdw:gpadmin-[INFO]:-Database successfully started
20130418:10:34:55:010414 gpstart:mdw:gpadmin-[INFO]:-Initializing DCA settings
20130418:10:34:55:010414 gpstart:mdw:gpadmin-[INFO]:-DCA settings initialize
  • Normal mode startup log:
cat /home/gpadmin/gpAdminLogs/gpstart_20130418.log
20130418:10:37:12:016497 gpstart:mdw:gpadmin-[INFO]:-Starting gpstart with args: -a
[.......]
[.......]
20130418:10:37:20:016497 gpstart:mdw:gpadmin-[INFO]:-Successfully started 8 of 8 segment instances
20130418:10:37:20:016497 gpstart:mdw:gpadmin-[INFO]:-----------------------------------------------------
20130418:10:37:20:016497 gpstart:mdw:gpadmin-[INFO]:-Starting Master instance mdw directory /data/master/gp42t/gp-1
20130418:10:37:21:016497 gpstart:mdw:gpadmin-[INFO]:-Command pg_ctl reports Master mdw instance active
20130418:10:37:21:016497 gpstart:mdw:gpadmin-[INFO]:-Database successfully started
20130418:10:37:21:016497 gpstart:mdw:gpadmin-[INFO]:-Initializing DCA settings
20130418:10:37:21:016497 gpstart:mdw:gpadmin-[INFO]:-DCA settings initialized

-- step 2

if you want to do it within a database session, you will usually see "superuser_reserved_connections" maxed out to 250:

  • Normal start:
test=# show max_connections; show superuser_reserved_connections ;
max_connections
-----------------
250
(1 row)

superuser_reserved_connections
--------------------------------
3
(1 row)
  • Restricted mode start:
test=# show max_connections; show superuser_reserved_connections ;
max_connections
-----------------
250
(1 row)
 
superuser_reserved_connections
--------------------------------
250
(1 row)

-- step 3

You can also find out the similarinformation as indicated on step2 from the process (ps) command:

  • Normal start:
[gpadmin@mdw kamal]$ pgrep -fl silent
31541 /usr/local/GP-4.2.3.2/bin/postgres -D /data/master/kumlik_4232_gpseg-1 -p 9002 -b 1 -z 24 --silent-mode=true -i -M master -C -1 -x 0 -E
[gpadmin@mdw kamal]$
  • Restricted mode start:
[gpadmin@mdw kamal]$ pgrep -fl silent
20326 /usr/local/GP-4.2.3.2/bin/postgres -D /data/master/kumlik_4232_gpseg-1 -p 9002 -b 1 -z 24 --silent-mode=true -i -M master -C -1 -x 0 -E -c superuser_reserved_connections=250
[gpadmin@mdw kamal]$

-- step 4

From the postmaster file, the restricted postmaster.opts files shows

[gpadmin@mdw gpseg-1]$ cat $MASTER_DATA_DIRECTORY/postmaster.opts
/data/david/greenplum-db-4.2.0.0/bin/postgres "-D" "/data/david/greenplum-db-4.2.0.0-master/gpseg-1" "-E" "-i" "-M" "master" "-p" "5438" "-b" "1" "-x" "6" "-C" "-1" "-z" "2" "--silent-mode=true" "-c" "superuser_reserved_connections=250"

Comments

  • Avatar
    Gurupreet Singh Bhatia

    What caused system to go into recovery mode or what are the possible reason

    Log message showing this
    FATAL: the database system is in recovery mode

  • Avatar
    Faisal Ali

    Hi Gurupreet,

    The error you have highlighted is not related to this article . In general it means that system crashed and currently recovering / rollbacking the transaction ...

    Thanks
    Faisal

    Edited by Faisal Ali
Powered by Zendesk