Skip to content

Commit 27cc2a5

Browse files
committed
Bug#32107056 SEVERAL COMPILE WARNINGS FOR MYSQL CLUSTER ON WINDOWS WITH VS 2019 [#5] [noclose]
storage\ndb\src\common\transporter\TransporterRegistry.cpp(410,33): warning C4150: deletion of pointer to incomplete type 'SHM_Transporter'; no destructor called Change-Id: I8d928d6ce403a9f08d2328bc1e8f934c51892c1e
1 parent 6ef15da commit 27cc2a5

File tree

2 files changed

+47
-18
lines changed

2 files changed

+47
-18
lines changed

storage/ndb/include/transporter/TransporterRegistry.hpp

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,23 @@
5050
#include <NodeBitmask.hpp>
5151
#include <NdbMutex.h>
5252

53+
#ifndef _WIN32
54+
/*
55+
* Shared memory (SHM) transporter is not implemented on Windows.
56+
*
57+
* This macro is not intended for turning SHM transporter feature on and off,
58+
* it should always be on for any platform that supports it.
59+
*
60+
* If one still want to try and build without full SHM transporter, partly
61+
* simulate a Windows build, support one also need to remove:
62+
*
63+
* SET(EXTRA_SRC SHM_Transporter.unix.cpp SHM_Transporter.cpp)
64+
*
65+
* from CMakeLists.txt
66+
*/
67+
#define NDB_SHM_TRANSPORTER_SUPPORTED 1
68+
#endif
69+
5370
// A transporter is always in an IOState.
5471
// NoHalt is used initially and as long as it is no restrictions on
5572
// sending or receiving.
@@ -544,8 +561,10 @@ class TransporterRegistry
544561
Transporter** allTransporters;
545562
Multi_Transporter** theMultiTransporters;
546563
TCP_Transporter** theTCPTransporters;
564+
#ifdef NDB_SHM_TRANSPORTER_SUPPORTED
547565
SHM_Transporter** theSHMTransporters;
548-
566+
#endif
567+
549568
/**
550569
* Array, indexed by nodeId, holding all transporters
551570
*/
@@ -624,7 +643,9 @@ class TransporterRegistry
624643
Uint32 check_TCP(TransporterReceiveHandle&, Uint32 timeoutMillis);
625644
Uint32 spin_check_transporters(TransporterReceiveHandle&);
626645

646+
#ifdef NDB_SHM_TRANSPORTER_SUPPORTED
627647
int m_shm_own_pid;
648+
#endif
628649
Uint32 m_transp_count;
629650

630651
public:

storage/ndb/src/common/transporter/TransporterRegistry.cpp

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
2+
Copyright (c) 2003, 2020, 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,
@@ -35,7 +35,7 @@
3535
#include "Multi_Transporter.hpp"
3636
#include "Loopback_Transporter.hpp"
3737

38-
#ifndef WIN32
38+
#ifdef NDB_SHM_TRANSPORTER_SUPPORTED
3939
#include "SHM_Transporter.hpp"
4040
#endif
4141

