Loading mysql-test/r/partition.result +6 −0 Original line number Diff line number Diff line Loading @@ -422,4 +422,10 @@ partition_name partition_description table_rows x123 11,12 1 x234 NULL,1 1 drop table t1; create table t1 (a int) partition by list (a) (partition p0 values in (1)); alter table t1 rebuild partition; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 drop table t1; End of 5.1 tests mysql-test/t/partition.test +12 −0 Original line number Diff line number Diff line Loading @@ -540,4 +540,16 @@ select partition_name, partition_description, table_rows from information_schema.partitions where table_schema ='test'; drop table t1; # # BUG 17947 Crash with REBUILD PARTITION # create table t1 (a int) partition by list (a) (partition p0 values in (1)); --error 1064 alter table t1 rebuild partition; drop table t1; --echo End of 5.1 tests sql/ha_ndbcluster_binlog.cc +1 −1 Original line number Diff line number Diff line Loading @@ -1477,7 +1477,7 @@ ndb_handle_schema_change(THD *thd, Ndb *ndb, NdbEventOperation *pOp, if (do_close_cached_tables) close_cached_tables((THD*) 0, 0, (TABLE_LIST*) 0); return 0; DBUG_RETURN(0); } static int Loading sql/sql_yacc.yy +1 −1 Original line number Diff line number Diff line Loading @@ -4953,7 +4953,7 @@ alter_commands: ; all_or_alt_part_name_list: | ALL ALL { Lex->alter_info.flags|= ALTER_ALL_PARTITION; } Loading storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp +69 −8 Original line number Diff line number Diff line Loading @@ -1117,7 +1117,7 @@ NdbEventBuffer::nextEvent() m_available_data.remove_first(); // add it to used list m_used_data.append(data); m_used_data.append_used_data(data); #ifdef VM_TRACE op->m_data_done_count++; Loading @@ -1144,6 +1144,10 @@ NdbEventBuffer::nextEvent() (void)tBlob->atNextEvent(); tBlob = tBlob->theNext; } EventBufData_list::Gci_ops *gci_ops = m_available_data.first_gci_ops(); while (gci_ops && op->getGCI() > gci_ops->m_gci) gci_ops = m_available_data.next_gci_ops(); assert(gci_ops && (op->getGCI() == gci_ops->m_gci)); DBUG_RETURN_EVENT(op->m_facade); } // the next event belonged to an event op that is no Loading @@ -1158,15 +1162,21 @@ NdbEventBuffer::nextEvent() #ifdef VM_TRACE m_latest_command= m_latest_command_save; #endif // free all "per gci unique" collected operations EventBufData_list::Gci_ops *gci_ops = m_available_data.first_gci_ops(); while (gci_ops) gci_ops = m_available_data.next_gci_ops(); DBUG_RETURN_EVENT(0); } NdbEventOperationImpl* NdbEventBuffer::getGCIEventOperations(Uint32* iter, Uint32* event_types) { if (*iter < m_available_data.m_gci_op_count) EventBufData_list::Gci_ops *gci_ops = m_available_data.first_gci_ops(); if (*iter < gci_ops->m_gci_op_count) { EventBufData_list::Gci_op g = m_available_data.m_gci_op_list[(*iter)++]; EventBufData_list::Gci_op g = gci_ops->m_gci_op_list[(*iter)++]; if (event_types != NULL) *event_types = g.event_types; return g.op; Loading Loading @@ -1318,7 +1328,7 @@ NdbEventBuffer::execSUB_GCP_COMPLETE_REP(const SubGcpCompleteRep * const rep) #ifdef VM_TRACE assert(bucket->m_data.m_count); #endif m_complete_data.m_data.append(bucket->m_data); m_complete_data.m_data.append_list(&bucket->m_data, gci); } reportStatus(); bzero(bucket, sizeof(Gci_container)); Loading Loading @@ -1389,7 +1399,7 @@ NdbEventBuffer::complete_outof_order_gcis() #ifdef VM_TRACE assert(bucket->m_data.m_count); #endif m_complete_data.m_data.append(bucket->m_data); m_complete_data.m_data.append_list(&bucket->m_data, start_gci); #ifdef VM_TRACE ndbout_c(" moved %lld rows -> %lld", bucket->m_data.m_count, m_complete_data.m_data.m_count); Loading Loading @@ -1599,7 +1609,7 @@ NdbEventBuffer::insertDataL(NdbEventOperationImpl *op, data->m_event_op = op; if (! is_blob_event || ! is_data_event) { bucket->m_data.append(data); bucket->m_data.append_data(data); } else { Loading @@ -1615,7 +1625,7 @@ NdbEventBuffer::insertDataL(NdbEventOperationImpl *op, if (ret != 0) // main event was created { main_data->m_event_op = op->theMainOp; bucket->m_data.append(main_data); bucket->m_data.append_data(main_data); if (use_hash) { main_data->m_pkhash = main_hpos.pkhash; Loading Loading @@ -2097,7 +2107,7 @@ NdbEventBuffer::move_data() if (!m_complete_data.m_data.is_empty()) { // move this list to last in m_available_data m_available_data.append(m_complete_data.m_data); m_available_data.append_list(&m_complete_data.m_data, 0); bzero(&m_complete_data, sizeof(m_complete_data)); } Loading Loading @@ -2160,6 +2170,19 @@ NdbEventBuffer::free_list(EventBufData_list &list) list.m_count = list.m_sz = 0; } void EventBufData_list::append_list(EventBufData_list *list, Uint64 gci) { move_gci_ops(list, gci); if (m_tail) m_tail->m_next= list->m_head; else m_head= list->m_head; m_tail= list->m_tail; m_count+= list->m_count; m_sz+= list->m_sz; } void EventBufData_list::add_gci_op(Gci_op g) { Loading Loading @@ -2188,6 +2211,44 @@ EventBufData_list::add_gci_op(Gci_op g) } } void EventBufData_list::move_gci_ops(EventBufData_list *list, Uint64 gci) { assert(!m_is_not_multi_list); if (!list->m_is_not_multi_list) { assert(gci == 0); if (m_gci_ops_list_tail) m_gci_ops_list_tail->m_next = list->m_gci_ops_list; else { m_gci_ops_list = list->m_gci_ops_list; } m_gci_ops_list_tail = list->m_gci_ops_list_tail; goto end; } { Gci_ops *new_gci_ops = new Gci_ops; if (m_gci_ops_list_tail) m_gci_ops_list_tail->m_next = new_gci_ops; else { assert(m_gci_ops_list == 0); m_gci_ops_list = new_gci_ops; } m_gci_ops_list_tail = new_gci_ops; new_gci_ops->m_gci_op_list = list->m_gci_op_list; new_gci_ops->m_gci_op_count = list->m_gci_op_count; new_gci_ops->m_gci = gci; new_gci_ops->m_next = 0; } end: list->m_gci_op_list = 0; list->m_gci_ops_list_tail = 0; list->m_gci_op_alloc = 0; } NdbEventOperation* NdbEventBuffer::createEventOperation(const char* eventName, NdbError &theError) Loading Loading
mysql-test/r/partition.result +6 −0 Original line number Diff line number Diff line Loading @@ -422,4 +422,10 @@ partition_name partition_description table_rows x123 11,12 1 x234 NULL,1 1 drop table t1; create table t1 (a int) partition by list (a) (partition p0 values in (1)); alter table t1 rebuild partition; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 drop table t1; End of 5.1 tests
mysql-test/t/partition.test +12 −0 Original line number Diff line number Diff line Loading @@ -540,4 +540,16 @@ select partition_name, partition_description, table_rows from information_schema.partitions where table_schema ='test'; drop table t1; # # BUG 17947 Crash with REBUILD PARTITION # create table t1 (a int) partition by list (a) (partition p0 values in (1)); --error 1064 alter table t1 rebuild partition; drop table t1; --echo End of 5.1 tests
sql/ha_ndbcluster_binlog.cc +1 −1 Original line number Diff line number Diff line Loading @@ -1477,7 +1477,7 @@ ndb_handle_schema_change(THD *thd, Ndb *ndb, NdbEventOperation *pOp, if (do_close_cached_tables) close_cached_tables((THD*) 0, 0, (TABLE_LIST*) 0); return 0; DBUG_RETURN(0); } static int Loading
sql/sql_yacc.yy +1 −1 Original line number Diff line number Diff line Loading @@ -4953,7 +4953,7 @@ alter_commands: ; all_or_alt_part_name_list: | ALL ALL { Lex->alter_info.flags|= ALTER_ALL_PARTITION; } Loading
storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp +69 −8 Original line number Diff line number Diff line Loading @@ -1117,7 +1117,7 @@ NdbEventBuffer::nextEvent() m_available_data.remove_first(); // add it to used list m_used_data.append(data); m_used_data.append_used_data(data); #ifdef VM_TRACE op->m_data_done_count++; Loading @@ -1144,6 +1144,10 @@ NdbEventBuffer::nextEvent() (void)tBlob->atNextEvent(); tBlob = tBlob->theNext; } EventBufData_list::Gci_ops *gci_ops = m_available_data.first_gci_ops(); while (gci_ops && op->getGCI() > gci_ops->m_gci) gci_ops = m_available_data.next_gci_ops(); assert(gci_ops && (op->getGCI() == gci_ops->m_gci)); DBUG_RETURN_EVENT(op->m_facade); } // the next event belonged to an event op that is no Loading @@ -1158,15 +1162,21 @@ NdbEventBuffer::nextEvent() #ifdef VM_TRACE m_latest_command= m_latest_command_save; #endif // free all "per gci unique" collected operations EventBufData_list::Gci_ops *gci_ops = m_available_data.first_gci_ops(); while (gci_ops) gci_ops = m_available_data.next_gci_ops(); DBUG_RETURN_EVENT(0); } NdbEventOperationImpl* NdbEventBuffer::getGCIEventOperations(Uint32* iter, Uint32* event_types) { if (*iter < m_available_data.m_gci_op_count) EventBufData_list::Gci_ops *gci_ops = m_available_data.first_gci_ops(); if (*iter < gci_ops->m_gci_op_count) { EventBufData_list::Gci_op g = m_available_data.m_gci_op_list[(*iter)++]; EventBufData_list::Gci_op g = gci_ops->m_gci_op_list[(*iter)++]; if (event_types != NULL) *event_types = g.event_types; return g.op; Loading Loading @@ -1318,7 +1328,7 @@ NdbEventBuffer::execSUB_GCP_COMPLETE_REP(const SubGcpCompleteRep * const rep) #ifdef VM_TRACE assert(bucket->m_data.m_count); #endif m_complete_data.m_data.append(bucket->m_data); m_complete_data.m_data.append_list(&bucket->m_data, gci); } reportStatus(); bzero(bucket, sizeof(Gci_container)); Loading Loading @@ -1389,7 +1399,7 @@ NdbEventBuffer::complete_outof_order_gcis() #ifdef VM_TRACE assert(bucket->m_data.m_count); #endif m_complete_data.m_data.append(bucket->m_data); m_complete_data.m_data.append_list(&bucket->m_data, start_gci); #ifdef VM_TRACE ndbout_c(" moved %lld rows -> %lld", bucket->m_data.m_count, m_complete_data.m_data.m_count); Loading Loading @@ -1599,7 +1609,7 @@ NdbEventBuffer::insertDataL(NdbEventOperationImpl *op, data->m_event_op = op; if (! is_blob_event || ! is_data_event) { bucket->m_data.append(data); bucket->m_data.append_data(data); } else { Loading @@ -1615,7 +1625,7 @@ NdbEventBuffer::insertDataL(NdbEventOperationImpl *op, if (ret != 0) // main event was created { main_data->m_event_op = op->theMainOp; bucket->m_data.append(main_data); bucket->m_data.append_data(main_data); if (use_hash) { main_data->m_pkhash = main_hpos.pkhash; Loading Loading @@ -2097,7 +2107,7 @@ NdbEventBuffer::move_data() if (!m_complete_data.m_data.is_empty()) { // move this list to last in m_available_data m_available_data.append(m_complete_data.m_data); m_available_data.append_list(&m_complete_data.m_data, 0); bzero(&m_complete_data, sizeof(m_complete_data)); } Loading Loading @@ -2160,6 +2170,19 @@ NdbEventBuffer::free_list(EventBufData_list &list) list.m_count = list.m_sz = 0; } void EventBufData_list::append_list(EventBufData_list *list, Uint64 gci) { move_gci_ops(list, gci); if (m_tail) m_tail->m_next= list->m_head; else m_head= list->m_head; m_tail= list->m_tail; m_count+= list->m_count; m_sz+= list->m_sz; } void EventBufData_list::add_gci_op(Gci_op g) { Loading Loading @@ -2188,6 +2211,44 @@ EventBufData_list::add_gci_op(Gci_op g) } } void EventBufData_list::move_gci_ops(EventBufData_list *list, Uint64 gci) { assert(!m_is_not_multi_list); if (!list->m_is_not_multi_list) { assert(gci == 0); if (m_gci_ops_list_tail) m_gci_ops_list_tail->m_next = list->m_gci_ops_list; else { m_gci_ops_list = list->m_gci_ops_list; } m_gci_ops_list_tail = list->m_gci_ops_list_tail; goto end; } { Gci_ops *new_gci_ops = new Gci_ops; if (m_gci_ops_list_tail) m_gci_ops_list_tail->m_next = new_gci_ops; else { assert(m_gci_ops_list == 0); m_gci_ops_list = new_gci_ops; } m_gci_ops_list_tail = new_gci_ops; new_gci_ops->m_gci_op_list = list->m_gci_op_list; new_gci_ops->m_gci_op_count = list->m_gci_op_count; new_gci_ops->m_gci = gci; new_gci_ops->m_next = 0; } end: list->m_gci_op_list = 0; list->m_gci_ops_list_tail = 0; list->m_gci_op_alloc = 0; } NdbEventOperation* NdbEventBuffer::createEventOperation(const char* eventName, NdbError &theError) Loading