#At file:///home/tomas/mysql_src/mysql-5.1-telco-6.3/
2709 Tomas Ulin 2008-10-09 [merge]
merge
modified:
sql/ha_ndbcluster_binlog.cc
sql/ha_ndbcluster_lock_ext.h
=== modified file 'sql/ha_ndbcluster_binlog.cc'
--- a/sql/ha_ndbcluster_binlog.cc 2008-10-09 09:13:22 +0000
+++ b/sql/ha_ndbcluster_binlog.cc 2008-10-09 09:15:32 +0000
@@ -27,6 +27,7 @@
#include <ndbapi/NdbDictionary.hpp>
#include <ndbapi/ndb_cluster_connection.hpp>
#include <util/NdbAutoPtr.hpp>
+#include <portlib/NdbTick.h>
#ifdef ndb_dynamite
#undef assert
@@ -1241,7 +1242,7 @@ static int ndbcluster_find_all_databases
/* create missing database */
sql_print_information("NDB: Discovered missing database '%s'", db);
const int no_print_error[1]= {0};
- name_len= snprintf(name, sizeof(name), "CREATE DATABASE %s", db);
+ name_len= my_snprintf(name, sizeof(name), "CREATE DATABASE %s", db);
run_query(thd, name, name + name_len,
no_print_error, /* print error */
TRUE); /* don't binlog the query */
@@ -2268,10 +2269,12 @@ ndb_binlog_thread_handle_schema_event(TH
// fall through
case SOT_RENAME_TABLE_NEW:
{
- uint end= snprintf(&errmsg[0], MYSQL_ERRMSG_SIZE,
- "NDB Binlog: Skipping renaming locally defined table '%s.%s' from binlog schema event '%s' from node %d. ",
- schema->db, schema->name, schema->query,
- schema->node_id);
+ uint end= my_snprintf(&errmsg[0], MYSQL_ERRMSG_SIZE,
+ "NDB Binlog: Skipping renaming locally "
+ "defined table '%s.%s' from binlog schema "
+ "event '%s' from node %d. ",
+ schema->db, schema->name, schema->query,
+ schema->node_id);
errmsg[end]= '\0';
}
@@ -2279,10 +2282,12 @@ ndb_binlog_thread_handle_schema_event(TH
case SOT_DROP_TABLE:
if (schema_type == SOT_DROP_TABLE)
{
- uint end= snprintf(&errmsg[0], MYSQL_ERRMSG_SIZE,
- "NDB Binlog: Skipping dropping locally defined table '%s.%s' from binlog schema event '%s' from node %d. ",
- schema->db, schema->name, schema->query,
- schema->node_id);
+ uint end= my_snprintf(&errmsg[0], MYSQL_ERRMSG_SIZE,
+ "NDB Binlog: Skipping dropping locally "
+ "defined table '%s.%s' from binlog schema "
+ "event '%s' from node %d. ",
+ schema->db, schema->name, schema->query,
+ schema->node_id);
errmsg[end]= '\0';
}
if (! ndbcluster_check_if_local_table(schema->db, schema->name))
@@ -6150,17 +6155,17 @@ ndbcluster_show_status_binlog(THD* thd,
pthread_mutex_unlock(&injector_mutex);
buflen=
- snprintf(buf, sizeof(buf),
- "latest_epoch=%s, "
- "latest_trans_epoch=%s, "
- "latest_received_binlog_epoch=%s, "
- "latest_handled_binlog_epoch=%s, "
- "latest_applied_binlog_epoch=%s",
- llstr(ndb_latest_epoch, buff1),
- llstr(ndb_get_latest_trans_gci(), buff2),
- llstr(ndb_latest_received_binlog_epoch, buff3),
- llstr(ndb_latest_handled_binlog_epoch, buff4),
- llstr(ndb_latest_applied_binlog_epoch, buff5));
+ my_snprintf(buf, sizeof(buf),
+ "latest_epoch=%s, "
+ "latest_trans_epoch=%s, "
+ "latest_received_binlog_epoch=%s, "
+ "latest_handled_binlog_epoch=%s, "
+ "latest_applied_binlog_epoch=%s",
+ llstr(ndb_latest_epoch, buff1),
+ llstr(ndb_get_latest_trans_gci(), buff2),
+ llstr(ndb_latest_received_binlog_epoch, buff3),
+ llstr(ndb_latest_handled_binlog_epoch, buff4),
+ llstr(ndb_latest_applied_binlog_epoch, buff5));
if (stat_print(thd, ndbcluster_hton_name, ndbcluster_hton_name_length,
"binlog", strlen("binlog"),
buf, buflen))
=== modified file 'sql/ha_ndbcluster_lock_ext.h'
--- a/sql/ha_ndbcluster_lock_ext.h 2008-10-07 08:20:50 +0000
+++ b/sql/ha_ndbcluster_lock_ext.h 2008-10-09 09:10:50 +0000
@@ -36,12 +36,12 @@ ndbcluster_global_schema_lock_ext(THD *t
NdbOperation *op;
NdbTransaction *trans= NULL;
int retry_sleep= 50; /* 50 milliseconds, transaction */
- struct timeval time_end;
+ NDB_TICKS time_end;
if (retry_time > 0)
{
- gettimeofday(&time_end, 0);
- time_end.tv_sec+= retry_time;
+ time_end= NdbTick_CurrentMillisecond();
+ time_end+= retry_time * 1000;
}
while (1)
{
@@ -77,14 +77,9 @@ ndbcluster_global_schema_lock_ext(THD *t
retry:
if (retry_time == 0)
goto error_handler;
- if (retry_time > 0)
- {
- struct timeval time_now;
- gettimeofday(&time_now, 0);
- if ((time_end.tv_sec < time_now.tv_sec) ||
- (time_end.tv_sec == time_now.tv_sec && time_end.tv_usec < time_now.tv_usec))
- goto error_handler;
- }
+ if (retry_time > 0 &&
+ time_end < NdbTick_CurrentMillisecond())
+ goto error_handler;
if (trans)
{
ndb->closeTransaction(trans);
| Thread |
|---|
| • bzr commit into mysql-5.1 branch (tomas.ulin:2709) | Tomas Ulin | 9 Oct |