81
81
* Method which returns the active Transaction message
82
82
* for the supplied Session. If one is not found, a new Transaction
83
* message is allocated, initialized, and returned.
83
* message is allocated, initialized, and returned. It is possible that
84
* we may want to NOT increment the transaction id for a new Transaction
85
* object (e.g., splitting up Transactions into smaller chunks). The
86
* should_inc_trx_id flag controls if we do this.
85
* @param The session processing the transaction
88
* @param in_session The session processing the transaction
89
* @param should_inc_trx_id If true, increments the transaction id for a new trx
87
message::Transaction *getActiveTransactionMessage(Session *in_session);
91
message::Transaction *getActiveTransactionMessage(Session *in_session,
92
bool should_inc_trx_id= true);
89
94
* Method which attaches a transaction context
90
95
* the supplied transaction based on the supplied Session's
91
96
* transaction information. This method also ensure the
92
97
* transaction message is attached properly to the Session object
94
* @param The transaction message to initialize
95
* @param The Session processing this transaction
99
* @param in_transaction The transaction message to initialize
100
* @param in_session The Session processing this transaction
101
* @param should_inc_trx_id If true, increments the transaction id for a new trx
97
void initTransactionMessage(message::Transaction &in_transaction, Session *in_session);
103
void initTransactionMessage(message::Transaction &in_transaction,
105
bool should_inc_trx_id);
99
107
* Helper method which finalizes data members for the
100
108
* supplied transaction's context.
102
* @param The transaction message to finalize
103
* @param The Session processing this transaction
110
* @param in_transaction The transaction message to finalize
111
* @param in_session The Session processing this transaction
105
113
void finalizeTransactionMessage(message::Transaction &in_transaction, Session *in_session);
113
121
* Helper method which initializes a Statement message
115
* @param The statement to initialize
116
* @param The type of the statement
117
* @param The session processing this statement
123
* @param statement The statement to initialize
124
* @param in_type The type of the statement
125
* @param in_session The session processing this statement
119
127
void initStatementMessage(message::Statement &statement,
120
128
message::Statement::Type in_type,
123
131
* Finalizes a Statement message and sets the Session's statement
124
132
* message to NULL.
126
* @param The statement to initialize
127
* @param The session processing this statement
134
* @param statement The statement to initialize
135
* @param in_session The session processing this statement
129
137
void finalizeStatementMessage(message::Statement &statement,
130
138
Session *in_session);
131
139
/** Helper method which returns an initialized Statement message for methods
132
140
* doing insertion of data.
134
* @param[in] Pointer to the Session doing the processing
135
* @param[in] Pointer to the Table object being inserted into
142
* @param[in] in_session Pointer to the Session doing the processing
143
* @param[in] in_table Pointer to the Table object being inserted into
144
* @param[out] next_segment_id The next Statement segment id to be used
137
146
message::Statement &getInsertStatement(Session *in_session,
148
uint32_t *next_segment_id);
141
151
* Helper method which initializes the header message for
142
152
* insert operations.
144
* @param[inout] Statement message container to modify
145
* @param[in] Pointer to the Session doing the processing
146
* @param[in] Pointer to the Table being inserted into
154
* @param[in,out] statement Statement message container to modify
155
* @param[in] in_session Pointer to the Session doing the processing
156
* @param[in] in_table Pointer to the Table being inserted into
148
158
void setInsertHeader(message::Statement &statement,
149
159
Session *in_session,
152
162
* Helper method which returns an initialized Statement
153
163
* message for methods doing updates of data.
155
* @param[in] Pointer to the Session doing the processing
156
* @param[in] Pointer to the Table object being updated
157
* @param[in] Pointer to the old data in the record
158
* @param[in] Pointer to the new data in the record
165
* @param[in] in_session Pointer to the Session doing the processing
166
* @param[in] in_table Pointer to the Table object being updated
167
* @param[in] old_record Pointer to the old data in the record
168
* @param[in] new_record Pointer to the new data in the record
169
* @param[out] next_segment_id The next Statement segment id to be used
160
171
message::Statement &getUpdateStatement(Session *in_session,
162
173
const unsigned char *old_record,
163
const unsigned char *new_record);
174
const unsigned char *new_record,
175
uint32_t *next_segment_id);
165
177
* Helper method which initializes the header message for
166
178
* update operations.
168
* @param[inout] Statement message container to modify
169
* @param[in] Pointer to the Session doing the processing
170
* @param[in] Pointer to the Table being updated
171
* @param[in] Pointer to the old data in the record
172
* @param[in] Pointer to the new data in the record
180
* @param[in,out] statement Statement message container to modify
181
* @param[in] in_session Pointer to the Session doing the processing
182
* @param[in] in_table Pointer to the Table being updated
183
* @param[in] old_record Pointer to the old data in the record
184
* @param[in] new_record Pointer to the new data in the record
174
186
void setUpdateHeader(message::Statement &statement,
175
187
Session *in_session,
180
192
* Helper method which returns an initialized Statement
181
193
* message for methods doing deletion of data.
183
* @param[in] Pointer to the Session doing the processing
184
* @param[in] Pointer to the Table object being deleted from
195
* @param[in] in_session Pointer to the Session doing the processing
196
* @param[in] in_table Pointer to the Table object being deleted from
197
* @param[out] next_segment_id The next Statement segment id to be used
186
199
message::Statement &getDeleteStatement(Session *in_session,
201
uint32_t *next_segment_id);
190
204
* Helper method which initializes the header message for
191
205
* insert operations.
193
* @param[inout] Statement message container to modify
194
* @param[in] Pointer to the Session doing the processing
195
* @param[in] Pointer to the Table being deleted from
207
* @param[in,out] statement Statement message container to modify
208
* @param[in] in_session Pointer to the Session doing the processing
209
* @param[in] in_table Pointer to the Table being deleted from
197
211
void setDeleteHeader(message::Statement &statement,
198
212
Session *in_session,
201
215
* Commits a normal transaction (see above) and pushes the transaction
202
216
* message out to the replicators.
204
* @param Pointer to the Session committing the transaction
218
* @param in_session Pointer to the Session committing the transaction
206
220
int commitTransactionMessage(Session *in_session);
208
222
* Marks the current active transaction message as being rolled back and
209
223
* pushes the transaction message out to replicators.
211
* @param Pointer to the Session committing the transaction
225
* @param in_session Pointer to the Session committing the transaction
213
227
void rollbackTransactionMessage(Session *in_session);
215
229
* Creates a new InsertRecord GPB message and pushes it to
218
* @param Pointer to the Session which has inserted a record
219
* @param Pointer to the Table containing insert information
232
* @param in_session Pointer to the Session which has inserted a record
233
* @param in_table Pointer to the Table containing insert information
221
235
* Grr, returning "true" here on error because of the cursor
222
236
* reversed bool return crap...fix that.
226
240
* Creates a new UpdateRecord GPB message and pushes it to
229
* @param Pointer to the Session which has updated a record
230
* @param Pointer to the Table containing update information
231
* @param Pointer to the raw bytes representing the old record/row
232
* @param Pointer to the raw bytes representing the new record/row
243
* @param in_session Pointer to the Session which has updated a record
244
* @param in_table Pointer to the Table containing update information
245
* @param old_record Pointer to the raw bytes representing the old record/row
246
* @param new_record Pointer to the raw bytes representing the new record/row
234
248
void updateRecord(Session *in_session,
249
263
* to the Session's active Transaction GPB message for pushing
250
264
* out to the replicator streams.
252
* @param[in] Pointer to the Session which issued the statement
253
* @param[in] message::Schema message describing new schema
266
* @param[in] in_session Pointer to the Session which issued the statement
267
* @param[in] schema message::Schema message describing new schema
255
269
void createSchema(Session *in_session, const message::Schema &schema);
258
272
* to the Session's active Transaction GPB message for pushing
259
273
* out to the replicator streams.
261
* @param[in] Pointer to the Session which issued the statement
262
* @param[in] message::Schema message describing new schema
275
* @param[in] in_session Pointer to the Session which issued the statement
276
* @param[in] schema_name message::Schema message describing new schema
264
278
void dropSchema(Session *in_session, const std::string &schema_name);
267
281
* to the Session's active Transaction GPB message for pushing
268
282
* out to the replicator streams.
270
* @param[in] Pointer to the Session which issued the statement
271
* @param[in] message::Table message describing new schema
284
* @param[in] in_session Pointer to the Session which issued the statement
285
* @param[in] table message::Table message describing new schema
273
287
void createTable(Session *in_session, const message::Table &table);
276
290
* to the Session's active Transaction GPB message for pushing
277
291
* out to the replicator streams.
279
* @param[in] Pointer to the Session which issued the statement
280
* @param[in] The schema of the table being dropped
281
* @param[in] The table name of the table being dropped
282
* @param[in] Did the user specify an IF EXISTS clause?
293
* @param[in] in_session Pointer to the Session which issued the statement
294
* @param[in] schema_name The schema of the table being dropped
295
* @param[in] table_name The table name of the table being dropped
296
* @param[in] if_exists Did the user specify an IF EXISTS clause?
284
298
void dropTable(Session *in_session,
285
299
const std::string &schema_name,
290
304
* to the Session's active Transaction GPB message for pushing
291
305
* out to the replicator streams.
293
* @param[in] Pointer to the Session which issued the statement
294
* @param[in] The Table being truncated
307
* @param[in] in_session Pointer to the Session which issued the statement
308
* @param[in] in_table The Table being truncated
296
310
void truncateTable(Session *in_session, Table *in_table);
303
317
* on the I_S, etc. Not sure what to do with administrative
304
318
* commands like CHECK TABLE, though..
306
* @param Pointer to the Session which issued the statement
307
* @param Query string
320
* @param in_session Pointer to the Session which issued the statement
321
* @param query Query string
309
323
void rawStatement(Session *in_session, const std::string &query);
310
324
/* transactions: interface to plugin::StorageEngine functions */
334
348
* per statement, and therefore should not need to be idempotent.
335
349
* Put in assert()s to test this.
337
* @param[in] Session pointer
338
* @param[in] Descriptor for the resource which will be participating
339
* @param[in] Pointer to the TransactionalStorageEngine resource
351
* @param[in] session Session pointer
352
* @param[in] monitored Descriptor for the resource which will be participating
353
* @param[in] engine Pointer to the TransactionalStorageEngine resource
341
355
void registerResourceForStatement(Session *session,
342
356
plugin::MonitoredInTransaction *monitored,
356
370
* per statement, and therefore should not need to be idempotent.
357
371
* Put in assert()s to test this.
359
* @param[in] Session pointer
360
* @param[in] Descriptor for the resource which will be participating
361
* @param[in] Pointer to the TransactionalStorageEngine resource
362
* @param[in] Pointer to the XaResourceManager resource manager
373
* @param[in] session Session pointer
374
* @param[in] monitored Descriptor for the resource which will be participating
375
* @param[in] engine Pointer to the TransactionalStorageEngine resource
376
* @param[in] resource_manager Pointer to the XaResourceManager resource manager
364
378
void registerResourceForStatement(Session *session,
365
379
plugin::MonitoredInTransaction *monitored,