Mon May 16 18:08:06 PDT 2005
- Previous message: [Slony1-commit] By cbbrowne: Fix typo in -h help output - vacuum was misspelled
- Next message: [Slony1-commit] By cbbrowne: Roll back docs on reversed-out "drop_indices"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Log Message:
-----------
Roll back changes that attempted to drop indices from tables on
would-be new slaves.
Problem: This did not play well AT ALL with the handling of foreign
key constraints.
We'll have to retry this in 1.2, in a better way.
Modified Files:
--------------
slony1-engine/src/slon:
confoptions.h (r1.20 -> r1.21)
remote_worker.c (r1.83 -> r1.84)
-------------- next part --------------
Index: confoptions.h
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/slon/confoptions.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -Lsrc/slon/confoptions.h -Lsrc/slon/confoptions.h -u -w -r1.20 -r1.21
--- src/slon/confoptions.h
+++ src/slon/confoptions.h
@@ -214,24 +214,6 @@
true
},
- {
- {
- (const char *)"drop_indices_for_copy",
- gettext_noop("Indicates that indices should be dropped "
- "on client while invoking COPY_SET event. "
- "This provides a big performance boost as it "
- "is cheaper to regenerate indices after loading "
- "data than it is to incrementally generate "
- "indexes as the load generates. Default is false."
- ),
- NULL,
- SLON_C_BOOL
- },
- &drop_indices,
- true
- },
-
-
NULL
};
Index: remote_worker.c
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/slon/remote_worker.c,v
retrieving revision 1.83
retrieving revision 1.84
diff -Lsrc/slon/remote_worker.c -Lsrc/slon/remote_worker.c -u -w -r1.83 -r1.84
--- src/slon/remote_worker.c
+++ src/slon/remote_worker.c
@@ -2372,10 +2372,9 @@
}
}
- /* cbbrowne - in progress - check tables/sequences in set to
- * make sure they are there and in good order. Don't copy any
- * data yet; we want to just do a first pass that finds "bozo
- * errors" */
+ /* check tables/sequences in set to make sure they are there
+ * and in good order. Don't copy any data yet; we want to
+ * just do a first pass that finds "bozo errors" */
/* Check tables and sequences in set to make sure they are all
* appropriately configured... */
@@ -2732,63 +2731,6 @@
}
PQclear(res2);
- if (drop_indices) {
- /*
- * Drop indices from table on the local database
- */
- slon_mkquery(&query1,
- "select 'alter table %s drop constraint ' || \"pg_catalog\".quote_ident(co.conname), "
- " 'alter table %s add ' || "
- " pg_get_constraintdef(co.oid) "
- "from pg_class c, pg_constraint co, pg_namespace ns "
- "where "
- " '%s' = \"pg_catalog\".quote_ident(ns.nspname) || '.' || \"pg_catalog\".quote_ident(c.relname) and "
- " co.connamespace = ns.oid and "
- " co.contype in ('p', 'u') and "
- " c.oid = co.conrelid and "
- " ns.oid = c.relnamespace "
- "UNION ALL "
- "select 'drop index ' || \"pg_catalog\".quote_ident(ns.nspname) || '.' || \"pg_catalog\".quote_ident(ci.relname) || ';' , "
- " pg_get_indexdef(ci.oid) "
- "from "
- " pg_class c, pg_namespace ns, pg_class ci, pg_index i "
- "where "
- " '%s' = \"pg_catalog\".quote_ident(ns.nspname) || '.' || \"pg_catalog\".quote_ident(c.relname) and "
- " i.indrelid = c.oid and "
- " i.indexrelid = ci.oid and "
- " not exists (select * from pg_constraint co where connamespace = ns.oid and "
- " conrelid = c.oid and contype in ('p', 'u') and co.conname = ci.relname);",
-
- tab_fqname, tab_fqname, tab_fqname, tab_fqname);
- res2 = PQexec(loc_dbconn, dstring_data(&query1));
- ntuples2 = PQntuples(res2);
- slon_log(SLON_DEBUG2, "remoteWorkerThread_%d: Found %d indices for %s - %s\n",
- node->no_id, ntuples2, tab_fqname, dstring_data(&query1));
-
- slon_mkquery(&indexregenquery, " ");
-
- slon_log(SLON_DEBUG2, "remoteWorkerThread_%d: start dropping %d indices\n", node->no_id, ntuples2);
- for (tupno2 = 0; tupno2 < ntuples2; tupno2++)
- {
- slon_mkquery(&query3,
- "%s;",
- PQgetvalue(res2, tupno2, 0));
- if (query_execute(node, loc_dbconn, &query3) < 0)
- {
- slon_log(SLON_FATAL, "remoteWorkerThread_%d: drop index during copy failed: %d\n",
- node->no_id, dstring_data(&query3));
- PQclear(res2);
- slon_abort();
- } else {
- slon_log(SLON_DEBUG2, "remoteWorkerThread_%d: Dropped index %s\n",
- node->no_id, dstring_data(&query3));
- }
-
- slon_appendquery(&indexregenquery,
- "%s;",
- PQgetvalue(res2, tupno2, 1));
- }
- }
/*
* Begin a COPY from stdin for the table on the local DB
@@ -3065,20 +3007,6 @@
INT64_FORMAT " bytes copied for table %s\n",
node->no_id, copysize, tab_fqname);
- if (drop_indices) {
- slon_log(SLON_DEBUG2, "now, regenerate indices...\n");
- slon_log(SLON_DEBUG2,
- "remoteWorkerThread_%d: "
- "regenerate indices: %s",
- node->no_id, dstring_data(&indexregenquery));
- if (query_execute(node, loc_dbconn, &indexregenquery) < 0)
- {
- PQclear(res2);
- slon_disconnectdb(pro_conn);
- dstring_free(&indexregenquery);
- return -1;
- }
- }
/*
* Analyze the table to update statistics
*/
- Previous message: [Slony1-commit] By cbbrowne: Fix typo in -h help output - vacuum was misspelled
- Next message: [Slony1-commit] By cbbrowne: Roll back docs on reversed-out "drop_indices"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Slony1-commit mailing list