Skip to content

Commit 3e7d1a0

Browse files
Bigger better fix for access to R/W nodes only
1 parent a4f2870 commit 3e7d1a0

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

dbcon/dmlpackageproc/dmlpackageprocessor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ int DMLPackageProcessor::rollBackTransaction(uint64_t uniqueId, BRM::TxnID txnID
350350

351351
while (1)
352352
{
353-
if (msgRecived == fWEClient->getPmCount())
353+
if (msgRecived == fWEClient->getRWConnections())
354354
break;
355355

356356
fWEClient->read(uniqueId, bsIn);

writeengine/client/we_clients.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,11 @@ void WEClients::Setup()
310310
}
311311
}
312312

313+
bool WEClient::isConectionReadonly(uint32_t connection)
314+
{
315+
return fPmConnections[connection] == nullptr;
316+
}
317+
313318
int WEClients::Close()
314319
{
315320
makeBusy(false);
@@ -502,9 +507,9 @@ void WEClients::write(const messageqcpp::ByteStream& msg, uint32_t connection)
502507
else
503508
{
504509
// new behavior: connection client is nullptr means it is read-only.
505-
// ostringstream os;
506-
// os << "Lost connection to WriteEngineServer on pm" << connection;
507-
// throw runtime_error(os.str());
510+
ostringstream os;
511+
os << "Connection to readonly pm" << connection;
512+
throw runtime_error(os.str());
508513
}
509514
}
510515

writeengine/client/we_clients.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,18 @@ class WEClients
114114
return pmCount;
115115
}
116116

117+
uint32_t getRWConnections()
118+
{
119+
uint32_t count = 0;
120+
for (uint32_t i = 0; i < fPmConnections.size(); i++)
121+
{
122+
count += fPmConnections[i] != nullptr;
123+
}
124+
return count;
125+
}
126+
127+
bool connectionIsReadonly(uint32_t connection);
128+
117129
private:
118130
WEClients(const WEClients& weClient);
119131
WEClients& operator=(const WEClients& weClient);

0 commit comments

Comments
 (0)