From: Date: October 9 2008 11:11am Subject: bzr push into mysql-5.1 branch (tomas.ulin:2691) List-Archive: http://lists.mysql.com/commits/55887 Message-Id: <20081009091154.CA78C5D837B@linux.local> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 2691 Tomas Ulin 2008-10-09 [merge] merge modified: storage/ndb/test/run-test/setup.cpp === modified file 'sql/ha_ndbcluster_binlog.cc' --- a/sql/ha_ndbcluster_binlog.cc 2008-10-07 08:19:31 +0000 +++ b/sql/ha_ndbcluster_binlog.cc 2008-10-09 09:10:50 +0000 @@ -28,6 +28,7 @@ #include #include #include +#include #ifdef ndb_dynamite #undef assert @@ -1238,7 +1239,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 */ @@ -2263,10 +2264,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'; } @@ -2274,10 +2277,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)) @@ -5493,17 +5498,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);