diff options
author | Nirbhay Choubey <nirbhay@mariadb.com> | 2015-02-20 17:29:03 -0500 |
---|---|---|
committer | Nirbhay Choubey <nirbhay@mariadb.com> | 2015-02-20 17:29:03 -0500 |
commit | 360ff3b0da557dc9fdbf3178ccaf084e6cb36cd0 (patch) | |
tree | 4b9a538c8156f996200211e546fc06a066d884a7 | |
parent | 69e5f0f42395d0028e75760685cdd7588854f1df (diff) | |
download | mariadb-git-360ff3b0da557dc9fdbf3178ccaf084e6cb36cd0.tar.gz |
Fix for build failures on Power8
-rw-r--r-- | sql/events.cc | 2 | ||||
-rw-r--r-- | sql/wsrep_sst.cc | 33 | ||||
-rw-r--r-- | storage/innobase/handler/ha_innodb.cc | 27 | ||||
-rw-r--r-- | wsrep/wsrep_loader.c | 21 |
4 files changed, 39 insertions, 44 deletions
diff --git a/sql/events.cc b/sql/events.cc index b675dafe01f..357695cdced 100644 --- a/sql/events.cc +++ b/sql/events.cc @@ -1132,7 +1132,7 @@ Events::load_events_from_db(THD *thd) #ifdef WITH_WSREP // when SST from master node who initials event, the event status is ENABLED // this is problematic because there are two nodes with same events and both enabled. - if (et->originator != thd->variables.server_id) + if (et->originator != (longlong) thd->variables.server_id) { store_record(table, record[1]); table->field[ET_FIELD_STATUS]-> diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc index c122d88f7cc..69f6b019d6b 100644 --- a/sql/wsrep_sst.cc +++ b/sql/wsrep_sst.cc @@ -440,8 +440,7 @@ static ssize_t sst_prepare_other (const char* method, const char* addr_in, const char** addr_out) { - ssize_t cmd_len= 1024; - char cmd_str[cmd_len]; + char cmd_str[1024]; const char* sst_dir= mysql_real_data_home; const char* binlog_opt= ""; char* binlog_opt_val= NULL; @@ -456,7 +455,7 @@ static ssize_t sst_prepare_other (const char* method, if (strlen(binlog_opt_val)) binlog_opt= WSREP_SST_OPT_BINLOG; - ret= snprintf (cmd_str, cmd_len, + ret= snprintf (cmd_str, sizeof(cmd_str), "wsrep_sst_%s " WSREP_SST_OPT_ROLE" 'joiner' " WSREP_SST_OPT_ADDR" '%s' " @@ -470,7 +469,7 @@ static ssize_t sst_prepare_other (const char* method, binlog_opt, binlog_opt_val); my_free(binlog_opt_val); - if (ret < 0 || ret >= cmd_len) + if (ret < 0 || ret >= (int)sizeof(cmd_str)) { WSREP_ERROR("sst_prepare_other(): snprintf() failed: %d", ret); return (ret < 0 ? ret : -EMSGSIZE); @@ -721,7 +720,7 @@ static int sst_donate_mysqldump (const char* addr, host_len = strlen (addr) + 1; } - char host[host_len]; + char *host= (char *) alloca(host_len); strncpy (host, addr, host_len - 1); host[host_len - 1] = '\0'; @@ -741,7 +740,7 @@ static int sst_donate_mysqldump (const char* addr, user_len = (auth) ? strlen (auth) + 1 : 1; } - char user[user_len]; + char *user= (char *) alloca(user_len); strncpy (user, (auth) ? auth : "", user_len - 1); user[user_len - 1] = '\0'; @@ -749,12 +748,11 @@ static int sst_donate_mysqldump (const char* addr, int ret = sst_mysqldump_check_addr (user, pswd, host, port); if (!ret) { - size_t cmd_len= 1024; - char cmd_str[cmd_len]; + char cmd_str[1024]; if (!bypass && wsrep_sst_donor_rejects_queries) sst_reject_queries(TRUE); - snprintf (cmd_str, cmd_len, + snprintf (cmd_str, sizeof(cmd_str), "wsrep_sst_mysqldump " WSREP_SST_OPT_USER" '%s' " WSREP_SST_OPT_PSWD" '%s' " @@ -850,11 +848,13 @@ static int sst_flush_tables(THD* thd) { WSREP_INFO("Tables flushed."); const char base_name[]= "tables_flushed"; + ssize_t const full_len= strlen(mysql_real_data_home) + strlen(base_name)+2; - char real_name[full_len]; - sprintf(real_name, "%s/%s", mysql_real_data_home, base_name); - char tmp_name[full_len + 4]; - sprintf(tmp_name, "%s.tmp", real_name); + char *real_name= (char *) alloca(full_len); + snprintf(real_name, (size_t) full_len, "%s/%s", mysql_real_data_home, + base_name); + char *tmp_name= (char *) alloca(full_len + 4); + snprintf(tmp_name, (size_t) full_len + 4, "%s.tmp", real_name); FILE* file= fopen(tmp_name, "w+"); if (0 == file) @@ -1014,8 +1014,7 @@ static int sst_donate_other (const char* method, wsrep_seqno_t seqno, bool bypass) { - ssize_t cmd_len = 4096; - char cmd_str[cmd_len]; + char cmd_str[4096]; const char* binlog_opt= ""; char* binlog_opt_val= NULL; @@ -1027,7 +1026,7 @@ static int sst_donate_other (const char* method, } if (strlen(binlog_opt_val)) binlog_opt= WSREP_SST_OPT_BINLOG; - ret= snprintf (cmd_str, cmd_len, + ret= snprintf (cmd_str, sizeof(cmd_str), "wsrep_sst_%s " WSREP_SST_OPT_ROLE" 'donor' " WSREP_SST_OPT_ADDR" '%s' " @@ -1045,7 +1044,7 @@ static int sst_donate_other (const char* method, bypass ? " "WSREP_SST_OPT_BYPASS : ""); my_free(binlog_opt_val); - if (ret < 0 || ret >= cmd_len) + if (ret < 0 || ret >= (int) sizeof(cmd_str)) { WSREP_ERROR("sst_donate_other(): snprintf() failed: %d", ret); return (ret < 0 ? ret : -EMSGSIZE); diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index ecd51fcb3a2..b55d13c7d8b 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -9782,7 +9782,6 @@ ha_innobase::wsrep_append_keys( uint len; char keyval[WSREP_MAX_SUPPORTED_KEY_LENGTH+1] = {'\0'}; char *key = &keyval[0]; - KEY *key_info = table->key_info; ibool is_null; len = wsrep_store_key_val_for_row( @@ -17251,18 +17250,18 @@ wsrep_innobase_kill_one_trx(void * const bf_thd_ptr, if (!thd) { DBUG_PRINT("wsrep", ("no thd for conflicting lock")); - WSREP_WARN("no THD for trx: %llu", victim_trx->id); + WSREP_WARN("no THD for trx: %lu", victim_trx->id); DBUG_RETURN(1); } if (!bf_thd) { DBUG_PRINT("wsrep", ("no BF thd for conflicting lock")); - WSREP_WARN("no BF THD for trx: %llu", (bf_trx) ? bf_trx->id : 0); + WSREP_WARN("no BF THD for trx: %lu", (bf_trx) ? bf_trx->id : 0); DBUG_RETURN(1); } WSREP_LOG_CONFLICT(bf_thd, thd, TRUE); - WSREP_DEBUG("BF kill (%lu, seqno: %lld), victim: (%lu) trx: %llu", + WSREP_DEBUG("BF kill (%lu, seqno: %lld), victim: (%lu) trx: %lu", signal, (long long)bf_seqno, wsrep_thd_thread_id(thd), victim_trx->id); @@ -17273,12 +17272,12 @@ wsrep_innobase_kill_one_trx(void * const bf_thd_ptr, wsrep_thd_LOCK(thd); if (wsrep_thd_query_state(thd) == QUERY_EXITING) { - WSREP_DEBUG("kill trx EXITING for %llu", victim_trx->id); + WSREP_DEBUG("kill trx EXITING for %lu", victim_trx->id); wsrep_thd_UNLOCK(thd); DBUG_RETURN(0); } if(wsrep_thd_exec_mode(thd) != LOCAL_STATE) { - WSREP_DEBUG("withdraw for BF trx: %llu, state: %d", + WSREP_DEBUG("withdraw for BF trx: %lu, state: %d", victim_trx->id, wsrep_thd_conflict_state(thd)); } @@ -17288,7 +17287,7 @@ wsrep_innobase_kill_one_trx(void * const bf_thd_ptr, wsrep_thd_set_conflict_state(thd, MUST_ABORT); break; case MUST_ABORT: - WSREP_DEBUG("victim %llu in MUST ABORT state", + WSREP_DEBUG("victim %lu in MUST ABORT state", victim_trx->id); wsrep_thd_UNLOCK(thd); wsrep_thd_awake(thd, signal); @@ -17297,7 +17296,7 @@ wsrep_innobase_kill_one_trx(void * const bf_thd_ptr, case ABORTED: case ABORTING: // fall through default: - WSREP_DEBUG("victim %llu in state %d", + WSREP_DEBUG("victim %lu in state %d", victim_trx->id, wsrep_thd_conflict_state(thd)); wsrep_thd_UNLOCK(thd); DBUG_RETURN(0); @@ -17310,7 +17309,7 @@ wsrep_innobase_kill_one_trx(void * const bf_thd_ptr, WSREP_DEBUG("kill query for: %ld", wsrep_thd_thread_id(thd)); - WSREP_DEBUG("kill trx QUERY_COMMITTING for %llu", + WSREP_DEBUG("kill trx QUERY_COMMITTING for %lu", victim_trx->id); if (wsrep_thd_exec_mode(thd) == REPL_RECV) { @@ -17324,7 +17323,7 @@ wsrep_innobase_kill_one_trx(void * const bf_thd_ptr, switch (rcode) { case WSREP_WARNING: - WSREP_DEBUG("cancel commit warning: %llu", + WSREP_DEBUG("cancel commit warning: %lu", victim_trx->id); wsrep_thd_UNLOCK(thd); wsrep_thd_awake(thd, signal); @@ -17334,8 +17333,8 @@ wsrep_innobase_kill_one_trx(void * const bf_thd_ptr, break; default: WSREP_ERROR( - "cancel commit bad exit: %d %llu", - rcode, + "cancel commit bad exit: %d %lu", + rcode, victim_trx->id); /* unable to interrupt, must abort */ /* note: kill_mysql() will block, if we cannot. @@ -17352,7 +17351,7 @@ wsrep_innobase_kill_one_trx(void * const bf_thd_ptr, /* it is possible that victim trx is itself waiting for some * other lock. We need to cancel this waiting */ - WSREP_DEBUG("kill trx QUERY_EXEC for %llu", victim_trx->id); + WSREP_DEBUG("kill trx QUERY_EXEC for %lu", victim_trx->id); victim_trx->lock.was_chosen_as_deadlock_victim= TRUE; if (victim_trx->lock.wait_lock) { @@ -17390,7 +17389,7 @@ wsrep_innobase_kill_one_trx(void * const bf_thd_ptr, bool skip_abort= false; wsrep_aborting_thd_t abortees; - WSREP_DEBUG("kill IDLE for %llu", victim_trx->id); + WSREP_DEBUG("kill IDLE for %lu", victim_trx->id); if (wsrep_thd_exec_mode(thd) == REPL_RECV) { WSREP_DEBUG("kill BF IDLE, seqno: %lld", diff --git a/wsrep/wsrep_loader.c b/wsrep/wsrep_loader.c index 8ae6ea962ec..0825d7e9ecf 100644 --- a/wsrep/wsrep_loader.c +++ b/wsrep/wsrep_loader.c @@ -39,11 +39,10 @@ static wsrep_log_cb_t logger = default_logger; static int verify(const wsrep_t *wh, const char *iface_ver) { - const size_t msg_len = 128; - char msg[msg_len]; + char msg[128]; #define VERIFY(_p) if (!(_p)) { \ - snprintf(msg, msg_len, "wsrep_load(): verify(): %s\n", # _p); \ + snprintf(msg, sizeof(msg), "wsrep_load(): verify(): %s\n", # _p); \ logger (WSREP_LOG_ERROR, msg); \ return EINVAL; \ } @@ -52,7 +51,7 @@ static int verify(const wsrep_t *wh, const char *iface_ver) VERIFY(wh->version); if (strcmp(wh->version, iface_ver)) { - snprintf (msg, msg_len, + snprintf (msg, sizeof(msg), "provider interface version mismatch: need '%s', found '%s'", iface_ver, wh->version); logger (WSREP_LOG_ERROR, msg); @@ -115,9 +114,7 @@ int wsrep_load(const char *spec, wsrep_t **hptr, wsrep_log_cb_t log_cb) int ret = 0; void *dlh = NULL; wsrep_loader_fun dlfun; - const size_t msg_len = 1024; - char msg[msg_len + 1]; - msg[msg_len] = 0; + char msg[1024]; if (NULL != log_cb) logger = log_cb; @@ -125,7 +122,7 @@ int wsrep_load(const char *spec, wsrep_t **hptr, wsrep_log_cb_t log_cb) if (!(spec && hptr)) return EINVAL; - snprintf (msg, msg_len, + snprintf (msg, sizeof(msg), "wsrep_load(): loading provider library '%s'", spec); logger (WSREP_LOG_INFO, msg); @@ -143,7 +140,7 @@ int wsrep_load(const char *spec, wsrep_t **hptr, wsrep_log_cb_t log_cb) } if (!(dlh = dlopen(spec, RTLD_NOW | RTLD_LOCAL))) { - snprintf(msg, msg_len, "wsrep_load(): dlopen(): %s", dlerror()); + snprintf(msg, sizeof(msg), "wsrep_load(): dlopen(): %s", dlerror()); logger (WSREP_LOG_ERROR, msg); ret = EINVAL; goto out; @@ -155,14 +152,14 @@ int wsrep_load(const char *spec, wsrep_t **hptr, wsrep_log_cb_t log_cb) } if ((ret = (*dlfun)(*hptr)) != 0) { - snprintf(msg, msg_len, "wsrep_load(): loader failed: %s", + snprintf(msg, sizeof(msg), "wsrep_load(): loader failed: %s", strerror(ret)); logger (WSREP_LOG_ERROR, msg); goto out; } if ((ret = verify(*hptr, WSREP_INTERFACE_VERSION)) != 0) { - snprintf (msg, msg_len, + snprintf (msg, sizeof(msg), "wsrep_load(): interface version mismatch: my version %s, " "provider version %s", WSREP_INTERFACE_VERSION, (*hptr)->version); @@ -178,7 +175,7 @@ out: free(*hptr); *hptr = NULL; } else { - snprintf (msg, msg_len, + snprintf (msg, sizeof(msg), "wsrep_load(): %s %s by %s loaded successfully.", (*hptr)->provider_name, (*hptr)->provider_version, (*hptr)->provider_vendor); |