Commit 140c3b8a authored by unknown's avatar unknown

ndb - rbr blobs etc: minor changes bug#17045 bug#17505

sql/ha_ndbcluster_binlog.cc:
  optim: setting db/schema for data events seems unnecessary
storage/ndb/src/ndbapi/Ndb.cpp:
  use NAME_LEN
parent c8a03c17
...@@ -2913,17 +2913,19 @@ pthread_handler_t ndb_binlog_thread_func(void *arg) ...@@ -2913,17 +2913,19 @@ pthread_handler_t ndb_binlog_thread_func(void *arg)
DBUG_ASSERT(share != 0); DBUG_ASSERT(share != 0);
} }
#endif #endif
// set injector_ndb database/schema from table internal name
int ret= ndb->setDatabaseAndSchemaName(pOp->getEvent()->getTable());
assert(ret == 0);
if ((unsigned) pOp->getEventType() < if ((unsigned) pOp->getEventType() <
(unsigned) NDBEVENT::TE_FIRST_NON_DATA_EVENT) (unsigned) NDBEVENT::TE_FIRST_NON_DATA_EVENT)
ndb_binlog_thread_handle_data_event(ndb, pOp, row, trans); ndb_binlog_thread_handle_data_event(ndb, pOp, row, trans);
else else
{
// set injector_ndb database/schema from table internal name
int ret= ndb->setDatabaseAndSchemaName(pOp->getEvent()->getTable());
assert(ret == 0);
ndb_binlog_thread_handle_non_data_event(ndb, pOp, row); ndb_binlog_thread_handle_non_data_event(ndb, pOp, row);
// reset to catch errors // reset to catch errors
ndb->setDatabaseName(""); ndb->setDatabaseName("");
ndb->setDatabaseSchemaName(""); ndb->setDatabaseSchemaName("");
}
pOp= ndb->nextEvent(); pOp= ndb->nextEvent();
} while (pOp && pOp->getGCI() == gci); } while (pOp && pOp->getGCI() == gci);
......
...@@ -1093,7 +1093,8 @@ int Ndb::setDatabaseAndSchemaName(const NdbDictionary::Table* t) ...@@ -1093,7 +1093,8 @@ int Ndb::setDatabaseAndSchemaName(const NdbDictionary::Table* t)
if (s1 && s1 != s0) { if (s1 && s1 != s0) {
const char* s2 = strchr(s1 + 1, table_name_separator); const char* s2 = strchr(s1 + 1, table_name_separator);
if (s2 && s2 != s1 + 1) { if (s2 && s2 != s1 + 1) {
char buf[200]; char buf[NAME_LEN + 1];
if (s1 - s0 <= NAME_LEN && s2 - (s1 + 1) <= NAME_LEN) {
sprintf(buf, "%.*s", s1 - s0, s0); sprintf(buf, "%.*s", s1 - s0, s0);
setDatabaseName(buf); setDatabaseName(buf);
sprintf(buf, "%.*s", s2 - (s1 + 1), s1 + 1); sprintf(buf, "%.*s", s2 - (s1 + 1), s1 + 1);
...@@ -1101,6 +1102,7 @@ int Ndb::setDatabaseAndSchemaName(const NdbDictionary::Table* t) ...@@ -1101,6 +1102,7 @@ int Ndb::setDatabaseAndSchemaName(const NdbDictionary::Table* t)
return 0; return 0;
} }
} }
}
return -1; return -1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment