Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GEODE-10237: Remove no-ack from testThinClientTransactionsWithSticky #959

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 5 additions & 122 deletions cppcache/integration-test/ThinClientTransactions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ const char* nvals[] = {"New Value-1", "New Value-2", "New Value-3",
"New Value-4", "New Value-5", "New Value-6",
"New Value-7"};

const char* regionNames[] = {"DistRegionAck", "DistRegionNoAck", "testregion"};
const char* regionNames[] = {"DistRegionAck", "testregion"};

const bool USE_ACK = true;
const bool NO_ACK = false;
Expand All @@ -375,7 +375,6 @@ class SuspendTransactionThread {

txManager->begin();
createEntry(regionNames[0], keys[4], vals[4]);
createEntry(regionNames[1], keys[5], vals[5]);

tx_ = &txManager->getTransactionId();

Expand Down Expand Up @@ -432,18 +431,10 @@ class ResumeTransactionThread {
auto keyPtr5 = CacheableKey::create(keys[5]);
auto keyPtr6 = CacheableKey::create(keys[6]);

auto regPtr1 = getHelper()->getRegion(regionNames[1]);
THREADERRORCHECK(regPtr1 != nullptr,
"In ResumeTransactionThread - Region not found.");

THREADERRORCHECK(!regPtr0->containsKeyOnServer(keyPtr4),
"In ResumeTransactionThread - Key should not have been "
"found in region.");

THREADERRORCHECK(!regPtr1->containsKeyOnServer(keyPtr5),
"In ResumeTransactionThread - Key should not have been "
"found in region.");

auto txManager = getHelper()->getCache()->getCacheTransactionManager();
if (sleep_) {
THREADERRORCHECK(!txManager->isSuspended(tx_),
Expand All @@ -469,64 +460,27 @@ class ResumeTransactionThread {
THREADERRORCHECK(
regPtr0->containsKeyOnServer(keyPtr4),
"In ResumeTransactionThread - Key should have been found in region.");
THREADERRORCHECK(
regPtr1->containsKeyOnServer(keyPtr5),
"In ResumeTransactionThread - Key should have been found in region.");

createEntry(regionNames[1], keys[6], vals[6]);

if (commit_) {
txManager->commit();
THREADERRORCHECK(
regPtr0->containsKeyOnServer(keyPtr4),
"In ResumeTransactionThread - Key should have been found in region.");
THREADERRORCHECK(
regPtr1->containsKeyOnServer(keyPtr5),
"In ResumeTransactionThread - Key should have been found in region.");
THREADERRORCHECK(
regPtr1->containsKeyOnServer(keyPtr6),
"In ResumeTransactionThread - Key should have been found in region.");

} else {
txManager->rollback();
THREADERRORCHECK(!regPtr0->containsKeyOnServer(keyPtr4),
"In ResumeTransactionThread - Key should not have been "
"found in region.");
THREADERRORCHECK(!regPtr1->containsKeyOnServer(keyPtr5),
"In ResumeTransactionThread - Key should not have been "
"found in region.");
THREADERRORCHECK(!regPtr1->containsKeyOnServer(keyPtr6),
"In ResumeTransactionThread - Key should not have been "
"found in region.");
}

if (commit_) {
regPtr1->destroy(keyPtr6);
regPtr1->destroy(keyPtr5);
regPtr0->destroy(keyPtr4);

THREADERRORCHECK(!regPtr1->containsKeyOnServer(keyPtr6),
"In ResumeTransactionThread - Key should not have been "
"found in region.");
THREADERRORCHECK(!regPtr1->containsKeyOnServer(keyPtr5),
"In ResumeTransactionThread - Key should not have been "
"found in region.");
THREADERRORCHECK(!regPtr0->containsKeyOnServer(keyPtr4),
"In ResumeTransactionThread - Key should not have been "
"found in region.");
} else {
try {
regPtr1->destroy(keyPtr6);
FAIL("Should have got EntryNotFoundException for keyPtr6");
} catch (EntryNotFoundException& /*ex*/) {
LOG("Got expected EntryNotFoundException for keyPtr6");
}
try {
regPtr1->destroy(keyPtr5);
FAIL("Should have got EntryNotFoundException for keyPtr5");
} catch (EntryNotFoundException& /*ex*/) {
LOG("Got expected EntryNotFoundException for keyPtr5");
}
try {
regPtr0->destroy(keyPtr4);
FAIL("Should have got EntryNotFoundException for keyPtr4");
Expand Down Expand Up @@ -580,23 +534,17 @@ DUNIT_TASK_DEFINITION(CLIENT1, SuspendResumeCommit)
auto txManager = getHelper()->getCache()->getCacheTransactionManager();
auto regPtr0 = getHelper()->getRegion(regionNames[0]);
ASSERT(regPtr0 != nullptr, "In SuspendResumeCommit - Region not found.");
auto regPtr1 = getHelper()->getRegion(regionNames[1]);
ASSERT(regPtr1 != nullptr, "In SuspendResumeCommit - Region not found.");
auto keyPtr4 = CacheableKey::create(keys[4]);
auto keyPtr5 = CacheableKey::create(keys[5]);
auto keyPtr6 = CacheableKey::create(keys[6]);

txManager->begin();
createEntry(regionNames[0], keys[4], vals[4]);
createEntry(regionNames[1], keys[5], vals[5]);
auto& m_suspendedTransaction = txManager->suspend();

ASSERT(
!regPtr0->containsKeyOnServer(keyPtr4),
"In SuspendResumeCommit - Key should not have been found in region.");
ASSERT(
!regPtr1->containsKeyOnServer(keyPtr5),
"In SuspendResumeCommit - Key should not have been found in region.");

ASSERT(txManager->isSuspended(m_suspendedTransaction),
"In SuspendResumeCommit - the transaction should be in suspended "
Expand All @@ -611,21 +559,11 @@ DUNIT_TASK_DEFINITION(CLIENT1, SuspendResumeCommit)
"SuspendResumeRollback: Transaction shouldnt have been resumed again");
ASSERT(regPtr0->containsKeyOnServer(keyPtr4),
"In SuspendResumeCommit - Key should have been found in region.");
ASSERT(regPtr1->containsKeyOnServer(keyPtr5),
"In SuspendResumeCommit - Key should have been found in region.");

createEntry(regionNames[1], keys[6], vals[6]);

txManager->commit();
ASSERT(regPtr0->containsKeyOnServer(keyPtr4),
"In SuspendResumeCommit - Key should have been found in region.");
ASSERT(regPtr1->containsKeyOnServer(keyPtr5),
"In SuspendResumeCommit - Key should have been found in region.");
ASSERT(regPtr1->containsKeyOnServer(keyPtr6),
"In SuspendResumeCommit - Key should have been found in region.");

regPtr1->destroy(keyPtr6);
regPtr1->destroy(keyPtr5);
regPtr0->destroy(keyPtr4);

ASSERT(!txManager->isSuspended(m_suspendedTransaction),
Expand Down Expand Up @@ -706,20 +644,14 @@ DUNIT_TASK_DEFINITION(CLIENT1, SuspendResumeRollback)

auto regPtr0 = getHelper()->getRegion(regionNames[0]);
ASSERT(regPtr0 != nullptr, "In SuspendResumeRollback - Region not found.");
auto regPtr1 = getHelper()->getRegion(regionNames[1]);
ASSERT(regPtr1 != nullptr, "In SuspendResumeRollback - Region not found.");

txManager->begin();
createEntry(regionNames[0], keys[4], vals[4]);
createEntry(regionNames[1], keys[5], vals[5]);
auto& m_suspendedTransaction = txManager->suspend();

ASSERT(
!regPtr0->containsKeyOnServer(keyPtr4),
"In SuspendResumeRollback - Key should not have been found in region.");
ASSERT(
!regPtr1->containsKeyOnServer(keyPtr5),
"In SuspendResumeRollback - Key should not have been found in region.");

ASSERT(txManager->isSuspended(m_suspendedTransaction),
"In SuspendResumeRollback the transaction should be in suspended "
Expand All @@ -731,34 +663,12 @@ DUNIT_TASK_DEFINITION(CLIENT1, SuspendResumeRollback)

ASSERT(regPtr0->containsKeyOnServer(keyPtr4),
"In SuspendResumeRollback - Key should have been found in region.");
ASSERT(regPtr1->containsKeyOnServer(keyPtr5),
"In SuspendResumeRollback - Key should have been found in region.");

createEntry(regionNames[1], keys[6], vals[6]);

txManager->rollback();
ASSERT(
!regPtr0->containsKeyOnServer(keyPtr4),
"In SuspendResumeRollback - Key should not have been found in region.");
ASSERT(
!regPtr1->containsKeyOnServer(keyPtr5),
"In SuspendResumeRollback - Key should not have been found in region.");
ASSERT(
!regPtr1->containsKeyOnServer(keyPtr6),
"In SuspendResumeRollback - Key should not have been found in region.");

try {
regPtr1->destroy(keyPtr6);
FAIL("Should have got EntryNotFoundException for keyPtr6");
} catch (EntryNotFoundException& /*ex*/) {
LOG("Got expected EntryNotFoundException for keyPtr6");
}
try {
regPtr1->destroy(keyPtr5);
FAIL("Should have got EntryNotFoundException for keyPtr5");
} catch (EntryNotFoundException& /*ex*/) {
LOG("Got expected EntryNotFoundException for keyPtr5");
}
try {
regPtr0->destroy(keyPtr4);
FAIL("Should have got EntryNotFoundException for keyPtr4");
Expand Down Expand Up @@ -893,7 +803,6 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, CreateClient1PooledRegionWithoutSticky)
{
createPooledRegion(regionNames[0], USE_ACK, locatorsG, "__TESTPOOL1_");
createPooledRegion(regionNames[1], NO_ACK, locatorsG, "__TESTPOOL1_");
LOG("StepOne_Pooled complete.");
}
END_TASK_DEFINITION
Expand All @@ -902,7 +811,6 @@ DUNIT_TASK_DEFINITION(CLIENT1, CreateClient1PooledRegionWithSticky)
{
createPooledRegionSticky(regionNames[0], USE_ACK, locatorsG,
"__TESTPOOL1_");
createPooledRegionSticky(regionNames[1], NO_ACK, locatorsG, "__TESTPOOL1_");
LOG("StepOne_Pooled_Locator_Sticky complete.");
}
END_TASK_DEFINITION
Expand All @@ -911,7 +819,6 @@ DUNIT_TASK_DEFINITION(CLIENT2, CreateClient2PooledRegionWithoutSticky)
{
initClient(true);
createPooledRegion(regionNames[0], USE_ACK, locatorsG, "__TESTPOOL1_");
createPooledRegion(regionNames[1], NO_ACK, locatorsG, "__TESTPOOL1_");
LOG("StepTwo complete.");
}
END_TASK_DEFINITION
Expand All @@ -921,7 +828,6 @@ DUNIT_TASK_DEFINITION(CLIENT2, CreateClient2PooledRegionWithSticky)
initClient(true);
createPooledRegionSticky(regionNames[0], USE_ACK, locatorsG,
"__TESTPOOL1_");
createPooledRegionSticky(regionNames[1], NO_ACK, locatorsG, "__TESTPOOL1_");
LOG("StepTwo complete.");
}
END_TASK_DEFINITION
Expand All @@ -931,7 +837,6 @@ DUNIT_TASK_DEFINITION(CLIENT1, CreateClient1Entries)
auto txManager = getHelper()->getCache()->getCacheTransactionManager();
txManager->begin();
createEntry(regionNames[0], keys[0], vals[0]);
createEntry(regionNames[1], keys[2], vals[2]);
txManager->commit();
LOG("StepThree complete.");
}
Expand All @@ -940,25 +845,19 @@ END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT2, CreateClient2Entries)
{
doNetsearch(regionNames[0], keys[0], vals[0]);
doNetsearch(regionNames[1], keys[2], vals[2]);
auto txManager = getHelper()->getCache()->getCacheTransactionManager();
txManager->begin();
createEntry(regionNames[0], keys[1], vals[1]);
createEntry(regionNames[1], keys[3], vals[3]);
txManager->commit();
verifyEntry(regionNames[0], keys[1], vals[1]);
verifyEntry(regionNames[1], keys[3], vals[3]);
LOG("StepFour complete.");
}
END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT1, UpdateClient1Entries)
{
auto reg0 = getHelper()->getRegion(regionNames[0]);
auto reg1 = getHelper()->getRegion(regionNames[1]);
auto vec0 = reg0->serverKeys();
auto vec1 = reg1->serverKeys();
ASSERT(vec0.size() == 2, "Should have 2 keys in first region.");
ASSERT(vec1.size() == 2, "Should have 2 keys in second region.");
std::string key0, key1;
key0 = vec0[0]->toString().c_str();
key1 = vec0[1]->toString().c_str();
Expand All @@ -968,29 +867,17 @@ DUNIT_TASK_DEFINITION(CLIENT1, UpdateClient1Entries)
ASSERT(key1 == keys[0] || key1 == keys[1],
"Unexpected key in first region.");

key0 = vec1[0]->toString().c_str();
key1 = vec1[1]->toString().c_str();
ASSERT(key0 != key1, "The two keys should be different in second region.");
ASSERT(key0 == keys[2] || key0 == keys[3],
"Unexpected key in second region.");
ASSERT(key1 == keys[2] || key1 == keys[3],
"Unexpected key in second region.");

doNetsearch(regionNames[0], keys[1], vals[1]);
doNetsearch(regionNames[1], keys[3], vals[3]);
updateEntry(regionNames[0], keys[0], nvals[0]);
updateEntry(regionNames[1], keys[2], nvals[2]);
LOG("StepFive complete.");
}
END_TASK_DEFINITION
DUNIT_TASK_DEFINITION(CLIENT2, UpdateClient2Entries)
{
doNetsearch(regionNames[0], keys[0], vals[0]);
doNetsearch(regionNames[1], keys[2], vals[2]);
auto txManager = getHelper()->getCache()->getCacheTransactionManager();
txManager->begin();
updateEntry(regionNames[0], keys[1], nvals[1]);
updateEntry(regionNames[1], keys[3], nvals[3]);
txManager->commit();
LOG("StepSix complete.");
}
Expand All @@ -1002,9 +889,9 @@ END_TASK_DEFINITION

DUNIT_TASK_DEFINITION(CLIENT1, CreateClient1KeyThriceWithoutSticky)
{
createPooledRegion(regionNames[2], NO_ACK, locatorsG, "__TESTPOOL1_", false,
createPooledRegion(regionNames[1], NO_ACK, locatorsG, "__TESTPOOL1_", false,
false);
auto reg = getHelper()->getRegion(regionNames[2]);
auto reg = getHelper()->getRegion(regionNames[1]);
LOG("REGION Created with Caching Enabled false");
auto keyPtr = CacheableKey::create(CREATE_TWICE_KEY);
auto valPtr = CacheableString::create(CREATE_TWICE_VALUE);
Expand All @@ -1030,24 +917,20 @@ END_TASK_DEFINITION

DUNIT_TASK_DEFINITION(CLIENT1, CreateClient1KeyThriceWithSticky)
{
createPooledRegionSticky(regionNames[2], NO_ACK, locatorsG, "__TESTPOOL1_",
createPooledRegionSticky(regionNames[1], NO_ACK, locatorsG, "__TESTPOOL1_",
false, false);
auto reg = getHelper()->getRegion(regionNames[2]);
auto reg = getHelper()->getRegion(regionNames[1]);
LOG("REGION Created with Caching Enabled false");
auto keyPtr = CacheableKey::create(CREATE_TWICE_KEY);
auto valPtr = CacheableString::create(CREATE_TWICE_VALUE);

auto reg0 = getHelper()->getRegion(regionNames[0]);
auto reg1 = getHelper()->getRegion(regionNames[1]);
reg0->localInvalidate(CacheableKey::create(keys[1]));
reg1->localInvalidate(CacheableKey::create(keys[3]));
auto pool = getHelper()->getCache()->getPoolManager().find("__TESTPOOL1_");
ASSERT(pool != nullptr, "Pool Should have been found");
doNetsearch(regionNames[0], keys[1], nvals[1]);
doNetsearch(regionNames[1], keys[3], nvals[3]);
pool->releaseThreadLocalConnection();
updateEntry(regionNames[0], keys[0], nvals[0]);
updateEntry(regionNames[1], keys[2], nvals[2]);
pool->releaseThreadLocalConnection();
try {
reg->create(keyPtr, valPtr);
Expand Down