Wed Apr 18 08:03:53 PDT 2007
- Previous message: [Slony1-commit] slony1-engine SAMPLE
- Next message: [Slony1-commit] slony1-engine/tests run_test.sh
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Update of /home/cvsd/slony1/slony1-engine/src/slon In directory main.slony.info:/tmp/cvs-serv3274/src/slon Modified Files: misc.h remote_worker.c Log Message: Patch that removes TABLE ADD KEY from CVS HEAD. This supercedes the previous patch: http://lists.slony.info/pipermail/slony1-patches/2007-April/000008.html Per Bill Moran's comments, this also drops out usage of sl_rowid_seq. http://lists.slony.info/pipermail/slony1-general/2007-April/005883.html It passes test1, as revised in the patch (e.g. - to remove usage of TABLE ADD KEY)... ---------------------------------------------------- creating origin DB: cbbrowne -h localhost -U cbbrowne -p 5882 slonyregress1 add plpgsql to Origin loading origin DB with test1/init_schema.sql setting up user cbbrowne to have weak access to data done creating subscriber 2 DB: cbbrowne -h localhost -U cbbrowne -p 5882 slonyregress2 add plpgsql to subscriber loading subscriber 2 DB from slonyregress1 done creating cluster done storing nodes done Granting weak access on Slony-I schema done storing paths done launching originnode : /opt/OXRS/dbs/pgsql82/bin/slon -s500 -g10 -d2 slony_regress1 "dbname=slonyregress1 host=localhost user=cbbrowne port=5882" launching: /opt/OXRS/dbs/pgsql82/bin/slon -s500 -g10 -d2 slony_regress1 "dbname=slonyregress2 host=localhost user=cbbrowne port=5882" subscribing done generating 468 transactions of random data 0 % 5 % 10 % 15 % 20 % 25 % 30 % 35 % 40 % 45 % 50 % 55 % 60 % 65 % 70 % 75 % 80 % 85 % 90 % 95 % 100 % done launching polling script loading data data load complete completed generate_sync_event() test completed make_function_strict() test done slony is caught up getting data from origin DB for diffing done getting data from node 2 for diffing against origin comparing subscriber node 2 is the same as origin node 1 done **** killing slon node 1 **** killing slon node 2 waiting for slons to die done dropping database slonyregress1 slonyregress2 done *************************** test test1 completed successfully *************************** Index: remote_worker.c =================================================================== RCS file: /home/cvsd/slony1/slony1-engine/src/slon/remote_worker.c,v retrieving revision 1.135 retrieving revision 1.136 diff -C2 -d -r1.135 -r1.136 *** remote_worker.c 14 Mar 2007 15:55:06 -0000 1.135 --- remote_worker.c 18 Apr 2007 15:03:51 -0000 1.136 *************** *** 2660,2747 **** node->no_id, tab_fqname); ! /* ! * Find out if the table we're copying has the special slony serial ! * number key on the provider DB ! */ ! slon_mkquery(&query1, ! "select %s.tableHasSerialKey('%q');", ! rtcfg_namespace, tab_fqname); ! res2 = PQexec(pro_dbconn, dstring_data(&query1)); if (PQresultStatus(res2) != PGRES_TUPLES_OK) { ! slon_log(SLON_ERROR, "remoteWorkerThread_%d: \"%s\" %s", ! node->no_id, dstring_data(&query1), ! PQresultErrorMessage(res2)); PQclear(res2); PQclear(res1); slon_disconnectdb(pro_conn); dstring_free(&query1); - dstring_free(&query2); dstring_free(&query3); - dstring_free(&lsquery); - dstring_free(&indexregenquery); archive_terminate(node); return -1; } - rc = *PQgetvalue(res2, 0, 0) == 't'; PQclear(res2); - - if (rc) - { - /* - * It has, check if the table has this on the local DB too. - */ - slon_log(SLON_DEBUG3, "remoteWorkerThread_%d: " - "table %s will require Slony-I serial key\n", - node->no_id, tab_fqname); - res2 = PQexec(loc_dbconn, dstring_data(&query1)); - if (PQresultStatus(res2) != PGRES_TUPLES_OK) - { - slon_log(SLON_ERROR, "remoteWorkerThread_%d: \"%s\" %s", - node->no_id, dstring_data(&query1), - PQresultErrorMessage(res2)); - PQclear(res2); - PQclear(res1); - slon_disconnectdb(pro_conn); - dstring_free(&query1); - dstring_free(&query2); - dstring_free(&query3); - dstring_free(&lsquery); - dstring_free(&indexregenquery); - archive_terminate(node); - return -1; - } - rc = *PQgetvalue(res2, 0, 0) == 't'; - PQclear(res2); - - if (!rc) - { - slon_log(SLON_DEBUG3, "remoteWorkerThread_%d: " - "table %s Slony-I serial key to be added local\n", - node->no_id, tab_fqname); - } - } - else - { - slon_log(SLON_DEBUG3, "remoteWorkerThread_%d: " - "table %s does not require Slony-I serial key\n", - node->no_id, tab_fqname); - slon_mkquery(&query3, "select * from %s limit 0;", - tab_fqname); - res2 = PQexec(loc_dbconn, dstring_data(&query3)); - if (PQresultStatus(res2) != PGRES_TUPLES_OK) - { - slon_log(SLON_ERROR, "remoteWorkerThread_%d: Could not find table %s " - "on subscriber\n", node->no_id, tab_fqname); - PQclear(res2); - PQclear(res1); - slon_disconnectdb(pro_conn); - dstring_free(&query1); - dstring_free(&query3); - archive_terminate(node); - return -1; - } - PQclear(res2); - } /* Request an exclusive lock on each table --- 2660,2679 ---- node->no_id, tab_fqname); ! slon_mkquery(&query3, "select * from %s limit 0;", ! tab_fqname); ! res2 = PQexec(loc_dbconn, dstring_data(&query3)); if (PQresultStatus(res2) != PGRES_TUPLES_OK) { ! slon_log(SLON_ERROR, "remoteWorkerThread_%d: Could not find table %s " ! "on subscriber\n", node->no_id, tab_fqname); PQclear(res2); PQclear(res1); slon_disconnectdb(pro_conn); dstring_free(&query1); dstring_free(&query3); archive_terminate(node); return -1; } PQclear(res2); /* Request an exclusive lock on each table *************** *** 2891,2990 **** /* - * Find out if the table we're copying has the special slony serial - * number key on the provider DB - */ - slon_mkquery(&query1, - "select %s.tableHasSerialKey('%q');", - rtcfg_namespace, tab_fqname); - res2 = PQexec(pro_dbconn, dstring_data(&query1)); - if (PQresultStatus(res2) != PGRES_TUPLES_OK) - { - slon_log(SLON_ERROR, "remoteWorkerThread_%d: \"%s\" %s", - node->no_id, dstring_data(&query1), - PQresultErrorMessage(res2)); - PQclear(res2); - PQclear(res1); - slon_disconnectdb(pro_conn); - dstring_free(&query1); - dstring_free(&query2); - dstring_free(&query3); - dstring_free(&lsquery); - dstring_free(&indexregenquery); - archive_terminate(node); - return -1; - } - rc = *PQgetvalue(res2, 0, 0) == 't'; - PQclear(res2); - - if (rc) - { - /* - * It has, check if the table has this on the local DB too. - */ - slon_log(SLON_DEBUG3, "remoteWorkerThread_%d: " - "table %s requires Slony-I serial key\n", - node->no_id, tab_fqname); - res2 = PQexec(loc_dbconn, dstring_data(&query1)); - if (PQresultStatus(res2) != PGRES_TUPLES_OK) - { - slon_log(SLON_ERROR, "remoteWorkerThread_%d: \"%s\" %s", - node->no_id, dstring_data(&query1), - PQresultErrorMessage(res2)); - PQclear(res2); - PQclear(res1); - slon_disconnectdb(pro_conn); - dstring_free(&query1); - dstring_free(&query2); - dstring_free(&query3); - dstring_free(&lsquery); - dstring_free(&indexregenquery); - archive_terminate(node); - return -1; - } - rc = *PQgetvalue(res2, 0, 0) == 't'; - PQclear(res2); - - if (!rc) - { - /* - * Nope, so we gotta add the key here. - */ - slon_mkquery(&query1, - "select %s.tableAddKey('%q'); " - "select %s.determineAttkindSerial('%q'); ", - rtcfg_namespace, tab_fqname, - rtcfg_namespace, tab_fqname); - if (query_execute(node, loc_dbconn, &query1) < 0) - { - PQclear(res1); - slon_disconnectdb(pro_conn); - dstring_free(&query1); - dstring_free(&query2); - dstring_free(&query3); - dstring_free(&lsquery); - dstring_free(&indexregenquery); - archive_terminate(node); - return -1; - } - slon_log(SLON_DEBUG3, "remoteWorkerThread_%d: " - "table %s Slony-I serial key added local\n", - node->no_id, tab_fqname); - } - else - { - slon_log(SLON_DEBUG3, "remoteWorkerThread_%d: " - "local table %s already has Slony-I serial key\n", - node->no_id, tab_fqname); - } - } - else - { - slon_log(SLON_DEBUG3, "remoteWorkerThread_%d: " - "table %s does not require Slony-I serial key\n", - node->no_id, tab_fqname); - } - - - /* * Call the setAddTable_int() stored procedure. Up to now, while we * have not been subscribed to the set, this should have been --- 2823,2826 ---- *************** *** 4803,4851 **** /* - * Get the nodes rowid sequence at that sync time just in case we are - * later on asked to restore the node after a failover. - */ - slon_mkquery(&query, - "select seql_last_value from %s.sl_seqlog " - " where seql_seqid = 0 " - " and seql_origin = %d " - " and seql_ev_seqno = '%s'; ", - rtcfg_namespace, node->no_id, - seqbuf); - res1 = PQexec(wd->provider_head->conn->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); - dstring_free(&query); - dstring_free(&lsquery); - archive_terminate(node); - return 60; - } - if (PQntuples(res1) > 0) - { - slon_mkquery(&query, - "insert into %s.sl_seqlog " - " (seql_seqid, seql_origin, seql_ev_seqno, seql_last_value) " - " values (0, %d, '%s', '%s'); ", - rtcfg_namespace, node->no_id, - seqbuf, PQgetvalue(res1, 0, 0)); - if (query_execute(node, local_dbconn, &query) < 0) - { - PQclear(res1); - dstring_free(&query); - dstring_free(&lsquery); - archive_terminate(node); - return 60; - } - slon_log(SLON_DEBUG2, "remoteWorkerThread_%d: " - "new sl_rowid_seq value: %s\n", - node->no_id, PQgetvalue(res1, 0, 0)); - } - PQclear(res1); - - /* * Add the final commit to the archive log, close it and rename the * temporary file to the real log chunk filename. --- 4639,4642 ---- Index: misc.h =================================================================== RCS file: /home/cvsd/slony1/slony1-engine/src/slon/misc.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** misc.h 27 Oct 2006 20:10:57 -0000 1.8 --- misc.h 18 Apr 2007 15:03:51 -0000 1.9 *************** *** 35,38 **** --- 35,45 ---- #endif + /* Adjustment windows */ + #ifdef WIN32 + #define sleep(x) Sleep(x*1000) + #define strtoll(x,y,z) (__int64) strtol(x,y,z) + #define strncasecmp(x,y,z) strnicmp(x,y,z) + #endif + /* * Local Variables:
- Previous message: [Slony1-commit] slony1-engine SAMPLE
- Next message: [Slony1-commit] slony1-engine/tests run_test.sh
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Slony1-commit mailing list