23 #include "replication_dictionary.h"
24 #include <drizzled/current_session.h>
54 #include "create_replication.h"
55 #include "read_replication.h"
58 #include <drizzled/drizzled.h>
60 #include <drizzled/replication_services.h>
62 #include <google/protobuf/io/zero_copy_stream.h>
63 #include <google/protobuf/io/zero_copy_stream_impl.h>
64 #include <google/protobuf/io/coded_stream.h>
65 #include <google/protobuf/text_format.h>
74 InnodbReplicationTable::InnodbReplicationTable() :
75 plugin::TableFunction(
"DATA_DICTIONARY",
"INNODB_REPLICATION_LOG")
77 add_field(
"TRANSACTION_ID", plugin::TableFunction::NUMBER, 0,
false);
78 add_field(
"TRANSACTION_SEGMENT_ID", plugin::TableFunction::NUMBER, 0,
false);
79 add_field(
"COMMIT_ID", plugin::TableFunction::NUMBER, 0,
false);
80 add_field(
"END_TIMESTAMP", plugin::TableFunction::NUMBER, 0,
false);
81 add_field(
"ORIGINATING_SERVER_UUID", plugin::TableFunction::STRING, 36,
false);
82 add_field(
"ORIGINATING_COMMIT_ID", plugin::TableFunction::NUMBER, 0,
false);
83 add_field(
"TRANSACTION_MESSAGE_STRING", plugin::TableFunction::STRING, transaction_message_threshold,
false);
84 add_field(
"TRANSACTION_LENGTH", plugin::TableFunction::NUMBER, 0,
false);
87 InnodbReplicationTable::Generator::Generator(
Field **arg) :
88 plugin::TableFunction::Generator(arg)
90 replication_state =replication_read_init();
93 InnodbReplicationTable::Generator::~Generator()
95 replication_read_deinit(replication_state);
98 bool InnodbReplicationTable::Generator::populate()
102 if (ret.message == NULL)
106 push(static_cast<uint64_t>(ret.id));
109 push(static_cast<uint64_t>(ret.seg_id));
111 push(static_cast<uint64_t>(ret.commit_id));
113 push(static_cast<uint64_t>(ret.end_timestamp));
115 push(ret.originating_server_uuid);
117 push(static_cast<uint64_t>(ret.originating_commit_id));
120 bool result= message.ParseFromArray(ret.message, ret.message_length);
124 fprintf(stderr, _(
"Unable to parse transaction. Got error: %s.\n"), message.InitializationErrorString().c_str());
129 google::protobuf::TextFormat::PrintToString(message, &transaction_text);
130 push(transaction_text);
133 push(static_cast<int64_t>(ret.message_length));
TODO: Rename this file - func.h is stupid.