Tue Feb 28 13:25:51 PST 2006
- Previous message: [Slony1-commit] By wieck: Let it compile and install under FreeBSD Jan
- Next message: [Slony1-commit] By cbbrowne: Fix tagging of <command>
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Log Message:
-----------
Forwarded log entries for cascading must go into the
currently active log as well so that the logswitch
also works on non-origin data providers.
Jan
Modified Files:
--------------
slony1-engine/src/slon:
remote_worker.c (r1.106 -> r1.107)
-------------- next part --------------
Index: remote_worker.c
===================================================================
RCS file: /usr/local/cvsroot/slony1/slony1-engine/src/slon/remote_worker.c,v
retrieving revision 1.106
retrieving revision 1.107
diff -Lsrc/slon/remote_worker.c -Lsrc/slon/remote_worker.c -u -w -r1.106 -r1.107
--- src/slon/remote_worker.c
+++ src/slon/remote_worker.c
@@ -163,6 +163,8 @@
{
SlonNode *node;
+ int active_log_table;
+
char *tab_forward;
char **tab_fqname;
int tab_fqname_size;
@@ -4001,6 +4003,7 @@
/* TODO: tab_forward array to know if we need to store the log */
PGconn *local_dbconn = local_conn->dbconn;
PGresult *res1;
+ int ntuples1;
int num_sets = 0;
int num_providers_active = 0;
int num_errors;
@@ -4447,6 +4450,40 @@
}
/*
+ * Get the current sl_log_status
+ */
+ slon_mkquery(&query, "select last_value from %s.sl_log_status",
+ rtcfg_namespace);
+ res1 = PQexec(local_dbconn, dstring_data(&query));
+ if (PQresultStatus(res1) != PGRES_TUPLES_OK)
+ {
+ slon_log(SLON_ERROR, "remoteWorkerThread_%d: \"%s\" %s",
+ node->no_id, dstring_data(&query),
+ PQresultErrorMessage(res1));
+ PQclear(res1);
+ TERMINATE_QUERY_AND_ARCHIVE;
+ slon_disconnectdb(provider->conn);
+ provider->conn = NULL;
+ return 20;
+ }
+ ntuples1 = PQntuples(res1);
+ if (ntuples1 != 1)
+ {
+ slon_log(SLON_ERROR, "remoteWorkerThread_%d: cannot determine current log status",
+ node->no_id);
+ PQclear(res1);
+ TERMINATE_QUERY_AND_ARCHIVE;
+ slon_disconnectdb(provider->conn);
+ provider->conn = NULL;
+ return 20;
+ }
+ wd->active_log_table = (strtol(PQgetvalue(res1, 0, 0), NULL, 10) & 0x01) + 1;
+ slon_log(SLON_DEBUG2, "remoteWorkerThread_%d: "
+ "current local log_status is %d\n",
+ node->no_id, strtol(PQgetvalue(res1, 0, 0), NULL, 10));
+ PQclear(res1);
+
+ /*
* Time to get the helpers busy.
*/
wd->workgroup_status = SLON_WG_BUSY;
@@ -4977,8 +5014,8 @@
log_status = strtol(PQgetvalue(res3, 0, 0), NULL, 10);
PQclear(res3);
slon_log(SLON_DEBUG2,
- "remoteWorkerThread_%d: current log_status = %d\n",
- node->no_id, log_status);
+ "remoteWorkerThread_%d_%d: current remote log_status = %d\n",
+ node->no_id, provider->no_id, log_status);
/*
* Open a cursor that reads the log data.
@@ -5314,12 +5351,12 @@
if (wd->tab_forward[log_tableid])
{
slon_appendquery(&(line->log),
- "insert into %s.sl_log_1 "
+ "insert into %s.sl_log_%d "
" (log_origin, log_xid, log_tableid, "
" log_actionseq, log_cmdtype, "
" log_cmddata) values "
" ('%s', '%s', '%d', '%s', '%q', '%q');\n",
- rtcfg_namespace,
+ rtcfg_namespace, wd->active_log_table,
log_origin, log_xid, log_tableid,
log_actionseq, log_cmdtype, log_cmddata);
largemem *= 2;
- Previous message: [Slony1-commit] By wieck: Let it compile and install under FreeBSD Jan
- Next message: [Slony1-commit] By cbbrowne: Fix tagging of <command>
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Slony1-commit mailing list