Skip to content
Permalink
Browse files
GEODE-5770: Fixes clang-analyzer-optin.performance.Padding warning
* Reorders members to reduce padding.
  • Loading branch information
pivotal-jbarrett committed Oct 9, 2018
1 parent 156431c commit f735c5397320d87bcc2f4f752ff75a9c6798df73
Showing 6 changed files with 165 additions and 174 deletions.
@@ -1,6 +1,6 @@
---
Checks: '-*,clang-diagnostic-*,clang-analyzer-*,-clang-analyzer-alpha*,google-*,-google-readability-todo,-google-runtime-references,-google-default-arguments'
WarningsAsErrors: 'google-build-using-namespace,google-readability-redundant-smartptr-get,google-explicit-constructor,google-global-names-in-headers,google-runtime-int,google-readability-casting,google-readability-namespace-comments'
WarningsAsErrors: 'google-build-using-namespace,google-readability-redundant-smartptr-get,google-explicit-constructor,google-global-names-in-headers,google-runtime-int,google-readability-casting,google-readability-namespace-comments,clang-analyzer-optin.performance.Padding'
HeaderFilterRegex: '.*'
AnalyzeTemporaryDtors: false
FormatStyle: file
@@ -1,8 +1,3 @@
#pragma once

#ifndef GEODE_INTEGRATION_TEST_QUERYSTRINGS_H_
#define GEODE_INTEGRATION_TEST_QUERYSTRINGS_H_

/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -20,7 +15,13 @@
* limitations under the License.
*/

#include <cstring>
#pragma once

#ifndef GEODE_INTEGRATION_TEST_QUERYSTRINGS_H_
#define GEODE_INTEGRATION_TEST_QUERYSTRINGS_H_

#include <utility>
#include <string>

