Browse Source

bzr merge -r3904..3928 lp:codership-mysql/5.5

This is now otherwise on level wsrep-25.9, but storage/innobase has not been fully merged
wsrep-5.5 is not good source for that, so we probably have to cherry pick innodb changes from wsrep-5.6
pull/57/head
Seppo Jaakola 12 years ago
parent
commit
b098b7a84c
  1. 2
      cmake/wsrep.cmake
  2. 1
      sql/log.cc
  3. 7
      sql/mdl.h
  4. 8
      sql/mysqld.cc
  5. 1
      sql/sql_class.cc
  6. 4
      sql/sql_class.h
  7. 38
      sql/sql_parse.cc
  8. 13
      sql/sql_table.cc
  9. 10
      sql/sys_vars.cc
  10. 7
      sql/transaction.cc
  11. 38
      sql/wsrep_applier.h
  12. 2
      sql/wsrep_hton.cc
  13. 34
      sql/wsrep_mysqld.cc
  14. 2
      sql/wsrep_mysqld.h
  15. 19
      sql/wsrep_thd.cc
  16. 1
      sql/wsrep_thd.h
  17. 15
      storage/innobase/handler/ha_innodb.cc
  18. 9
      storage/innobase/include/trx0sys.h
  19. 13
      storage/innobase/trx/trx0trx.cc
  20. 0
      wsrep.moved/CMakeLists.txt
  21. 0
      wsrep.moved/Makefile.am
  22. 1110
      wsrep.moved/wsrep_api.h
  23. 383
      wsrep.moved/wsrep_dummy.c
  24. 0
      wsrep.moved/wsrep_loader.c
  25. 0
      wsrep.moved/wsrep_uuid.c
  26. 14
      wsrep/wsrep_api.h
  27. 56
      wsrep/wsrep_dummy.c

2
cmake/wsrep.cmake

@ -17,7 +17,7 @@
# so WSREP_VERSION is produced regardless
# Set the patch version
SET(WSREP_PATCH_VERSION "7.6")
SET(WSREP_PATCH_VERSION "9")
# Obtain patch revision number
SET(WSREP_PATCH_REVNO $ENV{WSREP_REV})

1
sql/log.cc

