summaryrefslogtreecommitdiff
path: root/sql/wsrep_applier.h
diff options
context:
space:
mode:
authorJan Lindström <jan.lindstrom@mariadb.com>2018-08-23 17:14:13 +0300
committerJan Lindström <jan.lindstrom@mariadb.com>2018-08-23 17:14:13 +0300
commite4ec889c21ef24fbdfef3d0a36828807241877da (patch)
tree41eb54838e6b6277cb02d0ec3cf7ec0866d78103 /sql/wsrep_applier.h
parentd6d63f4844bf87adb6250d1b1d43e86feab9a5d0 (diff)
parent420cfe4efe72674d4291c0d5a46205ab70b6b91c (diff)
downloadmariadb-git-bb-10.4-galera-jantmp.tar.gz
Merge remote-tracking branch 'wsrep/10.3_wsrep_api-26' into 10.4bb-10.4-galera-jantmp
Conflicts: mysql-test/include/check-testcase.test mysql-test/include/wait_until_connected_again.inc mysql-test/suite/galera/disabled.def mysql-test/suite/galera/r/MW-416.result mysql-test/suite/galera/r/galera#500.result mysql-test/suite/galera/r/galera_var_dirty_reads.result mysql-test/suite/galera/t/MW-416.test mysql-test/suite/galera/t/galera#500.test sql/handler.cc sql/item_strfunc.cc sql/item_strfunc.h sql/slave.cc sql/sql_class.cc sql/sql_class.h sql/sql_connect.cc sql/sql_insert.cc sql/sql_parse.cc sql/sql_plugin.cc sql/sql_prepare.cc sql/wsrep_applier.cc sql/wsrep_mysqld.cc sql/wsrep_mysqld.h sql/wsrep_sst.cc sql/wsrep_thd.cc storage/innobase/handler/ha_innodb.cc
Diffstat (limited to 'sql/wsrep_applier.h')
-rw-r--r--sql/wsrep_applier.h67
1 files changed, 52 insertions, 15 deletions
diff --git a/sql/wsrep_applier.h b/sql/wsrep_applier.h
index f19d2d46d0c..a64c0e5eb12 100644
--- a/sql/wsrep_applier.h
+++ b/sql/wsrep_applier.h
@@ -1,4 +1,4 @@
-/* Copyright 2013 Codership Oy <http://www.codership.com>
+/* Copyright 2013-2015 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
@@ -19,26 +19,63 @@
#include <my_config.h>
#include "../wsrep/wsrep_api.h"
+#include "sql_class.h" // THD class
+
void wsrep_set_apply_format(THD* thd, Format_description_log_event* ev);
Format_description_log_event* wsrep_get_apply_format(THD* thd);
+int wsrep_apply_events(THD* thd,
+ const void* events_buf,
+ size_t buf_len);
+
/* wsrep callback prototypes */
-extern "C" {
-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_apply_cb(void* ctx,
+ const wsrep_ws_handle_t* ws_handle,
+ uint32_t flags,
+ const wsrep_buf_t* buf,
+ const wsrep_trx_meta_t* meta,
+ wsrep_bool_t* exit_loop);
+
+/* Applier error codes, when nothing better is available. */
+#define WSREP_RET_SUCCESS 0 // Success
+#define WSREP_ERR_GENERIC 1 // When in doubt (MySQL default error code)
+#define WSREP_ERR_BAD_EVENT 2 // Can't parse event
+#define WSREP_ERR_NOT_FOUND 3 // Key. table, schema not found
+#define WSREP_ERR_EXISTS 4 // Key, table, schema already exists
+#define WSREP_ERR_WRONG_TYPE 5 // Incompatible data type
+#define WSREP_ERR_FAILED 6 // Operation failed for some internal reason
+#define WSREP_ERR_ABORTED 7 // Operation was aborted externally
+
+class wsrep_apply_error
+{
+public:
+ wsrep_apply_error() : str_(NULL), len_(0) {};
+ ~wsrep_apply_error() { ::free(str_); }
+ /* stores the current THD error info from the diagnostic area. Works only
+ * once, subsequent invocations are ignored in order to preserve the original
+ * condition. */
+ void store(const THD* thd);
+ const char* c_str() const { return str_; }
+ size_t length() const { return len_; }
+ bool is_null() const { return (c_str() == NULL && length() == 0); }
+ wsrep_buf_t get_buf() const
+ {
+ wsrep_buf_t ret= { c_str(), length() };
+ return ret;
+ }
+private:
+ char* str_;
+ size_t len_;
+};
-wsrep_cb_status_t wsrep_commit_cb(void *ctx,
- uint32_t flags,
- const wsrep_trx_meta_t* meta,
- wsrep_bool_t* exit,
- bool commit);
+int wsrep_apply(void* ctx,
+ uint32_t flags,
+ const wsrep_buf_t* buf,
+ const wsrep_trx_meta_t* meta,
+ wsrep_apply_error& err);
-wsrep_cb_status_t wsrep_unordered_cb(void* ctx,
- const void* data,
- size_t size);
+wsrep_cb_status_t wsrep_unordered_cb(void* ctx,
+ const wsrep_buf_t* data);
-} /* extern "C" */
#endif /* WSREP_APPLIER_H */