diff --git a/CMakeLists.txt b/CMakeLists.txt index fec8b702db..e6d4f557c3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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") diff --git a/bbinc/comdb2_atomic.h b/bbinc/comdb2_atomic.h index 08de96020a..168a37babd 100644 --- a/bbinc/comdb2_atomic.h +++ b/bbinc/comdb2_atomic.h @@ -3,8 +3,8 @@ #if defined(_SUN_SOURCE) #include - #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) diff --git a/bbinc/ssl_support.h b/bbinc/ssl_support.h index 68f3b8b9bc..91334ae746 100644 --- a/bbinc/ssl_support.h +++ b/bbinc/ssl_support.h @@ -26,8 +26,9 @@ #include #include -#ifndef SBUF2_SERVER -# define SBUF2_SERVER 1 +#include + +#if SBUF2_SERVER # ifndef SBUF2_UNGETC # define SBUF2_UNGETC 1 # endif @@ -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) diff --git a/bdb/rep.c b/bdb/rep.c index 690fb75ec9..d2306e58aa 100644 --- a/bdb/rep.c +++ b/bdb/rep.c @@ -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" */ diff --git a/bdb/threads.c b/bdb/threads.c index 068f9e9071..9b63610589 100644 --- a/bdb/threads.c +++ b/bdb/threads.c @@ -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; @@ -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(); @@ -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(); @@ -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"); diff --git a/db/appsock_handler.c b/db/appsock_handler.c index ead42b5de9..538788bec0 100644 --- a/db/appsock_handler.c +++ b/db/appsock_handler.c @@ -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) */ @@ -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); } diff --git a/db/comdb2.c b/db/comdb2.c index 1d18d6fb53..d3f43d4560 100644 --- a/db/comdb2.c +++ b/db/comdb2.c @@ -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; @@ -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; @@ -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; @@ -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; @@ -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; @@ -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. */ diff --git a/db/comdb2.h b/db/comdb2.h index 551ce9b68b..0d5fa558c6 100644 --- a/db/comdb2.h +++ b/db/comdb2.h @@ -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 @@ -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[]; @@ -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; @@ -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; @@ -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; diff --git a/db/db_metrics.c b/db/db_metrics.c index bd3cebd276..2f6e9aed73 100644 --- a/db/db_metrics.c +++ b/db/db_metrics.c @@ -156,225 +156,118 @@ static struct comdb2_metrics_store stats; Please keep'em sorted. */ comdb2_metric gbl_metrics[] = { - {"cache_hits", "Buffer pool hits", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.cache_hits, - NULL}, - {"cache_misses", "Buffer pool misses", (int64_t)STATISTIC_COLLECTION_TYPE_CUMULATIVE, (int64_t)STATISTIC_INTEGER, - &stats.cache_misses, NULL}, - {"cache_hit_rate", "Buffer pool request hit rate", STATISTIC_DOUBLE, STATISTIC_COLLECTION_TYPE_LATEST, - &stats.cache_hit_rate, NULL}, + {"cache_hits", "Buffer pool hits", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.cache_hits, NULL}, + {"cache_misses", "Buffer pool misses", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.cache_misses, NULL}, + {"cache_hit_rate", "Buffer pool request hit rate", STATISTIC_DOUBLE, STATISTIC_COLLECTION_TYPE_LATEST, &stats.cache_hit_rate, NULL}, {"commits", "Number of commits", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.commits, NULL}, - {"concurrent_sql", "Concurrent SQL queries", STATISTIC_DOUBLE, STATISTIC_COLLECTION_TYPE_LATEST, - &stats.concurrent_sql, NULL}, - {"concurrent_connections", "Number of concurrent connections ", STATISTIC_DOUBLE, STATISTIC_COLLECTION_TYPE_LATEST, - &stats.concurrent_connections, NULL}, - {"connections", "Total connections", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.connections, - NULL}, - {"connection_timeouts", "Timed out connection attempts", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, - &stats.connection_timeouts, NULL}, - {"connection_to_sql_ratio", - "Ratio of total number of connections to sql " - "(and nonsql) request counts", - STATISTIC_DOUBLE, STATISTIC_COLLECTION_TYPE_LATEST, &stats.connection_to_sql_ratio, NULL}, - {"cpu_percent", "Database CPU time over last 5 seconds", STATISTIC_DOUBLE, STATISTIC_COLLECTION_TYPE_LATEST, - &stats.cpu_percent, NULL}, - {"current_connections", "Number of current connections", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_LATEST, - &stats.current_connections, NULL}, - {"deadlocks", "Number of deadlocks", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.deadlocks, - NULL}, - {"locks_aborted", "Number of locks aborted", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, - &stats.locks_aborted, NULL}, - {"diskspace", "Disk space used (bytes)", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_LATEST, &stats.diskspace, - NULL}, - {"fstraps", "Number of socket requests", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.fstraps, - NULL}, - {"ismaster", "Is this machine the current master", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_LATEST, - &stats.ismaster, NULL}, - {"lockrequests", "Total lock requests", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, - &stats.lockrequests, NULL}, - {"lockwaits", "Number of lock waits", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.lockwaits, - NULL}, - {"lockwait_time", "Time spent in lock waits (us)", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, - &stats.lock_wait_time_us, NULL}, - {"memory_ulimit", "Virtual address space ulimit", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_LATEST, - &stats.memory_ulimit, NULL}, - {"memory_usage", "Address space size", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_LATEST, &stats.memory_usage, - NULL}, + {"concurrent_sql", "Concurrent SQL queries", STATISTIC_DOUBLE, STATISTIC_COLLECTION_TYPE_LATEST, &stats.concurrent_sql, NULL}, + {"concurrent_connections", "Number of concurrent connections ", STATISTIC_DOUBLE, STATISTIC_COLLECTION_TYPE_LATEST, &stats.concurrent_connections, NULL}, + {"connections", "Total connections", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.connections, NULL}, + {"connection_timeouts", "Timed out connection attempts", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.connection_timeouts, NULL}, + {"connection_to_sql_ratio", "Ratio of total number of connections to sql (and nonsql) request counts", STATISTIC_DOUBLE, STATISTIC_COLLECTION_TYPE_LATEST, &stats.connection_to_sql_ratio, NULL}, + {"cpu_percent", "Database CPU time over last 5 seconds", STATISTIC_DOUBLE, STATISTIC_COLLECTION_TYPE_LATEST, &stats.cpu_percent, NULL}, + {"current_connections", "Number of current connections", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_LATEST, &stats.current_connections, NULL}, + {"deadlocks", "Number of deadlocks", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.deadlocks, NULL}, + {"locks_aborted", "Number of locks aborted", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.locks_aborted, NULL}, + {"diskspace", "Disk space used (bytes)", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_LATEST, &stats.diskspace, NULL}, + {"fstraps", "Number of socket requests", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.fstraps, NULL}, + {"ismaster", "Is this machine the current master", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_LATEST, &stats.ismaster, NULL}, + {"lockrequests", "Total lock requests", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.lockrequests, NULL}, + {"lockwaits", "Number of lock waits", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.lockwaits, NULL}, + {"lockwait_time", "Time spent in lock waits (us)", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.lock_wait_time_us, NULL}, + {"memory_ulimit", "Virtual address space ulimit", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_LATEST, &stats.memory_ulimit, NULL}, + {"memory_usage", "Address space size", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_LATEST, &stats.memory_usage, NULL}, {"preads", "Number of pread()'s", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.preads, NULL}, {"pwrites", "Number of pwrite()'s", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.pwrites, NULL}, - {"queue_depth", "Request queue depth", STATISTIC_DOUBLE, STATISTIC_COLLECTION_TYPE_LATEST, &stats.queue_depth, - NULL}, + {"queue_depth", "Request queue depth", STATISTIC_DOUBLE, STATISTIC_COLLECTION_TYPE_LATEST, &stats.queue_depth, NULL}, {"retries", "Number of retries", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.retries, NULL}, {"service_time", "Service time", STATISTIC_DOUBLE, STATISTIC_COLLECTION_TYPE_LATEST, &stats.service_time, NULL}, - {"sql_cost", "Number of sql steps executed (cost)", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, - &stats.sql_cost, NULL}, - {"sql_count", "Number of sql queries executed", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, - &stats.sql_count, NULL}, - {"sql_ssl_count", "Number of sql queries executed, via SSL", STATISTIC_INTEGER, - STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.sql_ssl_count, NULL}, + {"sql_cost", "Number of sql steps executed (cost)", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.sql_cost, NULL}, + {"sql_count", "Number of sql queries executed", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.sql_count, NULL}, + {"sql_ssl_count", "Number of sql queries executed, via SSL", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.sql_ssl_count, NULL}, {"start_time", "Server start time", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_LATEST, &stats.start_time, NULL}, {"threads", "Number of threads", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_LATEST, &stats.threads, NULL}, - {"num_sc_done", "Number of schema changes done", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_LATEST, - &stats.num_sc_done, NULL}, - {"checkpoint_ms", "Time taken for last checkpoint", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_LATEST, - &stats.last_checkpoint_ms}, - {"checkpoint_total_ms", "Total time taken for checkpoints", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, - &stats.total_checkpoint_ms}, - {"checkpoint_count", "Total number of checkpoints taken", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, - &stats.checkpoint_count}, - {"rcache_hits", "Count of root-page cache hits", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, - &stats.rcache_hits}, - {"rcache_misses", "Count of root-page cache misses", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, - &stats.rcache_misses}, - {"last_election_ms", "Time taken to resolve last election", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_LATEST, - &stats.last_election_ms, NULL}, - {"total_election_ms", "Total time taken to resolve elections", STATISTIC_INTEGER, - STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.total_election_ms, NULL}, - {"election_count", "Total number of elections", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_LATEST, - &stats.election_count, NULL}, - {"last_election_time", "Wallclock time last election completed", STATISTIC_INTEGER, - STATISTIC_COLLECTION_TYPE_LATEST, &stats.last_election_time, NULL}, - {"udp_sent", "Number of udp packets sent", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.udp_sent, - NULL}, - {"udp_failed_send", "Number of failed udp sends", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, - &stats.udp_failed_send, NULL}, - {"udp_received", "Number of udp receives", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, - &stats.udp_received, NULL}, - {"active_transactions", "Number of active transactions", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_LATEST, - &stats.active_transactions, NULL}, - {"max_active_transactions", "Maximum number of active transactions", STATISTIC_INTEGER, - STATISTIC_COLLECTION_TYPE_LATEST, &stats.maxactive_transactions, NULL}, - {"total_commits", "Number of transaction commits", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, - &stats.total_commits, NULL}, - {"total_aborts", "Number of transaction aborts", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, - &stats.total_aborts, NULL}, - {"sql_queue_time", "Average ms spent waiting in sql queue", STATISTIC_DOUBLE, STATISTIC_COLLECTION_TYPE_LATEST, - &stats.sql_queue_time, NULL}, - {"sql_queue_timeouts", "Number of sql items timed-out waiting on queue", STATISTIC_INTEGER, - STATISTIC_COLLECTION_TYPE_LATEST, &stats.sql_queue_timeouts, NULL}, - {"handle_buf_queue_time", "Average ms spent waiting in handle-buf queue", STATISTIC_DOUBLE, - STATISTIC_COLLECTION_TYPE_LATEST, &stats.handle_buf_queue_time, NULL}, - {"denied_appsocks", "Number of denied appsock connections", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, - &stats.denied_appsock_connections, NULL}, - {"locks", "Number of currently held locks", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_LATEST, &stats.locks, - NULL}, - {"temptable_created", "Number of temporary tables created", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, - &stats.temptable_created, NULL}, - {"temptable_create_requests", "Number of create temporary table requests", STATISTIC_INTEGER, - STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.temptable_create_reqs, NULL}, - {"temptable_spills", "Number of temporary tables that had to be spilled to disk-backed tables", STATISTIC_INTEGER, - STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.temptable_spills, NULL}, - {"net_drops", "Number of packets that didn't fit on network queue and were dropped", STATISTIC_INTEGER, - STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.net_drops, NULL}, - {"net_queue_size", "Size of largest outgoing net queue", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_LATEST, - &stats.net_queue_size, NULL}, - {"rep_deadlocks", "Replication deadlocks", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, - &stats.rep_deadlocks, NULL}, - {"rw_evictions", "Dirty page evictions", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.rw_evicts, - NULL}, - {"standing_queue_time", "How long the database has had a standing queue", STATISTIC_INTEGER, - STATISTIC_COLLECTION_TYPE_LATEST, &stats.standing_queue_time, NULL}, - {"nonsql", "Number of non-sql requests (eg: tagged)", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, - &stats.nonsql, NULL}, + {"num_sc_done", "Number of schema changes done", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_LATEST, &stats.num_sc_done, NULL}, + {"checkpoint_ms", "Time taken for last checkpoint", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_LATEST, &stats.last_checkpoint_ms}, + {"checkpoint_total_ms", "Total time taken for checkpoints", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.total_checkpoint_ms}, + {"checkpoint_count", "Total number of checkpoints taken", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.checkpoint_count}, + {"rcache_hits", "Count of root-page cache hits", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.rcache_hits}, + {"rcache_misses", "Count of root-page cache misses", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.rcache_misses}, + {"last_election_ms", "Time taken to resolve last election", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_LATEST, &stats.last_election_ms, NULL}, + {"total_election_ms", "Total time taken to resolve elections", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.total_election_ms, NULL}, + {"election_count", "Total number of elections", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_LATEST, &stats.election_count, NULL}, + {"last_election_time", "Wallclock time last election completed", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_LATEST, &stats.last_election_time, NULL}, + {"udp_sent", "Number of udp packets sent", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.udp_sent, NULL}, + {"udp_failed_send", "Number of failed udp sends", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.udp_failed_send, NULL}, + {"udp_received", "Number of udp receives", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.udp_received, NULL}, + {"active_transactions", "Number of active transactions", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_LATEST, &stats.active_transactions, NULL}, + {"max_active_transactions", "Maximum number of active transactions", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_LATEST, &stats.maxactive_transactions, NULL}, + {"total_commits", "Number of transaction commits", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.total_commits, NULL}, + {"total_aborts", "Number of transaction aborts", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.total_aborts, NULL}, + {"sql_queue_time", "Average ms spent waiting in sql queue", STATISTIC_DOUBLE, STATISTIC_COLLECTION_TYPE_LATEST, &stats.sql_queue_time, NULL}, + {"sql_queue_timeouts", "Number of sql items timed-out waiting on queue", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_LATEST, &stats.sql_queue_timeouts, NULL}, + {"handle_buf_queue_time", "Average ms spent waiting in handle-buf queue", STATISTIC_DOUBLE, STATISTIC_COLLECTION_TYPE_LATEST, &stats.handle_buf_queue_time, NULL}, + {"denied_appsocks", "Number of denied appsock connections", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.denied_appsock_connections, NULL}, + {"locks", "Number of currently held locks", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_LATEST, &stats.locks, NULL}, + {"temptable_created", "Number of temporary tables created", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.temptable_created, NULL}, + {"temptable_create_requests", "Number of create temporary table requests", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.temptable_create_reqs, NULL}, + {"temptable_spills", "Number of temporary tables that had to be spilled to disk-backed tables", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.temptable_spills, NULL}, + {"net_drops", "Number of packets that didn't fit on network queue and were dropped", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.net_drops, NULL}, + {"net_queue_size", "Size of largest outgoing net queue", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_LATEST, &stats.net_queue_size, NULL}, + {"rep_deadlocks", "Replication deadlocks", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.rep_deadlocks, NULL}, + {"rw_evictions", "Dirty page evictions", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.rw_evicts, NULL}, + {"standing_queue_time", "How long the database has had a standing queue", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_LATEST, &stats.standing_queue_time, NULL}, + {"nonsql", "Number of non-sql requests (eg: tagged)", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.nonsql, NULL}, #if 0 - {"minimum_truncation_file", "Minimum truncation file", STATISTIC_INTEGER, - STATISTIC_COLLECTION_TYPE_LATEST, &stats.minimum_truncation_file, NULL}, - {"minimum_truncation_offset", "Minimum truncation offset", - STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_LATEST, - &stats.minimum_truncation_offset, NULL}, - {"minimum_truncation_timestamp", "Minimum truncation timestamp", - STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_LATEST, - &stats.minimum_truncation_timestamp, NULL}, + {"minimum_truncation_file", "Minimum truncation file", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_LATEST, &stats.minimum_truncation_file, NULL}, + {"minimum_truncation_offset", "Minimum truncation offset", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_LATEST, &stats.minimum_truncation_offset, NULL}, + {"minimum_truncation_timestamp", "Minimum truncation timestamp", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_LATEST, &stats.minimum_truncation_timestamp, NULL}, #endif - {"reprepares", "Number of times statements are reprepared by sqlitex", STATISTIC_INTEGER, - STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.reprepares, NULL}, - {"verify_replays", "Number of replays on verify errors", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, - &stats.vreplays, NULL}, - {"nsslfullhandshakes", "Number of SSL full handshakes", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, - &stats.nsslfullhandshakes, NULL}, - {"nsslpartialhandshakes", "Number of SSL partial handshakes", STATISTIC_INTEGER, - STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.nsslpartialhandshakes, NULL}, - {"weighted_queue_depth", "Weighted queue depth", STATISTIC_DOUBLE, STATISTIC_COLLECTION_TYPE_LATEST, - &stats.weighted_queue_depth, NULL}, - {"weighted_standing_queue_time", "How long the database has had a weighted standing queue", STATISTIC_INTEGER, - STATISTIC_COLLECTION_TYPE_LATEST, &stats.weighted_standing_queue_time, NULL}, - {"auth_allowed", "Number of successful authentication requests", STATISTIC_INTEGER, - STATISTIC_COLLECTION_TYPE_LATEST, &stats.auth_allowed, NULL}, - {"auth_denied", "Number of failed authentication requests", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_LATEST, - &stats.auth_denied, NULL}, - {"watchdog_time", "Number of seconds for a successful watchdog test run", STATISTIC_DOUBLE, - STATISTIC_COLLECTION_TYPE_LATEST, &stats.watchdog_time, NULL}, - {"distributed_commits", "Number of distributed commits", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, - &stats.distributed_commits, NULL}, - {"not_durable_commits", "Number of not durable commits", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, - &stats.not_durable_commits, NULL}, - {"disabled_incoherent_slows", "Disabled incoherent-slow count", STATISTIC_INTEGER, - STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.incoherent_slow_skips, NULL}, - {"page_reads", "Total page reads", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.page_reads, - NULL}, - {"page_writes", "Total page writes", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.page_writes, - NULL}, - {"failed_page_reads", "Total failed page reads", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, - &stats.failed_page_reads, NULL}, - {"failed_page_writes", "Total failed page writes", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, - &stats.failed_page_writes, NULL}, + {"reprepares", "Number of times statements are reprepared by sqlitex", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.reprepares, NULL}, + {"verify_replays", "Number of replays on verify errors", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.vreplays, NULL}, + {"nsslfullhandshakes", "Number of SSL full handshakes", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.nsslfullhandshakes, NULL}, + {"nsslpartialhandshakes", "Number of SSL partial handshakes", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.nsslpartialhandshakes, NULL}, + {"weighted_queue_depth", "Weighted queue depth", STATISTIC_DOUBLE, STATISTIC_COLLECTION_TYPE_LATEST, &stats.weighted_queue_depth, NULL}, + {"weighted_standing_queue_time", "How long the database has had a weighted standing queue", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_LATEST, &stats.weighted_standing_queue_time, NULL}, + {"auth_allowed", "Number of successful authentication requests", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_LATEST, &stats.auth_allowed, NULL}, + {"auth_denied", "Number of failed authentication requests", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_LATEST, &stats.auth_denied, NULL}, + {"watchdog_time", "Number of seconds for a successful watchdog test run", STATISTIC_DOUBLE, STATISTIC_COLLECTION_TYPE_LATEST, &stats.watchdog_time, NULL}, + {"distributed_commits", "Number of distributed commits", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.distributed_commits, NULL}, + {"not_durable_commits", "Number of not durable commits", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.not_durable_commits, NULL}, + {"disabled_incoherent_slows", "Disabled incoherent-slow count", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.incoherent_slow_skips, NULL}, + {"page_reads", "Total page reads", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.page_reads, NULL}, + {"page_writes", "Total page writes", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.page_writes, NULL}, + {"failed_page_reads", "Total failed page reads", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.failed_page_reads, NULL}, + {"failed_page_writes", "Total failed page writes", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.failed_page_writes, NULL}, {"fsyncs", "Fsync count", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.fsyncs, NULL}, {"mempgets", "Mempget count", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.mempgets, NULL}, - {"page_bytes_read", "Total page bytes read", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, - &stats.page_bytes_read, NULL}, - {"page_bytes_written", "Total page bytes written", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, - &stats.page_bytes_written, NULL}, - {"failed_page_bytes_read", "Total failed page bytes read", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, - &stats.failed_page_bytes_read, NULL}, - {"failed_page_bytes_written", "Total failed page bytes written", STATISTIC_INTEGER, - STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.failed_page_bytes_written, NULL}, - {"fastsql_execute_inline_params", "Number of fastsql 'execute' requests", STATISTIC_INTEGER, - STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.fastsql_execute_inline_params, NULL}, - {"fastsql_set_isolation_level", "Number of fastsql 'set isolation level' requests", STATISTIC_INTEGER, - STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.fastsql_set_isolation_level, NULL}, - {"fastsql_set_timeout", "Number of fastsql 'set timeout' requests", STATISTIC_INTEGER, - STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.fastsql_set_timeout, NULL}, - {"fastsql_set_info", "Number of fastsql 'set info' requests", STATISTIC_INTEGER, - STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.fastsql_set_info, NULL}, - {"fastsql_execute_inline_params_tz", "Number of fastsql 'execute with timezone' requests", STATISTIC_INTEGER, - STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.fastsql_execute_inline_params_tz, NULL}, - {"fastsql_set_heartbeat", "Number of fastsql 'set heartbeat' requests", STATISTIC_INTEGER, - STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.fastsql_set_heartbeat, NULL}, - {"fastsql_pragma", "Number of fastsql pragma requests", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, - &stats.fastsql_pragma, NULL}, - {"fastsql_reset", "Number of fastsql reset requests", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, - &stats.fastsql_reset, NULL}, - {"fastsql_execute_replaceable_params", "Number of fastsql 'execute with replacable parameters' requests", - STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.fastsql_execute_replaceable_params, NULL}, - {"fastsql_set_sql_debug", "Number of fastsql 'set sql debug' requests", STATISTIC_INTEGER, - STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.fastsql_set_sql_debug, NULL}, - {"fastsql_grab_dbglog", "Number of fastsql 'grab dbglog' requests", STATISTIC_INTEGER, - STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.fastsql_grab_dbglog, NULL}, - {"fastsql_set_user", "Number of fastsql 'set user' requests", STATISTIC_INTEGER, - STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.fastsql_set_user, NULL}, - {"fastsql_set_password", "Number of fastsql 'set password' requests", STATISTIC_INTEGER, - STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.fastsql_set_password, NULL}, - {"fastsql_set_endian", "Number of fastsql 'set endian' requests", STATISTIC_INTEGER, - STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.fastsql_set_endian, NULL}, - {"fastsql_execute_replaceable_params_tz", - "Number of fastsql 'execute with replacable parameters & timezone' " - "requests", - STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.fastsql_execute_replaceable_params_tz, NULL}, - {"fastsql_get_effects", "Number of fastsql 'get effects' requests", STATISTIC_INTEGER, - STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.fastsql_get_effects, NULL}, - {"fastsql_set_planner_effort", "Number of fastsql 'set planner effort' requests", STATISTIC_INTEGER, - STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.fastsql_set_planner_effort, NULL}, - {"fastsql_set_remote_access", "Number of fastsql 'set remote access' requests", STATISTIC_INTEGER, - STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.fastsql_set_remote_access, NULL}, - {"fastsql_osql_max_trans", "Number of fastsql 'osql max trans' requests", STATISTIC_INTEGER, - STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.fastsql_osql_max_trans, NULL}, - {"fastsql_set_datetime_precision", "Number of fastsql 'set datetime precision' requests", STATISTIC_INTEGER, - STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.fastsql_set_datetime_precision, NULL}, - {"fastsql_sslconn", "Number of fastsql 'sslconn' requests", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, - &stats.fastsql_sslconn, NULL}, - {"fastsql_execute_stop", "Number of fastsql 'execute stop' requests", STATISTIC_INTEGER, - STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.fastsql_execute_stop, NULL}, - {"legacy_requests", "Number of non-cdb2api requests", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, - &stats.legacy_requests, NULL}, + {"page_bytes_read", "Total page bytes read", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.page_bytes_read, NULL}, + {"page_bytes_written", "Total page bytes written", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.page_bytes_written, NULL}, + {"failed_page_bytes_read", "Total failed page bytes read", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.failed_page_bytes_read, NULL}, + {"failed_page_bytes_written", "Total failed page bytes written", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.failed_page_bytes_written, NULL}, + {"fastsql_execute_inline_params", "Number of fastsql 'execute' requests", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.fastsql_execute_inline_params, NULL}, + {"fastsql_set_isolation_level", "Number of fastsql 'set isolation level' requests", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.fastsql_set_isolation_level, NULL}, + {"fastsql_set_timeout", "Number of fastsql 'set timeout' requests", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.fastsql_set_timeout, NULL}, + {"fastsql_set_info", "Number of fastsql 'set info' requests", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.fastsql_set_info, NULL}, + {"fastsql_execute_inline_params_tz", "Number of fastsql 'execute with timezone' requests", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.fastsql_execute_inline_params_tz, NULL}, + {"fastsql_set_heartbeat", "Number of fastsql 'set heartbeat' requests", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.fastsql_set_heartbeat, NULL}, + {"fastsql_pragma", "Number of fastsql pragma requests", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.fastsql_pragma, NULL}, + {"fastsql_reset", "Number of fastsql reset requests", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.fastsql_reset, NULL}, + {"fastsql_execute_replaceable_params", "Number of fastsql 'execute with replacable parameters' requests", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.fastsql_execute_replaceable_params, NULL}, + {"fastsql_set_sql_debug", "Number of fastsql 'set sql debug' requests", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.fastsql_set_sql_debug, NULL}, + {"fastsql_grab_dbglog", "Number of fastsql 'grab dbglog' requests", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.fastsql_grab_dbglog, NULL}, + {"fastsql_set_user", "Number of fastsql 'set user' requests", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.fastsql_set_user, NULL}, + {"fastsql_set_password", "Number of fastsql 'set password' requests", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.fastsql_set_password, NULL}, + {"fastsql_set_endian", "Number of fastsql 'set endian' requests", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.fastsql_set_endian, NULL}, + {"fastsql_execute_replaceable_params_tz", "Number of fastsql 'execute with replacable parameters & timezone' requests", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.fastsql_execute_replaceable_params_tz, NULL}, + {"fastsql_get_effects", "Number of fastsql 'get effects' requests", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.fastsql_get_effects, NULL}, + {"fastsql_set_planner_effort", "Number of fastsql 'set planner effort' requests", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.fastsql_set_planner_effort, NULL}, + {"fastsql_set_remote_access", "Number of fastsql 'set remote access' requests", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.fastsql_set_remote_access, NULL}, + {"fastsql_osql_max_trans", "Number of fastsql 'osql max trans' requests", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.fastsql_osql_max_trans, NULL}, + {"fastsql_set_datetime_precision", "Number of fastsql 'set datetime precision' requests", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.fastsql_set_datetime_precision, NULL}, + {"fastsql_sslconn", "Number of fastsql 'sslconn' requests", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.fastsql_sslconn, NULL}, + {"fastsql_execute_stop", "Number of fastsql 'execute stop' requests", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.fastsql_execute_stop, NULL}, + {"legacy_requests", "Number of non-cdb2api requests", STATISTIC_INTEGER, STATISTIC_COLLECTION_TYPE_CUMULATIVE, &stats.legacy_requests, NULL}, }; const char *metric_collection_type_string(comdb2_collection_type t) { @@ -389,7 +282,7 @@ const char *metric_collection_type_string(comdb2_collection_type t) { int gbl_metrics_count = sizeof(gbl_metrics) / sizeof(comdb2_metric); -extern int n_commits; +extern uint32_t n_commits; extern long n_fstrap; /* Legacy request metrics */ @@ -416,8 +309,8 @@ int64_t gbl_fastsql_set_datetime_precision; int64_t gbl_fastsql_sslconn; int64_t gbl_fastsql_execute_stop; -extern int64_t gbl_distributed_commit_count; -extern int64_t gbl_not_durable_commit_count; +extern uint64_t gbl_distributed_commit_count; +extern uint64_t gbl_not_durable_commit_count; extern int64_t gbl_incoherent_slow_skips; @@ -614,16 +507,14 @@ int refresh_metrics(void) stats.concurrent_sql = time_metric_average(thedb->concurrent_queries); stats.sql_queue_time = time_metric_average(thedb->sql_queue_time); stats.sql_queue_timeouts = get_all_sql_pool_timeouts(); - stats.handle_buf_queue_time = - time_metric_average(thedb->handle_buf_queue_time); + stats.handle_buf_queue_time = time_metric_average(thedb->handle_buf_queue_time); stats.concurrent_connections = time_metric_average(thedb->connections); stats.watchdog_time = time_metric_average(thedb->watchdog_time); stats.distributed_commits = gbl_distributed_commit_count; stats.not_durable_commits = gbl_not_durable_commit_count; stats.incoherent_slow_skips = gbl_incoherent_slow_skips; - struct global_stats gstats = {0}; - global_request_stats(&gstats); + struct global_stats gstats = global_request_stats(); stats.page_reads = gstats.page_reads; stats.page_writes = gstats.page_writes; @@ -636,9 +527,7 @@ int refresh_metrics(void) stats.failed_page_bytes_read = gstats.failed_page_bytes_read; stats.failed_page_bytes_written = gstats.failed_page_bytes_written; - int master = - bdb_whoismaster((bdb_state_type *)thedb->bdb_env) == gbl_myhostname ? 1 - : 0; + int master = bdb_whoismaster((bdb_state_type *)thedb->bdb_env) == gbl_myhostname ? 1 : 0; stats.ismaster = master; stats.last_checkpoint_ms = gbl_last_checkpoint_ms; stats.total_checkpoint_ms = gbl_total_checkpoint_ms; diff --git a/db/eventlog.c b/db/eventlog.c index 5aef7ace1f..0a2e45faca 100644 --- a/db/eventlog.c +++ b/db/eventlog.c @@ -60,8 +60,8 @@ static int eventlog_verbose = 0; static gzFile eventlog = NULL; static pthread_mutex_t eventlog_lk = PTHREAD_MUTEX_INITIALIZER; -static int eventlog_every_n = 1; -static int64_t eventlog_count = 0; +static uint32_t eventlog_every_n = 1; +static uint32_t eventlog_count = 0; static int eventlog_debug_events = 0; static void eventlog_roll(void); @@ -613,7 +613,7 @@ void eventlog_add(const struct reqlogger *logger) return; } - int loc_count = ATOMIC_ADD64(eventlog_count, 1); + uint32_t loc_count = ATOMIC_ADD32(eventlog_count, 1); if (eventlog_every_n > 1 && loc_count % eventlog_every_n != 0) { return; } diff --git a/db/glue.c b/db/glue.c index 0fc1013d57..6d5f60cc63 100644 --- a/db/glue.c +++ b/db/glue.c @@ -181,7 +181,7 @@ static int ix_find_check_blob_race(struct ireq *iq, char *inbuf, int numblobs, static int syncmode_callback(bdb_state_type *bdb_state); /* How many times we became, or ceased to be, master node. */ -int gbl_master_changes = 0; +uint32_t gbl_master_changes = 0; /* Dont block when removing old files */ int gbl_txn_fop_noblock = 0; diff --git a/db/osqlsession.c b/db/osqlsession.c index b1d632500e..49bf71132c 100644 --- a/db/osqlsession.c +++ b/db/osqlsession.c @@ -40,7 +40,7 @@ #include struct sess_impl { - int clients; /* number of threads using the session */ + uint32_t clients; /* number of threads using the session */ unsigned dispatched : 1; /* Set when session is dispatched to handle_buf */ unsigned terminate : 1; /* Set when this session is about to be terminated */ @@ -222,8 +222,9 @@ int osql_sess_addclient(osql_sess_t *psess) Pthread_mutex_lock(&sess->mtx); if (sess->dispatched) { rc = -1; - } else + } else { sess->clients += 1; + } Pthread_mutex_unlock(&sess->mtx); return rc; diff --git a/db/osqlsqlthr.h b/db/osqlsqlthr.h index 6d02c31bcd..9bdf33974c 100644 --- a/db/osqlsqlthr.h +++ b/db/osqlsqlthr.h @@ -37,7 +37,12 @@ */ struct BtCursor; -enum trans_clntcomm; + +enum trans_clntcomm { + TRANS_CLNTCOMM_NOREPLY = 0, + TRANS_CLNTCOMM_NORMAL = 1, + TRANS_CLNTCOMM_CHUNK = 2 +}; /* Upsert flags that attach with OSQL_INSERT. */ enum osql_rec_flags { diff --git a/db/process_message.c b/db/process_message.c index 02d7f44142..93707f8bf2 100644 --- a/db/process_message.c +++ b/db/process_message.c @@ -1905,11 +1905,10 @@ int process_command(struct dbenv *dbenv, char *line, int lline, int st) gbl_epoch_time - gbl_starttime); logmsg(LOGMSG_USER, "readonly %c\n", gbl_readonly ? 'Y' : 'N'); logmsg(LOGMSG_USER, "num sql queries %"PRId64"\n", gbl_nsql); - logmsg(LOGMSG_USER, "num new sql queries %"PRId64"\n", gbl_nnewsql); + logmsg(LOGMSG_USER, "num new sql queries %"PRIu64"\n", gbl_nnewsql); logmsg(LOGMSG_USER, "num ssl sql queries %"PRId64"\n", gbl_nnewsql_ssl); logmsg(LOGMSG_USER, "num sql compat queries %"PRId64"\n", gbl_nnewsql_compat); - logmsg(LOGMSG_USER, "num master rejects %u\n", - gbl_masterrejects); + logmsg(LOGMSG_USER, "num master rejects %d\n", gbl_masterrejects); logmsg(LOGMSG_USER, "sql ticks %llu\n", gbl_sqltick); logmsg(LOGMSG_USER, "sql deadlocks recover attempts %llu failures %llu\n", gbl_sql_deadlock_reconstructions, gbl_sql_deadlock_failures); diff --git a/db/request_stats.c b/db/request_stats.c index 2249568fad..90cfebea13 100644 --- a/db/request_stats.c +++ b/db/request_stats.c @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include @@ -170,8 +169,10 @@ void user_request_memp_callback(void) ATOMIC_ADD64(global.mempgets, 1); } -void global_request_stats(struct global_stats *stats) +struct global_stats global_request_stats(void) { + return global; + /* stats->page_reads = ATOMIC_LOAD64(global.page_reads); stats->page_writes = ATOMIC_LOAD64(global.page_writes); stats->failed_page_reads = ATOMIC_LOAD64(global.failed_page_reads); @@ -182,6 +183,7 @@ void global_request_stats(struct global_stats *stats) stats->page_bytes_written = ATOMIC_LOAD64(global.page_bytes_written); stats->failed_page_bytes_read = ATOMIC_LOAD64(global.failed_page_bytes_read); stats->failed_page_bytes_written = ATOMIC_LOAD64(global.failed_page_bytes_written); + */ } void user_request_init(void) diff --git a/db/request_stats.h b/db/request_stats.h index 01403287e0..7261e8cf95 100644 --- a/db/request_stats.h +++ b/db/request_stats.h @@ -60,16 +60,16 @@ struct per_request_stats { }; struct global_stats { - int64_t page_reads; - int64_t page_writes; - int64_t failed_page_reads; - int64_t failed_page_writes; - int64_t fsyncs; - int64_t mempgets; - int64_t page_bytes_read; - int64_t page_bytes_written; - int64_t failed_page_bytes_read; - int64_t failed_page_bytes_written; + uint64_t page_reads; + uint64_t page_writes; + uint64_t failed_page_reads; + uint64_t failed_page_writes; + uint64_t fsyncs; + uint64_t mempgets; + uint64_t page_bytes_read; + uint64_t page_bytes_written; + uint64_t failed_page_bytes_read; + uint64_t failed_page_bytes_written; }; void user_request_begin(enum request_type type, int flags); @@ -79,7 +79,7 @@ void user_request_read_callback(int); void user_request_write_callback(int); void user_request_memp_callback(void); void user_request_init(void); -void global_request_stats(struct global_stats *stats); +struct global_stats global_request_stats(void); void user_request_on(void); void user_request_off(void); diff --git a/db/sql.h b/db/sql.h index c471003ef5..8867544205 100644 --- a/db/sql.h +++ b/db/sql.h @@ -238,12 +238,6 @@ enum ctrl_sqleng { SQLENG_WRONG_STATE, }; -enum trans_clntcomm { - TRANS_CLNTCOMM_NOREPLY = 0, - TRANS_CLNTCOMM_NORMAL = 1, - TRANS_CLNTCOMM_CHUNK = 2 -}; - void sql_set_sqlengine_state(struct sqlclntstate *clnt, char *file, int line, int newstate); @@ -988,7 +982,7 @@ struct sqlclntstate { struct sqlthdstate *thd; int had_lease_at_begin; - int64_t connid; + uint64_t connid; int64_t total_sql; int64_t sql_since_reset; int64_t num_resets; diff --git a/db/sqlinterfaces.c b/db/sqlinterfaces.c index 298a809b2c..6cf5ab5d67 100644 --- a/db/sqlinterfaces.c +++ b/db/sqlinterfaces.c @@ -637,7 +637,7 @@ int toggle_case_sensitive_like(sqlite3 *db, int enable) return rc; } -static int64_t connid = 0; +static uint64_t connid = 0; /* lru_evbuffers may be accessed by multiple sql threads, hence we need to protect it with a mutex. */ static pthread_mutex_t lru_evbuffers_mtx = PTHREAD_MUTEX_INITIALIZER; diff --git a/db/toblock.c b/db/toblock.c index 0bd86fe3a6..bed04fb5a9 100644 --- a/db/toblock.c +++ b/db/toblock.c @@ -58,16 +58,13 @@ #include "sql.h" #include "sqloffload.h" #include "errstat.h" -#include "timer.h" #include "dbglog.h" #include "osqlblockproc.h" #include #include -#include "bdb_access.h" #include "bdb_int.h" #include "osqlblkseq.h" #include "localrep.h" -#include "util.h" #include "tohex.h" #include "osqlcomm.h" #include @@ -102,8 +99,8 @@ int gbl_debug_wait_on_verify_off; extern int gbl_osql_verify_retries_max; extern int verbose_deadlocks; extern int gbl_goslow; -extern int n_commits; -extern int n_commit_time; +extern uint32_t n_commits; +extern uint64_t n_commit_time; extern pthread_mutex_t osqlpf_mutex; extern int gbl_prefault_udp; extern int gbl_reorder_socksql_no_deadlock; @@ -6251,7 +6248,7 @@ static int toblock_main_int(struct javasp_trans_state *javasp_trans_handle, stru trans, iq->total_txnsize, iq->timeoutms, iq->reptimems, rate); } - int diff_time_micros = (int)reqlog_current_us(iq->reqlogger); + int64_t diff_time_micros = reqlog_current_us(iq->reqlogger); ATOMIC_ADD64(n_commit_time, diff_time_micros); ATOMIC_ADD32(n_commits, 1); diff --git a/db/trigger.h b/db/trigger.h index 37a94a22d9..17687bdc6b 100644 --- a/db/trigger.h +++ b/db/trigger.h @@ -54,7 +54,7 @@ enum { /* trigger registration info */ typedef struct trigger_reg { int node; - int elect_cookie; + uint32_t elect_cookie; genid_t trigger_cookie; int spname_len; char spname[0]; // spname_len + 1 diff --git a/db/watchdog.c b/db/watchdog.c index 46ea92058b..1d806c4207 100644 --- a/db/watchdog.c +++ b/db/watchdog.c @@ -331,7 +331,7 @@ static void *watchdog_thread(void *arg) socket_pool_timeout(); } - int one = 1; + uint32_t one = 1; if (CAS32(gbl_trigger_timepart, one, 0)) { if (thedb->master == gbl_myhostname) { rc = views_cron_restart(thedb->timepart_views); @@ -369,11 +369,11 @@ static void *watchdog_thread(void *arg) if ((diff_seconds < 0) || (diff_seconds > slow_seconds)) { logmsg((diff_seconds > 0) && gbl_client_abort_on_slow ? LOGMSG_FATAL : LOGMSG_ERROR, - "%s: client #%lld has been in state %s for " + "%s: client #%" PRIu64 " has been in state %s for " "%d seconds (>%d): connect_time %0.2f " "seconds, raw_time_in_state %d, host {%s}, " "pid %lld, sql {%s}\n", __func__, - (long long int)conn_info->connection_id, + conn_info->connection_id, zState, diff_seconds, slow_seconds, difftime(conn_info->connect_time_int, (time_t)0), conn_info->time_in_state_int, conn_info->host, diff --git a/lua/ltypes.h b/lua/ltypes.h index 6d8a320efd..c5fe8a8d31 100644 --- a/lua/ltypes.h +++ b/lua/ltypes.h @@ -171,4 +171,6 @@ typedef union { blob_t bl; } all_types_t; +const char *luabb_dbtype_to_str(enum dbtypes_enum); + #endif diff --git a/lua/luaglue.h b/lua/luaglue.h index 9453e75fe5..c1c4965070 100644 --- a/lua/luaglue.h +++ b/lua/luaglue.h @@ -20,11 +20,8 @@ struct lua_State; struct lua_TValue; -enum dbtypes_enum; int luabb_type_by_name(const char *); int luabb_dbtype_by_name(const char *); -enum dbtypes_enum; -const char *luabb_dbtype_to_str(enum dbtypes_enum); void luabb_typeconvert(struct lua_State *, int pos, int type); char *luabb_newblob(struct lua_State *, int len, void **blob); int parseblob(const char *str, int len, char *out); diff --git a/lua/luautil.c b/lua/luautil.c index debe4230cf..dc40f04c85 100644 --- a/lua/luautil.c +++ b/lua/luautil.c @@ -16,7 +16,6 @@ #include #include -#include #include #include #include diff --git a/lua/sp.c b/lua/sp.c index 20c5dac3c0..9fc6556020 100644 --- a/lua/sp.c +++ b/lua/sp.c @@ -67,7 +67,6 @@ #include #include #include -#include "comdb2_atomic.h" #include "sql_stmt_cache.h" #include "util.h" @@ -78,9 +77,6 @@ #include "fdb_fend.h" extern int gbl_dump_sql_dispatched; /* dump all sql strings dispatched */ -extern int gbl_return_long_column_names; -extern int gbl_max_sqlcache; -extern int gbl_lua_new_trans_model; extern int gbl_max_lua_instructions; extern int gbl_lua_version; extern int gbl_notimeouts; @@ -89,9 +85,9 @@ extern int gbl_lua_prepare_max_retries; extern int gbl_lua_prepare_retry_sleep; pthread_t gbl_break_lua; -int gbl_break_all_lua = 0; -char *gbl_break_spname; -void *debug_clnt; +static int gbl_break_all_lua = 0; +static char *gbl_break_spname; +static sqlclntstate *debug_clnt; pthread_mutex_t lua_debug_mutex = PTHREAD_MUTEX_INITIALIZER; pthread_cond_t lua_debug_cond = PTHREAD_COND_INITIALIZER; @@ -2263,7 +2259,7 @@ static int lua_prepare_sql_int(SP sp, const char *sql, sqlite3_stmt **stmt, struct sql_state *rec, int flags) { Lua L = sp->lua; - int maxRetries = ATOMIC_LOAD32(gbl_lua_prepare_max_retries); + int maxRetries = gbl_lua_prepare_max_retries; int nRetry = 0; struct errstat err; struct sql_state rec_lcl = {0}; @@ -2288,7 +2284,7 @@ static int lua_prepare_sql_int(SP sp, const char *sql, sqlite3_stmt **stmt, sp->initial = 0; if ((sp->rc == SQLITE_PERM) && (maxRetries != 0) && ((maxRetries == -1) || (nRetry++ < maxRetries))) { - int sleepms = ATOMIC_LOAD32(gbl_lua_prepare_retry_sleep); + int sleepms = gbl_lua_prepare_retry_sleep; if (sleepms >= 0) poll(NULL, 0, sleepms); goto retry; } diff --git a/net/net_appsock.h b/net/net_appsock.h index 9ee52f1426..7ac202f81c 100644 --- a/net/net_appsock.h +++ b/net/net_appsock.h @@ -40,7 +40,7 @@ typedef void(*run_on_base_fn)(void *); void run_on_base(struct event_base *, run_on_base_fn, void *); extern unsigned long long total_appsock_conns; -extern int32_t active_appsock_conns; +extern uint32_t active_appsock_conns; extern int64_t gbl_denied_appsock_connection_count; int get_max_appsocks_limit(void); diff --git a/net/ssl_evbuffer.c b/net/ssl_evbuffer.c index c932f9b3d8..f2e249e83b 100644 --- a/net/ssl_evbuffer.c +++ b/net/ssl_evbuffer.c @@ -32,7 +32,6 @@ extern char gbl_dbname[]; extern int gbl_nid_dbname; extern SSL_CTX *gbl_ssl_ctx; -extern ssl_mode gbl_client_ssl_mode; extern uint64_t gbl_ssl_num_full_handshakes; extern uint64_t gbl_ssl_num_partial_handshakes; diff --git a/net/ssl_evbuffer.h b/net/ssl_evbuffer.h index d1337bceba..da30a545cd 100644 --- a/net/ssl_evbuffer.h +++ b/net/ssl_evbuffer.h @@ -21,14 +21,12 @@ struct event; struct evbuffer; struct event_base; struct ssl_data; -enum ssl_mode; typedef void (ssl_evbuffer_cb)(void *); void accept_ssl_evbuffer(struct ssl_data *, struct event_base *, ssl_evbuffer_cb *err, ssl_evbuffer_cb *accepted, void *); void connect_ssl_evbuffer(struct ssl_data *, struct event_base *, ssl_evbuffer_cb *err, ssl_evbuffer_cb *connected, void *); int rd_ssl_evbuffer(struct evbuffer *, struct ssl_data *, int *eof); int wr_ssl_evbuffer(struct ssl_data *, struct evbuffer *); -int verify_ssl_evbuffer(struct ssl_data *, enum ssl_mode); int ssl_data_has_ssl(struct ssl_data *); int ssl_data_has_cert(struct ssl_data *); int ssl_data_cert(struct ssl_data *, int nid, void *out, int outsz); diff --git a/plugins/logdelete/logdelete.c b/plugins/logdelete/logdelete.c index b157cfc11a..acae09dee0 100644 --- a/plugins/logdelete/logdelete.c +++ b/plugins/logdelete/logdelete.c @@ -30,8 +30,7 @@ static int handle_logdelete_request(comdb2_appsock_arg_t *arg) char recovery_command[200] = {0}; char recovery_lsn[100] = {0}; char line[128] = {0}; - int before_master; - int after_master; + uint32_t before_master, after_master; int before_sc; int after_sc; int report_back = 0; diff --git a/plugins/newsql/newsql.c b/plugins/newsql/newsql.c index 0227d2683a..d62886e34b 100644 --- a/plugins/newsql/newsql.c +++ b/plugins/newsql/newsql.c @@ -2331,7 +2331,7 @@ static int do_query_on_master_check(struct sqlclntstate *clnt, CDB2SQLQUERY *sql return 0; } if (bdb_master_should_reject(thedb->bdb_env) && allow_master_exec == 0) { - ATOMIC_ADD32(gbl_masterrejects, 1); + ++gbl_masterrejects; if (allow_master_dbinfo) { struct newsql_appdata *appdata = clnt->appdata; appdata->write_dbinfo(clnt); diff --git a/plugins/newsql/newsql_evbuffer.c b/plugins/newsql/newsql_evbuffer.c index cab1d687e6..26164b7345 100644 --- a/plugins/newsql/newsql_evbuffer.c +++ b/plugins/newsql/newsql_evbuffer.c @@ -23,7 +23,6 @@ #include #include -#include #include #include #include diff --git a/util/ssl_glue.h b/util/ssl_glue.h index 95365b51ca..c38a57fe8a 100644 --- a/util/ssl_glue.h +++ b/util/ssl_glue.h @@ -16,17 +16,35 @@ #ifndef INCLUDED_SSL_GLUE_H #define INCLUDED_SSL_GLUE_H + +/* 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; + #include int ssl_verify_dbname(X509 *, const char *, int); int ssl_x509_get_attr(const X509 *, int, char *, size_t); int ssl_verify_hostname(X509 *, int); #ifndef SBUF2_SERVER -#define SBUF2_SERVER 1 +# define SBUF2_SERVER 1 #endif + #if SBUF2_SERVER /* visible to server only */ -/* returns 1 if the connection is whitelisted */ -int ssl_whitelisted(const char *); +struct ssl_data; +int ssl_whitelisted(const char *); /* returns 1 if the connection is whitelisted */ +int verify_ssl_evbuffer(struct ssl_data *, enum ssl_mode); #endif #endif /* INCLUDED_SSL_GLUE_H */