@ -6195,6 +6195,7 @@ int MYSQL_BIN_LOG::rotate(bool force_rotate, bool* check_purge)
#ifdef WITH_WSREP
if (WSREP_ON && wsrep_to_isolation)
{
*check_purge= false;
WSREP_DEBUG("avoiding binlog rotate due to TO isolation: %d",
wsrep_to_isolation);
DBUG_RETURN(0);

7
sql/mdl.h

@ -770,6 +770,13 @@ public:
m_tickets[MDL_EXPLICIT].is_empty());
}
#ifdef WITH_WSREP
inline bool has_transactional_locks() const
{
return !m_tickets[MDL_TRANSACTION].is_empty();
}
#endif /* WITH_WSREP */
MDL_savepoint mdl_savepoint()
{
return MDL_savepoint(m_tickets[MDL_STATEMENT].front(),

8
sql/mysqld.cc

@ -8453,8 +8453,9 @@ SHOW_VAR status_vars[]= {
{"wsrep_cluster_state_uuid", (char*) &wsrep_cluster_state_uuid,SHOW_CHAR_PTR},
{"wsrep_cluster_conf_id", (char*) &wsrep_cluster_conf_id, SHOW_LONGLONG},
{"wsrep_cluster_status", (char*) &wsrep_cluster_status, SHOW_CHAR_PTR},
{"wsrep_cluster_size", (char*) &wsrep_cluster_size, SHOW_LONG},
{"wsrep_local_index", (char*) &wsrep_local_index, SHOW_LONG},
{"wsrep_cluster_size", (char*) &wsrep_cluster_size, SHOW_LONG_NOFLUSH},
{"wsrep_local_index", (char*) &wsrep_local_index, SHOW_LONG_NOFLUSH},
{"wsrep_local_bf_aborts", (char*) &wsrep_show_bf_aborts, SHOW_FUNC},
{"wsrep_provider_name", (char*) &wsrep_provider_name, SHOW_CHAR_PTR},
{"wsrep_provider_version", (char*) &wsrep_provider_version, SHOW_CHAR_PTR},
{"wsrep_provider_vendor", (char*) &wsrep_provider_vendor, SHOW_CHAR_PTR},
@ -9798,6 +9799,9 @@ void refresh_status(THD *thd)
/* Reset some global variables */
reset_status_vars();
#ifdef WITH_WSREP
wsrep->stats_reset(wsrep);
#endif /* WITH_WSREP */
/* Reset the counters of all key caches (default and named). */
process_key_caches(reset_key_cache_counters, 0);

1
sql/sql_class.cc

@ -1022,6 +1022,7 @@ THD::THD()
wsrep_applier(is_applier),
wsrep_applier_closing(FALSE),
wsrep_client_thread(0),
wsrep_apply_toi(false),
#endif
m_parser_state(NULL),
#if defined(ENABLED_DEBUG_SYNC)

4
sql/sql_class.h

@ -61,9 +61,12 @@ void set_thd_stage_info(void *thd,
#include "wsrep_mysqld.h"
struct wsrep_thd_shadow {
ulonglong options;
uint server_status;
enum wsrep_exec_mode wsrep_exec_mode;
Vio *vio;
ulong tx_isolation;
char *db;
size_t db_length;
};
#endif
class Reprepare_observer;
@ -2563,6 +2566,7 @@ public:
const char* wsrep_TOI_pre_query; /* a query to apply before
the actual TOI query */
size_t wsrep_TOI_pre_query_len;
bool wsrep_apply_toi; /* applier processing in TOI */
#endif /* WITH_WSREP */
/**
Internal parser state.

38
sql/sql_parse.cc

@ -1858,12 +1858,15 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
if ((thd->wsrep_conflict_state != REPLAYING) &&
(thd->wsrep_conflict_state != RETRY_AUTOCOMMIT))
{
mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
thd->update_server_status();
thd->protocol->end_statement();
query_cache_end_of_result(thd);
}
else
{
mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
}
mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
} else { /* if (WSREP(thd))... */
#endif /* WITH_WSREP */
DBUG_ASSERT(thd->derived_tables == NULL &&
@ -3249,8 +3252,11 @@ case SQLCOM_PREPARE:
else
{
#ifdef WITH_WSREP
if (!thd->is_current_stmt_binlog_format_row() ||
!(create_info.options & HA_LEX_CREATE_TMP_TABLE))
/* in STATEMENT format, we probably have to replicate also temporary
tables, like mysql replication does
*/
if (!thd->is_current_stmt_binlog_format_row() ||
!(create_info.options & HA_LEX_CREATE_TMP_TABLE))
WSREP_TO_ISOLATION_BEGIN(create_table->db, create_table->table_name,
NULL)
#endif /* WITH_WSREP */
@ -5455,7 +5461,22 @@ finish:
{
thd->mdl_context.release_statement_locks();
}
WSREP_TO_ISOLATION_END
WSREP_TO_ISOLATION_END;
#ifdef WITH_WSREP
/*
Force release of transactional locks if not in active MST and wsrep is on.
*/
if (WSREP(thd) &&
! thd->in_sub_stmt &&
! thd->in_active_multi_stmt_transaction() &&
thd->mdl_context.has_transactional_locks())
{
WSREP_DEBUG("Forcing release of transactional locks for thd %lu",
thd->thread_id);
thd->mdl_context.release_transactional_locks();
}
#endif /* WITH_WSREP */
DBUG_RETURN(res || thd->is_error());
}
@ -6356,7 +6377,12 @@ void THD::reset_for_next_command(bool calculate_userstat)
thd->stmt_depends_on_first_successful_insert_id_in_prev_stmt= 0;
#ifdef WITH_WSREP
if (WSREP(thd)) {
/*
Autoinc variables should be adjusted only for locally executed
transactions. Appliers and replayers are either processing ROW
events or get autoinc variable values from Query_log_event.
*/
if (WSREP(thd) && thd->wsrep_exec_mode == LOCAL_STATE) {
if (wsrep_auto_increment_control)
{
if (thd->variables.auto_increment_offset !=

13
sql/sql_table.cc

@ -4898,12 +4898,23 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, TABLE_LIST* src_table,
break;
}
}
if (!is_tmp_table)
if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
{
/* CREATE TEMPORARY TABLE LIKE must be skipped from replication */
WSREP_DEBUG("CREATE TEMPORARY TABLE LIKE... skipped replication\n %s",
thd->query());
}
else if (!is_tmp_table)
{
/* this is straight CREATE TABLE LIKE... eith no tmp tables */
WSREP_TO_ISOLATION_BEGIN(table->db, table->table_name, NULL);
}
else
{
/* here we have CREATE TABLE LIKE <temporary table>
the temporary table definition will be needed in slaves to
enable the create to succeed
*/
TABLE_LIST tbl;
bzero((void*) &tbl, sizeof(tbl));
tbl.db= src_table->db;

10
sql/sys_vars.cc

@ -4092,7 +4092,7 @@ static Sys_var_charptr Sys_wsrep_data_home_dir(
static Sys_var_charptr Sys_wsrep_cluster_name(
"wsrep_cluster_name", "Name for the cluster",
GLOBAL_VAR(wsrep_cluster_name), CMD_LINE(REQUIRED_ARG),
PREALLOCATED GLOBAL_VAR(wsrep_cluster_name), CMD_LINE(REQUIRED_ARG),
IN_FS_CHARSET, DEFAULT(wsrep_cluster_name),
NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(wsrep_cluster_name_check),
@ -4110,13 +4110,13 @@ static Sys_var_charptr Sys_wsrep_cluster_address (
static Sys_var_charptr Sys_wsrep_node_name (
"wsrep_node_name", "Node name",
GLOBAL_VAR(wsrep_node_name), CMD_LINE(REQUIRED_ARG),
PREALLOCATED GLOBAL_VAR(wsrep_node_name), CMD_LINE(REQUIRED_ARG),
IN_FS_CHARSET, DEFAULT(wsrep_node_name),
NO_MUTEX_GUARD, NOT_IN_BINLOG);
static Sys_var_charptr Sys_wsrep_node_address (
"wsrep_node_address", "Node address",
GLOBAL_VAR(wsrep_node_address), CMD_LINE(REQUIRED_ARG),
PREALLOCATED GLOBAL_VAR(wsrep_node_address), CMD_LINE(REQUIRED_ARG),
IN_FS_CHARSET, DEFAULT(wsrep_node_address),
NO_MUTEX_GUARD, NOT_IN_BINLOG,
ON_CHECK(wsrep_node_address_check),
@ -4124,7 +4124,7 @@ static Sys_var_charptr Sys_wsrep_node_address (
static Sys_var_charptr Sys_wsrep_node_incoming_address(
"wsrep_node_incoming_address", "Client connection address",
GLOBAL_VAR(wsrep_node_incoming_address),CMD_LINE(REQUIRED_ARG),
PREALLOCATED GLOBAL_VAR(wsrep_node_incoming_address),CMD_LINE(REQUIRED_ARG),
IN_FS_CHARSET, DEFAULT(wsrep_node_incoming_address),
NO_MUTEX_GUARD, NOT_IN_BINLOG);
@ -4216,7 +4216,7 @@ static Sys_var_mybool Sys_wsrep_on (
static Sys_var_charptr Sys_wsrep_start_position (
"wsrep_start_position", "global transaction position to start from ",
GLOBAL_VAR(wsrep_start_position),
PREALLOCATED GLOBAL_VAR(wsrep_start_position),
CMD_LINE(REQUIRED_ARG, OPT_WSREP_START_POSITION),
IN_FS_CHARSET, DEFAULT(wsrep_start_position),
NO_MUTEX_GUARD, NOT_IN_BINLOG,

7
sql/transaction.cc

@ -423,14 +423,7 @@ bool trans_rollback_stmt(THD *thd)
#endif /* WITH_WSREP */
ha_rollback_trans(thd, FALSE);
if (thd->transaction_rollback_request && !thd->in_sub_stmt)
#ifdef WITH_WSREP
{
wsrep_register_hton(thd, TRUE);
#endif /* WITH_WSREP */
ha_rollback_trans(thd, TRUE);
#ifdef WITH_WSREP
}
#endif /* WITH_WSREP */
if (! thd->in_active_multi_stmt_transaction())
{
thd->tx_isolation= (enum_tx_isolation) thd->variables.tx_isolation;

38
sql/wsrep_applier.h

@ -0,0 +1,38 @@
/* Copyright 2013 Codership Oy <http://www.codership.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifndef WSREP_APPLIER_H
#define WSREP_APPLIER_H
#include <sys/types.h>
/* wsrep callback prototypes */
wsrep_cb_status_t wsrep_apply_cb(void *ctx,
const void* buf, size_t buf_len,
uint32_t flags,
const wsrep_trx_meta_t* meta);
wsrep_cb_status_t wsrep_commit_cb(void *ctx,
uint32_t flags,
const wsrep_trx_meta_t* meta,
wsrep_bool_t* exit,
bool commit);
wsrep_cb_status_t wsrep_unordered_cb(void* ctx,
const void* data,
size_t size);
#endif /* WSREP_APPLIER_H */

2
sql/wsrep_hton.cc

@ -68,7 +68,7 @@ handlerton *wsrep_hton;
*/
void wsrep_register_hton(THD* thd, bool all)
{
if (thd->wsrep_exec_mode != TOTAL_ORDER)
if (thd->wsrep_exec_mode != TOTAL_ORDER && !thd->wsrep_apply_toi)
{
THD_TRANS *trans=all ? &thd->transaction.all : &thd->transaction.stmt;
for (Ha_trx_info *i= trans->ha_list; WSREP(thd) && i; i = i->next())

34
sql/wsrep_mysqld.cc

@ -22,6 +22,7 @@
#include "wsrep_utils.h"
#include "wsrep_var.h"
#include "wsrep_binlog.h"
#include "wsrep_applier.h"
#include <cstdio>
#include <cstdlib>
#include "log_event.h"
@ -86,6 +87,7 @@ long long wsrep_cluster_conf_id = WSREP_SEQNO_UNDEFINED;
const char* wsrep_cluster_status = cluster_status_str[WSREP_VIEW_DISCONNECTED];
long wsrep_cluster_size = 0;
long wsrep_local_index = -1;
long long wsrep_local_bf_aborts = 0;
const char* wsrep_provider_name = provider_name;
const char* wsrep_provider_version = provider_version;
const char* wsrep_provider_vendor = provider_vendor;
@ -101,18 +103,6 @@ long wsrep_protocol_version = 2;
// if there was no state gap on receiving first view event.
static my_bool wsrep_startup = TRUE;
extern wsrep_cb_status_t wsrep_apply_cb(void *ctx,
const void* buf, size_t buf_len,
const wsrep_trx_meta_t* meta);
extern wsrep_cb_status_t wsrep_commit_cb(void *ctx,
const wsrep_trx_meta_t* meta,
wsrep_bool_t *exit,
wsrep_bool_t commit);
extern wsrep_cb_status_t wsrep_unordered_cb(void* ctx,
const void* data,
size_t size);
static void wsrep_log_cb(wsrep_log_level_t level, const char *msg) {
switch (level) {
@ -1326,6 +1316,20 @@ int wsrep_to_isolation_begin(THD *thd, char *db_, char *table_,
WSREP_DEBUG("thread holds MDL locks at TI begin: %s %lu",
thd->query(), thd->thread_id);
}
/*
It makes sense to set auto_increment_* to defaults in TOI operations.
Must be done before wsrep_TOI_begin() since Query_log_event encapsulating
TOI statement and auto inc variables for wsrep replication is constructed
there. Variables are reset back in THD::reset_for_next_command() before
processing of next command.
*/
if (wsrep_auto_increment_control)
{
thd->variables.auto_increment_offset = 1;
thd->variables.auto_increment_increment = 1;
}
if (thd->variables.wsrep_on && thd->wsrep_exec_mode==LOCAL_STATE)
{
switch (wsrep_OSU_method_options) {
@ -1336,12 +1340,6 @@ int wsrep_to_isolation_begin(THD *thd, char *db_, char *table_,
if (!ret)
{
thd->wsrep_exec_mode= TOTAL_ORDER;
/* It makes sense to set auto_increment_* to defaults in TOI operations */
if (wsrep_auto_increment_control)
{
thd->variables.auto_increment_offset = 1;
thd->variables.auto_increment_increment = 1;
}
}
}
return ret;

2
sql/wsrep_mysqld.h

@ -94,7 +94,6 @@ extern my_bool wsrep_recovery;
extern my_bool wsrep_replicate_myisam;
extern my_bool wsrep_log_conflicts;
extern ulong wsrep_mysql_replication_bundle;
extern ulong wsrep_mysql_replication_bundle;
extern my_bool wsrep_load_data_splitting;
enum enum_wsrep_OSU_method { WSREP_OSU_TOI, WSREP_OSU_RSU };
@ -107,6 +106,7 @@ extern long long wsrep_cluster_conf_id;
extern const char* wsrep_cluster_status;
extern long wsrep_cluster_size;
extern long wsrep_local_index;
extern long long wsrep_local_bf_aborts;
extern const char* wsrep_provider_name;
extern const char* wsrep_provider_version;
extern const char* wsrep_provider_vendor;

19
sql/wsrep_thd.cc

@ -23,12 +23,24 @@
#include "sql_base.h" // close_thread_tables()
#include "mysqld.h" // start_wsrep_THD();
static long long wsrep_bf_aborts_counter = 0;
int wsrep_show_bf_aborts (THD *thd, SHOW_VAR *var, char *buff)
{
wsrep_local_bf_aborts = my_atomic_load64(&wsrep_bf_aborts_counter);
var->type = SHOW_LONGLONG;
var->value = (char*)&wsrep_local_bf_aborts;
return 0;
}
/* must have (&thd->LOCK_wsrep_thd) */
void wsrep_client_rollback(THD *thd)
{
WSREP_DEBUG("client rollback due to BF abort for (%ld), query: %s",
thd->thread_id, thd->query());
my_atomic_add64(&wsrep_bf_aborts_counter, 1);
thd->wsrep_conflict_state= ABORTING;
mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
trans_rollback(thd);
@ -79,6 +91,7 @@ static Relay_log_info* wsrep_relay_log_init(const char* log_fname)
static void wsrep_prepare_bf_thd(THD *thd, struct wsrep_thd_shadow* shadow)
{
shadow->options = thd->variables.option_bits;
shadow->server_status = thd->server_status;
shadow->wsrep_exec_mode = thd->wsrep_exec_mode;
shadow->vio = thd->net.vio;
@ -96,14 +109,20 @@ static void wsrep_prepare_bf_thd(THD *thd, struct wsrep_thd_shadow* shadow)
shadow->tx_isolation = thd->variables.tx_isolation;
thd->variables.tx_isolation = ISO_READ_COMMITTED;
thd->tx_isolation = ISO_READ_COMMITTED;
shadow->db = thd->db;
shadow->db_length = thd->db_length;
thd->reset_db(NULL, 0);
}
static void wsrep_return_from_bf_mode(THD *thd, struct wsrep_thd_shadow* shadow)
{
thd->variables.option_bits = shadow->options;
thd->server_status = shadow->server_status;
thd->wsrep_exec_mode = shadow->wsrep_exec_mode;
thd->net.vio = shadow->vio;
thd->variables.tx_isolation = shadow->tx_isolation;
thd->reset_db(shadow->db, shadow->db_length);
}
void wsrep_replay_transaction(THD *thd)

1
sql/wsrep_thd.h

@ -18,6 +18,7 @@
#include "sql_class.h"
int wsrep_show_bf_aborts (THD *thd, SHOW_VAR *var, char *buff);
void wsrep_client_rollback(THD *thd);
void wsrep_replay_transaction(THD *thd);
void wsrep_create_appliers(long threads);

15
storage/innobase/handler/ha_innodb.cc

@ -7201,9 +7201,9 @@ no_commit:
DBUG_RETURN(1);
}
binlog_hton->commit(binlog_hton, user_thd, 1);
wsrep_cleanup_transaction(user_thd);
if (binlog_hton->commit(binlog_hton, user_thd, 1))
DBUG_RETURN(1);
wsrep_post_commit(user_thd, TRUE);
#endif /* WITH_WSREP */
/* Source table is not in InnoDB format:
no need to re-acquire locks on it. */
@ -7224,8 +7224,10 @@ no_commit:
case WSREP_TRX_ERROR:
DBUG_RETURN(1);
}
binlog_hton->commit(binlog_hton, user_thd, 1);
wsrep_cleanup_transaction(user_thd);
if (binlog_hton->commit(binlog_hton, user_thd, 1))
DBUG_RETURN(1);
wsrep_post_commit(user_thd, TRUE);
#endif /* WITH_WSREP */
/* Ensure that there are no other table locks than
LOCK_IX and LOCK_AUTO_INC on the destination table. */
@ -16889,7 +16891,8 @@ static int innobase_wsrep_set_checkpoint(handlerton* hton, const XID* xid)
if (wsrep_is_wsrep_xid(xid)) {
mtr_t mtr;
mtr_start(&mtr);
trx_sys_update_wsrep_checkpoint(xid, &mtr);
trx_sysf_t* sys_header = trx_sysf_get(&mtr);
trx_sys_update_wsrep_checkpoint(xid, sys_header, &mtr);
mtr_commit(&mtr);
return 0;
} else {

9
storage/innobase/include/trx0sys.h

@ -296,6 +296,9 @@ trx_sys_update_mysql_binlog_offset(
ib_int64_t offset, /*!< in: position in that log file */
ulint field, /*!< in: offset of the MySQL log info field in
the trx sys header */
#ifdef WITH_WSREP
trx_sysf_t* sys_header, /*!< in: trx sys header */
#endif /* WITH_WSREP */
mtr_t* mtr); /*!< in: mtr */
/*****************************************************************//**
Prints to stderr the MySQL binlog offset info in the trx system header if
@ -308,8 +311,10 @@ trx_sys_print_mysql_binlog_offset(void);
/** Update WSREP checkpoint XID in sys header. */
void
trx_sys_update_wsrep_checkpoint(
const XID* xid, /*!< in: WSREP XID */
mtr_t* mtr); /*!< in: mtr */
const XID* xid, /*!< in: WSREP XID */
trx_sysf_t* sys_header, /*!< in: sys_header */
mtr_t* mtr); /*!< in: mtr */
void
/** Read WSREP checkpoint XID from sys header. */
trx_sys_read_wsrep_checkpoint(

13
storage/innobase/trx/trx0trx.cc

@ -840,7 +840,9 @@ trx_write_serialisation_history(
/*============================*/
trx_t* trx) /*!< in: transaction */
{
#ifdef WITH_WSREP
trx_sysf_t* sys_header;
#endif /* WITH_WSREP */
mtr_t mtr;
trx_rseg_t* rseg;
@ -891,10 +893,11 @@ trx_write_serialisation_history(
MONITOR_INC(MONITOR_TRX_COMMIT_UNDO);
#ifdef WITH_WSREP
sys_header = trx_sysf_get(&mtr);
/* Update latest MySQL wsrep XID in trx sys header. */
if (wsrep_is_wsrep_xid(&trx->xid))
{
//trx_sys_update_wsrep_checkpoint(&trx->xid, &mtr);
trx_sys_update_wsrep_checkpoint(&trx->xid, &mtr);
}
#endif /* WITH_WSREP */
@ -908,7 +911,11 @@ trx_write_serialisation_history(
trx_sys_update_mysql_binlog_offset(
trx->mysql_log_file_name,
trx->mysql_log_offset,
TRX_SYS_MYSQL_LOG_INFO, &mtr);
TRX_SYS_MYSQL_LOG_INFO,
#ifdef WITH_WSREP
sys_header,
#endif /* WITH_WSREP */
&mtr);
trx->mysql_log_file_name = NULL;
}

0
wsrep/CMakeLists.txt → wsrep.moved/CMakeLists.txt

0
wsrep/Makefile.am → wsrep.moved/Makefile.am

1110
wsrep.moved/wsrep_api.h
File diff suppressed because it is too large
View File

383
wsrep.moved/wsrep_dummy.c

@ -0,0 +1,383 @@
/* Copyright (C) 2009-2010 Codership Oy <info@codersihp.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*! @file Dummy wsrep API implementation. */
#include "wsrep_api.h"
#include <errno.h>
#include <stdbool.h>
/*! Dummy backend context. */
typedef struct wsrep_dummy
{
wsrep_log_cb_t log_fn;
} wsrep_dummy_t;
/* Get pointer to wsrep_dummy context from wsrep_t pointer */
#define WSREP_DUMMY(_p) ((wsrep_dummy_t *) (_p)->ctx)
/* Trace function usage a-la DBUG */
#define WSREP_DBUG_ENTER(_w) do { \
if (WSREP_DUMMY(_w)) { \
if (WSREP_DUMMY(_w)->log_fn) \
WSREP_DUMMY(_w)->log_fn(WSREP_LOG_DEBUG, __FUNCTION__); \
} \
} while (0)
static void dummy_free(wsrep_t *w)
{
WSREP_DBUG_ENTER(w);
free(w->ctx);
w->ctx = NULL;
}
static wsrep_status_t dummy_init (wsrep_t* w,
const struct wsrep_init_args* args)
{
WSREP_DUMMY(w)->log_fn = args->logger_cb;
WSREP_DBUG_ENTER(w);
return WSREP_OK;
}
static uint64_t dummy_capabilities (wsrep_t* w __attribute__((unused)))
{
return 0;
}
static wsrep_status_t dummy_options_set(
wsrep_t* w,
const char* conf __attribute__((unused)))
{
WSREP_DBUG_ENTER(w);
return WSREP_OK;
}
static char* dummy_options_get (wsrep_t* w)
{
WSREP_DBUG_ENTER(w);
return NULL;
}
static wsrep_status_t dummy_connect(
wsrep_t* w,
const char* name __attribute__((unused)),
const char* url __attribute__((unused)),
const char* donor __attribute__((unused)),
wsrep_bool_t bootstrap __attribute__((unused)))
{
WSREP_DBUG_ENTER(w);
return WSREP_OK;
}
static wsrep_status_t dummy_disconnect(wsrep_t* w)
{
WSREP_DBUG_ENTER(w);
return WSREP_OK;
}
static wsrep_status_t dummy_recv(wsrep_t* w,
void* recv_ctx __attribute__((unused)))
{
WSREP_DBUG_ENTER(w);
return WSREP_OK;
}
static wsrep_status_t dummy_pre_commit(
wsrep_t* w,
const wsrep_conn_id_t conn_id __attribute__((unused)),
wsrep_ws_handle_t* ws_handle __attribute__((unused)),
// const struct wsrep_buf* data __attribute__((unused)),
// const long count __attribute__((unused)),
uint64_t flags __attribute__((unused)),
wsrep_trx_meta_t* meta __attribute__((unused)))
{
WSREP_DBUG_ENTER(w);
return WSREP_OK;
}
static wsrep_status_t dummy_post_commit(
wsrep_t* w,
wsrep_ws_handle_t* ws_handle __attribute__((unused)))
{
WSREP_DBUG_ENTER(w);
return WSREP_OK;
}
static wsrep_status_t dummy_post_rollback(
wsrep_t* w,
wsrep_ws_handle_t* ws_handle __attribute__((unused)))
{
WSREP_DBUG_ENTER(w);
return WSREP_OK;
}
static wsrep_status_t dummy_replay_trx(
wsrep_t* w,
wsrep_ws_handle_t* ws_handle __attribute__((unused)),
void* trx_ctx __attribute__((unused)))
{
WSREP_DBUG_ENTER(w);
return WSREP_OK;
}
static wsrep_status_t dummy_abort_pre_commit(
wsrep_t* w,
const wsrep_seqno_t bf_seqno __attribute__((unused)),
const wsrep_trx_id_t trx_id __attribute__((unused)))
{
WSREP_DBUG_ENTER(w);
return WSREP_OK;
}
static wsrep_status_t dummy_append_key(
wsrep_t* w,
wsrep_ws_handle_t* ws_handle __attribute__((unused)),
const wsrep_key_t* key __attribute__((unused)),
const int key_num __attribute__((unused)),
const wsrep_key_type_t key_type __attribute__((unused)),
const bool copy __attribute__((unused)))
{
WSREP_DBUG_ENTER(w);
return WSREP_OK;
}
static wsrep_status_t dummy_append_data(
wsrep_t* w,
wsrep_ws_handle_t* ws_handle __attribute__((unused)),
const struct wsrep_buf* data __attribute__((unused)),
const int count __attribute__((unused)),
const wsrep_data_type_t type __attribute__((unused)),
const bool copy __attribute__((unused)))
{
WSREP_DBUG_ENTER(w);
return WSREP_OK;
}
static wsrep_status_t dummy_causal_read(
wsrep_t* w,
wsrep_gtid_t* gtid __attribute__((unused)))
{
WSREP_DBUG_ENTER(w);
return WSREP_OK;
}
static wsrep_status_t dummy_free_connection(
wsrep_t* w,
const wsrep_conn_id_t conn_id __attribute__((unused)))
{
WSREP_DBUG_ENTER(w);
return WSREP_OK;
}
static wsrep_status_t dummy_to_execute_start(
wsrep_t* w,
const wsrep_conn_id_t conn_id __attribute__((unused)),
const wsrep_key_t* key __attribute__((unused)),
const int key_num __attribute__((unused)),
const struct wsrep_buf* data __attribute__((unused)),
const int count __attribute__((unused)),
wsrep_trx_meta_t* meta __attribute__((unused)))
{
WSREP_DBUG_ENTER(w);
return WSREP_OK;
}
static wsrep_status_t dummy_to_execute_end(
wsrep_t* w,
const wsrep_conn_id_t conn_id __attribute__((unused)))
{
WSREP_DBUG_ENTER(w);
return WSREP_OK;
}
static wsrep_status_t dummy_preordered(
wsrep_t* w,
const wsrep_uuid_t* source_id __attribute__((unused)),
int pa_range __attribute__((unused)),
const struct wsrep_buf* data __attribute__((unused)),
int count __attribute__((unused)),
uint64_t flags __attribute__((unused)),
wsrep_bool_t copy __attribute__((unused)))
{
WSREP_DBUG_ENTER(w);
return WSREP_OK;
}
static wsrep_status_t dummy_sst_sent(
wsrep_t* w,
const wsrep_uuid_t* uuid __attribute__((unused)),
wsrep_seqno_t seqno __attribute__((unused)))
{
WSREP_DBUG_ENTER(w);
return WSREP_OK;
}
static wsrep_status_t dummy_sst_received(
wsrep_t* w,
const wsrep_uuid_t* uuid __attribute__((unused)),
const wsrep_seqno_t seqno __attribute__((unused)),
const char* state __attribute__((unused)),
const size_t state_len __attribute__((unused)))
{
WSREP_DBUG_ENTER(w);
return WSREP_OK;
}
static wsrep_status_t dummy_snapshot(
wsrep_t* w,
const void* msg __attribute__((unused)),
const int msg_len __attribute__((unused)),
const char* donor_spec __attribute__((unused)))
{
WSREP_DBUG_ENTER(w);
return WSREP_OK;
}
static struct wsrep_stats_var dummy_stats[] = {
{ NULL, WSREP_VAR_STRING, { 0 } }
};
static struct wsrep_stats_var* dummy_stats_get (wsrep_t* w)
{
WSREP_DBUG_ENTER(w);
return dummy_stats;
}
static void dummy_stats_free (
wsrep_t* w,
struct wsrep_stats_var* stats __attribute__((unused)))
{
WSREP_DBUG_ENTER(w);
}
static void dummy_stats_reset (wsrep_t* w)
{
WSREP_DBUG_ENTER(w);
}
static wsrep_seqno_t dummy_pause (wsrep_t* w)
{
WSREP_DBUG_ENTER(w);
return -ENOSYS;
}
static wsrep_status_t dummy_resume (wsrep_t* w)
{
WSREP_DBUG_ENTER(w);
return WSREP_OK;
}
static wsrep_status_t dummy_desync (wsrep_t* w)
{
WSREP_DBUG_ENTER(w);
return WSREP_NOT_IMPLEMENTED;
}
static wsrep_status_t dummy_resync (wsrep_t* w)
{
WSREP_DBUG_ENTER(w);
return WSREP_OK;
}
static wsrep_status_t dummy_lock (wsrep_t* w,
const char* s __attribute__((unused)),
bool r __attribute__((unused)),
uint64_t o __attribute__((unused)),
int64_t t __attribute__((unused)))
{
WSREP_DBUG_ENTER(w);
return WSREP_NOT_IMPLEMENTED;
}
static wsrep_status_t dummy_unlock (wsrep_t* w,
const char* s __attribute__((unused)),
uint64_t o __attribute__((unused)))
{
WSREP_DBUG_ENTER(w);
return WSREP_OK;
}
static bool dummy_is_locked (wsrep_t* w,
const char* s __attribute__((unused)),
uint64_t* o __attribute__((unused)),
wsrep_uuid_t* t __attribute__((unused)))
{
WSREP_DBUG_ENTER(w);
return false;
}
static wsrep_t dummy_iface = {
WSREP_INTERFACE_VERSION,
&dummy_init,
&dummy_capabilities,
&dummy_options_set,
&dummy_options_get,
&dummy_connect,
&dummy_disconnect,
&dummy_recv,
&dummy_pre_commit,
&dummy_post_commit,
&dummy_post_rollback,
&dummy_replay_trx,
&dummy_abort_pre_commit,
&dummy_append_key,
&dummy_append_data,
&dummy_causal_read,
&dummy_free_connection,
&dummy_to_execute_start,
&dummy_to_execute_end,
&dummy_preordered,
&dummy_sst_sent,
&dummy_sst_received,
&dummy_snapshot,
&dummy_stats_get,
&dummy_stats_free,
&dummy_stats_reset,
&dummy_pause,
&dummy_resume,
&dummy_desync,
&dummy_resync,
&dummy_lock,
&dummy_unlock,
&dummy_is_locked,
WSREP_NONE,
WSREP_INTERFACE_VERSION,
"Codership Oy <info@codership.com>",
0xdeadbeef,
&dummy_free,
NULL,
NULL
};
int wsrep_dummy_loader(wsrep_t* w)
{
if (!w)
return EINVAL;
*w = dummy_iface;
// allocate private context
if (!(w->ctx = malloc(sizeof(wsrep_dummy_t))))
return ENOMEM;
// initialize private context
WSREP_DUMMY(w)->log_fn = NULL;
return 0;
}

0
wsrep/wsrep_loader.c → wsrep.moved/wsrep_loader.c

0
wsrep/wsrep_uuid.c → wsrep.moved/wsrep_uuid.c

14
wsrep/wsrep_api.h

@ -63,7 +63,7 @@ extern "C" {
* *
**************************************************************************/
#define WSREP_INTERFACE_VERSION "24"
#define WSREP_INTERFACE_VERSION "25"
/*! Empty backend spec */
#define WSREP_NONE "none"
@ -118,8 +118,8 @@ typedef void (*wsrep_log_cb_t)(wsrep_log_level_t, const char *);
*
* COMMIT the writeset and all preceding writesets must be committed
* ROLLBACK all preceding writesets in a transaction must be rolled back
* PA_UNSAFE the writeset cannot be applied in parallel
* ISOLATION the writeset must be applied AND committed in isolation
* PA_UNSAFE the writeset cannot be applied in parallel
* COMMUTATIVE the order in which the writeset is applied does not matter
* NATIVE the writeset contains another writeset in this provider format
*
@ -128,8 +128,8 @@ typedef void (*wsrep_log_cb_t)(wsrep_log_level_t, const char *);
*/
#define WSREP_FLAG_COMMIT ( 1ULL << 0 )
#define WSREP_FLAG_ROLLBACK ( 1ULL << 1 )
#define WSREP_FLAG_PA_UNSAFE ( 1ULL << 3 )
#define WSREP_FLAG_ISOLATION ( 1ULL << 2 )
#define WSREP_FLAG_PA_UNSAFE ( 1ULL << 3 )
#define WSREP_FLAG_COMMUTATIVE ( 1ULL << 4 )
#define WSREP_FLAG_NATIVE ( 1ULL << 5 )
@ -349,6 +349,7 @@ typedef enum wsrep_cb_status (*wsrep_view_cb_t) (
* @param recv_ctx receiver context pointer provided by the application
* @param data data buffer containing the writeset
* @param size data buffer size
* @param flags WSREP_FLAG_... flags
* @param meta transaction meta data of the writeset to be applied
*
* @return success code:
@ -360,6 +361,7 @@ typedef enum wsrep_cb_status (*wsrep_apply_cb_t) (
void* recv_ctx,
const void* data,
size_t size,
uint32_t flags,
const wsrep_trx_meta_t* meta
);
@ -370,6 +372,7 @@ typedef enum wsrep_cb_status (*wsrep_apply_cb_t) (
* This handler is called to commit the changes made by apply callback.
*
* @param recv_ctx receiver context pointer provided by the application
* @param flags WSREP_FLAG_... flags
* @param meta transaction meta data of the writeset to be committed
* @param exit set to true to exit recv loop
* @param commit true - commit writeset, false - rollback writeset
@ -380,6 +383,7 @@ typedef enum wsrep_cb_status (*wsrep_apply_cb_t) (
*/
typedef enum wsrep_cb_status (*wsrep_commit_cb_t) (
void* recv_ctx,
uint32_t flags,
const wsrep_trx_meta_t* meta,
wsrep_bool_t* exit,
wsrep_bool_t commit
@ -687,7 +691,7 @@ struct wsrep {
wsrep_status_t (*pre_commit)(wsrep_t* wsrep,
wsrep_conn_id_t conn_id,
wsrep_ws_handle_t* ws_handle,
uint64_t flags,
uint32_t flags,
wsrep_trx_meta_t* meta);
/*!
@ -913,7 +917,7 @@ struct wsrep {
wsrep_status_t (*preordered_commit) (wsrep_t* wsrep,
wsrep_po_handle_t* handle,
const wsrep_uuid_t* source_id,
uint64_t flags,
uint32_t flags,
int pa_range,
wsrep_bool_t commit);

56
wsrep/wsrep_dummy.c

@ -101,9 +101,7 @@ static wsrep_status_t dummy_pre_commit(
wsrep_t* w,
const wsrep_conn_id_t conn_id __attribute__((unused)),
wsrep_ws_handle_t* ws_handle __attribute__((unused)),
// const struct wsrep_buf* data __attribute__((unused)),
// const long count __attribute__((unused)),
uint64_t flags __attribute__((unused)),
uint32_t flags __attribute__((unused)),
wsrep_trx_meta_t* meta __attribute__((unused)))
{
WSREP_DBUG_ENTER(w);
@ -148,7 +146,7 @@ static wsrep_status_t dummy_append_key(
wsrep_t* w,
wsrep_ws_handle_t* ws_handle __attribute__((unused)),
const wsrep_key_t* key __attribute__((unused)),
const int key_num __attribute__((unused)),
const size_t key_num __attribute__((unused)),
const wsrep_key_type_t key_type __attribute__((unused)),
const bool copy __attribute__((unused)))
{
@ -160,7 +158,7 @@ static wsrep_status_t dummy_append_data(
wsrep_t* w,
wsrep_ws_handle_t* ws_handle __attribute__((unused)),
const struct wsrep_buf* data __attribute__((unused)),
const int count __attribute__((unused)),
const size_t count __attribute__((unused)),
const wsrep_data_type_t type __attribute__((unused)),
const bool copy __attribute__((unused)))
{
@ -188,9 +186,9 @@ static wsrep_status_t dummy_to_execute_start(
wsrep_t* w,
const wsrep_conn_id_t conn_id __attribute__((unused)),
const wsrep_key_t* key __attribute__((unused)),
const int key_num __attribute__((unused)),
const size_t key_num __attribute__((unused)),
const struct wsrep_buf* data __attribute__((unused)),
const int count __attribute__((unused)),
const size_t count __attribute__((unused)),
wsrep_trx_meta_t* meta __attribute__((unused)))
{
WSREP_DBUG_ENTER(w);
@ -205,14 +203,24 @@ static wsrep_status_t dummy_to_execute_end(
return WSREP_OK;
}
static wsrep_status_t dummy_preordered(
wsrep_t* w,
const wsrep_uuid_t* source_id __attribute__((unused)),
int pa_range __attribute__((unused)),
const struct wsrep_buf* data __attribute__((unused)),
int count __attribute__((unused)),
uint64_t flags __attribute__((unused)),
wsrep_bool_t copy __attribute__((unused)))
static wsrep_status_t dummy_preordered_collect(
wsrep_t* w,
wsrep_po_handle_t* handle __attribute__((unused)),
const struct wsrep_buf* data __attribute__((unused)),
size_t count __attribute__((unused)),
wsrep_bool_t copy __attribute__((unused)))
{
WSREP_DBUG_ENTER(w);
return WSREP_OK;
}
static wsrep_status_t dummy_preordered_commit(
wsrep_t* w,
wsrep_po_handle_t* handle __attribute__((unused)),
const wsrep_uuid_t* source_id __attribute__((unused)),
uint32_t flags __attribute__((unused)),
int pa_range __attribute__((unused)),
wsrep_bool_t commit __attribute__((unused)))
{
WSREP_DBUG_ENTER(w);
return WSREP_OK;
@ -220,8 +228,8 @@ static wsrep_status_t dummy_preordered(
static wsrep_status_t dummy_sst_sent(
wsrep_t* w,
const wsrep_uuid_t* uuid __attribute__((unused)),
wsrep_seqno_t seqno __attribute__((unused)))
const wsrep_gtid_t* state_id __attribute__((unused)),
const int rcode __attribute__((unused)))
{
WSREP_DBUG_ENTER(w);
return WSREP_OK;
@ -229,10 +237,10 @@ static wsrep_status_t dummy_sst_sent(
static wsrep_status_t dummy_sst_received(
wsrep_t* w,
const wsrep_uuid_t* uuid __attribute__((unused)),
const wsrep_seqno_t seqno __attribute__((unused)),
const char* state __attribute__((unused)),
const size_t state_len __attribute__((unused)))
const wsrep_gtid_t* state_id __attribute__((unused)),
const void* state __attribute__((unused)),
const size_t state_len __attribute__((unused)),
const int rcode __attribute__((unused)))
{
WSREP_DBUG_ENTER(w);
return WSREP_OK;
@ -241,7 +249,7 @@ static wsrep_status_t dummy_sst_received(
static wsrep_status_t dummy_snapshot(
wsrep_t* w,
const void* msg __attribute__((unused)),
const int msg_len __attribute__((unused)),
const size_t msg_len __attribute__((unused)),
const char* donor_spec __attribute__((unused)))
{
WSREP_DBUG_ENTER(w);
@ -341,7 +349,8 @@ static wsrep_t dummy_iface = {
&dummy_free_connection,
&dummy_to_execute_start,
&dummy_to_execute_end,
&dummy_preordered,
&dummy_preordered_collect,
&dummy_preordered_commit,
&dummy_sst_sent,
&dummy_sst_received,
&dummy_snapshot,
@ -358,7 +367,6 @@ static wsrep_t dummy_iface = {
WSREP_NONE,
WSREP_INTERFACE_VERSION,
"Codership Oy <info@codership.com>",
0xdeadbeef,
&dummy_free,
NULL,
NULL

Loading…
Cancel
Save