From 0507aed0fd2173bb1794da6448ec6ebabd60d9ff Mon Sep 17 00:00:00 2001 From: Hubert Zhang Date: Tue, 2 Jun 2020 08:19:50 +0000 Subject: [PATCH] Fix flaky test in recoverseg_from_file 1. after stop primary with content=1, we should check promotion status with 1U: 2. after manually update dbid, we should trigger a fts probe and wait for the mirror promotion as well. --- .../segwalrep/recoverseg_from_file.out | 25 ++++++++++++++++--- .../sql/segwalrep/recoverseg_from_file.sql | 17 ++++++++++--- 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/src/test/isolation2/expected/segwalrep/recoverseg_from_file.out b/src/test/isolation2/expected/segwalrep/recoverseg_from_file.out index bfef545817..e21e0e2cc3 100644 --- a/src/test/isolation2/expected/segwalrep/recoverseg_from_file.out +++ b/src/test/isolation2/expected/segwalrep/recoverseg_from_file.out @@ -43,21 +43,38 @@ select gp_request_fts_probe_scan(); t (1 row) --- wait for content 0 (earlier mirror, now primary) to finish the promotion -0U: select 1; +-- wait for content 1 (earlier mirror, now primary) to finish the promotion +1U: select 1; ?column? ---------- 1 (1 row) -- Quit this utility mode session, as need to start fresh one below -0Uq: ... +1Uq: ... -- make the dbid in gp_segment_configuration not continuous +-- dbid=2 corresponds to content id =0 set allow_system_table_mods to true; SET update gp_segment_configuration set dbid=9 where dbid=2; UPDATE 1 +-- trigger failover +select gp_request_fts_probe_scan(); + gp_request_fts_probe_scan +--------------------------- + t +(1 row) + +-- wait for content 0 (earlier mirror, now primary) to finish the promotion +0U: select 1; + ?column? +---------- + 1 +(1 row) +-- Quit this utility mode session, as need to start fresh one below +0Uq: ... + -- generate recover config file select generate_recover_config_file( (select datadir from gp_segment_configuration c where c.role='m' and c.content=1), (select port from gp_segment_configuration c where c.role='m' and c.content=1)::text); generate_recover_config_file @@ -65,7 +82,7 @@ select generate_recover_config_file( (select datadir from gp_segment_configurati (1 row) --- recover from config file +-- recover from config file, only seg with content=1 will be recovered !\retcode gprecoverseg -a -i /tmp/recover_config_file; -- start_ignore -- end_ignore diff --git a/src/test/isolation2/sql/segwalrep/recoverseg_from_file.sql b/src/test/isolation2/sql/segwalrep/recoverseg_from_file.sql index fd0f576053..3de09a0144 100644 --- a/src/test/isolation2/sql/segwalrep/recoverseg_from_file.sql +++ b/src/test/isolation2/sql/segwalrep/recoverseg_from_file.sql @@ -34,21 +34,30 @@ where c.role='p' and c.content=1), 'stop'); -- trigger failover select gp_request_fts_probe_scan(); --- wait for content 0 (earlier mirror, now primary) to finish the promotion -0U: select 1; +-- wait for content 1 (earlier mirror, now primary) to finish the promotion +1U: select 1; -- Quit this utility mode session, as need to start fresh one below -0Uq: +1Uq: -- make the dbid in gp_segment_configuration not continuous +-- dbid=2 corresponds to content id =0 set allow_system_table_mods to true; update gp_segment_configuration set dbid=9 where dbid=2; +-- trigger failover +select gp_request_fts_probe_scan(); + +-- wait for content 0 (earlier mirror, now primary) to finish the promotion +0U: select 1; +-- Quit this utility mode session, as need to start fresh one below +0Uq: + -- generate recover config file select generate_recover_config_file( (select datadir from gp_segment_configuration c where c.role='m' and c.content=1), (select port from gp_segment_configuration c where c.role='m' and c.content=1)::text); --- recover from config file +-- recover from config file, only seg with content=1 will be recovered !\retcode gprecoverseg -a -i /tmp/recover_config_file; -- after gprecoverseg -i, the down segemnt should be up -- GitLab