23 #include "replication_dictionary.h"
24 #include <drizzled/current_session.h>
55 #include "create_replication.h"
56 #include "read_replication.h"
59 #include <drizzled/drizzled.h>
61 #include <drizzled/replication_services.h>
63 #include <google/protobuf/io/zero_copy_stream.h>
64 #include <google/protobuf/io/zero_copy_stream_impl.h>
65 #include <google/protobuf/io/coded_stream.h>
66 #include <google/protobuf/text_format.h>
69 using namespace drizzled;
75 InnodbReplicationTable::InnodbReplicationTable() :
76 plugin::TableFunction(
"DATA_DICTIONARY",
"INNODB_REPLICATION_LOG")
78 add_field(
"TRANSACTION_ID", plugin::TableFunction::NUMBER, 0,
false);
79 add_field(
"TRANSACTION_SEGMENT_ID", plugin::TableFunction::NUMBER, 0,
false);
80 add_field(
"COMMIT_ID", plugin::TableFunction::NUMBER, 0,
false);
81 add_field(
"END_TIMESTAMP", plugin::TableFunction::NUMBER, 0,
false);
82 add_field(
"ORIGINATING_SERVER_UUID", plugin::TableFunction::STRING, 36,
false);
83 add_field(
"ORIGINATING_COMMIT_ID", plugin::TableFunction::NUMBER, 0,
false);
84 add_field(
"TRANSACTION_MESSAGE_STRING", plugin::TableFunction::STRING, transaction_message_threshold,
false);
85 add_field(
"TRANSACTION_LENGTH", plugin::TableFunction::NUMBER, 0,
false);
88 InnodbReplicationTable::Generator::Generator(
Field **arg) :
89 plugin::TableFunction::Generator(arg)
91 replication_state =replication_read_init();
94 InnodbReplicationTable::Generator::~Generator()
96 replication_read_deinit(replication_state);
99 bool InnodbReplicationTable::Generator::populate()
103 if (ret.message == NULL)
107 push(static_cast<uint64_t>(ret.id));
110 push(static_cast<uint64_t>(ret.seg_id));
112 push(static_cast<uint64_t>(ret.commit_id));
114 push(static_cast<uint64_t>(ret.end_timestamp));
116 push(ret.originating_server_uuid);
118 push(static_cast<uint64_t>(ret.originating_commit_id));
121 bool result= message.ParseFromArray(ret.message, ret.message_length);
125 fprintf(stderr, _(
"Unable to parse transaction. Got error: %s.\n"), message.InitializationErrorString().c_str());
130 google::protobuf::TextFormat::PrintToString(message, &transaction_text);
131 push(transaction_text);
134 push(static_cast<int64_t>(ret.message_length));