Create a Table and Populate it with gFlag Values

YugabyteDB consists of 3 primary applications: yb-master(master), yb-tserver(tserver) and postgres. Yb-master and yb-tserver use the gFlags for managing configurations and feature flags.

We saw in a previous YugabyteDB Tip how to quickly view the current gFlag settings from the command line.

Another cool way to view current gFlag settings is by creating a SQL table and populating it with the gFlag data!

Example:

				
					yugabyte=> CREATE TABLE gflags(server TEXT, gflag TEXT, value TEXT);
CREATE TABLE

yugabyte=> \COPY gflags FROM PROGRAM 'curl -s http://master_server_ip:7000/varz?raw | grep "\--" | sed -e "s/^--/MASTER=/"' DELIMITER '=';
COPY 1007

yugabyte=> \COPY gflags FROM PROGRAM 'curl -s http://t-server_ip:9000/varz?raw | grep "\--" | sed -e "s/^--/TSERVER=/"' DELIMITER '=';
COPY 876
				
			

Now I can run queries against the table using WHERE clause filters!

				
					yugabyte=> SELECT * FROM gflags WHERE gflag ILIKE '%packed%' ORDER BY 1, 2;
 server  |                   gflag                    | value
---------+--------------------------------------------+-------
 MASTER  | ycql_enable_packed_row                     | false
 MASTER  | ycql_packed_row_size_limit                 | 0
 MASTER  | ysql_enable_packed_row                     | false
 MASTER  | ysql_enable_packed_row_for_colocated_table | false
 MASTER  | ysql_packed_row_size_limit                 | 0
 TSERVER | ycql_enable_packed_row                     | false
 TSERVER | ycql_packed_row_size_limit                 | 0
 TSERVER | ysql_enable_packed_row                     | true
 TSERVER | ysql_enable_packed_row_for_colocated_table | false
 TSERVER | ysql_packed_row_size_limit                 | 0
(10 rows)
				
			

Have Fun!

Holmes Beach, Florida