Skip to content

Commit

Permalink
Add the capability to remove a sequence from a tables group while the…
Browse files Browse the repository at this point in the history
… group is in logging state. Move the code for the oldest marks deletion from the _delete_between_mark_group() into a separate _delete_before_mark_group() function.
  • Loading branch information
beaud76 committed Aug 25, 2017
1 parent 8892872 commit b155541
Show file tree
Hide file tree
Showing 43 changed files with 2,021 additions and 954 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ E-Maj - Change log

* Improve the documentation about the installation.
* PostgreSQL versions prior 9.2 are not supported by E-Maj anymore.
* A sequence can be removed from a tables group in LOGGING state. A
subsequent rollback operation will let it unchanged.
* Improve the security of the emaj_visible_param view by declaring it as
'security_barrier'.
* Some minor code improvements.
Expand Down
6 changes: 5 additions & 1 deletion docs/en/alterGroups.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ However, some actions are possible while the tables groups are in *LOGGING* stat
+-------------------------------------+---------------+-----------------------+
| Remove a table from a group | No | |
+-------------------------------------+---------------+-----------------------+
| Remove a sequence from a group | No | |
| Remove a sequence from a group | Yes | emaj_group_def update |
+-------------------------------------+---------------+-----------------------+
| Add a table to a group | No | |
+-------------------------------------+---------------+-----------------------+
Expand Down Expand Up @@ -123,3 +123,7 @@ An E-Maj rollback operation targeting a mark set before such groups changes does

However, the administrator can apply the same procedure to reset a tables group to a prior state.

.. caution::

Once a sequence is removed from a tables group, any rollback operation will left this object unchanged. Once unlinked from its tables group, the application sequence can be altered or dropped. The historical data linked to the object (logs, marks traces,...) are kept as is so that they can be later examined. However, they remain linked to the tables group that owned the object and will only be deleted by a :ref:`group’s reset <emaj_reset_group>` operation or by the :ref:`deletion of the oldest marks <emaj_delete_before_mark_group>` of the group.

6 changes: 5 additions & 1 deletion docs/fr/alterGroups.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Néanmoins certaines actions sont possibles sur des groupes de tables maintenus
+-------------------------------------+----------------+---------------------------+
| Oter une table d’un groupe | Non | |
+-------------------------------------+----------------+---------------------------+
| Oter une séquence d’un groupe | Non | |
| Oter une séquence d’un groupe | Oui | Ajustement emaj_group_def |
+-------------------------------------+----------------+---------------------------+
| Ajouter une table à un groupe | Non | |
+-------------------------------------+----------------+---------------------------+
Expand Down Expand Up @@ -124,3 +124,7 @@ Une opération de rollback E-Maj ciblant une marque antérieure à une modificat

Néanmoins, l’administrateur a la possibilité d’appliquer cette même procédure pour revenir à un état antérieur.

.. caution::

Quand une séquence est sortie de son groupe de tables, toute opération de rollback ultérieure sur ce groupe sera sans effet sur cet objet. Une fois la séquence applicative décrochée de son groupe de tables, elle peut être modifiée ou supprimée. Les historiques liés à l’objet (logs, trace des marques,...) sont conservés pour examen éventuel. Ils restent néanmoins associés au groupe d'appartenance de l'objet et ne seront supprimés que par les opérations de :ref:`réinitialisation du groupe de tables <emaj_reset_group>` ou par les :ref:`suppressions des plus anciennes marques <emaj_delete_before_mark_group>` du groupe.

426 changes: 311 additions & 115 deletions sql/emaj--2.1.0--next_version.sql

Large diffs are not rendered by default.

330 changes: 211 additions & 119 deletions sql/emaj--next_version.sql

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions test/10/expected/adm1.out
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ select count(*) from emaj.emaj_seq_hole;
select count(*) from emaj.emaj_rlbk;
count
-------
28
30
(1 row)

select count(*) from emaj.emaj_rlbk_session;
count
-------
28
30
(1 row)

select count(*) from emaj.emaj_rlbk_plan;
Expand Down Expand Up @@ -176,13 +176,13 @@ select * from emaj.emaj_seq_hole;
select count(*) from emaj.emaj_rlbk;
count
-------
28
30
(1 row)

select count(*) from emaj.emaj_rlbk_session;
count
-------
28
30
(1 row)