namespace testData {

@@ -59,8 +60,9 @@ class QueryStrings {
public:
QueryStrings(queryCategory pcategory, std::string pquery,
bool pisLargeResultset = false)
: category(pcategory),
_query(std::move(pquery)),
: _query(std::move(pquery)),
category(pcategory),

haveLargeResultset(pisLargeResultset) {}

static int RSsize() { return RS_ARRAY_SIZE; };
@@ -74,8 +76,8 @@ class QueryStrings {
const std::string& query() const { return _query; };

public:
queryCategory category;
std::string _query;
queryCategory category;
bool haveLargeResultset;

private:
@@ -42,39 +42,39 @@ TcrEndpoint::TcrEndpoint(const std::string& name, CacheImpl* cacheImpl,
ACE_Semaphore& cleanupSema,
ACE_Semaphore& redundancySema, ThinClientBaseDM* DM,
bool isMultiUserMode)
: m_needToConnectInLock(false),
: m_notifyConnection(nullptr),
m_notifyReceiver(nullptr),
m_cacheImpl(cacheImpl),
m_connectLockCond(m_connectLock),
m_maxConnections(cacheImpl->getDistributedSystem()
.getSystemProperties()
.connectionPoolSize()),
m_notifyConnection(nullptr),
m_notifyReceiver(nullptr),
m_numRegionListener(0),
m_needToConnectInLock(false),
m_isQueueHosted(false),
m_cacheImpl(cacheImpl),
m_uniqueId(0),
m_failoverSema(failoverSema),
m_cleanupSema(cleanupSema),
m_redundancySema(redundancySema),
m_baseDM(DM),
m_name(name),
m_notificationCleanupSema(0),
m_numberOfTimesFailed(0),
m_numRegions(0),
m_pingTimeouts(0),
m_notifyCount(0),
m_dupCount(0),
m_isAuthenticated(false),
m_msgSent(false),
m_pingSent(false),
m_numberOfTimesFailed(0),
m_isMultiUserMode(isMultiUserMode),
m_name(name),
m_connected(false),
m_isActiveEndpoint(false),
m_numRegions(0),
m_pingTimeouts(0),
m_notifyCount(0),
m_failoverSema(failoverSema),
m_cleanupSema(cleanupSema),
m_notificationCleanupSema(0),
m_redundancySema(redundancySema),
m_dupCount(0),
m_serverQueueStatus(NON_REDUNDANT_SERVER),
m_isServerQueueStatusSet(false),
m_queueSize(0),
m_baseDM(DM),
m_noOfConnRefs(0),
m_distributedMemId(0) {
m_distributedMemId(0),
m_isServerQueueStatusSet(false) {
/*
m_name = Utils::convertHostToCanonicalForm(m_name.c_str() );
*/
@@ -158,9 +158,6 @@ class APACHE_GEODE_EXPORT TcrEndpoint {
bool appThreadRequest = false);

bool needtoTakeConnectLock();
volatile bool m_needToConnectInLock;
ACE_Recursive_Thread_Mutex m_connectLock;
ACE_Condition<ACE_Recursive_Thread_Mutex> m_connectLockCond;

GfErrType createNewConnectionWL(TcrConnection*& newConn,
bool isClientNotification, bool isSecondary,
@@ -192,9 +189,23 @@ class APACHE_GEODE_EXPORT TcrEndpoint {
}

protected:
std::shared_ptr<Properties> getCredentials();
volatile int m_maxConnections;
TcrConnection* m_notifyConnection;
Task<TcrEndpoint>* m_notifyReceiver;
CacheImpl* m_cacheImpl;
std::list<Task<TcrEndpoint>*> m_notifyReceiverList;
std::list<TcrConnection*> m_notifyConnectionList;
ACE_Condition<ACE_Recursive_Thread_Mutex> m_connectLockCond;
ACE_Recursive_Thread_Mutex m_connectLock;
ACE_Recursive_Thread_Mutex m_notifyReceiverLock;
FairQueue<TcrConnection> m_opConnections;
volatile int m_maxConnections;
int m_numRegionListener;
volatile bool m_needToConnectInLock;
bool m_isQueueHosted;

static const char* NC_Notification;

std::shared_ptr<Properties> getCredentials();
virtual bool checkDupAndAdd(std::shared_ptr<EventId> eventid);
virtual void processMarker();
virtual void triggerRedundancyThread();
@@ -206,68 +217,49 @@ class APACHE_GEODE_EXPORT TcrEndpoint {
void closeConnection(TcrConnection*& conn);
virtual void handleNotificationStats(int64_t byteLength);
virtual void closeNotification();
std::list<Task<TcrEndpoint>*> m_notifyReceiverList;
std::list<TcrConnection*> m_notifyConnectionList;
TcrConnection* m_notifyConnection;
Task<TcrEndpoint>* m_notifyReceiver;
int m_numRegionListener;
bool m_isQueueHosted;
ACE_Recursive_Thread_Mutex m_notifyReceiverLock;

virtual bool handleIOException(const std::string& message,
TcrConnection*& conn, bool isBgThread = false);
CacheImpl* m_cacheImpl;

private:
int64_t m_uniqueId;
bool m_isAuthenticated;
ACE_Semaphore& m_failoverSema;
ACE_Semaphore& m_cleanupSema;
ACE_Semaphore& m_redundancySema;
ThinClientBaseDM* m_baseDM;
std::string m_name;
std::list<ThinClientBaseDM*> m_distMgrs;
ACE_Recursive_Thread_Mutex m_endpointAuthenticationLock;
ACE_Recursive_Thread_Mutex m_connectionLock;
ACE_Recursive_Thread_Mutex m_distMgrsLock;
ACE_Semaphore m_notificationCleanupSema;
Set<uint16_t> m_ports;
int32_t m_numberOfTimesFailed;
int m_numRegions;
int m_pingTimeouts;
int m_notifyCount;
uint32_t m_dupCount;
bool m_isAuthenticated;
volatile bool m_msgSent;
volatile bool m_pingSent;
int32_t m_numberOfTimesFailed;
bool m_isMultiUserMode;
volatile bool m_connected;
bool m_isActiveEndpoint;
ServerQueueStatus m_serverQueueStatus;
int32_t m_queueSize;
std::atomic<int32_t> m_noOfConnRefs;
uint16_t m_distributedMemId;
bool m_isServerQueueStatusSet;

bool compareTransactionIds(int32_t reqTransId, int32_t replyTransId,
std::string& failReason, TcrConnection* conn);
void closeConnections();
void setRetry(const TcrMessage& request, int& maxSendRetries);

std::string m_name;
ACE_Recursive_Thread_Mutex m_connectionLock;
volatile bool m_connected;
bool m_isActiveEndpoint;
int m_numRegions;
Set<uint16_t> m_ports;
int m_pingTimeouts;

int m_notifyCount;

ACE_Semaphore& m_failoverSema;
ACE_Semaphore& m_cleanupSema;
ACE_Semaphore m_notificationCleanupSema;
ACE_Semaphore& m_redundancySema;

std::list<ThinClientBaseDM*> m_distMgrs;
ACE_Recursive_Thread_Mutex m_distMgrsLock;

uint32_t m_dupCount;

// TESTING: Durable clients - flag that indicates whether endpoint made
// connection to server that has HA queue.
ServerQueueStatus m_serverQueueStatus;
bool m_isServerQueueStatusSet;
int32_t m_queueSize;
// ThinClientPoolDM* m_poolHADM;
ThinClientBaseDM* m_baseDM;
// number of connections to this endpoint

// Disallow copy constructor and assignment operator.
TcrEndpoint(const TcrEndpoint&);
TcrEndpoint& operator=(const TcrEndpoint&);
// number of connections to this endpoint
std::atomic<int32_t> m_noOfConnRefs;
uint16_t m_distributedMemId;

protected:
static const char* NC_Notification;
};
} // namespace client
} // namespace geode

0 comments on commit f735c53

Please sign in to comment.