All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
as_cluster Struct Reference

Detailed Description

Cluster of server nodes.

Definition at line 102 of file as_cluster.h.

#include "as_cluster.h"

+ Collaboration diagram for as_cluster:

Data Fields

as_cluster_event_callback event_callback
 
void * event_callback_udata
 
as_event_stateevent_state
 

Private Attributes

uint32_t async_max_conns_per_node
 
uint32_t async_min_conns_per_node
 
bool auth_enabled
 
as_auth_mode auth_mode
 
char * cluster_name
 
uint64_t command_count
 
uint32_t conn_pools_per_node
 
uint32_t conn_timeout_ms
 
uint64_t delay_queue_timeout_count
 
uint32_t error_rate_window
 
bool fail_if_not_connected
 
as_vectorgc
 
bool has_partition_query
 
uint32_t invalid_node_count
 
as_vectorip_map
 
uint32_t login_timeout_ms
 
uint32_t max_conns_per_node
 
uint32_t max_error_rate
 
uint64_t max_socket_idle_ns_tran
 
uint64_t max_socket_idle_ns_trim
 
bool metrics_enabled
 
uint32_t metrics_interval
 
uint32_t metrics_latency_columns
 
uint32_t metrics_latency_shift
 
as_metrics_listeners metrics_listeners
 
pthread_mutex_t metrics_lock
 
uint32_t min_conns_per_node
 
uint16_t n_partitions
 
uint32_t node_index
 
as_nodesnodes
 
as_partition_tables partition_tables
 
char * password
 
char * password_hash
 
uint32_t pipe_max_conns_per_node
 
bool rack_aware
 
int * rack_ids
 
uint32_t rack_ids_size
 
uint64_t retry_count
 
pthread_mutex_t seed_lock
 
as_vectorseeds
 
struct as_shm_info_s * shm_info
 
pthread_cond_t tend_cond
 
uint32_t tend_count
 
uint32_t tend_interval
 
pthread_mutex_t tend_lock
 
pthread_t tend_thread
 
int tend_thread_cpu
 
as_thread_pool thread_pool
 
as_tls_contexttls_ctx
 
bool use_services_alternate
 
char * user
 
volatile bool valid
 

Field Documentation

◆ async_max_conns_per_node

uint32_t as_cluster::async_max_conns_per_node
private

Maximum async (non-pipeline) connections per node.

Definition at line 298 of file as_cluster.h.

◆ async_min_conns_per_node

uint32_t as_cluster::async_min_conns_per_node
private

Minimum async connections per node.

Definition at line 292 of file as_cluster.h.

◆ auth_enabled

bool as_cluster::auth_enabled
private

Is authentication enabled

Definition at line 370 of file as_cluster.h.

◆ auth_mode

as_auth_mode as_cluster::auth_mode
private

Authentication mode.

Definition at line 346 of file as_cluster.h.

◆ cluster_name

char* as_cluster::cluster_name
private

Expected cluster name for all nodes. May be null.

Definition at line 149 of file as_cluster.h.

◆ command_count

uint64_t as_cluster::command_count
private

Command count. The value is cumulative and not reset per metrics interval.

Definition at line 450 of file as_cluster.h.

◆ conn_pools_per_node

uint32_t as_cluster::conn_pools_per_node
private

Number of synchronous connection pools used for each node.

Definition at line 310 of file as_cluster.h.

◆ conn_timeout_ms

uint32_t as_cluster::conn_timeout_ms
private

Initial connection timeout in milliseconds.

Definition at line 316 of file as_cluster.h.

◆ delay_queue_timeout_count

uint64_t as_cluster::delay_queue_timeout_count
private

Delay queue timeout count. The value is cumulative and not reset per metrics interval.

Definition at line 456 of file as_cluster.h.

◆ error_rate_window

uint32_t as_cluster::error_rate_window
private

Number of tend iterations defining window for max_error_rate.

Definition at line 262 of file as_cluster.h.

◆ event_callback

as_cluster_event_callback as_cluster::event_callback

Cluster event function that will be called when nodes are added/removed from the cluster.

Definition at line 154 of file as_cluster.h.

