(message->severity) {
74 caseCASS_LOG_CRITICAL:
105 returnCASS_LOG_ERROR;
112 autoname = app->GetProgramDisplayName();
113cass_cluster_set_application_name_n(cluster, name.c_str(), name.size());
114 auto version= app->GetFullVersion().GetVersionInfo().Print();
116cass_cluster_set_application_version_n(cluster,
version.c_str(),
version.size());
127 RAISE_DB_ERROR(eSeqFailed,
"invalid sequence of operations, driver is not connected");
130cass_session_get_schema_meta(m_session),
132cass_schema_meta_free(meta);
143 TKeyspaceMeta* keyspace_meta = cass_schema_meta_keyspace_by_name_n(
144schema_meta, keyspace.c_str(), keyspace.size()
146 if(!keyspace_meta) {
149 returnkeyspace_meta;
155 TTableMeta* table_meta = cass_keyspace_meta_table_by_name_n(
167 if(rc == CASS_ERROR_SERVER_UNAVAILABLE
168|| rc == CASS_ERROR_LIB_REQUEST_QUEUE_FULL
169|| rc == CASS_ERROR_LIB_NO_HOSTS_AVAILABLE
173 else if(rc == CASS_ERROR_LIB_REQUEST_TIMED_OUT
174|| rc == CASS_ERROR_SERVER_WRITE_TIMEOUT
175|| rc == CASS_ERROR_SERVER_READ_TIMEOUT
184 if(timeout_ms > 0) {
185message.append(
", timeout "+ to_string(timeout_ms) +
"ms (spent: "+ to_string(spent_ms) +
"ms)");
192 const char*message_ptr{
nullptr};
194cass_future_error_message(future, &message_ptr, &
message_len);
196CassError rc = cass_future_error_code(future);
197 return "CassandraErrorMessage - "+
NStr::Quote(message)
203 if(future ==
nullptr) {
204 return "Unknown Cassandra connection error: future is nullptr";
207+
"; connection timeout - "+ to_string(connection_timeout) +
"ms";
212 if(future ==
nullptr) {
213 return "Unknown Cassandra query error: future is nullptr";
216CassError rc = cass_future_error_code(future);
217 boolis_query_error = (rc == CASS_ERROR_SERVER_SYNTAX_ERROR
218|| rc == CASS_ERROR_SERVER_INVALID_QUERY
219|| rc == CASS_ERROR_LIB_REQUEST_TIMED_OUT);
220 if(
query!=
nullptr) {
221 if(is_query_error) {
223 if(
query->ParamCount() > 0) {
225 for(
size_t i= 0;
i<
query->ParamCount(); ++
i) {
226params += (
i> 0 ?
",":
"") +
query->ParamAsStrForDebug(
i);
228message.append(
"; Params - ("+ params +
")");
231 if(rc == CASS_ERROR_LIB_REQUEST_TIMED_OUT
232|| rc == CASS_ERROR_SERVER_WRITE_TIMEOUT
233|| rc == CASS_ERROR_SERVER_READ_TIMEOUT
235message.append(
"; timeout - "+ to_string(
query->GetRequestTimeoutMs()) +
"ms");
238 else if(is_query_error) {
254, m_cluster(
nullptr)
255, m_session(
nullptr)
258, m_qtimeout_retry_ms(0)
259, m_last_query_cnt(0)
261, m_tokenaware(
true)
262, m_latencyaware(
false)
264, m_numConnPerHost(0)
266, m_fallback_readconsistency(
false)
267, m_FallbackWriteConsistency(0)
268, m_active_statements(0)
287cass_log_set_level(CASS_LOG_DISABLED);
399 char buf[CASS_UUID_STRING_LENGTH];
401CassUuidGen *
gen, *nothing =
nullptr;
402 gen= cass_uuid_gen_new();
404cass_uuid_gen_free(
gen);
409cass_uuid_gen_time(
static_cast<CassUuidGen*
>(
m_CassUuidGen.load()), &uuid);
410cass_uuid_string(uuid,
buf);
441cass_cluster_set_load_balance_round_robin(
m_cluster);
475cass_prepared_free(item.second);
476item.second =
nullptr;
483CassFuture * close_future;
485close_future = cass_session_close(
m_session);
488cass_future_free(close_future);
503 "invalid sequence of operations, driver is not connected, can't re-connect");
512 RAISE_DB_ERROR(eRsrcFailed,
"failed to get cassandra session handle");
517 RAISE_DB_ERROR(eRsrcFailed,
"failed to obtain cassandra connection future");
520unique_ptr<CassFuture,
function<void(CassFuture*)>> future(
522[](CassFuture* future)
524cass_future_free(future);
528CassError rc = CASS_OK;
529cass_future_wait(future.get());
530rc = cass_future_error_code(future.get());
567CassMetrics cass_metrics;
568cass_session_get_metrics(
m_session, &cass_metrics);
569metrics.
requests.
min= chrono::microseconds(cass_metrics.requests.min);
570metrics.
requests.
max= chrono::microseconds(cass_metrics.requests.max);
571metrics.
requests.
stddev= chrono::microseconds(cass_metrics.requests.stddev);
572metrics.
requests.
median= chrono::microseconds(cass_metrics.requests.median);
625 query->SetSQL(
string(
"USE ") + keyspace, 0);
626 query->Execute(CASS_CONSISTENCY_LOCAL_QUORUM);
645 RAISE_DB_ERROR(eSeqFailed,
"invalid sequence of operations, driver is not connected");
648shared_ptr<CCassQuery> rv(
new CCassQuery(shared_from_this()));
655vector<TTokenValue> cluster_tokens;
657 stringrpc_address, datacenter,
schema, host_id;
661vector<string> tokens;
663 query->SetSQL(
"SELECT data_center, schema_version, rpc_address, host_id, tokens FROM system.local", 0);
666 query->FieldGetStrValue(0, datacenter);
668 query->FieldGetStrValue(2, rpc_address);
669 query->FieldGetStrValue(3, host_id);
670 query->FieldGetSetValues(4, tokens);
671 autoitr = peer_tokens.
insert(make_pair(host_id, vector<TTokenValue>())).first;
672 for(
const auto& item: tokens) {
674itr->second.push_back(
value);
675cluster_tokens.push_back(
value);
679 ERR_POST(
Trace<<
"GET_TOKEN_MAP: datacenter is "<< datacenter);
680 ERR_POST(
Trace<<
"GET_TOKEN_MAP: host_id is "<< host_id);
681 ERR_POST(
Trace<<
"GET_TOKEN_MAP: rpc_address is "<< rpc_address);
686 size_tpeers_count{0};
689 query->SetHost(rpc_address);
690 query->SetSQL(
"SELECT data_center, schema_version, host_id, tokens FROM system.peers", 0);
693 stringpeer_host_id, peer_dc, peer_schema;
694vector<string> tokens;
695 query->FieldGetStrValue(0, peer_dc);
696 query->FieldGetStrValue(1, peer_schema);
697 if(datacenter == peer_dc &&
schema== peer_schema) {
699 query->FieldGetStrValue(2, peer_host_id);
700 query->FieldGetSetValues(3, tokens);
701 ERR_POST(
Trace<<
"GET_TOKEN_MAP: host is '"<< peer_host_id
702<<
"'; tokens count - "<< tokens.size());
703 autoitr = peer_tokens.
find(peer_host_id);
704 if(itr == peer_tokens.
end()) {
705itr = peer_tokens.
insert(make_pair(peer_host_id, vector<TTokenValue>())).first;
706 for(
const auto& item : tokens) {
708itr->second.push_back(
value);
709cluster_tokens.push_back(
value);
714 ERR_POST(
Trace<<
"GET_TOKEN_MAP: TOTAL HOST COUNT IS "<< peer_tokens.
size());
715 if(peer_tokens.
size() != peers_count + 1) {
722 autotoken_count = cluster_tokens.size();
723 sort(cluster_tokens.begin(), cluster_tokens.end());
724cluster_tokens.erase(unique(cluster_tokens.begin(), cluster_tokens.end()), cluster_tokens.end());
725 if(token_count != cluster_tokens.size()) {
731 ERR_POST(
Trace<<
"GET_TOKEN_MAP: tokens count "<< cluster_tokens.size());
733ranges.reserve(cluster_tokens.size() + 1);
735 for(
int64_ttoken : cluster_tokens) {
737ranges.push_back(make_pair(lower_bound, token));
745 stringestimates_sql{
"SELECT range_start, range_end, mean_partition_size, partitions_count FROM system.size_estimates " 746 " WHERE keyspace_name = ? AND table_name = ?"};
748vector<SCassSizeEstimate> estimates;
749 size_tfailed_peers_count{0};
750 for(
auto const& peer : peers) {
753 query->SetHost(peer);
754 query->SetSQL(estimates_sql, 2);
755 query->BindStr(0, keyspace);
770estimates.push_back(estimate);
779 ERR_POST(
Info<<
"GetSizeEstimates got an exception from Cassandra: '"<< ex.
GetMsg() <<
"'");
781++failed_peers_count;
784 sort(estimates.begin(), estimates.end(),
786return a.range_start < b.range_start;
790 if(failed_peers_count > 0 && !estimates.empty()) {
793 int64_tavg_mean_partition_size{0}, avg_partitions_count{0};
794 for(
auto const& estimate : estimates) {
795avg_mean_partition_size += estimate.mean_partition_size;
796avg_partitions_count += estimate.partitions_count;
798avg_mean_partition_size /= estimates.size();
799avg_partitions_count /= estimates.size();
800 autoestimate_itr = begin(estimates);
801vector<SCassSizeEstimate> appended_estimates;
802 for(
auto const& local_range : local_ranges) {
803 if(estimate_itr != end(estimates) && estimate_itr->range_end == local_range.second) {
807estimate_itr->range_end > local_range.second || estimate_itr == end(estimates)
811estimate.
range_end= local_range.second;
814appended_estimates.push_back(estimate);
818 "Logic error in GetSizeEstimates() for one node down (estimate ranges and local ranges do not match)");
821 for(
auto const& estimate : appended_estimates) {
822estimates.push_back(estimate);
824 sort(estimates.begin(), estimates.end(),
826return a.range_start < b.range_start;
838 query->SetTimeout(timeout);
839 query->UsePerRequestTimeout(
true);
841 query->SetSQL(
"SELECT rpc_address, data_center FROM system.local", 0);
844 stringrpc_address =
query->FieldGetStrValue(0);
845 stringlocal_datacenter =
query->FieldGetStrValue(1);
846 if(datacenter.empty() || datacenter == local_datacenter) {
847hosts.
insert(rpc_address);
849 if(rpc_address.empty()) {
855 query->SetTimeout(timeout);
856 query->UsePerRequestTimeout(
true);
858 query->SetHost(rpc_address);
859 if(datacenter.empty()) {
860 query->SetSQL(
"SELECT rpc_address FROM system.peers", 0);
863 query->SetSQL(
"SELECT rpc_address FROM system.peers WHERE data_center = ? ALLOW FILTERING", 1);
864 query->BindStr(0, datacenter);
879 query->SetSQL(
"SELECT data_center FROM system.local", 0);
882 return query->FieldGetStrValue(0);
894unique_ptr<CassIterator,
function<void(CassIterator*)>> keyspaces_itr(
895cass_iterator_keyspaces_from_schema_meta(schema_meta.get()),
896[](CassIterator* itr)->
void{
897cass_iterator_free(itr);
900 if(!keyspaces_itr) {
903 while(cass_iterator_next(keyspaces_itr.get())) {
904cass_keyspace_meta_name(
905cass_iterator_get_keyspace_meta(keyspaces_itr.get()),
909 result.push_back(
string(name, name_length));
922unique_ptr<CassIterator,
function<void(CassIterator*)>> tables_itr(
923cass_iterator_tables_from_keyspace_meta(keyspace_meta),
924[](CassIterator* itr)->
void{
925cass_iterator_free(itr);
928 while(cass_iterator_next(tables_itr.get())) {
929cass_table_meta_name(
930cass_iterator_get_table_meta(tables_itr.get()),
934 result.push_back(
string(name, name_length));
943 size_tkey_count = cass_table_meta_column_count(table_meta);
945 for(
size_t i= 0;
i< key_count; ++
i) {
946 constCassColumnMeta* column_meta = cass_table_meta_column(table_meta,
i);
950cass_column_meta_name(column_meta, &name, &name_length);
951 result.emplace_back(name, name_length);
961 size_tkey_count = cass_table_meta_partition_key_count(table_meta);
963 result.reserve(key_count);
964 for(
size_t i= 0;
i< key_count; ++
i) {
965 constCassColumnMeta* column_meta = cass_table_meta_partition_key(table_meta,
i);
969cass_column_meta_name(column_meta, &name, &name_length);
970 result.emplace_back(name, name_length);
980 size_tkey_count = cass_table_meta_clustering_key_count(table_meta);
982 result.reserve(key_count);
983 for(
size_t i= 0;
i< key_count; ++
i) {
984 constCassColumnMeta* column_meta = cass_table_meta_clustering_key(table_meta,
i);
988cass_column_meta_name(column_meta, &name, &name_length);
989 result.emplace_back(name, name_length);
997 constCassPrepared * rv =
nullptr;
1012CassFuture * __future = cass_session_prepare(
m_session,
query);
1014 RAISE_DB_ERROR(eRsrcFailed,
string(
"failed to obtain cassandra query future"));
1017unique_ptr<CassFuture,
function<void(CassFuture*)>> future(
1019[](CassFuture* future)
1021cass_future_free(future);
1024 bool b= cass_future_wait_timed(future.get(),
m_qtimeoutms* 1000L);
1031CassError rc = cass_future_error_code(future.get());
1032 if(rc != CASS_OK) {
1038rv = cass_future_get_prepared(future.get());
1040 RAISE_DB_ERROR(eRsrcFailed,
string(
"failed to obtain prepared handle for sql: ") +
sql);
1052 unsigned intoptimeoutms,
1053 conststd::function<
bool()> & PreLoopCB,
1055 conststd::function<
bool(
bool)> & OpCB)
1058 boolis_repeated =
false;
1060 while(!PreLoopCB || PreLoopCB()) {
1062 if(OpCB(is_repeated)) {
1076 ERR_POST(
Info<<
"CAPTURED RESTARTABLE EXCEPTION: "<< e.
GetMsg() <<
", RESTARTING OP");
1085 if(optimeoutms != 0 && op_time_ms > optimeoutms) {
1091is_repeated =
true;
1098CassError rc = CASS_OK;
1100 caseCASS_VALUE_TYPE_UNKNOWN:
1102 RAISE_DB_ERROR(eSeqFailed,
"invalid sequence of operations, Param #"+ to_string(idx) +
" is not assigned");
1104rc = cass_statement_bind_null(statement, idx);
1106 caseCASS_VALUE_TYPE_TINY_INT:
1107rc = cass_statement_bind_int8(statement, idx,
static_cast<cass_int8_t
>(
m_simpleval.
i8));
1109 caseCASS_VALUE_TYPE_SMALL_INT:
1110rc = cass_statement_bind_int16(statement, idx,
static_cast<cass_int16_t
>(
m_simpleval.
i16));
1112 caseCASS_VALUE_TYPE_INT:
1113rc = cass_statement_bind_int32(statement, idx,
static_cast<cass_int32_t
>(
m_simpleval.
i32));
1115 caseCASS_VALUE_TYPE_BIGINT:
1116rc = cass_statement_bind_int64(statement, idx,
static_cast<cass_int64_t
>(
m_simpleval.
i64));
1126 caseCASS_VALUE_TYPE_VARCHAR:
1127rc = cass_statement_bind_string(statement, idx,
m_bytes.c_str());
1129 caseCASS_VALUE_TYPE_BLOB:
1131rc = cass_statement_bind_bytes(
1133 reinterpret_cast<const unsigned char*
>(
m_bytes.c_str()),
1136rc = cass_statement_bind_null(statement, idx);
1139 caseCASS_VALUE_TYPE_SET:
1140 caseCASS_VALUE_TYPE_LIST:
1141 caseCASS_VALUE_TYPE_MAP:
1143rc = cass_statement_bind_collection(statement, idx,
m_collection.get());
1145rc = cass_statement_bind_null(statement, idx);
1148 caseCASS_VALUE_TYPE_TUPLE:
1150rc = cass_statement_bind_tuple(statement, idx,
m_tuple.get());
1152rc = cass_statement_bind_null(statement, idx);
1155 caseCASS_VALUE_TYPE_DATE: {
1157rc = cass_statement_bind_uint32(statement, idx, u32);
1161 RAISE_DB_ERROR(eBindFailed,
string(
"Bind for (") + to_string(
static_cast<int>(
m_type)) +
") type is not implemented");
1163 if(rc != CASS_OK) {
1165 "Bind for ("+ to_string(
static_cast<int>(
m_type)) +
") failed with rc= "+ to_string(
static_cast<int>(rc)));
1270 RAISE_DB_ERROR(eSeqFailed,
"invalid sequence of operations, query is closed");
1368 return m_params[iprm].AsStringForDebug();
1387 RAISE_DB_ERROR(eSeqFailed,
"invalid sequence of operations, DB connection closed");
1390 RAISE_DB_ERROR(eSeqFailed,
"invalid sequence of operations, batch has already been started");
1393 RAISE_DB_ERROR(eSeqFailed,
"invalid sequence of operations, query is active");
1396 m_batch= cass_batch_new(CASS_BATCH_TYPE_LOGGED);
1403 if(rc != CASS_OK) {
1415 boolallow_prepared,
unsigned intpage_size)
1418 RAISE_DB_ERROR(eSeqFailed,
"invalid sequence of operations, DB connection closed");
1420 if(
m_sql.empty()) {
1421 RAISE_DB_ERROR(eSeqFailed,
"invalid sequence of operations, SQL is not set");
1424 RAISE_DB_ERROR(eSeqFailed,
"invalid sequence of operations, can't run select in batch mode");
1427 RAISE_DB_ERROR(eSeqFailed,
"invalid sequence of operations, Query is active");
1429 constCassPrepared * prepared =
nullptr;
1430 if(allow_prepared) {
1441 RAISE_DB_ERROR(eRsrcFailed,
string(
"failed to create cassandra query"));
1451rc = cass_statement_set_consistency(
m_statement, c);
1452 if(rc != CASS_OK) {
1453 RAISE_CASS_ERROR(rc, eQueryFailed,
"Failed to set consistency level "+ to_string(
static_cast<int>(c)));
1457 if(rc != CASS_OK) {
1459 "Failed to set serial consistency level "+ to_string(
static_cast<int>(
m_serial_consistency)));
1462 if(page_size > 0) {
1463rc = cass_statement_set_paging_size(
m_statement, page_size);
1464 if(rc != CASS_OK) {
1465 RAISE_CASS_ERROR(rc, eQueryFailed,
"Failed to set page size to "+ to_string(
static_cast<int>(page_size)));
1470 if(rc != CASS_OK) {
1496 RAISE_DB_ERROR(eSeqFailed,
"Query is is not in restartable state");
1503 autoretry_timeout =
m_connection->QryTimeoutRetryMs();
1504 if(retry_timeout != 0) {
1508 Query(c, async, allow_prepared, page_size);
1514 RAISE_DB_ERROR(eSeqFailed,
"invalid sequence of operations, DB connection closed");
1516 if(
m_sql.empty()) {
1517 RAISE_DB_ERROR(eSeqFailed,
"invalid sequence of operations, SQL is not set");
1520 RAISE_DB_ERROR(eSeqFailed,
"invalid sequence of operations, Query is active");
1523 constCassPrepared * prepared =
nullptr;
1524 if(allow_prepared) {
1536 RAISE_DB_ERROR(eRsrcFailed,
"failed to create cassandra query");
1542rc = cass_statement_set_consistency(
m_statement, c);
1543 if(rc != CASS_OK) {
1544 RAISE_CASS_ERROR(rc, eQueryFailed,
"Failed to set consistency level "+ to_string(
static_cast<int>(c)));
1548 if(rc != CASS_OK) {
1550 "Failed to set serial consistency level "+ to_string(
static_cast<int>(
m_serial_consistency)));
1556 if(rc != CASS_OK) {
1564 if(rc != CASS_OK) {
1594 RAISE_DB_ERROR(eSeqFailed,
"Query is is not in restartable state");
1600 autoretry_timeout =
m_connection->QryTimeoutRetryMs();
1601 if(retry_timeout != 0) {
1606 Execute(c, async, allow_prepared);
1612 RAISE_DB_ERROR(eSeqFailed,
"Query is not in restartable state");
1618 if(!params.empty()) {
1619params =
"; params - ("+ params +
")";
1640 RAISE_DB_ERROR(eSeqFailed,
"invalid sequence of operations, batch is not created");
1659 RAISE_DB_ERROR(eSeqFailed,
"attempt to wait on query in non-async state");
1661 return Wait(timeoutmks);
1668 returncass_future_ready(
m_future) == cass_true;
1675 RAISE_DB_ERROR(eSeqFailed,
"invalid sequence of operations, DB connection closed");
1678 RAISE_DB_ERROR(eSeqFailed,
"invalid sequence of operations, Query is not active");
1681 RAISE_DB_ERROR(eSeqFailed,
"invalid sequence of operations, results already obtained");
1692 RAISE_DB_ERROR(eRsrcFailed,
"failed to obtain cassandra query future");
1708 RAISE_DB_ERROR(eSeqFailed,
"result has already been allocated");
1717 if(timeoutmks != 0) {
1718rv = cass_future_wait_timed(
m_future, timeoutmks);
1723rv = cass_future_ready(
m_future);
1727 if(!
m_async&& timeoutmks > 0) {
1757 RAISE_DB_ERROR(eSeqFailed,
"invalid sequence of operations, m_ondata3 is not set");
1765 if(rv != CASS_OK) {
1768 RAISE_DB_ERROR(eSeqFailed,
"failed to assign future callback");
1775 RAISE_DB_ERROR(eSeqFailed,
"invalid sequence of operations, m_future is not set");
1778 RAISE_DB_ERROR(eSeqFailed,
"invalid sequence of operations, results already obtained");
1780CassError rc = cass_future_error_code(
m_future);
1781 if(rc != CASS_OK) {
1792 RAISE_DB_ERROR(eRsrcFailed,
string(
"failed to obtain cassandra query result"));
1795 RAISE_DB_ERROR(eSeqFailed,
"iterator has already been allocated");
1800 RAISE_DB_ERROR(eRsrcFailed,
string(
"failed to obtain cassandra query iterator"));
1836 RAISE_DB_ERROR(eSeqFailed,
"invalid sequence of operations, Query is not active");
1855 boolhas_more_pages = cass_result_has_more_pages(
m_result);
1856 if(has_more_pages) {
1859 RAISE_CASS_ERROR(err, eFetchFailed,
string(
"failed to retrive next page"));
1866 if(!has_more_pages) {
1879 RAISE_DB_ERROR(eRsrcFailed,
string(
"failed to obtain cassandra query result row"));
1884 RAISE_DB_ERROR(eSeqFailed,
"invalid sequence of operations, attempt to fetch next row on a closed query");
1896 constCassValue * clm = cass_row_get_column(
m_row, ifld);
1898 RAISE_DB_ERROR(eSeqFailed,
"column is not fetched (index "+ to_string(ifld) +
" beyound the range?)");
1910 constCassValue * clm = cass_row_get_column_by_name_n(
m_row, name.c_str(), name.size());
1912 RAISE_DB_ERROR(eSeqFailed,
"column "+ name +
" is not available");
1924 constCassValue * clm = cass_row_get_column_by_name(
m_row, name);
1926 RAISE_DB_ERROR(eSeqFailed,
"column "+
string(name) +
" is not available");
1938 return ToString() +
"\ncolumn: "+ name;
1950 if(!params.empty()) {
1951params.append(
", ");
1954 caseCASS_VALUE_TYPE_SET:
1955params.append(
"?SET");
1957 caseCASS_VALUE_TYPE_LIST:
1958params.append(
"?LIST");
1960 caseCASS_VALUE_TYPE_MAP:
1961params.append(
"?MAP");
1963 caseCASS_VALUE_TYPE_TUPLE:
1964params.append(
"?TUPLE");
1979 return m_sql.empty() ?
"<>":
m_sql+
"\nparams: "+ params;
#define BEGIN_IDBLOB_SCOPE
const CassSchemaMeta TSchemaMeta
TTableMeta * GetTableMetaPointer(TSchemaMeta *schema_meta, string const &keyspace, string const &table)
void SetDebugInformation(CassCluster *cluster)
string ProduceCassandraFutureErrorMessage(CassFuture *future)
void LogCallback(const CassLogMessage *message, void *)
string ProduceCassandraQueryErrorMessage(CassFuture *future, CCassQuery const *query, string const &sql)
string ProduceCassandraConnectionErrorMessage(CassFuture *future, unsigned int connection_timeout)
string ProduceSyncTimeoutMessage(string message, unsigned int spent_ms, unsigned int timeout_ms)
const CassKeyspaceMeta TKeyspaceMeta
constexpr cass_duration_t kDisconnectTimeoutMcs
CassLogLevel s_MapFromToolkitSeverity(EDiagSev severity)
const CassTableMeta TTableMeta
CCassandraException::EErrCode GetErrorCodeByDriverRC(CassError rc)
constexpr unsigned kDefaultIOThreads
BEGIN_IDBLOB_SCOPE USING_NCBI_SCOPE
TKeyspaceMeta * GetKeyspaceMetaPointer(TSchemaMeta *schema_meta, string const &keyspace)
auto GetMetaPointer(CassSession *m_session)
#define RAISE_CASS_QUERY_ERROR(error_code, message)
CassConsistency TCassConsistency
#define CASS_DRV_TIMEOUT_MS
#define RAISE_CASS_ERROR(errc, dberr, comm)
#define RAISE_DB_ERROR(errc, comm)
static void Perform(unsigned int optimeoutms, const std::function< bool()> &PreLoopCB, const std::function< void(const CCassandraException &)> &DbExceptCB, const std::function< bool(bool)> &OpCB)
void SetCredentials(string const &username, string const &password)
Set credentials to use connecting to Cassandra cluster.
static void DisableLogging()
void SetFallBackWrConsistency(unsigned int value)
static void SetLogging(EDiagSev severity)
unsigned int QryTimeoutMks() const
void SetConnProp(const string &host, const string &user, const string &pwd, int16_t port=0)
Deprecated. Use SetConnectionPoint() + SetCredentials()
void SetFallBackRdConsistency(bool value)
void SetBlackList(const string &blacklist)
Add the list of hosts denied to be used.
bool GetFallBackRdConsistency() const
static const unsigned int kCassMaxTimeout
unsigned int m_ctimeoutms
static void UpdateLogging()
loadbalancing_policy_t m_loadbalancing
vector< string > GetColumnNames(string const &keyspace, string const &table) const
bool m_fallback_readconsistency
unsigned int m_qtimeoutms
void GetTokenRanges(TTokenRanges &ranges)
void SetKeepAlive(unsigned int keepalive)
void SetTimeouts(unsigned int ConnTimeoutMs)
void SetRtLimits(unsigned int numThreadsIo, unsigned int numConnPerHost)
unsigned int GetFallBackWrConsistency() const
unsigned int m_FallbackWriteConsistency
static atomic< CassUuidGen * > m_CassUuidGen
void SetLatencyAware(bool value)
string GetDatacenterName()
void SetKeyspace(const string &keyspace)
Warning! Not suitable for usage in multi-threaded environment in case of multiple keyspaces.
vector< string > GetClusteringKeyColumnNames(string const &keyspace, string const &table) const
void SetTokenAware(bool value)
const CassPrepared * Prepare(const string &sql)
static shared_ptr< CCassConnection > Create()
static EDiagSev m_LoggingLevel
int64_t GetActiveStatements() const
static string NewTimeUUID()
unsigned int QryTimeoutRetryMs() const
static bool m_LoggingInitialized
void SetQueryTimeoutRetry(unsigned int timeout_ms)
vector< string > GetPartitionKeyColumnNames(string const &keyspace, string const &table) const
shared_ptr< CCassQuery > NewQuery()
unsigned int m_qtimeout_retry_ms
vector< pair< TTokenValue, TTokenValue > > TTokenRanges
void SetLoadBalancing(loadbalancing_policy_t policy)
atomic< int64_t > m_active_statements
vector< string > GetKeyspaces() const
vector< string > GetLocalPeersAddressList(string const &datacenter, unsigned int timeout=0)
static bool m_LoggingEnabled
unsigned int QryTimeoutMs() const
void SetConnectionPoint(string const &hostlist, int16_t port=0)
Set connection point parameters.
vector< SCassSizeEstimate > GetSizeEstimates(string const &datacenter, string const &keyspace, string const &table)
vector< string > GetTables(string const &keyspace) const
virtual ~CCassConnection()
SCassMetrics GetMetrics()
unsigned int m_numThreadsIo
unsigned int m_numConnPerHost
static constexpr TCassConsistency kLocalOne
unique_ptr< CassCollection, function< void(CassCollection *)> > m_collection
union CCassPrm::simpleval_t m_simpleval
bool IsAssigned(void) const
unique_ptr< CassTuple, function< void(CassTuple *)> > m_tuple
void Bind(CassStatement *statement, unsigned int idx)
CCassPrm.
static void s_OnFutureCb(CassFuture *, void *data)
void BindInt16(int iprm, int16_t value)
int32_t ParamAsInt32(int iprm)
void BindInt8(int iprm, int8_t value)
shared_ptr< CCassConnection > m_connection
weak_ptr< CCassDataCallbackReceiver > m_ondata3
void SetHost(const string &hostname)
int64_t ParamAsInt64(int iprm)
void CheckParamAssigned(int iprm) const
TCassConsistency m_serial_consistency
bool m_use_per_request_timeout
void SetupOnDataCallback()
CassValueType ParamType(int iprm) const
void BindStr(int iprm, const string &value)
virtual bool IsAsync(void) const
virtual string ToString(void) const
void SetSerialConsistency(TCassConsistency c)
virtual async_rslt_t WaitAsync(unsigned int timeoutmks)
virtual bool IsEOF(void) const
void Restart(TCassConsistency c=CCassConsistency::kLocalQuorum)
void BindBytes(int iprm, const unsigned char *buf, size_t len)
unsigned int Timeout(void) const
TCassQueryOnExecuteCallback m_onexecute
void BindInt64(int iprm, int64_t value)
const CassResult * m_result
void SetTimeout()
CCassQuery.
friend class CCassQueryCbRef
bool IsActive(void) const
string ParamAsStrForDebug(int iprm) const
void UsePerRequestTimeout(bool value)
void ProcessFutureResult()
string GetColumnDef(F ifld) const
string ParamAsStr(int iprm) const
CassIterator * m_iterator
void BindInt32(int iprm, int32_t value)
void RestartExecute(TCassConsistency c=CCassConsistency::kLocalQuorum)
const CassValue * GetColumn(F ifld) const
void BindDate(int iprm, int64_t value)
void Query(TCassConsistency c=CCassConsistency::kLocalQuorum, bool run_async=false, bool allow_prepare=true, unsigned int page_size=DEFAULT_PAGE_SIZE)
CassStatement * m_statement
void CheckParamExists(int iprm) const
void Execute(TCassConsistency c=CCassConsistency::kLocalQuorum, bool run_async=false, bool allow_prepare=true)
async_rslt_t Wait(unsigned int timeoutmks)
void SetSQL(const string &sql, unsigned int PrmCount)
unsigned int GetRequestTimeoutMs() const
unsigned int m_qtimeoutms
void InternalClose(bool closebatch)
size_t ParamCount(void) const
shared_ptr< CCassQueryCbRef > m_cb_ref
void RestartQuery(TCassConsistency c=CCassConsistency::kLocalQuorum)
@ eQueryFailedRestartable
static CNcbiApplication * Instance(void)
Singleton method.
const_iterator end() const
iterator_bool insert(const value_type &val)
const_iterator find(const key_type &key) const
iterator_bool insert(const value_type &val)
const_iterator begin() const
const_iterator end() const
The NCBI C++ standard methods for dealing with std::string.
static const char * schema
#define ERR_POST(message)
Error posting with file, line number information but without error codes.
EDiagSev
Severity level for the posted diagnostics.
@ eDiag_Trace
Trace message.
@ eDiag_Info
Informational message.
@ eDiag_Error
Error message.
@ eDiag_Warning
Warning message.
@ eDiag_Fatal
Fatal error â guarantees exit(or abort)
@ eDiag_Critical
Critical error message.
void Critical(CExceptionArgs_Base &args)
void Error(CExceptionArgs_Base &args)
TErrCode GetErrCode(void) const
Get error code.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
const string & GetMsg(void) const
Get message string.
void Trace(CExceptionArgs_Base &args)
void Warning(CExceptionArgs_Base &args)
void Info(CExceptionArgs_Base &args)
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_SCOPE(ns)
Define a new scope.
static string Quote(const CTempString str, char quote_char='"', char escape_char = '\\')
Quote string (generic version).
static enable_if< is_arithmetic< TNumeric >::value||is_convertible< TNumeric, Int8 >::value, string >::type NumericToString(TNumeric value, TNumToStringFlags flags=0, int base=10)
Convert numeric value to string.
<!DOCTYPE HTML >< html > n< header > n< title > PubSeq Gateway Help Page</title > n< style > n table
constexpr auto sort(_Init &&init)
const string version
version string
const GenericPointer< typename T::ValueType > T2 value
Defines the CNcbiApplication and CAppException classes for creating NCBI applications.
void copy(Njn::Matrix< S > *matrix_, const Njn::Matrix< T > &matrix0_)
static int message_len(const char *message, int offset)
uint64_t request_timeouts
chrono::microseconds percentile_99th
chrono::microseconds percentile_95th
chrono::microseconds percentile_999th
struct SCassMetrics::@887 requests
uint64_t total_connections
chrono::microseconds median
chrono::microseconds percentile_75th
double fifteen_minute_rate
chrono::microseconds percentile_98th
chrono::microseconds stddev
struct SCassMetrics::@888 stats
uint64_t connection_timeouts
struct SCassMetrics::@889 errors
int64_t mean_partition_size
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4