Skip to content

Commit 467bffa

Browse files
committed
Bug#33855045 Test ndbinfo_upgrade fails on valgrind builds [#2]
When creating a NdbEventOperationImpl it need reference to a NdbDictionary::Event. Creating a NdbDictionary::Event involves a roundtrip to NDB in order to "open" the Event and return the Event instance. This may fail and is not suitable for doing in a constructor. Fix by moving the opening of NdbDictionary::Event out of NdbEventOperationImpl constructor. Change-Id: I5752f8b636ddd31672ac95f59b8f272a41cddfa9
1 parent 3739f35 commit 467bffa

File tree

4 files changed

+22
-25
lines changed

4 files changed

+22
-25
lines changed

storage/ndb/include/ndbapi/NdbEventOperation.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2003, 2021, Oracle and/or its affiliates.
2+
Copyright (c) 2003, 2022, Oracle and/or its affiliates.
33
44
This program is free software; you can redistribute it and/or modify
55
it under the terms of the GNU General Public License, version 2.0,
@@ -337,7 +337,7 @@ class NdbEventOperation {
337337
friend class NdbEventOperationImpl;
338338
friend class NdbEventBuffer;
339339
#endif
340-
NdbEventOperation(Ndb *theNdb, const char* eventName);
340+
NdbEventOperation(Ndb *ndb, const NdbDictionary::Event *event);
341341
~NdbEventOperation();
342342
class NdbEventOperationImpl &m_impl;
343343
NdbEventOperation(NdbEventOperationImpl& impl);

storage/ndb/src/ndbapi/NdbEventOperation.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2003, 2021, Oracle and/or its affiliates.
2+
Copyright (c) 2003, 2022, Oracle and/or its affiliates.
33
44
This program is free software; you can redistribute it and/or modify
55
it under the terms of the GNU General Public License, version 2.0,
@@ -29,8 +29,9 @@
2929
#include "NdbDictionaryImpl.hpp"
3030
#include <EventLogger.hpp>
3131

32-
NdbEventOperation::NdbEventOperation(Ndb *theNdb,const char* eventName)
33-
: m_impl(* new NdbEventOperationImpl(*this,theNdb,eventName))
32+
NdbEventOperation::NdbEventOperation(Ndb *ndb,
33+
const NdbDictionary::Event *event)
34+
: m_impl(* new NdbEventOperationImpl(*this, ndb, event))
3435
{
3536
}
3637

storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -92,30 +92,18 @@ print_std(const SubTableData * sdata, LinearSectionPtr ptr[3])
9292
// todo free allocated data when closing NdbEventBuffer
9393

9494
NdbEventOperationImpl::NdbEventOperationImpl(NdbEventOperation &f,
95-
Ndb *theNdb,
96-
const char* eventName) :
95+
Ndb *ndb,
96+
const NdbDictionary::Event *event) :
9797
NdbEventOperation(*this),
9898
m_facade(&f),
99-
m_ndb(theNdb),
99+
m_ndb(ndb),
100100
m_state(EO_ERROR),
101101
m_oid(~(Uint32)0),
102102
m_stop_gci(),
103103
m_allow_empty_update(false)
104104
{
105105
DBUG_ENTER("NdbEventOperationImpl::NdbEventOperationImpl");
106-
107-
assert(m_ndb != NULL);
108-
NdbDictionary::Dictionary *myDict = m_ndb->getDictionary();
109-
assert(myDict != NULL);
110-
111-
const NdbDictionary::Event *myEvnt = myDict->getEvent(eventName);
112-
if (!myEvnt)
113-
{
114-
m_error.code= myDict->getNdbError().code;
115-
DBUG_VOID_RETURN;
116-
}
117-
118-
init(myEvnt->m_impl);
106+
init(event->m_impl);
119107
DBUG_VOID_RETURN;
120108
}
121109

@@ -4288,7 +4276,15 @@ NdbEventBuffer::createEventOperation(const char* eventName,
42884276
assert(m_event_queue.is_empty());
42894277
}
42904278

4291-
NdbEventOperation* tOp= new NdbEventOperation(m_ndb, eventName);
4279+
NdbDictionary::Dictionary *dict = m_ndb->getDictionary();
4280+
const NdbDictionary::Event *event = dict->getEvent(eventName);
4281+
if (!event)
4282+
{
4283+
theError.code= dict->getNdbError().code;
4284+
DBUG_RETURN(NULL);
4285+
}
4286+
4287+
NdbEventOperation* tOp= new NdbEventOperation(m_ndb, event);
42924288
if (tOp == 0)
42934289
{
42944290
theError.code= 4000;

storage/ndb/src/ndbapi/NdbEventOperationImpl.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -555,8 +555,8 @@ class EpochDataList
555555
class NdbEventOperationImpl : public NdbEventOperation {
556556
public:
557557
NdbEventOperationImpl(NdbEventOperation &f,
558-
Ndb *theNdb,
559-
const char* eventName);
558+
Ndb *ndb,
559+
const NdbDictionary::Event *myEvnt);
560560
NdbEventOperationImpl(Ndb *theNdb,
561561
NdbEventImpl& evnt);
562562
void init(NdbEventImpl& evnt);
@@ -601,7 +601,7 @@ class NdbEventOperationImpl : public NdbEventOperation {
601601
const NdbError & getNdbError() const;
602602
NdbError m_error;
603603

604-
Ndb *m_ndb;
604+
Ndb *const m_ndb;
605605
NdbEventImpl *m_eventImpl;
606606

607607
NdbRecAttr *theFirstPkAttrs[2];

0 commit comments

Comments
 (0)