3663 Magnus Blåudd 2011-10-29
ndb schema dist
- remove ue of old "Cluster_schema" and use Ndb_schema_op everywhere
modified:
sql/ha_ndbcluster_binlog.cc
3662 Magnus Blåudd 2011-10-29
ndb schema dist
- rename 'ndbcluser_update_slock' to 'ack_schema_op', make it a member function(remove static)
- make the function use member variables like m_thd and own_nodeid()
- also make 'handle_schema_unlock_post_epoch' member function
modified:
sql/ha_ndbcluster_binlog.cc
3661 Magnus Blåudd 2011-10-29
ndb schema dist
- change 'Ndb_schema_event_handler::ndbcluster_update_slock' to print warning to log
instead of pushing it to thd, since this is a daemon thread no one would see those warnings.
modified:
sql/ha_ndbcluster_binlog.cc
=== modified file 'sql/ha_ndbcluster_binlog.cc'
--- a/sql/ha_ndbcluster_binlog.cc 2011-10-29 09:30:27 +0000
+++ b/sql/ha_ndbcluster_binlog.cc 2011-10-29 14:01:48 +0000
@@ -2305,12 +2305,10 @@ class Ndb_schema_event_handler {
DBUG_RETURN(schema_op);
}
};
- typedef Ndb_schema_op Cluster_schema; // Old name
-
static void
print_could_not_discover_error(THD *thd,
- const Cluster_schema *schema)
+ const Ndb_schema_op *schema)
{
sql_print_error("NDB Binlog: Could not discover table '%s.%s' from "
"binlog schema event '%s' from node %d. "
@@ -2322,7 +2320,7 @@ class Ndb_schema_event_handler {
static void
- write_schema_op_to_binlog(THD *thd, Cluster_schema *schema)
+ write_schema_op_to_binlog(THD *thd, Ndb_schema_op *schema)
{
if (!ndb_binlog_running)
@@ -2394,24 +2392,23 @@ class Ndb_schema_event_handler {
/*
- acknowledge handling of schema operation
+ Acknowledge handling of schema operation
+ - Inform the other nodes that schema op has
+ been completed by this node (by updating the
+ row for this op in ndb_schema table)
*/
- static int
- ndbcluster_update_slock(THD *thd,
- const char *db,
- const char *table_name,
- uint32 table_id,
- uint32 table_version)
+ int
+ ack_schema_op(const char *db, const char *table_name,
+ uint32 table_id, uint32 table_version)
{
- DBUG_ENTER("ndbcluster_update_slock");
+ DBUG_ENTER("ack_schema_op");
if (!ndb_schema_share)
{
DBUG_RETURN(0);
}
const NdbError *ndb_error= 0;
- uint32 node_id= g_ndb_cluster_connection->node_id();
- Ndb *ndb= check_ndb_in_thd(thd);
+ Ndb *ndb= check_ndb_in_thd(m_thd);
char save_db[FN_HEADLEN];
strcpy(save_db, ndb->getDatabaseName());
@@ -2484,7 +2481,7 @@ class Ndb_schema_event_handler {
{
uint32 copy[SCHEMA_SLOCK_SIZE/4];
memcpy(copy, bitbuf, sizeof(copy));
- bitmap_clear_bit(&slock, node_id);
+ bitmap_clear_bit(&slock, own_nodeid());
sql_print_information("NDB: reply to %s.%s(%u/%u) from %x%x to %x%x",
db, table_name,
table_id, table_version,
@@ -2494,7 +2491,7 @@ class Ndb_schema_event_handler {
}
else
{
- bitmap_clear_bit(&slock, node_id);
+ bitmap_clear_bit(&slock, own_nodeid());
}
{
@@ -2520,7 +2517,7 @@ class Ndb_schema_event_handler {
r|= op->setValue(SCHEMA_SLOCK_I, (char*)slock.bitmap);
DBUG_ASSERT(r == 0);
/* node_id */
- r|= op->setValue(SCHEMA_NODE_ID_I, node_id);
+ r|= op->setValue(SCHEMA_NODE_ID_I, own_nodeid());
DBUG_ASSERT(r == 0);
/* type */
r|= op->setValue(SCHEMA_TYPE_I, (uint32)SOT_CLEAR_SLOCK);
@@ -2530,14 +2527,15 @@ class Ndb_schema_event_handler {
NdbOperation::DefaultAbortOption, 1 /*force send*/) == 0)
{
DBUG_PRINT("info", ("node %d cleared lock on '%s.%s'",
- node_id, db, table_name));
+ own_nodeid(), db, table_name));
dict->forceGCPWait(1);
break;
}
err:
const NdbError *this_error= trans ?
&trans->getNdbError() : &ndb->getNdbError();
- if (this_error->status == NdbError::TemporaryError && !thd->killed)
+ if (this_error->status == NdbError::TemporaryError &&
+ !thd_killed(m_thd))
{
if (retries--)
{
@@ -2855,8 +2853,8 @@ class Ndb_schema_event_handler {
if (post_epoch_unlock)
unlock_after_epoch(schema);
else
- ndbcluster_update_slock(thd, schema->db, schema->name,
- schema->id, schema->version);
+ ack_schema_op(schema->db, schema->name,
+ schema->id, schema->version);
}
}
}
@@ -3233,8 +3231,7 @@ class Ndb_schema_event_handler {
the epoch is complete
*/
void
- handle_schema_log_post_epoch(THD *thd,
- List<Cluster_schema> *log_list)
+ handle_schema_log_post_epoch(List<Ndb_schema_op> *log_list)
{
DBUG_ENTER("handle_schema_log_post_epoch");
@@ -3247,17 +3244,16 @@ class Ndb_schema_event_handler {
}
- static void
- handle_schema_unlock_post_epoch(THD *thd,
- List<Cluster_schema> *unlock_list)
+ void
+ handle_schema_unlock_post_epoch(List<Ndb_schema_op> *unlock_list)
{
DBUG_ENTER("handle_schema_unlock_post_epoch");
- Cluster_schema *schema;
+ Ndb_schema_op *schema;
while ((schema= unlock_list->pop()))
{
- ndbcluster_update_slock(thd, schema->db, schema->name,
- schema->id, schema->version);
+ ack_schema_op(schema->db, schema->name,
+ schema->id, schema->version);
}
DBUG_VOID_RETURN;
}
@@ -3266,8 +3262,8 @@ class Ndb_schema_event_handler {
MEM_ROOT* m_mem_root;
uint m_own_nodeid;
- List<Cluster_schema> m_post_epoch_log_list;
- List<Cluster_schema> m_post_epoch_unlock_list;
+ List<Ndb_schema_op> m_post_epoch_log_list;
+ List<Ndb_schema_op> m_post_epoch_unlock_list;
public:
Ndb_schema_event_handler(); // Not implemented
@@ -3426,9 +3422,9 @@ public:
{
if (m_post_epoch_log_list.elements > 0)
{
- handle_schema_log_post_epoch(m_thd, &m_post_epoch_log_list);
+ handle_schema_log_post_epoch(&m_post_epoch_log_list);
// NOTE post_epoch_unlock_list may not be handled!
- handle_schema_unlock_post_epoch(m_thd, &m_post_epoch_unlock_list);
+ handle_schema_unlock_post_epoch(&m_post_epoch_unlock_list);
}
// There should be no work left todo...
DBUG_ASSERT(m_post_epoch_log_list.elements == 0);
No bundle (reason: useless for push emails).| Thread |
|---|
| • bzr push into mysql-5.5-cluster branch (magnus.blaudd:3661 to 3663) | Magnus Blåudd | 1 Nov |