@@ -295,7 +295,9 @@ TransporterRegistry::TransporterRegistry(TransporterCallback *callback,
295295

296296
allTransporters = new Transporter* [maxTransporters];
297297
theTCPTransporters = new TCP_Transporter * [maxTransporters];
298+
#ifdef NDB_SHM_TRANSPORTER_SUPPORTED
298299
theSHMTransporters = new SHM_Transporter * [maxTransporters];
300+
#endif
299301
theTransporterTypes = new TransporterType [MAX_NODES];
300302
theNodeIdTransporters = new Transporter * [MAX_NODES];
301303
theMultiTransporters = new Multi_Transporter * [MAX_NODES];
@@ -337,7 +339,9 @@ TransporterRegistry::TransporterRegistry(TransporterCallback *callback,
337339
{
338340
allTransporters[i] = NULL;
339341
theTCPTransporters[i] = NULL;
342+
#ifdef NDB_SHM_TRANSPORTER_SUPPORTED
340343
theSHMTransporters[i] = NULL;
344+
#endif
341345
}
342346
theMultiTransporterMutex = NdbMutex_Create();
343347
DBUG_VOID_RETURN;
@@ -374,7 +378,9 @@ TransporterRegistry::~TransporterRegistry()
374378

375379
delete[] allTransporters;
376380
delete[] theTCPTransporters;
381+
#ifdef NDB_SHM_TRANSPORTER_SUPPORTED
377382
delete[] theSHMTransporters;
383+
#endif
378384
delete[] theTransporterTypes;
379385
delete[] theMultiTransporters;
380386
delete[] theNodeIdTransporters;
@@ -405,10 +411,12 @@ TransporterRegistry::removeAll()
405411
{
406412
delete theTCPTransporters[i];
407413
}
414+
#ifdef NDB_SHM_TRANSPORTER_SUPPORTED
408415
for (Uint32 i = 0; i < nSHMTransporters; i++)
409416
{
410417
delete theSHMTransporters[i];
411418
}
419+
#endif
412420
for (Uint32 i = 0; i < nMultiTransporters; i++)
413421
{
414422
delete theMultiTransporters[i];
@@ -427,7 +435,7 @@ TransporterRegistry::disconnectAll(){
427435
{
428436
theTCPTransporters[i]->doDisconnect();
429437
}
430-
#ifndef WIN32
438+
#ifdef NDB_SHM_TRANSPORTER_SUPPORTED
431439
for (Uint32 i = 0; i < nSHMTransporters; i++)
432440
{
433441
theSHMTransporters[i]->doDisconnect();
@@ -901,7 +909,7 @@ TransporterRegistry::createMultiTransporter(Uint32 node_id, Uint32 num_trps)
901909
new_trp->set_multi_transporter_instance(i + 1);
902910
theTCPTransporters[nTCPTransporters++] = new_trp;
903911
}
904-
#ifndef WIN32
912+
#ifdef NDB_SHM_TRANSPORTER_SUPPORTED
905913
else if (type == tt_SHM_TRANSPORTER)
906914
{
907915
SHM_Transporter *shm_trp = (SHM_Transporter*)base_trp;
@@ -960,7 +968,7 @@ TransporterRegistry::createTCPTransporter(TransporterConfiguration *config) {
960968
bool
961969
TransporterRegistry::createSHMTransporter(TransporterConfiguration *config)
962970
{
963-
#ifndef WIN32
971+
#ifdef NDB_SHM_TRANSPORTER_SUPPORTED
964972
DBUG_ENTER("TransporterRegistry::createTransporter SHM");
965973

966974
/* Don't use index 0, special use case for extra transporters */
@@ -1386,7 +1394,7 @@ TransporterRegistry::poll_SHM(TransporterReceiveHandle& recvdata,
13861394

13871395
Uint32 retVal = 0;
13881396
any_connected = false;
1389-
#ifndef WIN32
1397+
#ifdef NDB_SHM_TRANSPORTER_SUPPORTED
13901398
for (Uint32 i = 0; i < recvdata.nSHMTransporters; i++)
13911399
{
13921400
SHM_Transporter * t = theSHMTransporters[i];
@@ -1415,7 +1423,7 @@ TransporterRegistry::spin_check_transporters(
14151423
TransporterReceiveHandle& recvdata)
14161424
{
14171425
Uint32 res = 0;
1418-
#ifndef WIN32
1426+
#ifdef NDB_SHM_TRANSPORTER_SUPPORTED
14191427
Uint64 micros_passed = 0;
14201428
bool any_connected = false;
14211429
Uint64 spintime = Uint64(recvdata.m_spintime);
@@ -1468,7 +1476,7 @@ TransporterRegistry::pollReceive(Uint32 timeOutMillis,
14681476
timeOutMillis = 0;
14691477
retVal = 1;
14701478
}
1471-
#ifndef WIN32
1479+
#ifdef NDB_SHM_TRANSPORTER_SUPPORTED
14721480
if (recvdata.nSHMTransporters > 0)
14731481
{
14741482
/**
@@ -1532,7 +1540,7 @@ TransporterRegistry::pollReceive(Uint32 timeOutMillis,
15321540
}
15331541
#endif
15341542
retVal |= check_TCP(recvdata, timeOutMillis);
1535-
#ifndef WIN32
1543+
#ifdef NDB_SHM_TRANSPORTER_SUPPORTED
15361544
if (recvdata.nSHMTransporters > 0)
15371545
{
15381546
/**
@@ -1580,7 +1588,7 @@ TransporterRegistry::reset_shm_awake_state(TransporterReceiveHandle& recvdata,
15801588
bool& sleep_state_set)
15811589
{
15821590
int res = 0;
1583-
#ifndef WIN32
1591+
#ifdef NDB_SHM_TRANSPORTER_SUPPORTED
15841592
for (Uint32 i = 0; i < recvdata.nSHMTransporters; i++)
15851593
{
15861594
SHM_Transporter * t = theSHMTransporters[i];
@@ -1622,7 +1630,7 @@ TransporterRegistry::reset_shm_awake_state(TransporterReceiveHandle& recvdata,
16221630
void
16231631
TransporterRegistry::set_shm_awake_state(TransporterReceiveHandle& recvdata)
16241632
{
1625-
#ifndef WIN32
1633+
#ifdef NDB_SHM_TRANSPORTER_SUPPORTED
16261634
for (Uint32 i = 0; i < recvdata.nSHMTransporters; i++)
16271635
{
16281636
SHM_Transporter * t = theSHMTransporters[i];
@@ -1685,7 +1693,7 @@ TransporterRegistry::poll_TCP(Uint32 timeOutMillis,
16851693
}
16861694
}
16871695

1688-
#ifndef WIN32
1696+
#ifdef NDB_SHM_TRANSPORTER_SUPPORTED
16891697
for (Uint32 j = 0; j < recvdata.nSHMTransporters; j++)
16901698
{
16911699
/**
@@ -1737,7 +1745,7 @@ TransporterRegistry::poll_TCP(Uint32 timeOutMillis,
17371745
}
17381746
}
17391747
}
1740-
#ifndef WIN32
1748+
#ifdef NDB_SHM_TRANSPORTER_SUPPORTED
17411749
for (Uint32 j = 0; j < recvdata.nSHMTransporters; j++)
17421750
{
17431751
/**
@@ -1895,7 +1903,7 @@ TransporterRegistry::performReceive(TransporterReceiveHandle& recvdata,
18951903
}
18961904
else
18971905
{
1898-
#ifndef WIN32
1906+
#ifdef NDB_SHM_TRANSPORTER_SUPPORTED
18991907
require(transp->getTransporterType() == tt_SHM_TRANSPORTER);
19001908
SHM_Transporter * t = (SHM_Transporter*)transp;
19011909
assert(recvdata.m_transporters.get(trp_id));
@@ -1980,7 +1988,7 @@ TransporterRegistry::performReceive(TransporterReceiveHandle& recvdata,
19801988
}
19811989
else
19821990
{
1983-
#ifndef WIN32
1991+
#ifdef NDB_SHM_TRANSPORTER_SUPPORTED
19841992
require(t->getTransporterType() == tt_SHM_TRANSPORTER);
19851993
SHM_Transporter *t_shm = (SHM_Transporter*)t;
19861994
Uint32 * readPtr, * eodPtr, * endPtr;
@@ -3133,7 +3141,7 @@ TransporterRegistry::update_connections(TransporterReceiveHandle& recvdata,
31333141

31343142
switch(performStates[nodeId]){
31353143
case CONNECTED:
3136-
#ifndef WIN32
3144+
#ifdef NDB_SHM_TRANSPORTER_SUPPORTED
31373145
if (t->getTransporterType() == tt_SHM_TRANSPORTER)
31383146
{
31393147
SHM_Transporter *shm_trp = (SHM_Transporter*)t;
@@ -3482,7 +3490,7 @@ TransporterRegistry::startReceiving()
34823490
{
34833491
DBUG_ENTER("TransporterRegistry::startReceiving");
34843492

3485-
#ifndef WIN32
3493+
#ifdef NDB_SHM_TRANSPORTER_SUPPORTED
34863494
m_shm_own_pid = getpid();
34873495
#endif
34883496
DBUG_VOID_RETURN;

0 commit comments

Comments
 (0)