standby.stop() shutil.rmtree('standby', True) sys.stdout.write(''' *********************************************************** *** Demo for Filespace support *********************************************************** ''') pline('Initialize standby info in catalog and take online backup') standby.create() subprocess.call(['ls', 'standby']) subprocess.call(['psql', '-c', 'select * from gp_segment_configuration']) pline('Start standby', 'pg_ctl start -D standby') standby.create_recovery_conf() subprocess.call(['cat', 'standby/recovery.conf']) standby.start() with open('filespace_setup.sql') as f: sql = f.read() pline('Run some SQL on primary while standby is running', sql) subprocess.call(['psql', '-f', 'filespace_setup.sql']) pline('Promote standby', 'pg_ctl promote -D standby\n' 'select pg_activate_standby()') standby.promote() sql = 'SELECT * FROM fspc_table' pline('Connect to port 5433', 'psql -p 5433\n{0}'.format(sql)) subprocess.call(['psql', '-p', '5433', '-c', sql])