Skip to content

Commit

Permalink
Refactor the way secondary log schemas are dropped. This fixes the ca…
Browse files Browse the repository at this point in the history
…se when a schema should be dropped once a log table is dropped by at group reset time or at an old mark deletion time. Refactor also the secondary log schemas creation. The CREATE_SCHEMA and DROP_SCHEMA elementary steps are now useless in alter group operations. So remove them from the alter planning.
  • Loading branch information
beaud76 committed Oct 18, 2017
1 parent 00a748c commit c53bfaa
Show file tree
Hide file tree
Showing 63 changed files with 3,564 additions and 3,213 deletions.
251 changes: 195 additions & 56 deletions sql/emaj--2.1.0--next_version.sql

Large diffs are not rendered by default.

209 changes: 98 additions & 111 deletions sql/emaj--next_version.sql

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions test/10/expected/adm1.out
Original file line number Diff line number Diff line change
Expand Up @@ -2282,15 +2282,15 @@ select * from emaj.emaj_verify_all();

select emaj.emaj_create_group('dummyGroup');
ERROR: emaj_create_group: The group "dummyGroup" is unknown in the emaj_group_def table. To create an empty group, explicitely set the third parameter to true.
CONTEXT: PL/pgSQL function emaj.emaj_create_group(text,boolean,boolean) line 31 at RAISE
CONTEXT: PL/pgSQL function emaj.emaj_create_group(text,boolean,boolean) line 29 at RAISE
select emaj.emaj_drop_group('dummyGroup');
ERROR: _drop_group: The group "dummyGroup" does not exist.
CONTEXT: PL/pgSQL function emaj._drop_group(text,boolean) line 20 at RAISE
CONTEXT: PL/pgSQL function emaj._drop_group(text,boolean) line 18 at RAISE
SQL statement "SELECT emaj._drop_group(v_groupName, FALSE)"
PL/pgSQL function emaj.emaj_drop_group(text) line 12 at SQL statement
select emaj.emaj_force_drop_group('dummyGroup');
ERROR: _drop_group: The group "dummyGroup" does not exist.
CONTEXT: PL/pgSQL function emaj._drop_group(text,boolean) line 20 at RAISE
CONTEXT: PL/pgSQL function emaj._drop_group(text,boolean) line 18 at RAISE
SQL statement "SELECT emaj._drop_group(v_groupName, TRUE)"
PL/pgSQL function emaj.emaj_force_drop_group(text) line 17 at SQL statement
select emaj.emaj_get_previous_mark_group('dummyGroup', '2010-01-01');
Expand Down
20 changes: 9 additions & 11 deletions test/10/expected/adm2.out
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,6 @@ select emaj.emaj_enable_protection_by_event_triggers();
select * from emaj.emaj_alter_plan where altr_time_id > 10000 order by 1,2,3,4,5;
altr_time_id | altr_step | altr_schema | altr_tblseq | altr_group | altr_priority | altr_group_is_logging | altr_new_group | altr_new_priority | altr_new_group_is_logging | altr_rlbk_id
--------------+-------------------------+----------------+-------------+------------------+---------------+-----------------------+----------------+-------------------+---------------------------+--------------
10035 | CREATE_LOG_SCHEMA | emaj3 | | | | | | | |
10035 | REPAIR_TBL | phil's schema3 | phil's tbl1 | phil's group#3", | | f | | | |
10035 | RESET_GROUP | | | phil's group#3", | | f | | | |
10035 | CHANGE_TBL_LOG_SCHEMA | phil's schema3 | myTbl2\ | phil's group#3", | 1 | f | | | |
Expand All @@ -536,8 +535,7 @@ select * from emaj.emaj_alter_plan where altr_time_id > 10000 order by 1,2,3,4,5
10039 | CHANGE_TBL_NAMES_PREFIX | phil's schema3 | myTbl2\ | phil's group#3", | | f | | | |
10039 | CHANGE_REL_PRIORITY | myschema4 | mytblm | myGroup4 | | f | | 999 | |
10039 | CHANGE_REL_PRIORITY | phil's schema3 | myTbl2\ | phil's group#3", | 1 | f | | | |
10039 | DROP_LOG_SCHEMA | emaj3 | | | | | | | |
(14 rows)
(12 rows)

-----------------------------
-- Step 10 : for phil''s group#3", recreate the group as rollbackable, update tables,
Expand Down Expand Up @@ -1993,14 +1991,14 @@ select rlbk_id, rlbk_groups, rlbk_mark, rlbk_time_id, rlbk_is_logged, rlbk_is_al
22 | {myGroup1} | Conso_M2 | 3057 | t | f | 1 | 5 | 2 | 3 | COMMITTED | 3411 | t | [ts] | Completed: 3 tables and 2 sequences effectively processed
23 | {myGroup1} | Conso_M1 | 3059 | f | f | 1 | 5 | 2 | 2 | COMMITTED | 3437 | t | [ts] | Completed: 2 tables and 2 sequences effectively processed
24 | {myGroup4} | myGroup4_start | 3060 | f | f | 1 | 5 | 0 | 0 | ABORTED | 3452 | t | [ts] | Completed: 0 tables and 0 sequences effectively processed
6000 | {myGroup1} | Mk2b | 6058 | t | t | 1 | 5 | 1 | 0 | ABORTED | 6254 | t | [ts] | Completed: 0 tables and 1 sequences effectively processed
6001 | {myGroup1} | Mk2b | 6060 | f | t | 1 | 5 | 1 | 0 | ABORTED | 6265 | t | [ts] | Completed: 0 tables and 1 sequences effectively processed
6004 | {myGroup1,myGroup2} | Mk3 | 6072 | f | f | 1 | 11 | 4 | 0 | COMMITTED | 6357 | t | [ts] | Completed: 0 tables and 4 sequences effectively processed
6005 | {myGroup1,myGroup2} | Mk2 | 6073 | t | t | 1 | 11 | 4 | 1 | COMMITTED | 6367 | t | [ts] | Completed: 1 tables and 4 sequences effectively processed
6006 | {myGroup1,myGroup2} | Mk2 | 6075 | f | f | 1 | 11 | 4 | 1 | COMMITTED | 6384 | t | [ts] | Completed: 1 tables and 4 sequences effectively processed
6007 | {myGroup1,myGroup2} | Mk1 | 6076 | f | t | 1 | 11 | 4 | 0 | COMMITTED | 6407 | t | [ts] | Completed: 0 tables and 4 sequences effectively processed
6008 | {myGroup1,myGroup2} | Mk1 | 6077 | t | f | 1 | 11 | 4 | 0 | ABORTED | 6422 | t | [ts] | Completed: 0 tables and 4 sequences effectively processed
6009 | {myGroup1,myGroup2} | Mk1 | 6079 | f | f | 1 | 11 | 4 | 0 | ABORTED | 6439 | t | [ts] | Completed: 0 tables and 4 sequences effectively processed
6000 | {myGroup1} | Mk2b | 6058 | t | t | 1 | 5 | 1 | 0 | ABORTED | 6256 | t | [ts] | Completed: 0 tables and 1 sequences effectively processed
6001 | {myGroup1} | Mk2b | 6060 | f | t | 1 | 5 | 1 | 0 | ABORTED | 6267 | t | [ts] | Completed: 0 tables and 1 sequences effectively processed
6004 | {myGroup1,myGroup2} | Mk3 | 6072 | f | f | 1 | 11 | 4 | 0 | COMMITTED | 6363 | t | [ts] | Completed: 0 tables and 4 sequences effectively processed
6005 | {myGroup1,myGroup2} | Mk2 | 6073 | t | t | 1 | 11 | 4 | 1 | COMMITTED | 6373 | t | [ts] | Completed: 1 tables and 4 sequences effectively processed
6006 | {myGroup1,myGroup2} | Mk2 | 6075 | f | f | 1 | 11 | 4 | 1 | COMMITTED | 6390 | t | [ts] | Completed: 1 tables and 4 sequences effectively processed
6007 | {myGroup1,myGroup2} | Mk1 | 6076 | f | t | 1 | 11 | 4 | 0 | COMMITTED | 6413 | t | [ts] | Completed: 0 tables and 4 sequences effectively processed
6008 | {myGroup1,myGroup2} | Mk1 | 6077 | t | f | 1 | 11 | 4 | 0 | ABORTED | 6428 | t | [ts] | Completed: 0 tables and 4 sequences effectively processed
6009 | {myGroup1,myGroup2} | Mk1 | 6079 | f | f | 1 | 11 | 4 | 0 | ABORTED | 6445 | t | [ts] | Completed: 0 tables and 4 sequences effectively processed
10000 | {myGroup2} | M2 | 10009 | t | f | 1 | 6 | 2 | 3 | COMMITTED | 10057 | f | [ts] | Completed: 3 tables and 2 sequences effectively processed
10001 | {myGroup2} | M3 | 10011 | t | f | 1 | 6 | 2 | 3 | COMMITTED | 10074 | f | [ts] | Completed: 3 tables and 2 sequences effectively processed
10002 | {myGroup1} | M2 | 10013 | f | f | 1 | 5 | 2 | 2 | COMMITTED | 10091 | t | [ts] | Completed: 2 tables and 2 sequences effectively processed
Expand Down

0 comments on commit c53bfaa

Please sign in to comment.