◆ event_callback_udata

void* as_cluster::event_callback_udata

Cluster event user data that will be passed back to event_callback.

Definition at line 159 of file as_cluster.h.

◆ event_state

as_event_state* as_cluster::event_state

Cluster state for all event loops.

Definition at line 164 of file as_cluster.h.

◆ fail_if_not_connected

bool as_cluster::fail_if_not_connected
private

Fail on cluster init if seed node and all peers are not reachable.

Definition at line 382 of file as_cluster.h.

◆ gc

as_vector* as_cluster::gc
private

Nodes to be garbage collected.

Definition at line 119 of file as_cluster.h.

◆ has_partition_query

bool as_cluster::has_partition_query
private

Does cluster support partition queries.

Definition at line 376 of file as_cluster.h.

◆ invalid_node_count

uint32_t as_cluster::invalid_node_count
private

Count of add node failures in the most recent cluster tend iteration.

Definition at line 334 of file as_cluster.h.

◆ ip_map

as_vector* as_cluster::ip_map
private

A IP translation table is used in cases where different clients use different server IP addresses. This may be necessary when using clients from both inside and outside a local area network. Default is no translation.

The key is the IP address returned from friend info requests to other servers. The value is the real IP address used to connect to the server.

Definition at line 181 of file as_cluster.h.

◆ login_timeout_ms

uint32_t as_cluster::login_timeout_ms
private

Node login timeout in milliseconds.

Definition at line 322 of file as_cluster.h.

◆ max_conns_per_node

uint32_t as_cluster::max_conns_per_node
private

Maximum sync connections per node.

Definition at line 286 of file as_cluster.h.

◆ max_error_rate

uint32_t as_cluster::max_error_rate
private

Max errors per node per error_rate_window.

Definition at line 256 of file as_cluster.h.

◆ max_socket_idle_ns_tran

uint64_t as_cluster::max_socket_idle_ns_tran
private

Maximum socket idle to validate connections in commands.

Definition at line 232 of file as_cluster.h.

◆ max_socket_idle_ns_trim

uint64_t as_cluster::max_socket_idle_ns_trim
private

Maximum socket idle to trim peak connections to min connections.

Definition at line 238 of file as_cluster.h.

◆ metrics_enabled

bool as_cluster::metrics_enabled
private

Is metrics colleciton enabled.

Definition at line 394 of file as_cluster.h.

◆ metrics_interval

uint32_t as_cluster::metrics_interval
private

Number of cluster tend iterations between metrics notification events. One tend iteration is defined as as_config.tender_interval (default 1 second) plus the time to tend all nodes. This is set using as_policy_metrics.

Definition at line 402 of file as_cluster.h.

◆ metrics_latency_columns

uint32_t as_cluster::metrics_latency_columns
private

Number of elapsed time range buckets in latency histograms. This is set using as_policy_metrics.

Definition at line 408 of file as_cluster.h.

◆ metrics_latency_shift

uint32_t as_cluster::metrics_latency_shift
private

Power of 2 multiple between each range bucket in latency histograms starting at column 3. The bucket units are in milliseconds. The first 2 buckets are "<=1ms" and ">1ms". Examples:

// latencyColumns=7 latencyShift=1
<=1ms >1ms >2ms >4ms >8ms >16ms >32ms
// latencyColumns=5 latencyShift=3
<=1ms >1ms >8ms >64ms >512ms

This is set using as_policy_metrics.

Definition at line 425 of file as_cluster.h.

◆ metrics_listeners

as_metrics_listeners as_cluster::metrics_listeners
private

Listeners that handles metrics notification events. The default listener implementation writes the metrics snapshot to a file which will later be read and forwarded to OpenTelemetry by a separate offline application.

The listener could be overridden to send the metrics snapshot directly to OpenTelemetry.

This is set using as_policy_metrics.

Definition at line 437 of file as_cluster.h.

◆ metrics_lock

pthread_mutex_t as_cluster::metrics_lock
private

Lock for metrics operations.

Definition at line 211 of file as_cluster.h.

◆ min_conns_per_node

uint32_t as_cluster::min_conns_per_node
private

