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)
DBUG_ASSERT(share != 0);
}
#endif
// set injector_ndb database/schema from table internal name
int ret= ndb->setDatabaseAndSchemaName(pOp->getEvent()->getTable());
assert(ret == 0);
if ((unsigned) pOp->getEventType() <
(unsigned) NDBEVENT::TE_FIRST_NON_DATA_EVENT)
ndb_binlog_thread_handle_data_event(ndb, pOp, row, trans);
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);
// reset to catch errors
ndb->setDatabaseName("");
ndb->setDatabaseSchemaName("");
// reset to catch errors
ndb->setDatabaseName("");
ndb->setDatabaseSchemaName("");
}
pOp= ndb->nextEvent();
} while (pOp && pOp->getGCI() == gci);
......
......@@ -1093,12 +1093,14 @@ int Ndb::setDatabaseAndSchemaName(const NdbDictionary::Table* t)
if (s1 && s1 != s0) {
const char* s2 = strchr(s1 + 1, table_name_separator);
if (s2 && s2 != s1 + 1) {
char buf[200];
sprintf(buf, "%.*s", s1 - s0, s0);
setDatabaseName(buf);
sprintf(buf, "%.*s", s2 - (s1 + 1), s1 + 1);
setDatabaseSchemaName(buf);
return 0;
char buf[NAME_LEN + 1];
if (s1 - s0 <= NAME_LEN && s2 - (s1 + 1) <= NAME_LEN) {
sprintf(buf, "%.*s", s1 - s0, s0);
setDatabaseName(buf);
sprintf(buf, "%.*s", s2 - (s1 + 1), s1 + 1);
setDatabaseSchemaName(buf);
return 0;
}
}
}
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