Commit bd256c15 authored by unknown's avatar unknown

ndb - bug#18102: fixes on NDB API level


storage/ndb/test/ndbapi/test_event_merge.cpp:
  test multiple tables and getGCIEventOperations
storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp:
  fix getGCIEventOperations when merge events is on
storage/ndb/src/ndbapi/NdbEventOperationImpl.hpp:
  fix getGCIEventOperations when merge events is on
parent a898dfc5
...@@ -1159,7 +1159,10 @@ NdbEventBuffer::nextEvent() ...@@ -1159,7 +1159,10 @@ NdbEventBuffer::nextEvent()
NdbEventOperationImpl *op= data->m_event_op; NdbEventOperationImpl *op= data->m_event_op;
DBUG_PRINT_EVENT("info", ("available data=%p op=%p", data, op)); DBUG_PRINT_EVENT("info", ("available data=%p op=%p", data, op));
// blob table ops must not be seen at this level /*
* If merge is on, blob part sub-events must not be seen on this level.
* If merge is not on, there are no blob part sub-events.
*/
assert(op->theMainOp == NULL); assert(op->theMainOp == NULL);
// set NdbEventOperation data // set NdbEventOperation data
...@@ -1175,13 +1178,6 @@ NdbEventBuffer::nextEvent() ...@@ -1175,13 +1178,6 @@ NdbEventBuffer::nextEvent()
op->m_data_done_count++; op->m_data_done_count++;
#endif #endif
// NUL event is not returned
if (data->sdata->operation == NdbDictionary::Event::_TE_NUL)
{
DBUG_PRINT_EVENT("info", ("skip _TE_NUL"));
continue;
}
int r= op->receive_event(); int r= op->receive_event();
if (r > 0) if (r > 0)
{ {
...@@ -1203,6 +1199,12 @@ NdbEventBuffer::nextEvent() ...@@ -1203,6 +1199,12 @@ NdbEventBuffer::nextEvent()
gci_ops = m_available_data.next_gci_ops(); gci_ops = m_available_data.next_gci_ops();
} }
assert(gci_ops && (op->getGCI() == gci_ops->m_gci)); assert(gci_ops && (op->getGCI() == gci_ops->m_gci));
// to return TE_NUL it should be made into data event
if (data->sdata->operation == NdbDictionary::Event::_TE_NUL)
{
DBUG_PRINT_EVENT("info", ("skip _TE_NUL"));
continue;
}
DBUG_RETURN_EVENT(op->m_facade); DBUG_RETURN_EVENT(op->m_facade);
} }
// the next event belonged to an event op that is no // the next event belonged to an event op that is no
...@@ -1800,19 +1802,19 @@ NdbEventBuffer::insertDataL(NdbEventOperationImpl *op, ...@@ -1800,19 +1802,19 @@ NdbEventBuffer::insertDataL(NdbEventOperationImpl *op,
else else
{ {
// event with same op, PK found, merge into old buffer // event with same op, PK found, merge into old buffer
Uint32 old_op = data->sdata->operation;
if (unlikely(merge_data(sdata, ptr, data))) if (unlikely(merge_data(sdata, ptr, data)))
{ {
op->m_has_error = 3; op->m_has_error = 3;
DBUG_RETURN_EVENT(-1); DBUG_RETURN_EVENT(-1);
} }
Uint32 new_op = data->sdata->operation; // merge is on so we do not report blob part events
if (! is_blob_event) {
// make Gci_ops reflect the merge by delete old and add new // report actual operation, not composite
EventBufData_list::Gci_op g = { op, (1 << old_op) }; // there is no way to "fix" the flags for a composite op
// bucket->m_data.del_gci_op(g); // XXX whats wrong? fix later // since the flags represent multiple ops on multiple PKs
g.event_types = (1 << new_op); EventBufData_list::Gci_op g = { op, (1 << sdata->operation) };
bucket->m_data.add_gci_op(g); bucket->m_data.add_gci_op(g);
}
} }
DBUG_RETURN_EVENT(0); DBUG_RETURN_EVENT(0);
} }
...@@ -2381,21 +2383,18 @@ void EventBufData_list::append_list(EventBufData_list *list, Uint64 gci) ...@@ -2381,21 +2383,18 @@ void EventBufData_list::append_list(EventBufData_list *list, Uint64 gci)
} }
void void
EventBufData_list::add_gci_op(Gci_op g, bool del) EventBufData_list::add_gci_op(Gci_op g)
{ {
DBUG_ENTER_EVENT("EventBufData_list::add_gci_op"); DBUG_ENTER_EVENT("EventBufData_list::add_gci_op");
DBUG_PRINT_EVENT("info", ("p.op: %p g.event_types: %x", g.op, g.event_types)); DBUG_PRINT_EVENT("info", ("p.op: %p g.event_types: %x", g.op, g.event_types));
assert(g.op != NULL); assert(g.op != NULL && g.op->theMainOp == NULL); // as in nextEvent
Uint32 i; Uint32 i;
for (i = 0; i < m_gci_op_count; i++) { for (i = 0; i < m_gci_op_count; i++) {
if (m_gci_op_list[i].op == g.op) if (m_gci_op_list[i].op == g.op)
break; break;
} }
if (i < m_gci_op_count) { if (i < m_gci_op_count) {
if (! del) m_gci_op_list[i].event_types |= g.event_types;
m_gci_op_list[i].event_types |= g.event_types;
else
m_gci_op_list[i].event_types &= ~ g.event_types;
} else { } else {
if (m_gci_op_count == m_gci_op_alloc) { if (m_gci_op_count == m_gci_op_alloc) {
Uint32 n = 1 + 2 * m_gci_op_alloc; Uint32 n = 1 + 2 * m_gci_op_alloc;
...@@ -2413,7 +2412,6 @@ EventBufData_list::add_gci_op(Gci_op g, bool del) ...@@ -2413,7 +2412,6 @@ EventBufData_list::add_gci_op(Gci_op g, bool del)
m_gci_op_alloc = n; m_gci_op_alloc = n;
} }
assert(m_gci_op_count < m_gci_op_alloc); assert(m_gci_op_count < m_gci_op_alloc);
assert(! del);
#ifndef DBUG_OFF #ifndef DBUG_OFF
i = m_gci_op_count; i = m_gci_op_count;
#endif #endif
......
...@@ -145,9 +145,7 @@ public: ...@@ -145,9 +145,7 @@ public:
Gci_ops *first_gci_ops(); Gci_ops *first_gci_ops();
Gci_ops *next_gci_ops(); Gci_ops *next_gci_ops();
// case 1 above; add Gci_op to single list // case 1 above; add Gci_op to single list
void add_gci_op(Gci_op g, bool del = false); void add_gci_op(Gci_op g);
// delete bit from existing flags
void del_gci_op(Gci_op g) { add_gci_op(g, true); }
private: private:
// case 2 above; move single list or multi list from // case 2 above; move single list or multi list from
// one list to another // one list to another
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment