Skip to content
Closed
Show file tree
Hide file tree
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
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,13 @@ elseif(${CMAKE_C_COMPILER_ID} STREQUAL SunPro)
set(COMMON_FLAGS "${COMMON_FLAGS} -fma=fused")
set(COMMON_FLAGS "${COMMON_FLAGS} -xmemalign=8i")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -errfmt=error")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -errtags=yes")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -erroff=E_ANONYMOUS_UNION_DECL")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -erroff=E_EMPTY_TRANSLATION_UNIT")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -erroff=E_PROTOTYPE_MISMATCH_PROMOTE")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -erroff=E_STATEMENT_NOT_REACHED")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -erroff=E_TYPEDEF_REDECLARED")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -erroff=E_ZERO_OR_NEGATIVE_SUBSCRIPT")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lsocket")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lnsl")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lresolv")
Expand Down
4 changes: 2 additions & 2 deletions bbinc/comdb2_atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

#if defined(_SUN_SOURCE)
#include <atomic.h>
#define CAS32(mem, oldv, newv) (atomic_cas_32((uint32_t *)&mem, oldv, newv) == oldv)
#define CAS64(mem, oldv, newv) (atomic_cas_64((uint64_t *)&mem, oldv, newv) == oldv)
#define CAS32(mem, oldv, newv) (atomic_cas_32(&mem, oldv, newv) == oldv)
#define CAS64(mem, oldv, newv) (atomic_cas_64(&mem, oldv, newv) == oldv)
#define XCHANGE32(mem, newv) atomic_swap_32(&mem, newv)
#define XCHANGE64(mem, newv) atomic_swap_64(&mem, newv)
#define ATOMIC_LOAD32(mem) atomic_add_32_nv(&mem, 0)
Expand Down
20 changes: 3 additions & 17 deletions bbinc/ssl_support.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@
#include <openssl/ssl.h>
#include <openssl/err.h>

#ifndef SBUF2_SERVER
# define SBUF2_SERVER 1
#include <ssl_glue.h>

#if SBUF2_SERVER
# ifndef SBUF2_UNGETC
# define SBUF2_UNGETC 1
# endif
Expand Down Expand Up @@ -129,21 +130,6 @@ do { \
PRINT_SSL_ERRSTR_MT(cb, msg); \
} while (0)

/* XXX Don't change the order of the enum types */
typedef enum ssl_mode {
SSL_DISABLE, /* invisible to users */
SSL_UNKNOWN, /* invisible to users */
SSL_ALLOW,
SSL_PREFER,
SSL_PREFER_VERIFY_CA, /* implies PREFER */
SSL_PREFER_VERIFY_HOSTNAME, /* implies PREFER_VERIFY_CA */
SSL_PREFER_VERIFY_DBNAME, /* implies PREFER_VERIFY_DBNAME */
SSL_REQUIRE,
SSL_VERIFY_CA, /* It implies REQUIRE. */
SSL_VERIFY_HOSTNAME, /* It impiles VERIFY_CA. */
SSL_VERIFY_DBNAME /* It impiles VERIFY_HOSTNAME. */
} ssl_mode;

#define SSL_IS_ABLE(mode) ((mode) >= SSL_ALLOW)
#define SSL_IS_REQUIRED(mode) ((mode) >= SSL_REQUIRE)
#define SSL_IS_OPTIONAL(mode) ((mode) < SSL_REQUIRE)
Expand Down
4 changes: 2 additions & 2 deletions bdb/rep.c
Original file line number Diff line number Diff line change
Expand Up @@ -3152,8 +3152,8 @@ static int node_in_list(int node, int list[], int listsz)

*/

int64_t gbl_distributed_commit_count = 0;
int64_t gbl_not_durable_commit_count = 0;
uint64_t gbl_distributed_commit_count = 0;
uint64_t gbl_not_durable_commit_count = 0;
int gbl_ignore_final_non_durable_retry = 1;

/* ripped out ALL SUPPORT FOR ALL BROKEN CRAP MODES, aside from "newcoh" */
Expand Down
34 changes: 16 additions & 18 deletions bdb/threads.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,26 +81,18 @@ void *udpbackup_and_autoanalyze_thd(void *arg)
return NULL;
}

/* try to with atomic compare-and-exchange to set thread_running to 1
* if CAS is successful, we are the only (first) such thread and returns 1
* if CAS is UNsuccessful, another thread is already running and we return 0
*/
static inline int try_set(int *thread_running)
{
int zero = 0;
return CAS32(*thread_running, zero, 1);
}

void *memp_trickle_thread(void *arg)
{
unsigned int time;
bdb_state_type *bdb_state;
static int memp_trickle_thread_running = 0;
static uint32_t memp_trickle_thread_running = 0;
static uint32_t zero = 0;
int nwrote;
int rc;

if (try_set(&memp_trickle_thread_running) == 0)
if (!CAS32(memp_trickle_thread_running, zero, 1)) {
return NULL;
}

bdb_state = (bdb_state_type *)arg;

Expand Down Expand Up @@ -212,10 +204,12 @@ void *master_lease_thread(void *arg)
int pollms, renew, lease_time;
bdb_state_type *bdb_state = (bdb_state_type *)arg;
repinfo_type *repinfo = bdb_state->repinfo;
static int master_lease_thread_running = 0;
static uint32_t master_lease_thread_running = 0;
uint32_t zero = 0;

if (try_set(&master_lease_thread_running) == 0)
if (!CAS32(master_lease_thread_running, zero, 1)) {
return NULL;
}

bdb_state->master_lease_thread = pthread_self();

Expand Down Expand Up @@ -252,10 +246,12 @@ void *coherency_lease_thread(void *arg)
bdb_state_type *bdb_state = (bdb_state_type *)arg;
repinfo_type *repinfo = bdb_state->repinfo;
pthread_t tid;
static int coherency_thread_running = 0;
static uint32_t coherency_thread_running = 0;
uint32_t zero = 0;

if (try_set(&coherency_thread_running) == 0)
if (!CAS32(coherency_thread_running, zero, 1)) {
return NULL;
}

bdb_state->coherency_lease_thread = pthread_self();

Expand Down Expand Up @@ -372,10 +368,12 @@ void *checkpoint_thread(void *arg)
DB_LSN logfile;
DB_LSN crtlogfile;
int broken;
static int checkpoint_thd_running = 0;
static uint32_t checkpoint_thd_running = 0;
uint32_t zero = 0;

if (try_set(&checkpoint_thd_running) == 0)
if (!CAS32(checkpoint_thd_running, zero, 1)) {
return NULL;
}

thrman_register(THRTYPE_GENERIC);
thread_started("bdb checkpoint");
Expand Down
4 changes: 2 additions & 2 deletions db/appsock_handler.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ struct thdpool *gbl_appsock_thdpool = NULL;
char appsock_unknown_old[] = "-1 #unknown command\n";
char appsock_unknown[] = "Error: -1 #unknown command\n";
char appsock_supported[] = "supported\n";
int32_t active_appsock_conns = 0;
uint32_t active_appsock_conns = 0;
int64_t gbl_denied_appsock_connection_count = 0;

/* HASH of all registered appsock handlers (one handler per appsock type) */
Expand Down Expand Up @@ -106,7 +106,7 @@ int destroy_appsock(void)
void appsock_quick_stat(void)
{
logmsg(LOGMSG_USER, "num appsock connections %llu\n", total_appsock_conns);
logmsg(LOGMSG_USER, "num active appsock connections %d\n", active_appsock_conns);
logmsg(LOGMSG_USER, "num active appsock connections %u\n", active_appsock_conns);
logmsg(LOGMSG_USER, "num appsock commands %llu\n", total_toks);
}

Expand Down
20 changes: 10 additions & 10 deletions db/comdb2.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ int gbl_recovery_timestamp = 0;
int gbl_recovery_lsn_file = 0;
int gbl_recovery_lsn_offset = 0;
int gbl_trace_prepare_errors = 0;
int gbl_trigger_timepart = 0;
uint32_t gbl_trigger_timepart = 0;
int gbl_extended_sql_debug_trace = 0;
int gbl_perform_full_clean_exit = 1;
int gbl_abort_on_dangling_stringrefs = 0;
Expand Down Expand Up @@ -233,8 +233,8 @@ int gbl_move_deadlk_max_attempt = 500;

int gbl_uses_password;
int gbl_unauth_tag_access = 0;
int64_t gbl_num_auth_allowed = 0;
int64_t gbl_num_auth_denied = 0;
uint64_t gbl_num_auth_allowed = 0;
uint64_t gbl_num_auth_denied = 0;
int gbl_allow_old_authn = 1;
int gbl_uses_externalauth = 0;
int gbl_uses_externalauth_connect = 0;
Expand Down Expand Up @@ -351,7 +351,7 @@ int gbl_meta_lite = 1;
int gbl_context_in_key = 1;
int gbl_ready = 0; /* gets set just before waitft is called
and never gets unset */
static int gbl_db_is_exiting = 0; /* Indicates this process is exiting */
static uint32_t gbl_db_is_exiting = 0; /* Indicates this process is exiting */


int gbl_debug_omit_dta_write;
Expand Down Expand Up @@ -382,13 +382,13 @@ int gbl_init_with_bthash = 0;
int64_t gbl_nsql;
long long gbl_nsql_steps;

int64_t gbl_nnewsql;
uint64_t gbl_nnewsql;
int64_t gbl_nnewsql_ssl;
long long gbl_nnewsql_steps;

int64_t gbl_nnewsql_compat;

uint32_t gbl_masterrejects = 0;
int gbl_masterrejects = 0;

volatile uint32_t gbl_analyze_gen = 0;
volatile int gbl_views_gen = 0;
Expand Down Expand Up @@ -515,8 +515,8 @@ long n_retries;
long n_missed;
long n_dbinfo;

int n_commits;
long long n_commit_time; /* in micro seconds.*/
uint32_t n_commits;
uint64_t n_commit_time; /* in micro seconds.*/

int n_retries_transaction_active = 0;
int n_retries_transaction_done = 0;
Expand Down Expand Up @@ -1668,8 +1668,8 @@ static void begin_clean_exit(void)
#endif
/* this defaults to 5 minutes */
alarm(alarmtime);

XCHANGE32(gbl_db_is_exiting, comdb2_time_epoch());
uint32_t now = comdb2_time_epoch();
XCHANGE32(gbl_db_is_exiting, now);

/* dont let any new requests come in. we're going to go non-coherent
here in a second, so letting new reads in would be bad. */
Expand Down
20 changes: 10 additions & 10 deletions db/comdb2.h
Original file line number Diff line number Diff line change
Expand Up @@ -658,16 +658,16 @@ typedef struct dbtable {
int64_t prev_blockosqltypcnt[MAX_OSQL_TYPES];
int64_t prev_nsql;
/* counters for writes to this table */
int64_t write_count[RECORD_WRITE_MAX];
uint64_t write_count[RECORD_WRITE_MAX];
int64_t saved_write_count[RECORD_WRITE_MAX];
/* counters for cascaded writes to this table */
int64_t casc_write_count;
int64_t saved_casc_write_count;
int64_t deadlock_count;
int64_t saved_deadlock_count;
int64_t aa_saved_counter; // zeroed out at autoanalyze
int64_t aa_lastepoch;
int64_t aa_needs_analyze_time; // time when analyze is needed for table in request mode, otherwise 0
uint64_t aa_saved_counter; // zeroed out at autoanalyze
uint64_t aa_lastepoch;
uint64_t aa_needs_analyze_time; // time when analyze is needed for table in request mode, otherwise 0
int64_t read_count; // counter for reads to this table
int64_t index_used_count; // counter for number of times a table index was used

Expand Down Expand Up @@ -1605,11 +1605,11 @@ typedef struct {

/* global settings */
extern int gbl_sc_timeoutms;
extern int gbl_trigger_timepart;
extern uint32_t gbl_trigger_timepart;
extern int gbl_multitable_ddl;

extern int64_t gbl_num_auth_allowed;
extern int64_t gbl_num_auth_denied;
extern uint64_t gbl_num_auth_allowed;
extern uint64_t gbl_num_auth_denied;

extern const char *const gbl_db_git_version_sha;
extern const char gbl_db_version[];
Expand Down Expand Up @@ -1772,7 +1772,7 @@ extern pthread_attr_t gbl_pthread_attr_detached;
extern int64_t gbl_nsql;
extern long long gbl_nsql_steps;

extern int64_t gbl_nnewsql;
extern uint64_t gbl_nnewsql;
extern int64_t gbl_nnewsql_ssl;
extern long long gbl_nnewsql_steps;

Expand Down Expand Up @@ -1802,7 +1802,7 @@ extern int64_t gbl_fastsql_set_datetime_precision;
extern int64_t gbl_fastsql_sslconn;
extern int64_t gbl_fastsql_execute_stop;

extern unsigned int gbl_masterrejects;
extern int gbl_masterrejects;

extern int gbl_selectv_rangechk;

Expand All @@ -1826,7 +1826,7 @@ extern int gbl_verify_abort;

extern int gbl_sort_nulls_correctly;

extern int gbl_master_changes;
extern uint32_t gbl_master_changes;
extern int gbl_sc_commit_count;

extern int gbl_fix_validate_cstr;
Expand Down
Loading
Loading