Merge lp:~dshrews/drizzle/bugs_626566_637590 into lp:~drizzle-trunk/drizzle/development

Proposed by David Shrewsbury
Status: Merged
Approved by: Brian Aker
Approved revision: 1762
Merged at revision: 1766
Proposed branch: lp:~dshrews/drizzle/bugs_626566_637590
Merge into: lp:~drizzle-trunk/drizzle/development
Diff against target: 104 lines (+29/-4)
1 file modified
drizzled/transaction_services.cc (+29/-4)
To merge this branch: bzr merge lp:~dshrews/drizzle/bugs_626566_637590
Reviewer Review Type Date Requested Status
Brian Aker Needs Information
Review via email: mp+35353@code.launchpad.net

Description of the change

The segment_id of Statement messages wasn't remaining set to its proper value when a Transaction message had to be split up due to exceed message size. This broke the rollback code since it could not identify bulk load messages.

Also fixed calculating the current message size by using the Transaction message rather than its embedded Statement messages.

Also also, during a ROLLBACK, the transaction id was improperly incremented.

To post a comment you must log in.
Revision history for this message
Brian Aker (brianaker) wrote :

Anyway to add a test case for the rollback?

review: Needs Information
Revision history for this message
David Shrewsbury (dshrews) wrote :

Good question Brian. Since this is testing the GPB messages themselves, we don't yet have a good way to test that part. But I'm working with Patrick to implement a plan to do just that. So this is something that is coming in the near future.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'drizzled/transaction_services.cc'
--- drizzled/transaction_services.cc 2010-09-11 20:23:04 +0000
+++ drizzled/transaction_services.cc 2010-09-14 00:21:01 +0000
@@ -1072,7 +1072,7 @@
1072 * attach it to the transaction, and push it to replicators.1072 * attach it to the transaction, and push it to replicators.
1073 */1073 */
1074 transaction->Clear();1074 transaction->Clear();
1075 initTransactionMessage(*transaction, in_session, true);1075 initTransactionMessage(*transaction, in_session, false);
10761076
1077 message::Statement *statement= transaction->add_statement();1077 message::Statement *statement= transaction->add_statement();
10781078
@@ -1107,12 +1107,14 @@
1107 } 1107 }
1108 else if (statement != NULL)1108 else if (statement != NULL)
1109 {1109 {
1110 transaction= getActiveTransactionMessage(in_session);
1111
1110 /*1112 /*
1111 * If we've passed our threshold for the statement size (possible for1113 * If we've passed our threshold for the statement size (possible for
1112 * a bulk insert), we'll finalize the Statement and Transaction (doing1114 * a bulk insert), we'll finalize the Statement and Transaction (doing
1113 * the Transaction will keep it from getting huge).1115 * the Transaction will keep it from getting huge).
1114 */1116 */
1115 if (static_cast<size_t>(statement->ByteSize()) >= trx_msg_threshold)1117 if (static_cast<size_t>(transaction->ByteSize()) >= trx_msg_threshold)
1116 {1118 {
1117 message::InsertData *current_data= statement->mutable_insert_data();1119 message::InsertData *current_data= statement->mutable_insert_data();
11181120
@@ -1143,11 +1145,18 @@
1143 1145
1144 string current_table_name;1146 string current_table_name;
1145 (void) in_table->getShare()->getTableName(current_table_name);1147 (void) in_table->getShare()->getTableName(current_table_name);
1148
1146 if (current_table_name.compare(old_table_name))1149 if (current_table_name.compare(old_table_name))
1147 {1150 {
1148 finalizeStatementMessage(*statement, in_session);1151 finalizeStatementMessage(*statement, in_session);
1149 statement= in_session->getStatementMessage();1152 statement= in_session->getStatementMessage();
1150 }1153 }
1154 else
1155 {
1156 /* carry forward the existing segment id */
1157 const message::InsertData &current_data= statement->insert_data();
1158 *next_segment_id= current_data.segment_id();
1159 }
1151 }1160 }
1152 } 1161 }
11531162
@@ -1288,12 +1297,14 @@
1288 }1297 }
1289 else if (statement != NULL)1298 else if (statement != NULL)
1290 {1299 {
1300 transaction= getActiveTransactionMessage(in_session);
1301
1291 /*1302 /*
1292 * If we've passed our threshold for the statement size (possible for1303 * If we've passed our threshold for the statement size (possible for
1293 * a bulk insert), we'll finalize the Statement and Transaction (doing1304 * a bulk insert), we'll finalize the Statement and Transaction (doing
1294 * the Transaction will keep it from getting huge).1305 * the Transaction will keep it from getting huge).
1295 */1306 */
1296 if (static_cast<size_t>(statement->ByteSize()) >= trx_msg_threshold)1307 if (static_cast<size_t>(transaction->ByteSize()) >= trx_msg_threshold)
1297 {1308 {
1298 message::UpdateData *current_data= statement->mutable_update_data();1309 message::UpdateData *current_data= statement->mutable_update_data();
12991310
@@ -1329,6 +1340,12 @@
1329 finalizeStatementMessage(*statement, in_session);1340 finalizeStatementMessage(*statement, in_session);
1330 statement= in_session->getStatementMessage();1341 statement= in_session->getStatementMessage();
1331 }1342 }
1343 else
1344 {
1345 /* carry forward the existing segment id */
1346 const message::UpdateData &current_data= statement->update_data();
1347 *next_segment_id= current_data.segment_id();
1348 }
1332 }1349 }
1333 }1350 }
13341351
@@ -1535,12 +1552,14 @@
1535 }1552 }
1536 else if (statement != NULL)1553 else if (statement != NULL)
1537 {1554 {
1555 transaction= getActiveTransactionMessage(in_session);
1556
1538 /*1557 /*
1539 * If we've passed our threshold for the statement size (possible for1558 * If we've passed our threshold for the statement size (possible for
1540 * a bulk insert), we'll finalize the Statement and Transaction (doing1559 * a bulk insert), we'll finalize the Statement and Transaction (doing
1541 * the Transaction will keep it from getting huge).1560 * the Transaction will keep it from getting huge).
1542 */1561 */
1543 if (static_cast<size_t>(statement->ByteSize()) >= trx_msg_threshold)1562 if (static_cast<size_t>(transaction->ByteSize()) >= trx_msg_threshold)
1544 {1563 {
1545 message::DeleteData *current_data= statement->mutable_delete_data();1564 message::DeleteData *current_data= statement->mutable_delete_data();
15461565
@@ -1576,6 +1595,12 @@
1576 finalizeStatementMessage(*statement, in_session);1595 finalizeStatementMessage(*statement, in_session);
1577 statement= in_session->getStatementMessage();1596 statement= in_session->getStatementMessage();
1578 }1597 }
1598 else
1599 {
1600 /* carry forward the existing segment id */
1601 const message::DeleteData &current_data= statement->delete_data();
1602 *next_segment_id= current_data.segment_id();
1603 }
1579 }1604 }
1580 }1605 }
15811606