Merge lp:~dshrews/drizzle/bug600795 into lp:~drizzle-trunk/drizzle/development
- bug600795
- Merge into development
Status: | Merged |
---|---|
Approved by: | Monty Taylor |
Approved revision: | 1721 |
Merged at revision: | 1735 |
Proposed branch: | lp:~dshrews/drizzle/bug600795 |
Merge into: | lp:~drizzle-trunk/drizzle/development |
Diff against target: |
743 lines (+306/-105) 4 files modified
drizzled/cursor.cc (+1/-0) drizzled/message/transaction_reader.cc (+56/-2) drizzled/transaction_services.cc (+171/-39) drizzled/transaction_services.h (+78/-64) |
To merge this branch: | bzr merge lp:~dshrews/drizzle/bug600795 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Drizzle Merge Team | Pending | ||
Review via email: mp+33919@code.launchpad.net |
Commit message
Description of the change
This enables logging of the INSERTs produced by LOAD DATA.
As a consequence, I had to introduce a transaction message size threshold, because otherwise, we would have a large Transaction object for LOAD DATA that would contain all of the INSERTs for a single LOAD DATA statement. That could use a lot of memory and create a large GPB message, which has a maximum of 64M. (Right now, the transaction message size threshold is hard coded to 1M. I'll make this configurable in the near future once our sys var changes are merged into trunk.)
This means that we may have multiple Transactions in the replication stream for a single transaction, but they will all have the same transaction id, and all but the last Transaction will have the Statement end_segment attribute set to FALSE.
So a reader of the stream (or transaction log) will know to COMMIT when either:
a) The transaction id changes
b) Or, the Statement(s) within the Transaction have end_segment = TRUE
- 1722. By David Shrewsbury
-
Merge from trunk, resolve conflict with transaction_
services. h
Preview Diff
1 | === modified file 'drizzled/cursor.cc' |
2 | --- drizzled/cursor.cc 2010-08-26 17:42:07 +0000 |
3 | +++ drizzled/cursor.cc 2010-08-28 01:13:43 +0000 |
4 | @@ -1363,6 +1363,7 @@ |
5 | break; |
6 | case SQLCOM_INSERT: |
7 | case SQLCOM_INSERT_SELECT: |
8 | + case SQLCOM_LOAD: |
9 | /* |
10 | * The else block below represents an |
11 | * INSERT ... ON DUPLICATE KEY UPDATE that |
12 | |
13 | === modified file 'drizzled/message/transaction_reader.cc' |
14 | --- drizzled/message/transaction_reader.cc 2010-07-17 06:28:29 +0000 |
15 | +++ drizzled/message/transaction_reader.cc 2010-08-28 01:13:43 +0000 |
16 | @@ -95,20 +95,74 @@ |
17 | } |
18 | } |
19 | |
20 | +static bool isEndStatement(const message::Statement &statement) |
21 | +{ |
22 | + switch (statement.type()) |
23 | + { |
24 | + case (message::Statement::INSERT): |
25 | + { |
26 | + const message::InsertData &data= statement.insert_data(); |
27 | + if (not data.end_segment()) |
28 | + return false; |
29 | + break; |
30 | + } |
31 | + case (message::Statement::UPDATE): |
32 | + { |
33 | + const message::UpdateData &data= statement.update_data(); |
34 | + if (not data.end_segment()) |
35 | + return false; |
36 | + break; |
37 | + } |
38 | + case (message::Statement::DELETE): |
39 | + { |
40 | + const message::DeleteData &data= statement.delete_data(); |
41 | + if (not data.end_segment()) |
42 | + return false; |
43 | + break; |
44 | + } |
45 | + default: |
46 | + return true; |
47 | + } |
48 | + return true; |
49 | +} |
50 | + |
51 | static void printTransaction(const message::Transaction &transaction) |
52 | { |
53 | + static uint64_t last_trx_id= 0; |
54 | + bool should_commit= true; |
55 | const message::TransactionContext trx= transaction.transaction_context(); |
56 | |
57 | size_t num_statements= transaction.statement_size(); |
58 | size_t x; |
59 | |
60 | - cout << "START TRANSACTION;" << endl; |
61 | + /* |
62 | + * One way to determine when a new transaction begins is when the |
63 | + * transaction id changes. We check that here. |
64 | + */ |
65 | + if (trx.transaction_id() != last_trx_id) |
66 | + cout << "START TRANSACTION;" << endl; |
67 | + |
68 | + last_trx_id= trx.transaction_id(); |
69 | + |
70 | for (x= 0; x < num_statements; ++x) |
71 | { |
72 | const message::Statement &statement= transaction.statement(x); |
73 | + |
74 | + if (should_commit) |
75 | + should_commit= isEndStatement(statement); |
76 | + |
77 | printStatement(statement); |
78 | } |
79 | - cout << "COMMIT;" << endl; |
80 | + |
81 | + /* |
82 | + * If ALL Statements are end segments, we can commit this Transaction. |
83 | + * We can also check to see if the transaction_id changed, but this |
84 | + * wouldn't work for the last Transaction in the transaction log since |
85 | + * we don't have another Transaction to compare to. Checking for all |
86 | + * end segments (like we do above) covers this case. |
87 | + */ |
88 | + if (should_commit) |
89 | + cout << "COMMIT;" << endl; |
90 | } |
91 | |
92 | int main(int argc, char* argv[]) |
93 | |
94 | === modified file 'drizzled/transaction_services.cc' |
95 | --- drizzled/transaction_services.cc 2010-08-26 15:33:12 +0000 |
96 | +++ drizzled/transaction_services.cc 2010-08-28 01:13:43 +0000 |
97 | @@ -80,6 +80,9 @@ |
98 | namespace drizzled |
99 | { |
100 | |
101 | +/** @TODO: Make this a system variable */ |
102 | +static const size_t trx_msg_threshold= 1024 * 1024; |
103 | + |
104 | /** |
105 | * @defgroup Transactions |
106 | * |
107 | @@ -895,7 +898,7 @@ |
108 | return replication_services.isActive(); |
109 | } |
110 | |
111 | -message::Transaction *TransactionServices::getActiveTransactionMessage(Session *in_session) |
112 | +message::Transaction *TransactionServices::getActiveTransactionMessage(Session *in_session, bool should_inc_trx_id) |
113 | { |
114 | message::Transaction *transaction= in_session->getTransactionMessage(); |
115 | |
116 | @@ -907,7 +910,7 @@ |
117 | * deleting transaction message when done with it. |
118 | */ |
119 | transaction= new (nothrow) message::Transaction(); |
120 | - initTransactionMessage(*transaction, in_session); |
121 | + initTransactionMessage(*transaction, in_session, should_inc_trx_id); |
122 | in_session->setTransactionMessage(transaction); |
123 | return transaction; |
124 | } |
125 | @@ -916,11 +919,17 @@ |
126 | } |
127 | |
128 | void TransactionServices::initTransactionMessage(message::Transaction &in_transaction, |
129 | - Session *in_session) |
130 | + Session *in_session, |
131 | + bool should_inc_trx_id) |
132 | { |
133 | message::TransactionContext *trx= in_transaction.mutable_transaction_context(); |
134 | trx->set_server_id(in_session->getServerId()); |
135 | - trx->set_transaction_id(getNextTransactionId()); |
136 | + |
137 | + if (should_inc_trx_id) |
138 | + trx->set_transaction_id(getNextTransactionId()); |
139 | + else |
140 | + trx->set_transaction_id(getCurrentTransactionId()); |
141 | + |
142 | trx->set_start_timestamp(in_session->getCurrentTimestamp()); |
143 | } |
144 | |
145 | @@ -1014,7 +1023,7 @@ |
146 | * attach it to the transaction, and push it to replicators. |
147 | */ |
148 | transaction->Clear(); |
149 | - initTransactionMessage(*transaction, in_session); |
150 | + initTransactionMessage(*transaction, in_session, true); |
151 | |
152 | message::Statement *statement= transaction->add_statement(); |
153 | |
154 | @@ -1029,9 +1038,11 @@ |
155 | } |
156 | |
157 | message::Statement &TransactionServices::getInsertStatement(Session *in_session, |
158 | - Table *in_table) |
159 | + Table *in_table, |
160 | + uint32_t *next_segment_id) |
161 | { |
162 | message::Statement *statement= in_session->getStatementMessage(); |
163 | + message::Transaction *transaction= NULL; |
164 | |
165 | /* |
166 | * Check the type for the current Statement message, if it is anything |
167 | @@ -1047,21 +1058,59 @@ |
168 | } |
169 | else if (statement != NULL) |
170 | { |
171 | - const message::InsertHeader &insert_header= statement->insert_header(); |
172 | - string old_table_name= insert_header.table_metadata().table_name(); |
173 | + /* |
174 | + * If we've passed our threshold for the statement size (possible for |
175 | + * a bulk insert), we'll finalize the Statement and Transaction (doing |
176 | + * the Transaction will keep it from getting huge). |
177 | + */ |
178 | + if (static_cast<size_t>(statement->ByteSize()) >= trx_msg_threshold) |
179 | + { |
180 | + message::InsertData *current_data= statement->mutable_insert_data(); |
181 | + |
182 | + /* Caller should use this value when adding a new record */ |
183 | + *next_segment_id= current_data->segment_id() + 1; |
184 | + |
185 | + current_data->set_end_segment(false); |
186 | + |
187 | + /* |
188 | + * Send the trx message to replicators after finalizing the |
189 | + * statement and transaction. This will also set the Transaction |
190 | + * and Statement objects in Session to NULL. |
191 | + */ |
192 | + commitTransactionMessage(in_session); |
193 | + |
194 | + /* |
195 | + * Statement and Transaction should now be NULL, so new ones will get |
196 | + * created. We reuse the transaction id since we are segmenting |
197 | + * one transaction. |
198 | + */ |
199 | + statement= in_session->getStatementMessage(); |
200 | + transaction= getActiveTransactionMessage(in_session, false); |
201 | + } |
202 | + else |
203 | + { |
204 | + const message::InsertHeader &insert_header= statement->insert_header(); |
205 | + string old_table_name= insert_header.table_metadata().table_name(); |
206 | |
207 | - string current_table_name; |
208 | - (void) in_table->getShare()->getTableName(current_table_name); |
209 | - if (current_table_name.compare(old_table_name)) |
210 | - { |
211 | - finalizeStatementMessage(*statement, in_session); |
212 | - statement= in_session->getStatementMessage(); |
213 | + string current_table_name; |
214 | + (void) in_table->getShare()->getTableName(current_table_name); |
215 | + if (current_table_name.compare(old_table_name)) |
216 | + { |
217 | + finalizeStatementMessage(*statement, in_session); |
218 | + statement= in_session->getStatementMessage(); |
219 | + } |
220 | } |
221 | } |
222 | |
223 | if (statement == NULL) |
224 | { |
225 | - message::Transaction *transaction= getActiveTransactionMessage(in_session); |
226 | + /* |
227 | + * Transaction will be non-NULL only if we had to segment it due to |
228 | + * transaction size above. |
229 | + */ |
230 | + if (transaction == NULL) |
231 | + transaction= getActiveTransactionMessage(in_session); |
232 | + |
233 | /* |
234 | * Transaction message initialized and set, but no statement created |
235 | * yet. We construct one and initialize it, here, then return the |
236 | @@ -1132,10 +1181,11 @@ |
237 | return true; |
238 | } |
239 | |
240 | - message::Statement &statement= getInsertStatement(in_session, in_table); |
241 | + uint32_t next_segment_id= 1; |
242 | + message::Statement &statement= getInsertStatement(in_session, in_table, &next_segment_id); |
243 | |
244 | message::InsertData *data= statement.mutable_insert_data(); |
245 | - data->set_segment_id(1); |
246 | + data->set_segment_id(next_segment_id); |
247 | data->set_end_segment(true); |
248 | message::InsertRecord *record= data->add_record(); |
249 | |
250 | @@ -1169,9 +1219,11 @@ |
251 | message::Statement &TransactionServices::getUpdateStatement(Session *in_session, |
252 | Table *in_table, |
253 | const unsigned char *old_record, |
254 | - const unsigned char *new_record) |
255 | + const unsigned char *new_record, |
256 | + uint32_t *next_segment_id) |
257 | { |
258 | message::Statement *statement= in_session->getStatementMessage(); |
259 | + message::Transaction *transaction= NULL; |
260 | |
261 | /* |
262 | * Check the type for the current Statement message, if it is anything |
263 | @@ -1187,21 +1239,59 @@ |
264 | } |
265 | else if (statement != NULL) |
266 | { |
267 | - const message::UpdateHeader &update_header= statement->update_header(); |
268 | - string old_table_name= update_header.table_metadata().table_name(); |
269 | - |
270 | - string current_table_name; |
271 | - (void) in_table->getShare()->getTableName(current_table_name); |
272 | - if (current_table_name.compare(old_table_name)) |
273 | + /* |
274 | + * If we've passed our threshold for the statement size (possible for |
275 | + * a bulk insert), we'll finalize the Statement and Transaction (doing |
276 | + * the Transaction will keep it from getting huge). |
277 | + */ |
278 | + if (static_cast<size_t>(statement->ByteSize()) >= trx_msg_threshold) |
279 | { |
280 | - finalizeStatementMessage(*statement, in_session); |
281 | + message::UpdateData *current_data= statement->mutable_update_data(); |
282 | + |
283 | + /* Caller should use this value when adding a new record */ |
284 | + *next_segment_id= current_data->segment_id() + 1; |
285 | + |
286 | + current_data->set_end_segment(false); |
287 | + |
288 | + /* |
289 | + * Send the trx message to replicators after finalizing the |
290 | + * statement and transaction. This will also set the Transaction |
291 | + * and Statement objects in Session to NULL. |
292 | + */ |
293 | + commitTransactionMessage(in_session); |
294 | + |
295 | + /* |
296 | + * Statement and Transaction should now be NULL, so new ones will get |
297 | + * created. We reuse the transaction id since we are segmenting |
298 | + * one transaction. |
299 | + */ |
300 | statement= in_session->getStatementMessage(); |
301 | + transaction= getActiveTransactionMessage(in_session, false); |
302 | + } |
303 | + else |
304 | + { |
305 | + const message::UpdateHeader &update_header= statement->update_header(); |
306 | + string old_table_name= update_header.table_metadata().table_name(); |
307 | + |
308 | + string current_table_name; |
309 | + (void) in_table->getShare()->getTableName(current_table_name); |
310 | + if (current_table_name.compare(old_table_name)) |
311 | + { |
312 | + finalizeStatementMessage(*statement, in_session); |
313 | + statement= in_session->getStatementMessage(); |
314 | + } |
315 | } |
316 | } |
317 | |
318 | if (statement == NULL) |
319 | { |
320 | - message::Transaction *transaction= getActiveTransactionMessage(in_session); |
321 | + /* |
322 | + * Transaction will be non-NULL only if we had to segment it due to |
323 | + * transaction size above. |
324 | + */ |
325 | + if (transaction == NULL) |
326 | + transaction= getActiveTransactionMessage(in_session); |
327 | + |
328 | /* |
329 | * Transaction message initialized and set, but no statement created |
330 | * yet. We construct one and initialize it, here, then return the |
331 | @@ -1288,10 +1378,11 @@ |
332 | if (! replication_services.isActive()) |
333 | return; |
334 | |
335 | - message::Statement &statement= getUpdateStatement(in_session, in_table, old_record, new_record); |
336 | + uint32_t next_segment_id= 1; |
337 | + message::Statement &statement= getUpdateStatement(in_session, in_table, old_record, new_record, &next_segment_id); |
338 | |
339 | message::UpdateData *data= statement.mutable_update_data(); |
340 | - data->set_segment_id(1); |
341 | + data->set_segment_id(next_segment_id); |
342 | data->set_end_segment(true); |
343 | message::UpdateRecord *record= data->add_record(); |
344 | |
345 | @@ -1375,9 +1466,11 @@ |
346 | } |
347 | |
348 | message::Statement &TransactionServices::getDeleteStatement(Session *in_session, |
349 | - Table *in_table) |
350 | + Table *in_table, |
351 | + uint32_t *next_segment_id) |
352 | { |
353 | message::Statement *statement= in_session->getStatementMessage(); |
354 | + message::Transaction *transaction= NULL; |
355 | |
356 | /* |
357 | * Check the type for the current Statement message, if it is anything |
358 | @@ -1393,21 +1486,59 @@ |
359 | } |
360 | else if (statement != NULL) |
361 | { |
362 | - const message::DeleteHeader &delete_header= statement->delete_header(); |
363 | - string old_table_name= delete_header.table_metadata().table_name(); |
364 | - |
365 | - string current_table_name; |
366 | - (void) in_table->getShare()->getTableName(current_table_name); |
367 | - if (current_table_name.compare(old_table_name)) |
368 | + /* |
369 | + * If we've passed our threshold for the statement size (possible for |
370 | + * a bulk insert), we'll finalize the Statement and Transaction (doing |
371 | + * the Transaction will keep it from getting huge). |
372 | + */ |
373 | + if (static_cast<size_t>(statement->ByteSize()) >= trx_msg_threshold) |
374 | { |
375 | - finalizeStatementMessage(*statement, in_session); |
376 | + message::DeleteData *current_data= statement->mutable_delete_data(); |
377 | + |
378 | + /* Caller should use this value when adding a new record */ |
379 | + *next_segment_id= current_data->segment_id() + 1; |
380 | + |
381 | + current_data->set_end_segment(false); |
382 | + |
383 | + /* |
384 | + * Send the trx message to replicators after finalizing the |
385 | + * statement and transaction. This will also set the Transaction |
386 | + * and Statement objects in Session to NULL. |
387 | + */ |
388 | + commitTransactionMessage(in_session); |
389 | + |
390 | + /* |
391 | + * Statement and Transaction should now be NULL, so new ones will get |
392 | + * created. We reuse the transaction id since we are segmenting |
393 | + * one transaction. |
394 | + */ |
395 | statement= in_session->getStatementMessage(); |
396 | + transaction= getActiveTransactionMessage(in_session, false); |
397 | + } |
398 | + else |
399 | + { |
400 | + const message::DeleteHeader &delete_header= statement->delete_header(); |
401 | + string old_table_name= delete_header.table_metadata().table_name(); |
402 | + |
403 | + string current_table_name; |
404 | + (void) in_table->getShare()->getTableName(current_table_name); |
405 | + if (current_table_name.compare(old_table_name)) |
406 | + { |
407 | + finalizeStatementMessage(*statement, in_session); |
408 | + statement= in_session->getStatementMessage(); |
409 | + } |
410 | } |
411 | } |
412 | |
413 | if (statement == NULL) |
414 | { |
415 | - message::Transaction *transaction= getActiveTransactionMessage(in_session); |
416 | + /* |
417 | + * Transaction will be non-NULL only if we had to segment it due to |
418 | + * transaction size above. |
419 | + */ |
420 | + if (transaction == NULL) |
421 | + transaction= getActiveTransactionMessage(in_session); |
422 | + |
423 | /* |
424 | * Transaction message initialized and set, but no statement created |
425 | * yet. We construct one and initialize it, here, then return the |
426 | @@ -1469,10 +1600,11 @@ |
427 | if (! replication_services.isActive()) |
428 | return; |
429 | |
430 | - message::Statement &statement= getDeleteStatement(in_session, in_table); |
431 | + uint32_t next_segment_id; |
432 | + message::Statement &statement= getDeleteStatement(in_session, in_table, &next_segment_id); |
433 | |
434 | message::DeleteData *data= statement.mutable_delete_data(); |
435 | - data->set_segment_id(1); |
436 | + data->set_segment_id(next_segment_id); |
437 | data->set_end_segment(true); |
438 | message::DeleteRecord *record= data->add_record(); |
439 | |
440 | |
441 | === modified file 'drizzled/transaction_services.h' |
442 | --- drizzled/transaction_services.h 2010-08-26 15:33:12 +0000 |
443 | +++ drizzled/transaction_services.h 2010-08-28 01:13:43 +0000 |
444 | @@ -80,27 +80,35 @@ |
445 | /** |
446 | * Method which returns the active Transaction message |
447 | * for the supplied Session. If one is not found, a new Transaction |
448 | - * message is allocated, initialized, and returned. |
449 | + * message is allocated, initialized, and returned. It is possible that |
450 | + * we may want to NOT increment the transaction id for a new Transaction |
451 | + * object (e.g., splitting up Transactions into smaller chunks). The |
452 | + * should_inc_trx_id flag controls if we do this. |
453 | * |
454 | - * @param The session processing the transaction |
455 | + * @param in_session The session processing the transaction |
456 | + * @param should_inc_trx_id If true, increments the transaction id for a new trx |
457 | */ |
458 | - message::Transaction *getActiveTransactionMessage(Session *in_session); |
459 | + message::Transaction *getActiveTransactionMessage(Session *in_session, |
460 | + bool should_inc_trx_id= true); |
461 | /** |
462 | * Method which attaches a transaction context |
463 | * the supplied transaction based on the supplied Session's |
464 | * transaction information. This method also ensure the |
465 | * transaction message is attached properly to the Session object |
466 | * |
467 | - * @param The transaction message to initialize |
468 | - * @param The Session processing this transaction |
469 | + * @param in_transaction The transaction message to initialize |
470 | + * @param in_session The Session processing this transaction |
471 | + * @param should_inc_trx_id If true, increments the transaction id for a new trx |
472 | */ |
473 | - void initTransactionMessage(message::Transaction &in_transaction, Session *in_session); |
474 | + void initTransactionMessage(message::Transaction &in_transaction, |
475 | + Session *in_session, |
476 | + bool should_inc_trx_id); |
477 | /** |
478 | * Helper method which finalizes data members for the |
479 | * supplied transaction's context. |
480 | * |
481 | - * @param The transaction message to finalize |
482 | - * @param The Session processing this transaction |
483 | + * @param in_transaction The transaction message to finalize |
484 | + * @param in_session The Session processing this transaction |
485 | */ |
486 | void finalizeTransactionMessage(message::Transaction &in_transaction, Session *in_session); |
487 | /** |
488 | @@ -112,9 +120,9 @@ |
489 | /** |
490 | * Helper method which initializes a Statement message |
491 | * |
492 | - * @param The statement to initialize |
493 | - * @param The type of the statement |
494 | - * @param The session processing this statement |
495 | + * @param statement The statement to initialize |
496 | + * @param in_type The type of the statement |
497 | + * @param in_session The session processing this statement |
498 | */ |
499 | void initStatementMessage(message::Statement &statement, |
500 | message::Statement::Type in_type, |
501 | @@ -123,27 +131,29 @@ |
502 | * Finalizes a Statement message and sets the Session's statement |
503 | * message to NULL. |
504 | * |
505 | - * @param The statement to initialize |
506 | - * @param The session processing this statement |
507 | + * @param statement The statement to initialize |
508 | + * @param in_session The session processing this statement |
509 | */ |
510 | void finalizeStatementMessage(message::Statement &statement, |
511 | Session *in_session); |
512 | /** Helper method which returns an initialized Statement message for methods |
513 | * doing insertion of data. |
514 | * |
515 | - * @param[in] Pointer to the Session doing the processing |
516 | - * @param[in] Pointer to the Table object being inserted into |
517 | + * @param[in] in_session Pointer to the Session doing the processing |
518 | + * @param[in] in_table Pointer to the Table object being inserted into |
519 | + * @param[out] next_segment_id The next Statement segment id to be used |
520 | */ |
521 | message::Statement &getInsertStatement(Session *in_session, |
522 | - Table *in_table); |
523 | + Table *in_table, |
524 | + uint32_t *next_segment_id); |
525 | |
526 | /** |
527 | * Helper method which initializes the header message for |
528 | * insert operations. |
529 | * |
530 | - * @param[inout] Statement message container to modify |
531 | - * @param[in] Pointer to the Session doing the processing |
532 | - * @param[in] Pointer to the Table being inserted into |
533 | + * @param[in,out] statement Statement message container to modify |
534 | + * @param[in] in_session Pointer to the Session doing the processing |
535 | + * @param[in] in_table Pointer to the Table being inserted into |
536 | */ |
537 | void setInsertHeader(message::Statement &statement, |
538 | Session *in_session, |
539 | @@ -152,24 +162,26 @@ |
540 | * Helper method which returns an initialized Statement |
541 | * message for methods doing updates of data. |
542 | * |
543 | - * @param[in] Pointer to the Session doing the processing |
544 | - * @param[in] Pointer to the Table object being updated |
545 | - * @param[in] Pointer to the old data in the record |
546 | - * @param[in] Pointer to the new data in the record |
547 | + * @param[in] in_session Pointer to the Session doing the processing |
548 | + * @param[in] in_table Pointer to the Table object being updated |
549 | + * @param[in] old_record Pointer to the old data in the record |
550 | + * @param[in] new_record Pointer to the new data in the record |
551 | + * @param[out] next_segment_id The next Statement segment id to be used |
552 | */ |
553 | message::Statement &getUpdateStatement(Session *in_session, |
554 | Table *in_table, |
555 | const unsigned char *old_record, |
556 | - const unsigned char *new_record); |
557 | + const unsigned char *new_record, |
558 | + uint32_t *next_segment_id); |
559 | /** |
560 | * Helper method which initializes the header message for |
561 | * update operations. |
562 | * |
563 | - * @param[inout] Statement message container to modify |
564 | - * @param[in] Pointer to the Session doing the processing |
565 | - * @param[in] Pointer to the Table being updated |
566 | - * @param[in] Pointer to the old data in the record |
567 | - * @param[in] Pointer to the new data in the record |
568 | + * @param[in,out] statement Statement message container to modify |
569 | + * @param[in] in_session Pointer to the Session doing the processing |
570 | + * @param[in] in_table Pointer to the Table being updated |
571 | + * @param[in] old_record Pointer to the old data in the record |
572 | + * @param[in] new_record Pointer to the new data in the record |
573 | */ |
574 | void setUpdateHeader(message::Statement &statement, |
575 | Session *in_session, |
576 | @@ -180,19 +192,21 @@ |
577 | * Helper method which returns an initialized Statement |
578 | * message for methods doing deletion of data. |
579 | * |
580 | - * @param[in] Pointer to the Session doing the processing |
581 | - * @param[in] Pointer to the Table object being deleted from |
582 | + * @param[in] in_session Pointer to the Session doing the processing |
583 | + * @param[in] in_table Pointer to the Table object being deleted from |
584 | + * @param[out] next_segment_id The next Statement segment id to be used |
585 | */ |
586 | message::Statement &getDeleteStatement(Session *in_session, |
587 | - Table *in_table); |
588 | + Table *in_table, |
589 | + uint32_t *next_segment_id); |
590 | |
591 | /** |
592 | * Helper method which initializes the header message for |
593 | * insert operations. |
594 | * |
595 | - * @param[inout] Statement message container to modify |
596 | - * @param[in] Pointer to the Session doing the processing |
597 | - * @param[in] Pointer to the Table being deleted from |
598 | + * @param[in,out] statement Statement message container to modify |
599 | + * @param[in] in_session Pointer to the Session doing the processing |
600 | + * @param[in] in_table Pointer to the Table being deleted from |
601 | */ |
602 | void setDeleteHeader(message::Statement &statement, |
603 | Session *in_session, |
604 | @@ -201,22 +215,22 @@ |
605 | * Commits a normal transaction (see above) and pushes the transaction |
606 | * message out to the replicators. |
607 | * |
608 | - * @param Pointer to the Session committing the transaction |
609 | + * @param in_session Pointer to the Session committing the transaction |
610 | */ |
611 | int commitTransactionMessage(Session *in_session); |
612 | /** |
613 | * Marks the current active transaction message as being rolled back and |
614 | * pushes the transaction message out to replicators. |
615 | * |
616 | - * @param Pointer to the Session committing the transaction |
617 | + * @param in_session Pointer to the Session committing the transaction |
618 | */ |
619 | void rollbackTransactionMessage(Session *in_session); |
620 | /** |
621 | * Creates a new InsertRecord GPB message and pushes it to |
622 | * replicators. |
623 | * |
624 | - * @param Pointer to the Session which has inserted a record |
625 | - * @param Pointer to the Table containing insert information |
626 | + * @param in_session Pointer to the Session which has inserted a record |
627 | + * @param in_table Pointer to the Table containing insert information |
628 | * |
629 | * Grr, returning "true" here on error because of the cursor |
630 | * reversed bool return crap...fix that. |
631 | @@ -226,10 +240,10 @@ |
632 | * Creates a new UpdateRecord GPB message and pushes it to |
633 | * replicators. |
634 | * |
635 | - * @param Pointer to the Session which has updated a record |
636 | - * @param Pointer to the Table containing update information |
637 | - * @param Pointer to the raw bytes representing the old record/row |
638 | - * @param Pointer to the raw bytes representing the new record/row |
639 | + * @param in_session Pointer to the Session which has updated a record |
640 | + * @param in_table Pointer to the Table containing update information |
641 | + * @param old_record Pointer to the raw bytes representing the old record/row |
642 | + * @param new_record Pointer to the raw bytes representing the new record/row |
643 | */ |
644 | void updateRecord(Session *in_session, |
645 | Table *in_table, |
646 | @@ -249,8 +263,8 @@ |
647 | * to the Session's active Transaction GPB message for pushing |
648 | * out to the replicator streams. |
649 | * |
650 | - * @param[in] Pointer to the Session which issued the statement |
651 | - * @param[in] message::Schema message describing new schema |
652 | + * @param[in] in_session Pointer to the Session which issued the statement |
653 | + * @param[in] schema message::Schema message describing new schema |
654 | */ |
655 | void createSchema(Session *in_session, const message::Schema &schema); |
656 | /** |
657 | @@ -258,8 +272,8 @@ |
658 | * to the Session's active Transaction GPB message for pushing |
659 | * out to the replicator streams. |
660 | * |
661 | - * @param[in] Pointer to the Session which issued the statement |
662 | - * @param[in] message::Schema message describing new schema |
663 | + * @param[in] in_session Pointer to the Session which issued the statement |
664 | + * @param[in] schema_name message::Schema message describing new schema |
665 | */ |
666 | void dropSchema(Session *in_session, const std::string &schema_name); |
667 | /** |
668 | @@ -267,8 +281,8 @@ |
669 | * to the Session's active Transaction GPB message for pushing |
670 | * out to the replicator streams. |
671 | * |
672 | - * @param[in] Pointer to the Session which issued the statement |
673 | - * @param[in] message::Table message describing new schema |
674 | + * @param[in] in_session Pointer to the Session which issued the statement |
675 | + * @param[in] table message::Table message describing new schema |
676 | */ |
677 | void createTable(Session *in_session, const message::Table &table); |
678 | /** |
679 | @@ -276,10 +290,10 @@ |
680 | * to the Session's active Transaction GPB message for pushing |
681 | * out to the replicator streams. |
682 | * |
683 | - * @param[in] Pointer to the Session which issued the statement |
684 | - * @param[in] The schema of the table being dropped |
685 | - * @param[in] The table name of the table being dropped |
686 | - * @param[in] Did the user specify an IF EXISTS clause? |
687 | + * @param[in] in_session Pointer to the Session which issued the statement |
688 | + * @param[in] schema_name The schema of the table being dropped |
689 | + * @param[in] table_name The table name of the table being dropped |
690 | + * @param[in] if_exists Did the user specify an IF EXISTS clause? |
691 | */ |
692 | void dropTable(Session *in_session, |
693 | const std::string &schema_name, |
694 | @@ -290,8 +304,8 @@ |
695 | * to the Session's active Transaction GPB message for pushing |
696 | * out to the replicator streams. |
697 | * |
698 | - * @param[in] Pointer to the Session which issued the statement |
699 | - * @param[in] The Table being truncated |
700 | + * @param[in] in_session Pointer to the Session which issued the statement |
701 | + * @param[in] in_table The Table being truncated |
702 | */ |
703 | void truncateTable(Session *in_session, Table *in_table); |
704 | /** |
705 | @@ -303,8 +317,8 @@ |
706 | * on the I_S, etc. Not sure what to do with administrative |
707 | * commands like CHECK TABLE, though.. |
708 | * |
709 | - * @param Pointer to the Session which issued the statement |
710 | - * @param Query string |
711 | + * @param in_session Pointer to the Session which issued the statement |
712 | + * @param query Query string |
713 | */ |
714 | void rawStatement(Session *in_session, const std::string &query); |
715 | /* transactions: interface to plugin::StorageEngine functions */ |
716 | @@ -334,9 +348,9 @@ |
717 | * per statement, and therefore should not need to be idempotent. |
718 | * Put in assert()s to test this. |
719 | * |
720 | - * @param[in] Session pointer |
721 | - * @param[in] Descriptor for the resource which will be participating |
722 | - * @param[in] Pointer to the TransactionalStorageEngine resource |
723 | + * @param[in] session Session pointer |
724 | + * @param[in] monitored Descriptor for the resource which will be participating |
725 | + * @param[in] engine Pointer to the TransactionalStorageEngine resource |
726 | */ |
727 | void registerResourceForStatement(Session *session, |
728 | plugin::MonitoredInTransaction *monitored, |
729 | @@ -356,10 +370,10 @@ |
730 | * per statement, and therefore should not need to be idempotent. |
731 | * Put in assert()s to test this. |
732 | * |
733 | - * @param[in] Session pointer |
734 | - * @param[in] Descriptor for the resource which will be participating |
735 | - * @param[in] Pointer to the TransactionalStorageEngine resource |
736 | - * @param[in] Pointer to the XaResourceManager resource manager |
737 | + * @param[in] session Session pointer |
738 | + * @param[in] monitored Descriptor for the resource which will be participating |
739 | + * @param[in] engine Pointer to the TransactionalStorageEngine resource |
740 | + * @param[in] resource_manager Pointer to the XaResourceManager resource manager |
741 | */ |
742 | void registerResourceForStatement(Session *session, |
743 | plugin::MonitoredInTransaction *monitored, |