Minimum sync connections per node.

Definition at line 280 of file as_cluster.h.

◆ n_partitions

uint16_t as_cluster::n_partitions
private

Total number of data partitions used by cluster.

Definition at line 352 of file as_cluster.h.

◆ node_index

uint32_t as_cluster::node_index
private

Random node index.

Definition at line 328 of file as_cluster.h.

◆ nodes

as_nodes* as_cluster::nodes
private

Active nodes in cluster.

Definition at line 107 of file as_cluster.h.

◆ partition_tables

as_partition_tables as_cluster::partition_tables
private

Hints for best node for a partition.

Definition at line 113 of file as_cluster.h.

◆ password

char* as_cluster::password
private

Password in clear text.

Definition at line 137 of file as_cluster.h.

◆ password_hash

char* as_cluster::password_hash
private

Password in hashed format.

Definition at line 143 of file as_cluster.h.

◆ pipe_max_conns_per_node

uint32_t as_cluster::pipe_max_conns_per_node
private

Maximum pipeline connections per node.

Definition at line 304 of file as_cluster.h.

◆ rack_aware

bool as_cluster::rack_aware
private

Request server rack ids.

Definition at line 364 of file as_cluster.h.

◆ rack_ids

int* as_cluster::rack_ids
private

Rack ids

Definition at line 244 of file as_cluster.h.

◆ rack_ids_size

uint32_t as_cluster::rack_ids_size
private

Rack ids size

Definition at line 250 of file as_cluster.h.

◆ retry_count

uint64_t as_cluster::retry_count
private

Command retry count. There can be multiple retries for a single command. The value is cumulative and not reset per metrics interval.

Definition at line 444 of file as_cluster.h.

◆ seed_lock

pthread_mutex_t as_cluster::seed_lock
private

Lock for adding/removing seeds.

Definition at line 205 of file as_cluster.h.

◆ seeds

as_vector* as_cluster::seeds
private

Initial seed hosts specified by user.

Definition at line 170 of file as_cluster.h.

◆ shm_info

struct as_shm_info_s* as_cluster::shm_info
private

Shared memory implementation of cluster.

Definition at line 125 of file as_cluster.h.

◆ tend_cond

pthread_cond_t as_cluster::tend_cond
private

Tend thread identifier to be used with tend_lock.

Definition at line 226 of file as_cluster.h.

◆ tend_count

uint32_t as_cluster::tend_count
private

Cluster tend counter.

Definition at line 274 of file as_cluster.h.

◆ tend_interval

uint32_t as_cluster::tend_interval
private

Milliseconds between cluster tends.

Definition at line 268 of file as_cluster.h.

◆ tend_lock

pthread_mutex_t as_cluster::tend_lock
private

Lock for the tend thread to wait on with the tend interval as timeout. Normally locked, resulting in waiting a full interval between tend iterations. Upon cluster shutdown, unlocked by the main thread, allowing a fast termination of the tend thread.

Definition at line 220 of file as_cluster.h.

◆ tend_thread

pthread_t as_cluster::tend_thread
private

Cluster tend thread.

Definition at line 199 of file as_cluster.h.

◆ tend_thread_cpu

int as_cluster::tend_thread_cpu
private

Assign tend thread to this specific CPU ID.

Definition at line 340 of file as_cluster.h.

◆ thread_pool

as_thread_pool as_cluster::thread_pool
private

Pool of threads used to query server nodes in parallel for batch, scan and query.

Definition at line 193 of file as_cluster.h.

◆ tls_ctx

as_tls_context* as_cluster::tls_ctx
private

TLS parameters

Definition at line 187 of file as_cluster.h.

◆ use_services_alternate

bool as_cluster::use_services_alternate
private

If "services-alternate" should be used instead of "services"

Definition at line 358 of file as_cluster.h.

◆ user

char* as_cluster::user
private

User name in UTF-8 encoded bytes.

Definition at line 131 of file as_cluster.h.

◆ valid

volatile bool as_cluster::valid
private

Should continue to tend cluster.

Definition at line 388 of file as_cluster.h.


The documentation for this struct was generated from the following file: