Fri Oct 22 15:46:11 PDT 2004
- Previous message: [Slony1-commit] By wieck: Bumped version number to 1.0.4.
- Next message: [Slony1-commit] By wieck: Bumped Slony version to 1.0.5.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Log Message:
-----------
Prevent mergeSet(), setMoveTable() and setMoveSequence()
to work while pending subscriptions exist. This prevents
breaking of replication as reported per bug #896.
Jan
Tags:
----
REL_1_0_STABLE
Modified Files:
--------------
slony1-engine/src/backend:
slony1_funcs.sql (r1.15.2.8 -> r1.15.2.9)
slony1-engine/src/slonik:
slonik.c (r1.27.2.5 -> r1.27.2.6)
-------------- next part --------------
Index: slony1_funcs.sql
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/backend/slony1_funcs.sql,v
retrieving revision 1.15.2.8
retrieving revision 1.15.2.9
diff -Lsrc/backend/slony1_funcs.sql -Lsrc/backend/slony1_funcs.sql -u -w -r1.15.2.8 -r1.15.2.9
--- src/backend/slony1_funcs.sql
+++ src/backend/slony1_funcs.sql
@@ -1947,6 +1947,42 @@
end if;
-- ----
+ -- Also check that there are no unconfirmed enable subscriptions
+ -- still lingering (prevents bug 896)
+ -- ----
+ if exists (select true from @NAMESPACE at .sl_event
+ where ev_origin = v_origin
+ and ev_type = ''ENABLE_SUBSCRIPTION''
+ and ev_data1 = p_set_id
+ and ev_seqno > (select min(max_con_seqno) from
+ (select con_received, max(con_seqno) as max_con_seqno
+ from @NAMESPACE at .sl_confirm
+ where con_origin = v_origin
+ group by con_received) as CON
+ )
+ )
+ then
+ raise exception ''Slony-I: set % cannot be merged because of pending subscription'',
+ p_set_id;
+ end if;
+
+ if exists (select true from @NAMESPACE at .sl_event
+ where ev_origin = v_origin
+ and ev_type = ''ENABLE_SUBSCRIPTION''
+ and ev_data1 = p_add_id
+ and ev_seqno > (select min(max_con_seqno) from
+ (select con_received, max(con_seqno) as max_con_seqno
+ from @NAMESPACE at .sl_confirm
+ where con_origin = v_origin
+ group by con_received) as CON
+ )
+ )
+ then
+ raise exception ''Slony-I: set % cannot be merged because of pending subscription'',
+ p_add_id;
+ end if;
+
+ -- ----
-- Create a SYNC event, merge the sets, create a MERGE_SET event
-- ----
perform @NAMESPACE at .createEvent(''_ at CLUSTERNAME@'', ''SYNC'', NULL);
@@ -2606,6 +2642,40 @@
end if;
-- ----
+ -- Also check that there are no unconfirmed enable subscriptions
+ -- still lingering (prevents bug 896)
+ -- ----
+ if exists (select true from @NAMESPACE at .sl_event
+ where ev_origin = v_origin
+ and ev_type = ''ENABLE_SUBSCRIPTION''
+ and ev_data1 = v_old_set_id
+ and ev_seqno > (select min(max_con_seqno) from
+ (select con_received, max(con_seqno) as max_con_seqno
+ from @NAMESPACE at .sl_confirm
+ where con_origin = v_origin
+ group by con_received) as CON
+ )
+ )
+ then
+ raise exception ''Slony-I: table cannot be moved because of pending subscription'';
+ end if;
+
+ if exists (select true from @NAMESPACE at .sl_event
+ where ev_origin = v_origin
+ and ev_type = ''ENABLE_SUBSCRIPTION''
+ and ev_data1 = p_new_set_id
+ and ev_seqno > (select min(max_con_seqno) from
+ (select con_received, max(con_seqno) as max_con_seqno
+ from @NAMESPACE at .sl_confirm
+ where con_origin = v_origin
+ group by con_received) as CON
+ )
+ )
+ then
+ raise exception ''Slony-I: table cannot be moved because of pending subscription'';
+ end if;
+
+ -- ----
-- Change the set the table belongs to
-- ----
perform @NAMESPACE at .createEvent(''_ at CLUSTERNAME@'', ''SYNC'', NULL);
@@ -2723,6 +2793,40 @@
end if;
-- ----
+ -- Also check that there are no unconfirmed enable subscriptions
+ -- still lingering (prevents bug 896)
+ -- ----
+ if exists (select true from @NAMESPACE at .sl_event
+ where ev_origin = v_origin
+ and ev_type = ''ENABLE_SUBSCRIPTION''
+ and ev_data1 = v_old_set_id
+ and ev_seqno > (select min(max_con_seqno) from
+ (select con_received, max(con_seqno) as max_con_seqno
+ from @NAMESPACE at .sl_confirm
+ where con_origin = v_origin
+ group by con_received) as CON
+ )
+ )
+ then
+ raise exception ''Slony-I: sequence cannot be moved because of pending subscription'';
+ end if;
+
+ if exists (select true from @NAMESPACE at .sl_event
+ where ev_origin = v_origin
+ and ev_type = ''ENABLE_SUBSCRIPTION''
+ and ev_data1 = p_new_set_id
+ and ev_seqno > (select min(max_con_seqno) from
+ (select con_received, max(con_seqno) as max_con_seqno
+ from @NAMESPACE at .sl_confirm
+ where con_origin = v_origin
+ group by con_received) as CON
+ )
+ )
+ then
+ raise exception ''Slony-I: sequence cannot be moved because of pending subscription'';
+ end if;
+
+ -- ----
-- Change the set the sequence belongs to
-- ----
perform @NAMESPACE at .setMoveSequence_int(p_seq_id, p_new_set_id);
Index: slonik.c
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/slonik/slonik.c,v
retrieving revision 1.27.2.5
retrieving revision 1.27.2.6
diff -Lsrc/slonik/slonik.c -Lsrc/slonik/slonik.c -u -w -r1.27.2.5 -r1.27.2.6
--- src/slonik/slonik.c
+++ src/slonik/slonik.c
@@ -1861,6 +1861,22 @@
}
break;
+ case 8:
+ switch (adminfo->version_minor)
+ {
+ case 0:
+ use_major = 7;
+ use_minor = 4;
+ break;
+
+ default:
+ printf("%s:%d: unsupported PostgreSQL "
+ "version %d.%d\n",
+ stmt->stmt_filename, stmt->stmt_lno,
+ adminfo->version_major, adminfo->version_minor);
+ }
+ break;
+
default:
printf("%s:%d: unsupported PostgreSQL "
"version %d.%d\n",
- Previous message: [Slony1-commit] By wieck: Bumped version number to 1.0.4.
- Next message: [Slony1-commit] By wieck: Bumped Slony version to 1.0.5.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Slony1-commit mailing list