Commit 976be6fa authored by pekka@mysql.com's avatar pekka@mysql.com

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

parent 62870815
...@@ -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,12 +1093,14 @@ int Ndb::setDatabaseAndSchemaName(const NdbDictionary::Table* t) ...@@ -1093,12 +1093,14 @@ 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];
sprintf(buf, "%.*s", s1 - s0, s0); if (s1 - s0 <= NAME_LEN && s2 - (s1 + 1) <= NAME_LEN) {
setDatabaseName(buf); sprintf(buf, "%.*s", s1 - s0, s0);
sprintf(buf, "%.*s", s2 - (s1 + 1), s1 + 1); setDatabaseName(buf);
setDatabaseSchemaName(buf); sprintf(buf, "%.*s", s2 - (s1 + 1), s1 + 1);
return 0; setDatabaseSchemaName(buf);
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