select count(*) from emaj.emaj_rlbk_plan;
Expand Down
18 changes: 10 additions & 8 deletions test/10/expected/adm2.out
Original file line number Diff line number Diff line change
Expand Up @@ -2120,12 +2120,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,myGroup2} | Mk3 | 6056 | f | f | 1 | 11 | 4 | 0 | COMMITTED | 6242 | t | [ts] | Completed: 0 tables and 4 sequences effectively processed
6001 | {myGroup1,myGroup2} | Mk2 | 6057 | t | t | 1 | 11 | 4 | 0 | COMMITTED | 6252 | t | [ts] | Completed: 0 tables and 4 sequences effectively processed
6002 | {myGroup1,myGroup2} | Mk2 | 6059 | f | t | 1 | 11 | 4 | 0 | COMMITTED | 6267 | t | [ts] | Completed: 0 tables and 4 sequences effectively processed
6003 | {myGroup1,myGroup2} | Mk1 | 6060 | f | t | 1 | 11 | 4 | 0 | COMMITTED | 6287 | t | [ts] | Completed: 0 tables and 4 sequences effectively processed
6004 | {myGroup1,myGroup2} | Mk1 | 6061 | t | f | 1 | 11 | 4 | 0 | ABORTED | 6302 | t | [ts] | Completed: 0 tables and 4 sequences effectively processed
6005 | {myGroup1,myGroup2} | Mk1 | 6063 | f | f | 1 | 11 | 4 | 0 | ABORTED | 6319 | t | [ts] | Completed: 0 tables and 4 sequences effectively processed
6000 | {myGroup1} | Mk2b | 6057 | t | t | 1 | 5 | 1 | 0 | ABORTED | 6249 | t | [ts] | Completed: 0 tables and 1 sequences effectively processed
6001 | {myGroup1} | Mk2b | 6059 | f | t | 1 | 5 | 1 | 0 | ABORTED | 6260 | t | [ts] | Completed: 0 tables and 1 sequences effectively processed
6002 | {myGroup1,myGroup2} | Mk3 | 6063 | f | f | 1 | 11 | 4 | 0 | COMMITTED | 6292 | t | [ts] | Completed: 0 tables and 4 sequences effectively processed
6003 | {myGroup1,myGroup2} | Mk2 | 6064 | t | t | 1 | 11 | 4 | 0 | COMMITTED | 6302 | t | [ts] | Completed: 0 tables and 4 sequences effectively processed
6004 | {myGroup1,myGroup2} | Mk2 | 6066 | f | t | 1 | 11 | 4 | 0 | COMMITTED | 6317 | t | [ts] | Completed: 0 tables and 4 sequences effectively processed
6005 | {myGroup1,myGroup2} | Mk1 | 6067 | f | t | 1 | 11 | 4 | 0 | COMMITTED | 6338 | t | [ts] | Completed: 0 tables and 4 sequences effectively processed
6006 | {myGroup1,myGroup2} | Mk1 | 6068 | t | f | 1 | 11 | 4 | 0 | ABORTED | 6353 | t | [ts] | Completed: 0 tables and 4 sequences effectively processed
6007 | {myGroup1,myGroup2} | Mk1 | 6070 | f | f | 1 | 11 | 4 | 0 | ABORTED | 6370 | 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 Expand Up @@ -2153,7 +2155,7 @@ select rlbk_id, rlbk_groups, rlbk_mark, rlbk_time_id, rlbk_is_logged, rlbk_is_al
10024 | {myGroup1} | MC15 | 10084 | t | f | 1 | 5 | 2 | 2 | COMMITTED | 10668 | t | [ts] | Completed: 2 tables and 2 sequences effectively processed
10025 | {myGroup1} | MC16 | 10087 | t | f | 1 | 5 | 2 | 2 | COMMITTED | 10691 | t | [ts] | Completed: 2 tables and 2 sequences effectively processed
10026 | {myGroup1} | Multi-1 | 10089 | f | f | 1 | 5 | 2 | 2 | COMMITTED | 10709 | t | [ts] | Completed: 2 tables and 2 sequences effectively processed
(55 rows)
(57 rows)

select rlbs_rlbk_id, rlbs_session,
case when rlbs_end_datetime is null then 'null' else '[ts]' end as "end_datetime"
Expand Down Expand Up @@ -2674,7 +2676,7 @@ select hist_id, hist_function, hist_event, hist_object, regexp_replace(regexp_re
hist_id | hist_function | hist_event | hist_object | regexp_replace | hist_user
---------+--------------------------+-------------------------+----------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+-----------
10027 | START_GROUP | BEGIN | myGroup1 | With log reset | postgres
10028 | PURGE_HISTORY | | | 27 emaj_hist rows deleted ; 38 alter groups events deleted ; 28 rollback events deleted | postgres
10028 | PURGE_HISTORY | | | 27 emaj_hist rows deleted ; 38 alter groups events deleted ; 30 rollback events deleted | postgres
10029 | LOCK_GROUP | BEGIN | myGroup1 | | postgres
10030 | LOCK_GROUP | END | myGroup1 | 5 tables locked, 0 deadlock(s) | postgres
10031 | SET_MARK_GROUP | BEGIN | myGroup1 | M1 | postgres
Expand Down

0 comments on commit b155541

Please sign in to comment.