You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by bb...@apache.org on 2019/05/23 22:15:31 UTC
[geode-native] branch develop updated: GEODE-3287: remove
Assert.hpp (#487)
This is an automated email from the ASF dual-hosted git repository.
bbender pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode-native.git
The following commit(s) were added to refs/heads/develop by this push:
new f23a7fa GEODE-3287: remove Assert.hpp (#487)
f23a7fa is described below
commit f23a7fa78fa13627aae85c3951a4322366a408de
Author: Blake Bender <bb...@pivotal.io>
AuthorDate: Thu May 23 22:15:26 2019 +0000
GEODE-3287: remove Assert.hpp (#487)
* GEODE-3287: Remove Assert.hpp
- The only asserts that were ever enabled were GF_R_ASSERT
- There were only 3 occurrences of GF_R_ASSERT
- Replaced these macros with the code they'd expand to
- Removed all other GF_*_ASSERT* macros
- Deleted Assert.hpp and Assert.cpp
- Going forward just use <cassert> and the assert call from std
Co-authored-by: Matthew Reddington <mr...@pivotal.io>
---
clicache/src/impl/ManagedString.hpp | 4 -
cppcache/src/Assert.cpp | 43 ----------
cppcache/src/Assert.hpp | 100 -----------------------
cppcache/src/CachePerfStats.hpp | 2 -
cppcache/src/ConcurrentEntriesMap.cpp | 2 -
cppcache/src/CppCacheLibrary.cpp | 1 -
cppcache/src/ExpiryTaskManager.cpp | 2 -
cppcache/src/FairQueue.hpp | 3 -
cppcache/src/LRUEntriesMap.cpp | 4 +-
cppcache/src/LRUList.cpp | 3 -
cppcache/src/LocalRegion.cpp | 1 -
cppcache/src/Log.cpp | 2 -
cppcache/src/PoolManagerImpl.cpp | 1 -
cppcache/src/RegionXmlCreation.cpp | 2 -
cppcache/src/TcpConn.cpp | 20 -----
cppcache/src/TcpConn.hpp | 3 -
cppcache/src/TcpSslConn.cpp | 19 -----
cppcache/src/TcpSslConn.hpp | 2 -
cppcache/src/TcrConnection.cpp | 19 -----
cppcache/src/TcrConnectionManager.cpp | 2 -
cppcache/src/TcrDistributionManager.cpp | 4 +-
cppcache/src/TcrEndpoint.cpp | 30 -------
cppcache/src/TcrHADistributionManager.cpp | 4 +-
cppcache/src/TcrMessage.cpp | 4 +-
cppcache/src/ThinClientBaseDM.cpp | 1 -
cppcache/src/ThinClientDistributionManager.cpp | 23 ++----
cppcache/src/ThinClientPoolDM.cpp | 2 -
cppcache/src/ThinClientPoolHADM.cpp | 1 -
cppcache/src/ThinClientRedundancyManager.cpp | 36 --------
cppcache/src/Utils.hpp | 2 -
cppcache/src/statistics/AtomicStatisticsImpl.cpp | 2 -
cppcache/src/statistics/StatArchiveWriter.cpp | 2 -
32 files changed, 14 insertions(+), 332 deletions(-)
diff --git a/clicache/src/impl/ManagedString.hpp b/clicache/src/impl/ManagedString.hpp
index 60bd2a9..8945ba9 100644
--- a/clicache/src/impl/ManagedString.hpp
+++ b/clicache/src/impl/ManagedString.hpp
@@ -72,10 +72,6 @@ namespace Apache
{
System::Runtime::InteropServices::Marshal::FreeHGlobal( m_str );
}
-#if GF_DEVEL_ASSERTS == 1
- throw gcnew System::ApplicationException(
- "Finalizer for ManagedString should not have been called!!" );
-#endif
}
inline static String^ Get( const char* str )
diff --git a/cppcache/src/Assert.cpp b/cppcache/src/Assert.cpp
deleted file mode 100644
index eee59ac..0000000
--- a/cppcache/src/Assert.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "Assert.hpp"
-
-#include <sstream>
-
-#include <boost/stacktrace.hpp>
-
-#include <geode/ExceptionTypes.hpp>
-
-#include "util/Log.hpp"
-
-namespace apache {
-namespace geode {
-namespace client {
-
-void Assert::throwAssertion(const char* expressionText, const char* file,
- int line) {
- AssertionException ae(expressionText);
- LOGERROR("AssertionException: ( %s ) at %s:%d", expressionText, file, line);
- std::stringstream ss;
- ss << boost::stacktrace::stacktrace();
- LOGERROR(ss.str().c_str());
- throw ae;
-}
-} // namespace client
-} // namespace geode
-} // namespace apache
diff --git a/cppcache/src/Assert.hpp b/cppcache/src/Assert.hpp
deleted file mode 100644
index 7350fbc..0000000
--- a/cppcache/src/Assert.hpp
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-
-#ifndef GEODE_ASSERT_H_
-#define GEODE_ASSERT_H_
-
-#include <geode/internal/geode_globals.hpp>
-
-/**
- * @file
- *
- * Assertion functions for debugging
- */
-
-namespace apache {
-namespace geode {
-namespace client {
-
-/**
- * @class Assert Assert.hpp
- *
- * Declares debugging assertion reporting functions.
- */
-class APACHE_GEODE_EXPORT Assert {
- public:
- /** If the given expression is true, does nothing, otherwise calls
- * @ref throwAssertion .
- */
- inline static void assertTrue(bool expression, const char* expressionText,
- const char* file, int line) {
- if (!expression) {
- throwAssertion(expressionText, file, line);
- }
- }
-
- /** Throws the given assertion.
- */
- [[noreturn]] static void throwAssertion(const char* expressionText,
- const char* file, int line);
-};
-} // namespace client
-} // namespace geode
-} // namespace apache
-
-/** Throws the given assertion. */
-#define GF_R_ASSERT(x) \
- apache::geode::client::Assert::assertTrue(x, #x, __FILE__, __LINE__)
-
-#ifndef GF_DEBUG_ASSERTS
-/** Change this to 1 to use assertion functions. */
-#define GF_DEBUG_ASSERTS 0
-#endif
-
-#ifndef GF_DEVEL_ASSERTS
-#define GF_DEVEL_ASSERTS 0
-#endif
-
-#if GF_DEVEL_ASSERTS == 1
-#undef GF_DEBUG_ASSERTS
-#define GF_DEBUG_ASSERTS 1
-#endif
-
-#if GF_DEBUG_ASSERTS == 1
-#undef GF_DEVEL_ASSERTS
-#define GF_DEVEL_ASSERTS 1
-#endif
-
-/** Throws the given assertion if GF_DEBUG_ASSERTS is true. */
-#if GF_DEBUG_ASSERTS == 1
-#define GF_D_ASSERT(x) \
- apache::geode::client::Assert::assertTrue(x, #x, __FILE__, __LINE__)
-#else
-#define GF_D_ASSERT(x)
-#endif
-
-/** Throws the given assertion if GF_DEVEL_ASSERTS is true. */
-#if GF_DEVEL_ASSERTS == 1
-#define GF_DEV_ASSERT(x) \
- apache::geode::client::Assert::assertTrue(x, #x, __FILE__, __LINE__)
-#else
-#define GF_DEV_ASSERT(x)
-#endif
-
-#endif // GEODE_ASSERT_H_
diff --git a/cppcache/src/CachePerfStats.hpp b/cppcache/src/CachePerfStats.hpp
index aac896b..9c7ad7e 100644
--- a/cppcache/src/CachePerfStats.hpp
+++ b/cppcache/src/CachePerfStats.hpp
@@ -22,7 +22,6 @@
#include <geode/internal/geode_globals.hpp>
-#include "Assert.hpp"
#include "statistics/Statistics.hpp"
#include "statistics/StatisticsFactory.hpp"
#include "statistics/StatisticsManager.hpp"
@@ -142,7 +141,6 @@ class APACHE_GEODE_EXPORT CachePerfStats {
"Statistics about native client cache",
statDescArr, 24);
}
- GF_D_ASSERT(statsType != nullptr);
// Create Statistics object
m_cachePerfStats =
factory->createAtomicStatistics(statsType, "CachePerfStats");
diff --git a/cppcache/src/ConcurrentEntriesMap.cpp b/cppcache/src/ConcurrentEntriesMap.cpp
index 090e560..b1983f4 100644
--- a/cppcache/src/ConcurrentEntriesMap.cpp
+++ b/cppcache/src/ConcurrentEntriesMap.cpp
@@ -39,8 +39,6 @@ ConcurrentEntriesMap::ConcurrentEntriesMap(
m_region(region),
m_numDestroyTrackers(0),
m_concurrencyChecksEnabled(concurrencyChecksEnabled) {
- GF_DEV_ASSERT(entryFactory != nullptr);
-
uint8_t maxConcurrency = TableOfPrimes::getMaxPrimeForConcurrency();
if (concurrency > maxConcurrency) {
m_concurrency = maxConcurrency;
diff --git a/cppcache/src/CppCacheLibrary.cpp b/cppcache/src/CppCacheLibrary.cpp
index ada5d08..3a68cee 100644
--- a/cppcache/src/CppCacheLibrary.cpp
+++ b/cppcache/src/CppCacheLibrary.cpp
@@ -103,7 +103,6 @@ std::string CppCacheLibrary::getProductDir() {
}
// check if bin on windows, and go back one...
- GF_D_ASSERT(productLibraryDirectoryName.length() > 4);
#ifdef WIN32
std::string libpart = "bin";
#else
diff --git a/cppcache/src/ExpiryTaskManager.cpp b/cppcache/src/ExpiryTaskManager.cpp
index f5348ac..d7b90d5 100644
--- a/cppcache/src/ExpiryTaskManager.cpp
+++ b/cppcache/src/ExpiryTaskManager.cpp
@@ -17,7 +17,6 @@
#include "ExpiryTaskManager.hpp"
-#include "Assert.hpp"
#include "DistributedSystem.hpp"
#include "DistributedSystemImpl.hpp"
#include "config.h"
@@ -80,7 +79,6 @@ void ExpiryTaskManager::stopExpiryTaskManager() {
if (m_reactorEventLoopRunning) {
m_reactor->end_reactor_event_loop();
this->wait();
- GF_D_ASSERT(m_reactor->reactor_event_loop_done() > 0);
m_reactorEventLoopRunning = false;
m_condition.notify_all();
}
diff --git a/cppcache/src/FairQueue.hpp b/cppcache/src/FairQueue.hpp
index 0cadce5..7e038c6 100644
--- a/cppcache/src/FairQueue.hpp
+++ b/cppcache/src/FairQueue.hpp
@@ -29,7 +29,6 @@
#include <ace/Time_Value.h>
#include <ace/Token.h>
-#include "Assert.hpp"
#include "util/Log.hpp"
namespace apache {
@@ -64,8 +63,6 @@ class FairQueue {
}
void put(T* mp, bool openQueue) {
- GF_DEV_ASSERT(mp != 0);
-
bool delMp = false;
{
ACE_Guard<MUTEX> _guard(m_queueLock);
diff --git a/cppcache/src/LRUEntriesMap.cpp b/cppcache/src/LRUEntriesMap.cpp
index 394f5fe..ff43cd9 100644
--- a/cppcache/src/LRUEntriesMap.cpp
+++ b/cppcache/src/LRUEntriesMap.cpp
@@ -260,8 +260,6 @@ GfErrType LRUEntriesMap::put(const std::shared_ptr<CacheableKey>& key,
std::shared_ptr<VersionTag> versionTag,
bool& isUpdate, DataInput* delta) {
MapSegment* segmentRPtr = segmentFor(key);
- GF_D_ASSERT(segmentRPtr != nullptr);
-
GfErrType err = GF_NOERR;
bool segmentLocked = false;
{
@@ -322,7 +320,7 @@ GfErrType LRUEntriesMap::put(const std::shared_ptr<CacheableKey>& key,
segmentRPtr->getEntry(key, mePtr, tmpValue);
// mePtr cannot be null, we just put it...
// must convert to an std::shared_ptr<LRUMapEntryImpl>...
- GF_D_ASSERT(mePtr != nullptr);
+
m_lruList.appendEntry(mePtr);
me = mePtr;
} else {
diff --git a/cppcache/src/LRUList.cpp b/cppcache/src/LRUList.cpp
index 2e2dc9c..8d16753 100644
--- a/cppcache/src/LRUList.cpp
+++ b/cppcache/src/LRUList.cpp
@@ -19,7 +19,6 @@
#include <mutex>
-#include "Assert.hpp"
#include "util/concurrent/spinlock_mutex.hpp"
namespace apache {
@@ -61,8 +60,6 @@ template <typename TEntry, typename TCreateEntry>
void LRUList<TEntry, TCreateEntry>::appendNode(LRUListNode* aNode) {
std::lock_guard<spinlock_mutex> lk(m_tailLock);
- GF_D_ASSERT(aNode != nullptr);
-
aNode->clearNextLRUListNode();
m_tailNode->setNextLRUListNode(aNode);
m_tailNode = aNode;
diff --git a/cppcache/src/LocalRegion.cpp b/cppcache/src/LocalRegion.cpp
index 79e469d..7cc9ca4 100644
--- a/cppcache/src/LocalRegion.cpp
+++ b/cppcache/src/LocalRegion.cpp
@@ -2419,7 +2419,6 @@ GfErrType LocalRegion::destroyRegionNoThrow(
if (m_regionAttributes.getCachingEnabled()) {
_GEODE_SAFE_DELETE(m_entries);
}
- GF_D_ASSERT(m_destroyPending);
if (removeFromParent) {
if (m_parentRegion == nullptr) {
diff --git a/cppcache/src/Log.cpp b/cppcache/src/Log.cpp
index 93a2ffb..07d8362 100644
--- a/cppcache/src/Log.cpp
+++ b/cppcache/src/Log.cpp
@@ -44,7 +44,6 @@
#include <geode/util/LogLevel.hpp>
#include "../internal/hacks/AceThreadId.h"
-#include "Assert.hpp"
#include "geodeBanner.hpp"
#include "util/chrono/time_point.hpp"
@@ -413,7 +412,6 @@ void Log::writeBanner() {
fflush(stdout);
return;
} // else
- GF_D_ASSERT(g_logFile && g_logMutex && g_logFileWithExt);
if (fprintf(g_log, "%s", bannertext.c_str()) == 0 || ferror(g_log)) {
// we should be continue,
diff --git a/cppcache/src/PoolManagerImpl.cpp b/cppcache/src/PoolManagerImpl.cpp
index 305668d..fc81a5d 100644
--- a/cppcache/src/PoolManagerImpl.cpp
+++ b/cppcache/src/PoolManagerImpl.cpp
@@ -62,7 +62,6 @@ std::shared_ptr<Pool> PoolManagerImpl::find(const std::string& name) const {
if (iter != m_connectionPools.end()) {
poolPtr = iter->second;
- GF_DEV_ASSERT(poolPtr != nullptr);
}
return poolPtr;
diff --git a/cppcache/src/RegionXmlCreation.cpp b/cppcache/src/RegionXmlCreation.cpp
index aedd7f4..283fa97 100644
--- a/cppcache/src/RegionXmlCreation.cpp
+++ b/cppcache/src/RegionXmlCreation.cpp
@@ -44,7 +44,6 @@ void RegionXmlCreation::fillIn(std::shared_ptr<Region> regionPtr) {
}
void RegionXmlCreation::createRoot(Cache* cache) {
- GF_D_ASSERT(this->isRoot);
std::shared_ptr<Region> rootRegPtr = nullptr;
CacheImpl* cacheImpl = CacheRegionHelper::getCacheImpl(cache);
@@ -53,7 +52,6 @@ void RegionXmlCreation::createRoot(Cache* cache) {
}
void RegionXmlCreation::create(std::shared_ptr<Region> parent) {
- GF_D_ASSERT(!(this->isRoot));
std::shared_ptr<Region> subRegPtr = nullptr;
subRegPtr = parent->createSubregion(regionName, regionAttributes);
diff --git a/cppcache/src/TcpConn.cpp b/cppcache/src/TcpConn.cpp
index ec88007..c8837c6 100644
--- a/cppcache/src/TcpConn.cpp
+++ b/cppcache/src/TcpConn.cpp
@@ -159,8 +159,6 @@ void TcpConn::listen(ACE_INET_Addr addr,
std::chrono::microseconds waitSeconds) {
using apache::geode::internal::chrono::duration::to_string;
- GF_DEV_ASSERT(m_io != nullptr);
-
ACE_SOCK_Acceptor listener(addr, 1);
int32_t retVal = 0;
if (waitSeconds > std::chrono::microseconds::zero()) {
@@ -202,8 +200,6 @@ void TcpConn::connect(const char *ipaddr,
void TcpConn::connect() {
using apache::geode::internal::chrono::duration::to_string;
- GF_DEV_ASSERT(m_io != nullptr);
-
ACE_INET_Addr ipaddr = m_addr;
std::chrono::microseconds waitMicroSeconds = m_waitMilliSeconds;
@@ -269,19 +265,6 @@ size_t TcpConn::send(const char *buff, size_t len,
size_t TcpConn::socketOp(TcpConn::SockOp op, char *buff, size_t len,
std::chrono::microseconds waitDuration) {
{
- GF_DEV_ASSERT(m_io != nullptr);
- GF_DEV_ASSERT(buff != nullptr);
-
-#if GF_DEVEL_ASSERTS == 1
- if (len <= 0) {
- LOGERROR(
- "TcpConn::socketOp called with a length of %d specified. "
- "No operation performed.",
- len);
- GF_DEV_ASSERT(false);
- }
-#endif
-
ACE_Time_Value waitTime(waitDuration);
auto endTime = std::chrono::steady_clock::now() + waitDuration;
size_t readLen = 0;
@@ -333,15 +316,12 @@ size_t TcpConn::socketOp(TcpConn::SockOp op, char *buff, size_t len,
ACE_OS::last_error(ETIME);
}
- GF_DEV_ASSERT(len >= 0);
return totalsend;
}
}
// Return the local port for this TCP connection.
uint16_t TcpConn::getPort() {
- GF_DEV_ASSERT(m_io != nullptr);
-
ACE_INET_Addr localAddr;
m_io->get_local_addr(localAddr);
return localAddr.get_port_number();
diff --git a/cppcache/src/TcpConn.hpp b/cppcache/src/TcpConn.hpp
index 8fddb8a..888df84 100644
--- a/cppcache/src/TcpConn.hpp
+++ b/cppcache/src/TcpConn.hpp
@@ -26,7 +26,6 @@
#include <geode/internal/geode_globals.hpp>
-#include "Assert.hpp"
#include "Connector.hpp"
#include "util/Log.hpp"
@@ -120,8 +119,6 @@ class APACHE_GEODE_EXPORT TcpConn : public Connector {
std::chrono::microseconds waitSeconds) override;
virtual void setOption(int32_t level, int32_t option, void* val, size_t len) {
- GF_DEV_ASSERT(m_io != nullptr);
-
if (m_io->set_option(level, option, val, static_cast<int32_t>(len)) == -1) {
int32_t lastError = ACE_OS::last_error();
LOGERROR("Failed to set option, errno: %d: %s", lastError,
diff --git a/cppcache/src/TcpSslConn.cpp b/cppcache/src/TcpSslConn.cpp
index de80c4d..b4b328e 100644
--- a/cppcache/src/TcpSslConn.cpp
+++ b/cppcache/src/TcpSslConn.cpp
@@ -66,8 +66,6 @@ void TcpSslConn::listen(ACE_INET_Addr addr,
std::chrono::microseconds waitSeconds) {
using apache::geode::internal::chrono::duration::to_string;
- GF_DEV_ASSERT(m_ssl != nullptr);
-
int32_t retVal = m_ssl->listen(addr, waitSeconds);
if (retVal == -1) {
@@ -87,8 +85,6 @@ void TcpSslConn::listen(ACE_INET_Addr addr,
void TcpSslConn::connect() {
using apache::geode::internal::chrono::duration::to_string;
- GF_DEV_ASSERT(m_ssl != nullptr);
-
ACE_OS::signal(SIGPIPE, SIG_IGN); // Ignore broken pipe
// m_ssl->init();
@@ -132,18 +128,6 @@ void TcpSslConn::close() {
size_t TcpSslConn::socketOp(TcpConn::SockOp op, char* buff, size_t len,
std::chrono::microseconds waitDuration) {
{
- GF_DEV_ASSERT(m_ssl != nullptr);
- GF_DEV_ASSERT(buff != nullptr);
-
-#if GF_DEVEL_ASSERTS == 1
- if (len <= 0) {
- LOGERROR(
- "TcpSslConn::socketOp called with a length of %d specified. "
- "No operation performed.",
- len);
- GF_DEV_ASSERT(false);
- }
-#endif
// passing wait time as micro seconds
ACE_Time_Value waitTime(waitDuration);
auto endTime = std::chrono::steady_clock::now() + waitDuration;
@@ -196,14 +180,11 @@ size_t TcpSslConn::socketOp(TcpConn::SockOp op, char* buff, size_t len,
ACE_OS::last_error(ETIME);
}
- GF_DEV_ASSERT(len >= 0);
return totalsend;
}
}
uint16_t TcpSslConn::getPort() {
- GF_DEV_ASSERT(m_ssl != nullptr);
-
ACE_INET_Addr localAddr;
m_ssl->getLocalAddr(localAddr);
return localAddr.get_port_number();
diff --git a/cppcache/src/TcpSslConn.hpp b/cppcache/src/TcpSslConn.hpp
index 02f3ea5..378c8c6 100644
--- a/cppcache/src/TcpSslConn.hpp
+++ b/cppcache/src/TcpSslConn.hpp
@@ -87,8 +87,6 @@ class TcpSslConn : public TcpConn {
void setOption(int32_t level, int32_t option, void* val,
size_t len) override {
- GF_DEV_ASSERT(m_ssl != nullptr);
-
if (m_ssl->setOption(level, option, val, static_cast<int32_t>(len)) == -1) {
int32_t lastError = ACE_OS::last_error();
LOGERROR("Failed to set option, errno: %d: %s", lastError,
diff --git a/cppcache/src/TcrConnection.cpp b/cppcache/src/TcrConnection.cpp
index c046096..941e8b2 100644
--- a/cppcache/src/TcrConnection.cpp
+++ b/cppcache/src/TcrConnection.cpp
@@ -78,13 +78,10 @@ bool TcrConnection::InitTcrConnection(
m_endpointObj->getConnRefCounter());
bool isPool = false;
m_isBeingUsed = false;
- GF_DEV_ASSERT(endpoint != nullptr);
m_endpoint = endpoint;
// Precondition:
// 1. isSecondary ==> isClientNotification
- GF_DEV_ASSERT(!isSecondary || isClientNotification);
-
// Create TcpConn object which manages a socket connection with the endpoint.
if (endpointObj && endpointObj->getPoolHADM()) {
m_conn = createConnection(
@@ -97,8 +94,6 @@ bool TcrConnection::InitTcrConnection(
sysProp.maxSocketBufferSize());
}
- GF_DEV_ASSERT(m_conn != nullptr);
-
auto handShakeMsg = cacheImpl->createDataOutput();
bool isNotificationChannel = false;
// Send byte Acceptor.CLIENT_TO_SERVER = (byte) 100;
@@ -579,9 +574,6 @@ Connector* TcrConnection::createConnection(
inline ConnErrType TcrConnection::receiveData(
char* buffer, size_t length, std::chrono::microseconds receiveTimeoutSec,
bool checkConnected, bool isNotificationMessage) {
- GF_DEV_ASSERT(buffer != nullptr);
- GF_DEV_ASSERT(m_conn != nullptr);
-
std::chrono::microseconds defaultWaitSecs =
isNotificationMessage ? std::chrono::seconds(1) : std::chrono::seconds(2);
if (defaultWaitSecs > receiveTimeoutSec) defaultWaitSecs = receiveTimeoutSec;
@@ -620,8 +612,6 @@ inline ConnErrType TcrConnection::receiveData(
}
}
// Postconditions for checking bounds.
- GF_DEV_ASSERT(startLen >= length);
- GF_DEV_ASSERT(length >= 0);
return (length == 0 ? CONN_NOERR
: (length == startLen ? CONN_NODATA : CONN_TIMEOUT));
}
@@ -636,9 +626,6 @@ inline ConnErrType TcrConnection::sendData(
inline ConnErrType TcrConnection::sendData(
std::chrono::microseconds& timeSpent, const char* buffer, size_t length,
std::chrono::microseconds sendTimeout, bool checkConnected) {
- GF_DEV_ASSERT(buffer != nullptr);
- GF_DEV_ASSERT(m_conn != nullptr);
-
std::chrono::microseconds defaultWaitSecs = std::chrono::seconds(2);
if (defaultWaitSecs > sendTimeout) defaultWaitSecs = sendTimeout;
LOGDEBUG(
@@ -767,8 +754,6 @@ void TcrConnection::send(const char* buffer, size_t len,
void TcrConnection::send(std::chrono::microseconds& timeSpent,
const char* buffer, size_t len,
std::chrono::microseconds sendTimeoutSec, bool) {
- GF_DEV_ASSERT(m_conn != nullptr);
-
// LOGINFO("TcrConnection::send: [%p] sending request to endpoint %s;",
//: this, m_endpoint);
@@ -796,8 +781,6 @@ void TcrConnection::send(std::chrono::microseconds& timeSpent,
char* TcrConnection::receive(size_t* recvLen, ConnErrType* opErr,
std::chrono::microseconds receiveTimeoutSec) {
- GF_DEV_ASSERT(m_conn != nullptr);
-
return readMessage(recvLen, receiveTimeoutSec, false, opErr, true);
}
@@ -869,7 +852,6 @@ char* TcrConnection::readMessage(size_t* recvLen,
return fullMessage;
// exit(0);
}
- // GF_DEV_ASSERT(msgLen > 0);
// user has to delete this pointer
char* fullMessage;
@@ -1024,7 +1006,6 @@ void TcrConnection::readMessageChunked(
int32_t chunkLen;
chunkLen = input.readInt32();
// check that chunk length is valid.
- GF_DEV_ASSERT(chunkLen > 0);
isLastChunk = input.read();
uint8_t* chunk_body;
diff --git a/cppcache/src/TcrConnectionManager.cpp b/cppcache/src/TcrConnectionManager.cpp
index 0a862ff..609c761 100644
--- a/cppcache/src/TcrConnectionManager.cpp
+++ b/cppcache/src/TcrConnectionManager.cpp
@@ -389,7 +389,6 @@ void TcrConnectionManager::initializeHAEndpoints(const char *endpointsStr) {
}
// Postconditions:
// 1. endpointsList.size() > 0
- GF_DEV_ASSERT(endpointsList.size() > 0);
}
void TcrConnectionManager::removeHAEndpoints() {
@@ -474,7 +473,6 @@ void TcrConnectionManager::cleanup(std::atomic<bool> &isRunning) {
LOGFINE("TcrConnectionManager: ending cleanup thread");
// Postcondition - all notification channels should be cleaned up by the end
// of this function.
- GF_DEV_ASSERT(m_receiverReleaseList.size() == 0);
}
void TcrConnectionManager::cleanNotificationLists() {
diff --git a/cppcache/src/TcrDistributionManager.cpp b/cppcache/src/TcrDistributionManager.cpp
index da4c0ac..6b7aa8d 100644
--- a/cppcache/src/TcrDistributionManager.cpp
+++ b/cppcache/src/TcrDistributionManager.cpp
@@ -16,6 +16,8 @@
*/
#include "TcrDistributionManager.hpp"
+#include <cassert>
+
#include <geode/ExceptionTypes.hpp>
#include <geode/internal/geode_globals.hpp>
@@ -29,7 +31,7 @@ namespace client {
TcrDistributionManager::TcrDistributionManager(
ThinClientRegion* region, TcrConnectionManager& connManager)
: ThinClientDistributionManager(connManager, region) {
- GF_R_ASSERT(region != nullptr);
+ assert(region != nullptr);
m_clientNotification = region->getAttributes().getClientNotificationEnabled();
}
diff --git a/cppcache/src/TcrEndpoint.cpp b/cppcache/src/TcrEndpoint.cpp
index 812de37..3418137 100644
--- a/cppcache/src/TcrEndpoint.cpp
+++ b/cppcache/src/TcrEndpoint.cpp
@@ -95,8 +95,6 @@ TcrEndpoint::~TcrEndpoint() {
"to subscription channel while closing",
m_name.c_str());
// fail in dev build to track #295 better in regressions
- GF_DEV_ASSERT(m_numRegionListener == 0);
-
m_numRegionListener = 0;
closeNotification();
}
@@ -391,7 +389,6 @@ GfErrType TcrEndpoint::registerDM(bool clientNotification, bool isSecondary,
ThinClientBaseDM* distMgr) {
// Pre-conditions:
// 1. If this is a secondary server then clientNotification must be true
- GF_DEV_ASSERT(!isSecondary || clientNotification);
bool connected = false;
GfErrType err = GF_NOERR;
@@ -491,20 +488,6 @@ GfErrType TcrEndpoint::registerDM(bool clientNotification, bool isSecondary,
// 1. The endpoint should be marked as active, only if m_connected is true
// 2. If this is not an active endpoint and it is connected then only one
// connection + notify channel
- GF_DEV_ASSERT(!m_isActiveEndpoint || m_connected);
-#if GF_DEVEL_ASSERTS == 1
- int numConnections = m_opConnections.size();
- if (!m_isActiveEndpoint && !isActiveEndpoint && m_connected &&
- (numConnections != 1 || m_numRegionListener <= 0 ||
- m_notifyReceiver == nullptr)) {
- LOGWARN(
- "Inactive connected endpoint does not have exactly one "
- "connection. Number of connections: %d, number of region listeners: "
- "%d",
- numConnections, m_numRegionListener);
- }
-#endif
-
return err;
}
@@ -1090,8 +1073,6 @@ GfErrType TcrEndpoint::sendRequestWithRetry(
}
} else {
LOGERROR("Unexpected failure while sending request to server.");
- GF_DEV_ASSERT("Bug in TcrEndpoint::sendRequestWithRetry()?" ? false
- : true);
}
}
} while (++sendRetryCount <= maxSendRetries);
@@ -1133,17 +1114,6 @@ GfErrType TcrEndpoint::send(const TcrMessage& request, TcrMessageReply& reply) {
setConnectionStatus(false);
}
-// Postconditions:
-#if GF_DEVEL_ASSERTS == 1
- int opConnectionsSize = m_opConnections.size();
- if (!m_isActiveEndpoint && (opConnectionsSize > 1)) {
- LOGWARN("Connections size = %d, expected maximum %d", opConnectionsSize, 1);
- } else if (opConnectionsSize > m_maxConnections) {
- LOGWARN("Connections size = %d, expected maximum %d", opConnectionsSize,
- m_maxConnections);
- }
-#endif
-
return error;
}
diff --git a/cppcache/src/TcrHADistributionManager.cpp b/cppcache/src/TcrHADistributionManager.cpp
index af0529e..fac5ef0 100644
--- a/cppcache/src/TcrHADistributionManager.cpp
+++ b/cppcache/src/TcrHADistributionManager.cpp
@@ -17,6 +17,8 @@
#include "TcrHADistributionManager.hpp"
+#include <cassert>
+
#include <geode/ExceptionTypes.hpp>
#include <geode/internal/geode_globals.hpp>
@@ -36,7 +38,7 @@ TcrHADistributionManager::TcrHADistributionManager(
ThinClientRegion* theRegion, TcrConnectionManager& connManager)
: ThinClientDistributionManager(connManager, theRegion),
m_theTcrConnManager(connManager) {
- GF_R_ASSERT(theRegion != nullptr);
+ assert(theRegion != nullptr);
}
void TcrHADistributionManager::init() {
diff --git a/cppcache/src/TcrMessage.cpp b/cppcache/src/TcrMessage.cpp
index e5b6f93..efd1f18 100644
--- a/cppcache/src/TcrMessage.cpp
+++ b/cppcache/src/TcrMessage.cpp
@@ -23,7 +23,6 @@
#include <geode/CacheableObjectArray.hpp>
#include <geode/SystemProperties.hpp>
-#include "Assert.hpp"
#include "AutoDelete.hpp"
#include "CacheRegionHelper.hpp"
#include "DataInputInternal.hpp"
@@ -1925,7 +1924,7 @@ TcrMessageUnregisterInterestList::TcrMessageUnregisterInterestList(
m_receiveValues = receiveValues;
auto numInItrestList = keys.size();
- GF_R_ASSERT(numInItrestList != 0);
+ assert(numInItrestList != 0);
uint32_t numOfParts = 2 + static_cast<uint32_t>(numInItrestList);
numOfParts += 2;
@@ -2099,7 +2098,6 @@ TcrMessagePeriodicAck::TcrMessagePeriodicAck(
m_request.reset(dataOutput);
uint32_t numParts = static_cast<uint32_t>(entries.size());
- GF_D_ASSERT(numParts > 0);
writeHeader(m_msgType, numParts);
for (EventIdMapEntryList::const_iterator entry = entries.begin();
entry != entries.end(); ++entry) {
diff --git a/cppcache/src/ThinClientBaseDM.cpp b/cppcache/src/ThinClientBaseDM.cpp
index b062915..a1d741a 100644
--- a/cppcache/src/ThinClientBaseDM.cpp
+++ b/cppcache/src/ThinClientBaseDM.cpp
@@ -228,7 +228,6 @@ void ThinClientBaseDM::processChunks(std::atomic<bool>& isRunning) {
}
LOGFINE("Ending chunk process thread for region %s",
(m_region ? m_region->getFullPath().c_str() : "(null)"));
- GF_DEV_ASSERT(m_chunks.size() == 0);
}
// start the chunk processing thread
diff --git a/cppcache/src/ThinClientDistributionManager.cpp b/cppcache/src/ThinClientDistributionManager.cpp
index 5bf8cfe..5365ffc 100644
--- a/cppcache/src/ThinClientDistributionManager.cpp
+++ b/cppcache/src/ThinClientDistributionManager.cpp
@@ -287,23 +287,12 @@ GfErrType ThinClientDistributionManager::selectEndpoint(
}
}
-// Postconditions:
-// 1. If initial size of randIndex > 0 && failover was attempted, final size of
-// randIndex < initial size of randIndex
-// 2. If CONN_NOERR, then m_activeEndpoint > -1, m_activeEndpoint should be
-// connected.
-// 3. Number of endpoints on which DM is registered <= 1
-#if GF_DEVEL_ASSERTS == 1
- currentEndpoint = m_activeEndpoint;
- if ((err == GF_NOERR) &&
- (currentEndpoint < 0 || !m_endpoints[currentEndpoint]->connected())) {
- LOGWARN(
- "Current endpoint %s is not connected after failover.",
- (currentEndpoint < 0 ? "(null)"
- : m_endpoints[currentEndpoint]->name().c_str()));
- }
-#endif
-
+ // Postconditions:
+ // 1. If initial size of randIndex > 0 && failover was attempted, final size
+ // of randIndex < initial size of randIndex
+ // 2. If CONN_NOERR, then m_activeEndpoint > -1, m_activeEndpoint should be
+ // connected.
+ // 3. Number of endpoints on which DM is registered <= 1
return err;
}
diff --git a/cppcache/src/ThinClientPoolDM.cpp b/cppcache/src/ThinClientPoolDM.cpp
index f0c9da2..c89bebc 100644
--- a/cppcache/src/ThinClientPoolDM.cpp
+++ b/cppcache/src/ThinClientPoolDM.cpp
@@ -2055,8 +2055,6 @@ TcrEndpoint* ThinClientPoolDM::addEP(const std::string& endpointName) {
if (m_endpoints.emplace(endpointName, ep).second) {
LOGERROR("Failed to add endpoint %s to pool %s", endpointName.c_str(),
m_poolName.c_str());
- GF_DEV_ASSERT(
- "ThinClientPoolDM::addEP( ): failed to add endpoint" ? false : false);
}
}
// Update Server Stats
diff --git a/cppcache/src/ThinClientPoolHADM.cpp b/cppcache/src/ThinClientPoolHADM.cpp
index 244fd2e..29b15ed 100644
--- a/cppcache/src/ThinClientPoolHADM.cpp
+++ b/cppcache/src/ThinClientPoolHADM.cpp
@@ -266,7 +266,6 @@ void ThinClientPoolHADM::removeRegion(ThinClientRegion* theTCR) {
return;
}
}
- GF_DEV_ASSERT("Region not found in ThinClientPoolHADM list" ? false : false);
}
void ThinClientPoolHADM::readyForEvents() {
diff --git a/cppcache/src/ThinClientRedundancyManager.cpp b/cppcache/src/ThinClientRedundancyManager.cpp
index 75fe357..598e1aa 100644
--- a/cppcache/src/ThinClientRedundancyManager.cpp
+++ b/cppcache/src/ThinClientRedundancyManager.cpp
@@ -399,14 +399,6 @@ GfErrType ThinClientRedundancyManager::maintainRedundancyLevel(
// 3. If primary is connected, m_redundantEndpoints[0] is primary. ( Not
// checked. To verify, We may have to modify
// TcrEndpoint class.)
-
- GF_DEV_ASSERT(!isRedundancySatisfied || ((m_redundantEndpoints.size() ==
- (size_t)(m_redundancyLevel + 1)) &&
- isPrimaryConnected));
- GF_DEV_ASSERT(isRedundancySatisfied ||
- ((int)m_redundantEndpoints.size() <= m_redundancyLevel) ||
- m_redundancyLevel == -1);
-
std::shared_ptr<RemoteQueryService> queryServicePtr;
ThinClientPoolDM* poolDM = dynamic_cast<ThinClientPoolDM*>(m_poolHADM);
if (poolDM) {
@@ -429,14 +421,6 @@ GfErrType ThinClientRedundancyManager::maintainRedundancyLevel(
}
}
-#if GF_DEVEL_ASSERTS == 1
- if (isPrimaryConnected && !m_redundantEndpoints[0]->connected()) {
- LOGWARN(
- "GF_DEV_ASSERT Warning: Failed condition ( isPrimaryConnected ==> "
- "m_redundantEndpoints[ 0 ]->connected( ) )");
- }
-#endif
-
// Invariants:
// 1. m_redundantEndpoints UNION m_nonredundantEndpionts = All Endpoints
// 2. m_redundantEndpoints INTERSECTION m_nonredundantEndpoints = Empty
@@ -444,13 +428,7 @@ GfErrType ThinClientRedundancyManager::maintainRedundancyLevel(
// The global endpoint list does not change ever for HA so getAllEndpoints
// result or redundantEndpoints/nonredundantEndpoints cannot have stale or
// deleted endpoints
- if (!m_poolHADM) {
- GF_DEV_ASSERT(m_redundantEndpoints.size() +
- m_nonredundantEndpoints.size() ==
- (unsigned)m_theTcrConnManager->getNumEndPoints());
- }
- // Update pool stats
if (m_poolHADM) {
m_poolHADM->getStats().setSubsServers(
static_cast<int32_t>(m_redundantEndpoints.size()));
@@ -497,10 +475,6 @@ GfErrType ThinClientRedundancyManager::maintainRedundancyLevel(
void ThinClientRedundancyManager::removeEndpointsInOrder(
std::vector<TcrEndpoint*>& destVector,
const std::vector<TcrEndpoint*>& srcVector) {
-#if GF_DEVEL_ASSERTS == 1
- size_t destInitSize = destVector.size();
-#endif
-
std::vector<TcrEndpoint*> tempDestVector;
std::vector<TcrEndpoint*>::iterator itDest;
std::vector<TcrEndpoint*>::const_iterator itSrc;
@@ -519,23 +493,15 @@ void ThinClientRedundancyManager::removeEndpointsInOrder(
// Postconditions:
// 1. size of destVector decreases by the size of srcVector
-
- GF_DEV_ASSERT(destInitSize == destVector.size() + srcVector.size());
}
void ThinClientRedundancyManager::addEndpointsInOrder(
std::vector<TcrEndpoint*>& destVector,
const std::vector<TcrEndpoint*>& srcVector) {
-#if GF_DEVEL_ASSERTS == 1
- size_t destInitSize = destVector.size();
-#endif
-
destVector.insert(destVector.end(), srcVector.begin(), srcVector.end());
// Postconditions:
// 1. Length of destVector increases by the length of srcVector
-
- GF_DEV_ASSERT(destVector.size() == destInitSize + srcVector.size());
}
GfErrType ThinClientRedundancyManager::createQueueEP(TcrEndpoint* ep,
@@ -771,7 +737,6 @@ bool ThinClientRedundancyManager::readyForEvents(
void ThinClientRedundancyManager::moveEndpointToLast(
std::vector<TcrEndpoint*>& epVector, TcrEndpoint* targetEp) {
// Pre-condition
- GF_DEV_ASSERT(epVector.size() > 0 && targetEp != nullptr);
// Remove Ep
for (std::vector<TcrEndpoint*>::iterator it = epVector.begin();
@@ -1045,7 +1010,6 @@ void ThinClientRedundancyManager::getAllEndpoints(
"endpoints, found redundant endpoint.");
} else if (status == PRIMARY_SERVER) {
// Primary should be unique
- GF_DEV_ASSERT(primaryEp == nullptr);
primaryEp = ep;
LOGDEBUG(
"ThinClientRedundancyManager::getAllEndpoints(): sorting "
diff --git a/cppcache/src/Utils.hpp b/cppcache/src/Utils.hpp
index b3577c1..eb048fb 100644
--- a/cppcache/src/Utils.hpp
+++ b/cppcache/src/Utils.hpp
@@ -34,7 +34,6 @@
#include <geode/internal/geode_base.hpp>
#include <geode/internal/geode_globals.hpp>
-#include "Assert.hpp"
#include "DistributedSystem.hpp"
#include "statistics/Statistics.hpp"
#include "util/Log.hpp"
@@ -142,7 +141,6 @@ class APACHE_GEODE_EXPORT Utils {
theObject->toString().c_str());
youHaveBeenWarned = true;
}
- GF_DEV_ASSERT(objectSize != 0);
return objectSize;
}
diff --git a/cppcache/src/statistics/AtomicStatisticsImpl.cpp b/cppcache/src/statistics/AtomicStatisticsImpl.cpp
index 3618844..407e436 100644
--- a/cppcache/src/statistics/AtomicStatisticsImpl.cpp
+++ b/cppcache/src/statistics/AtomicStatisticsImpl.cpp
@@ -21,7 +21,6 @@
#include <geode/internal/geode_globals.hpp>
-#include "../Assert.hpp"
#include "StatisticDescriptorImpl.hpp"
#include "StatisticsTypeImpl.hpp"
@@ -68,7 +67,6 @@ AtomicStatisticsImpl::AtomicStatisticsImpl(StatisticsType* typeArg,
this->uniqueId = uniqueIdArg;
this->closed = false;
this->statsType = dynamic_cast<StatisticsTypeImpl*>(typeArg);
- GF_D_ASSERT(this->statsType != nullptr);
int32_t intCount = statsType->getIntStatCount();
int32_t longCount = statsType->getLongStatCount();
int32_t doubleCount = statsType->getDoubleStatCount();
diff --git a/cppcache/src/statistics/StatArchiveWriter.cpp b/cppcache/src/statistics/StatArchiveWriter.cpp
index a216c06..d3362e7 100644
--- a/cppcache/src/statistics/StatArchiveWriter.cpp
+++ b/cppcache/src/statistics/StatArchiveWriter.cpp
@@ -204,8 +204,6 @@ void ResourceInst::writeSample() {
bool wroteInstId = false;
bool checkForChange = true;
StatisticDescriptor **stats = type->getStats();
- GF_D_ASSERT(stats != nullptr);
- GF_D_ASSERT(*stats != nullptr);
if (resource->isClosed()) {
return;
}