Hola lista Continué con la evaluación del BDR para mi caso y realice unas pruebas adicionales que aquí se las presento.
Respecto al tema de la secuencias, pues la mas fácil que se me ocurrió por el momento fue crear secuencias locales y establecer un servidor con secuencias pares y el otro impares... :-) obvio esto solo para el esquema de dos maestros multimaster. Eso es posible ya que si bien es cierto la definición de la secuencias se comparte en ambos servidores, el valor actual si queda en el ámbito de cada servidor: bdrdemo=# create secuence seq_bdr_prueba start with 1 INCREMENT BY 2; --- servidor puerto 3333 bdrdemo=# select setval('seq_bdr_prueba',1); --- servidor puerto4444 bdrdemo=# select setval('seq_bdr_prueba',2); --- servidor puerto 3333 bdrdemo=# select nextval('seq_bdr_prueba'); nextval --------- 1 (1 row) bdrdemo=# select nextval('seq_bdr_prueba'); nextval --------- 3 (1 row) bdrdemo=# select nextval('seq_bdr_prueba'); nextval --------- 5 (1 row) --- servidor puerto 4444 bdrdemo=# select nextval('seq_bdr_prueba'); nextval --------- 2 (1 row) bdrdemo=# select nextval('seq_bdr_prueba'); nextval --------- 4 (1 row) bdrdemo=# select nextval('seq_bdr_prueba'); nextval --------- 6 (1 row) ----------------------------------------------------- --- servidor puerto 3333 bdrdemo=# create table tbpruebas(id bigint default nextval('seq_bdr_prueba') primary key, numero bigint, origen text); CREATE TABLE --- servidor puerto 3333 bdrdemo=# insert into tbpruebas(numero,origen) select a.dato,'3333' from generate_series(1,30000000) as a(dato); INSERT 0 30000000 bdrdemo=# select count(*) from tbpruebas; count ---------- 30000000 (1 row) --- casi simultáneamente en el servidor puerto 4444 bdrdemo=# insert into tbpruebas(numero,origen) select a.dato,'4444' from generate_series(1,30000000) as a(dato); INSERT 0 30000000 bdrdemo=# select count(*) from tbpruebas; count ---------- 30000000 (1 row) --- y despues de un tiempo... --- servidor puerto 3333 bdrdemo=# select count(*) from tbpruebas; count ---------- 60000000 (1 row) bdrdemo=# select * from tbpruebas order by id desc limit 10; id | numero | origen ----------+----------+-------- 60000010 | 30000000 | 4444 60000008 | 29999999 | 4444 60000007 | 30000000 | 3333 60000006 | 29999998 | 4444 60000005 | 29999999 | 3333 60000004 | 29999997 | 4444 60000003 | 29999998 | 3333 60000002 | 29999996 | 4444 60000001 | 29999997 | 3333 60000000 | 29999995 | 4444 (10 rows) Parte 2: Realice una prueba, reconstruyendo un backup de la base de datos y obtuve las siguientes observaciones: 1. las tablas cuyos campos tiene estadísticas personalizadas fallan y no se crean: definición de la tabla: CREATE TABLE llamadas ( calldate timestamp with time zone NOT NULL DEFAULT now(), clid character varying(80) NOT NULL DEFAULT ''::character varying, src character varying(80) NOT NULL DEFAULT ''::character varying, dst character varying(80) NOT NULL DEFAULT ''::character varying, dcontext character varying(80) NOT NULL DEFAULT ''::character varying, ..... CONSTRAINT cdr_agentes_pkey PRIMARY KEY (id) ) WITH ( OIDS=FALSE ); ALTER TABLE llamadas ALTER COLUMN calldate SET STATISTICS 500; ALTER TABLE llamadas ALTER COLUMN dcontext SET STATISTICS 500; Error generado: pg_restore: processing item 1014 TABLE llamadas pg_restore: creating TABLE llamadas pg_restore: [archiver (db)] Error from TOC entry 1014; 1259 116741355 TABLE llamadas pg_restore: [archiver (db)] could not execute query: ERROR: ALTER TABLE ... ALTER COLUMN SET STATISTICS|(...) may only affect UNLOGGED or TEMPORARY tables when BDR is active; llamadas is a regular table Command was: CREATE TABLE llamadas ( calldate timestamp with time zone DEFAULT now() NOT NULL, clid character varying(80) DEFA... pg_restore: [archiver (db)] could not execute query: ERROR: relation "llamadas" does not exist Command was: ALTER TABLE llamadas OWNER TO user; 2. no soporta vistas materializadas: pg_restore: processing item 5618 MATERIALIZED VIEW mv_calificacion pg_restore: creating MATERIALIZED VIEW mv_calificacion pg_restore: [archiver (db)] Error from TOC entry 5618; 1259 273374704 MATERIALIZED VIEW mv_calificacion postgres pg_restore: [archiver (db)] could not execute query: ERROR: CREATE MATERIALIZED VIEW is not supported when bdr is active Command was: CREATE MATERIALIZED VIEW mv_calificacion AS SELECT x.id, split_part(x.path, '@'::text, 1) AS calificacion, CASE... pg_restore: [archiver (db)] could not execute query: ERROR: relation "mv_calificacion" does not exist Command was: ALTER TABLE mv_calificacion OWNER TO postgres; 3. falla en la creación de indices y constraints cuanto se configura el pg_restore con varios jobs concurrentes': pg_restore: creating INDEX idx_tmp_busqueda_identificacion pg_restore: [archiver (db)] Error from TOC entry 20671; 1259 271924294 INDEX idx_tmp_busqueda_identificacion postgres pg_restore: [archiver (db)] could not execute query: ERROR: database is locked against ddl by another node HINT: Node (6096143136483713623,1,17756) in the cluster is already performing DDL Command was: CREATE INDEX idx_tmp_busqueda_identificacion ON tmp_busqueda USING btree (numerodocumento, tipodocumento); pg_restore: finished item 20671 INDEX idx_tmp_busqueda_identificacion pg_restore: launching item 20672 INDEX idx_tmp_cruce_uniqueid pg_restore: creating INDEX idx_tmp_cruce_uniqueid pg_restore: [archiver (db)] Error from TOC entry 20672; 1259 271957407 INDEX idx_tmp_cruce_uniqueid postgres pg_restore: [archiver (db)] could not execute query: ERROR: database is locked against ddl by another node HINT: Node (6096143136483713623,1,17756) in the cluster is already performing DDL Command was: CREATE INDEX idx_tmp_cruce_uniqueid ON tmp_cruce USING btree (uniqueid); pg_restore: finished item 20672 INDEX idx_tmp_cruce_uniqueid pg_restore: launching item 21534 MATERIALIZED VIEW DATA mv_tipificacion pg_restore: creating MATERIALIZED VIEW DATA mv_tipificacion pg_restore: [archiver (db)] Error from TOC entry 21534; 0 273374704 MATERIALIZED VIEW DATA mv_tipificacion postgres pg_restore: [archiver (db)] could not execute query: ERROR: is not supported when bdr is active Command was: REFRESH MATERIALIZED VIEW mv_tipificacion; pg_restore: finished item 21534 MATERIALIZED VIEW DATA mv_tipificacion pg_restore: launching item 20183 CONSTRAINT actividadbase_pkey pg_restore: creating CONSTRAINT actividadbase_pkey pg_restore: [archiver (db)] Error from TOC entry 20183; 2606 19741 CONSTRAINT actividadbase_pkey milledesarrollo pg_restore: [archiver (db)] could not execute query: ERROR: database is locked against ddl by another node HINT: Node (6096143136483713623,1,17756) in the cluster is already performing DDL Command was: ALTER TABLE ONLY actividadbase ADD CONSTRAINT actividadbase_pkey PRIMARY KEY (id); .... Y de ahí en adelante no creo ningún indice ni constraint, solo vuelve a funcionar cuando termina el ciclo paralelo; .... pg_restore: finished item 20681 INDEX idx_mv_tipificacion_id pg_restore: finished main parallel loop El feb 3, 2015 7:50 PM, "Gerardo Herzig" <gher...@fmed.uba.ar> escribió: > > > ----- Mensaje original ----- > > De: "Jaime Casanova" <ja...@2ndquadrant.com> > > Para: "Gerardo Herzig" <gher...@fmed.uba.ar> > > CC: "Hellmuth Vargas" <hiv...@gmail.com>, "Lista Postgres ES" < > pgsql-es-ayuda@postgresql.org> > > Enviados: Martes, 3 de Febrero 2015 1:24:08 > > Asunto: Re: [pgsql-es-ayuda] Fwd: consulta sobre sequencias globales de > BDR > > > > 2015-01-30 18:56 GMT-05:00 Gerardo Herzig <gher...@fmed.uba.ar>: > > > Probaste con postgres-xc? Es un postgres modificado para usarse en > > > entornos distribuidos, con soluciones nativas de replicacion y > > > balanceo. Tal vez pueda ser util aqui. > > > > > > > Como maneja postgres-xc el problema de las secuencias? no encontré > > nada concreto pero me imagino que asigna los valores a través del GTM > > (el cual no es solo un punto central de fallas sino también un > > posible > > cuello de botella). > > > > Exacto Jaime. Y ciertamente, en situaciones de alta carga es candidato a > convertirse en cuello de botella. Lo que se recomienda en esos casos es > usar un "gtm proxy" para alivianar la carga del gtm. > > http://postgres-xc.sourceforge.net/docs/1_1/app-gtm-proxy.html > > Saludos, > Gerardo >