Below is the list of changes that have just been committed into a local
5.1 repository of tomas. When tomas does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2027 06/01/10 23:30:10 tomas@stripped +6 -0
fixed execution --binlog-format=statment
sql/ha_ndbcluster_binlog.h
1.3 06/01/10 23:30:02 tomas@stripped +6 -3
fixed execution --binlog-format=statment
sql/ha_ndbcluster_binlog.cc
1.6 06/01/10 23:30:02 tomas@stripped +23 -21
fixed execution --binlog-format=statment
sql/ha_ndbcluster.h
1.104 06/01/10 23:30:02 tomas@stripped +6 -0
fixed execution --binlog-format=statment
sql/ha_ndbcluster.cc
1.234 06/01/10 23:30:01 tomas@stripped +16 -20
fixed execution --binlog-format=statment
mysql-test/r/rpl_loaddata_m.result
1.17 06/01/10 23:30:01 tomas@stripped +1 -0
cluster_replication missing in result
mysql-test/mysql-test-run.sh
1.287 06/01/10 23:30:01 tomas@stripped +10 -0
removed ndbcluster tables frm's at cluster shutdown as not to confuse other tests
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: tomas
# Host: poseidon.ndb.mysql.com
# Root: /home/tomas/mysql-5.1-wl2325-v6
--- 1.286/mysql-test/mysql-test-run.sh 2006-01-10 14:18:30 +01:00
+++ 1.287/mysql-test/mysql-test-run.sh 2006-01-10 23:30:01 +01:00
@@ -1282,6 +1282,12 @@
fi
}
+rm_ndbcluster_tables()
+{
+ $RM -f $1/cluster_replication/apply_status*
+ $RM -f $1/cluster_replication/schema*
+}
+
stop_ndbcluster()
{
if [ -n "$USE_NDBCLUSTER_OPT" ]
@@ -1292,6 +1298,9 @@
# Kill any running ndbcluster stuff
$ECHO "Stopping master cluster"
./ndb/ndbcluster $NDBCLUSTER_OPTS --stop
+ # remove ndb table the hard way as not to upset later tests
+ rm_ndbcluster_tables $MASTER_MYDDIR
+ rm_ndbcluster_tables $MASTER_MYDDIR"1"
fi
fi
}
@@ -1640,6 +1649,7 @@
cd $MYSQL_TEST_DIR
$ECHO "Stopping slave cluster"
./ndb/ndbcluster $NDBCLUSTER_OPTS_SLAVE --stop
+ rm_ndbcluster_tables $SLAVE_MYDDIR
cd $savedir
fi
fi
--- 1.16/mysql-test/r/rpl_loaddata_m.result 2005-12-22 21:55:12 +01:00
+++ 1.17/mysql-test/r/rpl_loaddata_m.result 2006-01-10 23:30:01 +01:00
@@ -21,6 +21,7 @@
SHOW DATABASES;
Database
information_schema
+cluster_replication
mysql
mysqltest
test
--- 1.233/sql/ha_ndbcluster.cc 2006-01-09 15:05:22 +01:00
+++ 1.234/sql/ha_ndbcluster.cc 2006-01-10 23:30:01 +01:00
@@ -56,8 +56,6 @@
static int ndbcluster_end(ha_panic_function flag);
static bool ndbcluster_show_status(THD*,stat_print_fn *,enum ha_stat_type);
-#define IS_TMP_PREFIX(A) (is_prefix(A, tmp_file_prefix) || is_prefix(A, "@0023sql"))
-
handlerton ndbcluster_hton = {
MYSQL_HANDLERTON_INTERFACE_VERSION,
"ndbcluster",
@@ -3918,16 +3916,15 @@
if (create_from_engine)
{
/*
- Table alreay exists in NDB and frm file has been created by
+ Table already exists in NDB and frm file has been created by
caller.
Do Ndb specific stuff, such as create a .ndb file
*/
if ((my_errno= write_ndb_file()))
DBUG_RETURN(my_errno);
#ifdef HAVE_NDB_BINLOG
- ndbcluster_create_binlog_setup(get_ndb(), name2, m_dbname, m_tabname,
- ndb_binlog_thread_running > 0 &&
- !IS_TMP_PREFIX(m_tabname), 0);
+ if (ndb_binlog_thread_running > 0)
+ ndbcluster_create_binlog_setup(get_ndb(), name2, m_dbname, m_tabname, 0);
#endif /* HAVE_NDB_BINLOG */
DBUG_RETURN(my_errno);
}
@@ -4093,7 +4090,7 @@
/*
get a new share
*/
- if (!(share= get_share(name2, true, true)))
+ if (!(share= get_share(name2, form, true, true)))
{
sql_print_error("NDB: allocating table share for %s failed", name2);
/* my_errno is set */
@@ -4239,7 +4236,7 @@
#ifdef HAVE_NDB_BINLOG
NDB_SHARE *share= 0;
if (ndb_binlog_thread_running > 0 &&
- (share= get_share(from, false)))
+ (share= get_share(from, 0, false)))
{
int r= rename_share(share, to);
DBUG_ASSERT(r == 0);
@@ -4312,7 +4309,7 @@
}
else
{
- sql_print_error("NDB Binlog: FAILED create event during RENAME."
+ sql_print_error("NDB Binlog: FAILED create event during RENAME. "
"Event: %s", event_name.c_ptr());
push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
ER_GET_ERRMSG, ER(ER_GET_ERRMSG),
@@ -4322,13 +4319,13 @@
if (is_old_table_tmpfile)
ndbcluster_log_schema_op(current_thd, share,
current_thd->query, current_thd->query_length,
- share->db, share->table_name,
+ m_dbname, new_tabname,
0, 0,
SOT_ALTER_TABLE);
else
ndbcluster_log_schema_op(current_thd, share,
current_thd->query, current_thd->query_length,
- share->db, share->table_name,
+ m_dbname, new_tabname,
0, 0,
SOT_RENAME_TABLE);
}
@@ -4379,7 +4376,7 @@
DBUG_ENTER("ha_ndbcluster::ndbcluster_delete_table");
NDBDICT *dict= ndb->getDictionary();
#ifdef HAVE_NDB_BINLOG
- NDB_SHARE *share= get_share(path, false);
+ NDB_SHARE *share= get_share(path, 0, false);
#endif
/* Drop the table from NDB */
@@ -4680,7 +4677,7 @@
DBUG_PRINT("info", (" ref_length: %d", ref_length));
}
// Init table lock structure
- if (!(m_share=get_share(name)))
+ if (!(m_share=get_share(name, table)))
DBUG_RETURN(1);
thr_lock_data_init(&m_share->lock,&m_lock,(void*) 0);
@@ -5047,7 +5044,7 @@
pthread_mutex_unlock(&LOCK_open);
}
#ifdef HAVE_NDB_BINLOG
- else
+ else if (ndb_binlog_thread_running > 0)
{
/* set up replication for this table */
NDB_SHARE *share;
@@ -5064,8 +5061,7 @@
pthread_mutex_unlock(&ndbcluster_mutex);
pthread_mutex_lock(&LOCK_open);
ndbcluster_create_binlog_setup(ndb, key, elmt.database, elmt.name,
- ndb_binlog_thread_running > 0 &&
- !IS_TMP_PREFIX(elmt.name), share);
+ share);
pthread_mutex_unlock(&LOCK_open);
}
else
@@ -5203,8 +5199,7 @@
pthread_mutex_unlock(&ndbcluster_mutex);
pthread_mutex_lock(&LOCK_open);
- ndbcluster_create_binlog_setup(ndb, name, db, file_name,
- !IS_TMP_PREFIX(file_name), share);
+ ndbcluster_create_binlog_setup(ndb, name, db, file_name, share);
pthread_mutex_unlock(&LOCK_open);
pthread_mutex_lock(&ndbcluster_mutex);
}
@@ -6164,7 +6159,8 @@
have_lock == TRUE, pthread_mutex_lock(&ndbcluster_mutex) already taken
*/
-NDB_SHARE *ndbcluster_get_share(const char *key, bool create_if_not_exists,
+NDB_SHARE *ndbcluster_get_share(const char *key, TABLE *table,
+ bool create_if_not_exists,
bool have_lock)
{
DBUG_ENTER("get_share");
@@ -6216,7 +6212,7 @@
share->table_name= share->db + strlen(share->db) + 1;
ha_ndbcluster::set_tabname(key, share->table_name);
#ifdef HAVE_NDB_BINLOG
- ndbcluster_binlog_init_share(share);
+ ndbcluster_binlog_init_share(share, table);
#endif
*root_ptr= old_root;
}
--- 1.103/sql/ha_ndbcluster.h 2006-01-09 18:04:01 +01:00
+++ 1.104/sql/ha_ndbcluster.h 2006-01-10 23:30:02 +01:00
@@ -89,6 +89,7 @@
char *db;
char *table_name;
#ifdef HAVE_NDB_BINLOG
+ uint32 flags;
NDB_SHARE_STATE state;
NdbEventOperation *op;
NdbEventOperation *op_old; // for rename table
@@ -101,6 +102,11 @@
uint32 slock[256/32]; // 256 bits for lock status of table
#endif
} NDB_SHARE;
+
+#ifdef HAVE_NDB_BINLOG
+/* NDB_SHARE.flags */
+#define NSF_HIDDEN_PK 1 /* table has hidden primary key */
+#endif
typedef enum ndb_item_type {
NDB_VALUE = 0, // Qualified more with Item::Type
--- 1.5/sql/ha_ndbcluster_binlog.cc 2006-01-10 15:04:27 +01:00
+++ 1.6/sql/ha_ndbcluster_binlog.cc 2006-01-10 23:30:02 +01:00
@@ -223,14 +223,21 @@
/*
Initialize the binlog part of the NDB_SHARE
*/
-void ndbcluster_binlog_init_share(NDB_SHARE *share)
+void ndbcluster_binlog_init_share(NDB_SHARE *share, TABLE *_table)
{
THD *thd= current_thd;
MEM_ROOT *mem_root= &share->mem_root;
share->op= 0;
share->table= 0;
- while (ndb_binlog_thread_running > 0)
+ if (ndb_binlog_thread_running <= 0)
+ {
+ DBUG_ASSERT(_table != 0);
+ if (_table->s->primary_key == MAX_KEY)
+ share->flags|= NSF_HIDDEN_PK;
+ return;
+ }
+ while (1)
{
TABLE_SHARE *table_share=
(TABLE_SHARE *) my_malloc(sizeof(*table_share), MYF(MY_WME));
@@ -305,6 +312,8 @@
sizeof(share->slock)*8, false);
bitmap_clear_all(&share->slock_bitmap);
}
+ if (table->s->primary_key == MAX_KEY)
+ share->flags|= NSF_HIDDEN_PK;
break;
}
}
@@ -1327,7 +1336,7 @@
char key[FN_REFLEN];
(void)strxnmov(key, FN_REFLEN, share_prefix, schema->db,
"/", schema->name, NullS);
- NDB_SHARE *share= get_share(key, false, false);
+ NDB_SHARE *share= get_share(key, 0, false, false);
if (share)
{
pthread_mutex_lock(&share->mutex);
@@ -1602,7 +1611,6 @@
int ndbcluster_create_binlog_setup(Ndb *ndb, const char *key,
const char *db,
const char *table_name,
- bool do_binlog,
NDB_SHARE *share)
{
DBUG_ENTER("ndbcluster_create_binlog_setup");
@@ -1621,14 +1629,14 @@
handle_trailing_share(share);
/* Create share which is needed to hold replication information */
- if (!(share= get_share(key, true, true)))
+ if (!(share= get_share(key, 0, true, true)))
{
sql_print_error("NDB Binlog: "
"allocating table share for %s failed", key);
}
pthread_mutex_unlock(&ndbcluster_mutex);
- while (share && do_binlog)
+ while (share && !IS_TMP_PREFIX(table_name))
{
/*
ToDo make sanity check of share so that the table is actually the same
@@ -1694,19 +1702,13 @@
const char *event_name, NDB_SHARE *share)
{
DBUG_ENTER("ndbcluster_create_event");
+ if (!share)
+ DBUG_RETURN(0);
NDBDICT *dict= ndb->getDictionary();
-
- if (!dict)
- {
- sql_print_error("NDB Binlog: could not setup binlog, "
- "Invalid NdbDictionary");
- DBUG_RETURN(-1);
- }
-
NDBEVENT my_event(event_name);
my_event.setTable(*ndbtab);
my_event.addTableEvent(NDBEVENT::TE_ALL);
- if (share->table->s->primary_key == MAX_KEY)
+ if (share->flags & NSF_HIDDEN_PK)
{
/* No primary key, susbscribe for all attributes */
my_event.setReport(NDBEVENT::ER_ALL);
@@ -1969,13 +1971,13 @@
NDBDICT *dict= ndb->getDictionary();
if (event_name && dict->dropEvent(event_name))
{
- /* drop event failed for some reason, issue a warning */
- push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
- ER_GET_ERRMSG, ER(ER_GET_ERRMSG),
- dict->getNdbError().code,
- dict->getNdbError().message, "NDB");
if (dict->getNdbError().code != 4710)
{
+ /* drop event failed for some reason, issue a warning */
+ push_warning_printf(current_thd, MYSQL_ERROR::WARN_LEVEL_ERROR,
+ ER_GET_ERRMSG, ER(ER_GET_ERRMSG),
+ dict->getNdbError().code,
+ dict->getNdbError().message, "NDB");
/* error is not that the event did not exist */
sql_print_error("NDB Binlog: Unable to drop event in database. "
"Event: %s Error Code: %d Message: %s",
@@ -1986,7 +1988,7 @@
if (share && share->op &&
share->op->getState() == NdbEventOperation::EO_EXECUTING &&
dict->getNdbError().code != 4009)
- {
+ {
DBUG_ASSERT(false);
DBUG_RETURN(-1);
}
--- 1.2/sql/ha_ndbcluster_binlog.h 2006-01-05 17:07:01 +01:00
+++ 1.3/sql/ha_ndbcluster_binlog.h 2006-01-10 23:30:02 +01:00
@@ -23,6 +23,8 @@
typedef NdbDictionary::Dictionary NDBDICT;
typedef NdbDictionary::Event NDBEVENT;
+#define IS_TMP_PREFIX(A) (is_prefix(A, tmp_file_prefix) || is_prefix(A, "@0023sql"))
+
#ifdef HAVE_NDB_BINLOG
#define INJECTOR_EVENT_LEN 200
@@ -66,12 +68,11 @@
/*
Initialize the binlog part of the NDB_SHARE
*/
-void ndbcluster_binlog_init_share(NDB_SHARE *share);
+void ndbcluster_binlog_init_share(NDB_SHARE *share, TABLE *table);
int ndbcluster_create_binlog_setup(Ndb *ndb, const char *key,
const char *db,
const char *table_name,
- bool do_binlog,
NDB_SHARE *share);
int ndbcluster_create_event(Ndb *ndb, const NDBTAB *table,
const char *event_name, NDB_SHARE *share);
@@ -115,6 +116,7 @@
MY_BITMAP *defined, byte *buf);
NDB_SHARE *ndbcluster_get_share(const char *key,
+ TABLE *table,
bool create_if_not_exists,
bool have_lock);
NDB_SHARE *ndbcluster_get_share(NDB_SHARE *share);
@@ -122,10 +124,11 @@
void ndbcluster_real_free_share(NDB_SHARE **share);
int handle_trailing_share(NDB_SHARE *share);
inline NDB_SHARE *get_share(const char *key,
+ TABLE *table,
bool create_if_not_exists= TRUE,
bool have_lock= FALSE)
{
- return ndbcluster_get_share(key, create_if_not_exists, have_lock);
+ return ndbcluster_get_share(key, table, create_if_not_exists, have_lock);
}
inline NDB_SHARE *get_share(NDB_SHARE *share)
| Thread |
|---|
| • bk commit into 5.1 tree (tomas:1.2027) | tomas | 10 Jan |