A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/cass__driver_8cpp_source.html below:

NCBI C++ ToolKit: src/objtools/pubseq_gateway/cassandra/cass_driver.cpp Source File

56 #define RAISE_CASS_QUERY_ERROR(error_code, message) \ 58  auto macro_error_code = (error_code); \ 59  if (macro_error_code == CCassandraException::eQueryFailedRestartable) { \ 60  NCBI_THROW(CCassandraException, eQueryFailedRestartable, message); \ 62  else if (macro_error_code == CCassandraException::eQueryTimeout) { \ 63  NCBI_THROW(CCassandraException, eQueryTimeout, message); \ 65  NCBI_THROW(CCassandraException, eQueryFailed, message); \ 73  switch

(message->severity) {

74  case

CASS_LOG_CRITICAL:

105  return

CASS_LOG_ERROR;

112  auto

name = app->GetProgramDisplayName();

113

cass_cluster_set_application_name_n(cluster, name.c_str(), name.size());

114  auto version

= app->GetFullVersion().GetVersionInfo().Print();

116

cass_cluster_set_application_version_n(cluster,

version

.c_str(),

version

.size());

127  RAISE_DB_ERROR

(eSeqFailed,

"invalid sequence of operations, driver is not connected"

);

130

cass_session_get_schema_meta(m_session),

132

cass_schema_meta_free(meta);

143  TKeyspaceMeta

* keyspace_meta = cass_schema_meta_keyspace_by_name_n(

144

schema_meta, keyspace.c_str(), keyspace.size()

146  if

(!keyspace_meta) {

149  return

keyspace_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) {

185

message.append(

", timeout "

+ to_string(timeout_ms) +

"ms (spent: "

+ to_string(spent_ms) +

"ms)"

);

192  const char

*message_ptr{

nullptr

};

194

cass_future_error_message(future, &message_ptr, &

message_len

);

196

CassError 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"

;

216

CassError rc = cass_future_error_code(future);

217  bool

is_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

) {

226

params += (

i

> 0 ?

","

:

""

) +

query

->ParamAsStrForDebug(

i

);

228

message.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

235

message.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)

287

cass_log_set_level(CASS_LOG_DISABLED);

399  char buf

[CASS_UUID_STRING_LENGTH];

401

CassUuidGen *

gen

, *nothing =

nullptr

;

402  gen

= cass_uuid_gen_new();

404

cass_uuid_gen_free(

gen

);

409

cass_uuid_gen_time(

static_cast<

CassUuidGen*

>

(

m_CassUuidGen

.load()), &uuid);

410

cass_uuid_string(uuid,

buf

);

441

cass_cluster_set_load_balance_round_robin(

m_cluster

);

475

cass_prepared_free(item.second);

476

item.second =

nullptr

;

483

CassFuture * close_future;

485

close_future = cass_session_close(

m_session

);

488

cass_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"

);

520

unique_ptr<CassFuture,

function

<void(CassFuture*)>> future(

522

[](CassFuture* future)

524

cass_future_free(future);

528

CassError rc = CASS_OK;

529

cass_future_wait(future.get());

530

rc = cass_future_error_code(future.get());

567

CassMetrics cass_metrics;

568

cass_session_get_metrics(

m_session

, &cass_metrics);

569

metrics.

requests

.

min

= chrono::microseconds(cass_metrics.requests.min);

570

metrics.

requests

.

max

= chrono::microseconds(cass_metrics.requests.max);

571

metrics.

requests

.

stddev

= chrono::microseconds(cass_metrics.requests.stddev);

572

metrics.

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"

);

648

shared_ptr<CCassQuery> rv(

new CCassQuery

(shared_from_this()));

655

vector<TTokenValue> cluster_tokens;

657  string

rpc_address, datacenter,

schema

, host_id;

661

vector<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  auto

itr = peer_tokens.

insert

(make_pair(host_id, vector<TTokenValue>())).first;

672  for

(

const auto

& item: tokens) {

674

itr->second.push_back(

value

);

675

cluster_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_t

peers_count{0};

689  query

->SetHost(rpc_address);

690  query

->SetSQL(

"SELECT data_center, schema_version, host_id, tokens FROM system.peers"

, 0);

693  string

peer_host_id, peer_dc, peer_schema;

694

vector<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  auto

itr = peer_tokens.

find

(peer_host_id);

704  if

(itr == peer_tokens.

end

()) {

705

itr = peer_tokens.

insert

(make_pair(peer_host_id, vector<TTokenValue>())).first;

706  for

(

const auto

& item : tokens) {

708

itr->second.push_back(

value

);

709

cluster_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  auto

token_count = cluster_tokens.size();

723  sort

(cluster_tokens.begin(), cluster_tokens.end());

724

cluster_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());

733

ranges.reserve(cluster_tokens.size() + 1);

735  for

(

int64_t

token : cluster_tokens) {

737

ranges.push_back(make_pair(lower_bound, token));

745  string

estimates_sql{

"SELECT range_start, range_end, mean_partition_size, partitions_count FROM system.size_estimates " 746  " WHERE keyspace_name = ? AND table_name = ?"

};

748

vector<SCassSizeEstimate> estimates;

749  size_t

failed_peers_count{0};

750  for

(

auto const

& peer : peers) {

753  query

->SetHost(peer);

754  query

->SetSQL(estimates_sql, 2);

755  query

->BindStr(0, keyspace);

770

estimates.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(),

786

return a.range_start < b.range_start;

790  if

(failed_peers_count > 0 && !estimates.empty()) {

793  int64_t

avg_mean_partition_size{0}, avg_partitions_count{0};

794  for

(

auto const

& estimate : estimates) {

795

avg_mean_partition_size += estimate.mean_partition_size;

796

avg_partitions_count += estimate.partitions_count;

798

avg_mean_partition_size /= estimates.size();

799

avg_partitions_count /= estimates.size();

800  auto

estimate_itr = begin(estimates);

801

vector<SCassSizeEstimate> appended_estimates;

802  for

(

auto const

& local_range : local_ranges) {

803  if

(estimate_itr != end(estimates) && estimate_itr->range_end == local_range.second) {

807

estimate_itr->range_end > local_range.second || estimate_itr == end(estimates)

811

estimate.

range_end

= local_range.second;

814

appended_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) {

822

estimates.push_back(estimate);

824  sort

(estimates.begin(), estimates.end(),

826

return 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  string

rpc_address =

query

->FieldGetStrValue(0);

845  string

local_datacenter =

query

->FieldGetStrValue(1);

846  if

(datacenter.empty() || datacenter == local_datacenter) {

847

hosts.

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);

894

unique_ptr<CassIterator,

function

<void(CassIterator*)>> keyspaces_itr(

895

cass_iterator_keyspaces_from_schema_meta(schema_meta.get()),

896

[](CassIterator* itr)->

void

{

897

cass_iterator_free(itr);

900  if

(!keyspaces_itr) {

903  while

(cass_iterator_next(keyspaces_itr.get())) {

904

cass_keyspace_meta_name(

905

cass_iterator_get_keyspace_meta(keyspaces_itr.get()),

909  result

.push_back(

string

(name, name_length));

922

unique_ptr<CassIterator,

function

<void(CassIterator*)>> tables_itr(

923

cass_iterator_tables_from_keyspace_meta(keyspace_meta),

924

[](CassIterator* itr)->

void

{

925

cass_iterator_free(itr);

928  while

(cass_iterator_next(tables_itr.get())) {

929

cass_table_meta_name(

930

cass_iterator_get_table_meta(tables_itr.get()),

934  result

.push_back(

string

(name, name_length));

943  size_t

key_count = cass_table_meta_column_count(table_meta);

945  for

(

size_t i

= 0;

i

< key_count; ++

i

) {

946  const

CassColumnMeta* column_meta = cass_table_meta_column(table_meta,

i

);

950

cass_column_meta_name(column_meta, &name, &name_length);

951  result

.emplace_back(name, name_length);

961  size_t

key_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  const

CassColumnMeta* column_meta = cass_table_meta_partition_key(table_meta,

i

);

969

cass_column_meta_name(column_meta, &name, &name_length);

970  result

.emplace_back(name, name_length);

980  size_t

key_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  const

CassColumnMeta* column_meta = cass_table_meta_clustering_key(table_meta,

i

);

988

cass_column_meta_name(column_meta, &name, &name_length);

989  result

.emplace_back(name, name_length);

997  const

CassPrepared * rv =

nullptr

;

1012

CassFuture * __future = cass_session_prepare(

m_session

,

query

);

1014  RAISE_DB_ERROR

(eRsrcFailed,

string

(

"failed to obtain cassandra query future"

));

1017

unique_ptr<CassFuture,

function

<void(CassFuture*)>> future(

1019

[](CassFuture* future)

1021

cass_future_free(future);

1024  bool b

= cass_future_wait_timed(future.get(),

m_qtimeoutms

* 1000L);

1031

CassError rc = cass_future_error_code(future.get());

1032  if

(rc != CASS_OK) {

1038

rv = cass_future_get_prepared(future.get());

1040  RAISE_DB_ERROR

(eRsrcFailed,

string

(

"failed to obtain prepared handle for sql: "

) +

sql

);

1052  unsigned int

optimeoutms,

1053  const

std::function<

bool

()> & PreLoopCB,

1055  const

std::function<

bool

(

bool

)> & OpCB)

1058  bool

is_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) {

1091

is_repeated =

true

;

1098

CassError rc = CASS_OK;

1100  case

CASS_VALUE_TYPE_UNKNOWN:

1102  RAISE_DB_ERROR

(eSeqFailed,

"invalid sequence of operations, Param #"

+ to_string(idx) +

" is not assigned"

);

1104

rc = cass_statement_bind_null(statement, idx);

1106  case

CASS_VALUE_TYPE_TINY_INT:

1107

rc = cass_statement_bind_int8(statement, idx,

static_cast<

cass_int8_t

>

(

m_simpleval

.

i8

));

1109  case

CASS_VALUE_TYPE_SMALL_INT:

1110

rc = cass_statement_bind_int16(statement, idx,

static_cast<

cass_int16_t

>

(

m_simpleval

.

i16

));

1112  case

CASS_VALUE_TYPE_INT:

1113

rc = cass_statement_bind_int32(statement, idx,

static_cast<

cass_int32_t

>

(

m_simpleval

.

i32

));

1115  case

CASS_VALUE_TYPE_BIGINT:

1116

rc = cass_statement_bind_int64(statement, idx,

static_cast<

cass_int64_t

>

(

m_simpleval

.

i64

));

1126  case

CASS_VALUE_TYPE_VARCHAR:

1127

rc = cass_statement_bind_string(statement, idx,

m_bytes

.c_str());

1129  case

CASS_VALUE_TYPE_BLOB:

1131

rc = cass_statement_bind_bytes(

1133  reinterpret_cast<const unsigned char

*

>

(

m_bytes

.c_str()),

1136

rc = cass_statement_bind_null(statement, idx);

1139  case

CASS_VALUE_TYPE_SET:

1140  case

CASS_VALUE_TYPE_LIST:

1141  case

CASS_VALUE_TYPE_MAP:

1143

rc = cass_statement_bind_collection(statement, idx,

m_collection

.get());

1145

rc = cass_statement_bind_null(statement, idx);

1148  case

CASS_VALUE_TYPE_TUPLE:

1150

rc = cass_statement_bind_tuple(statement, idx,

m_tuple

.get());

1152

rc = cass_statement_bind_null(statement, idx);

1155  case

CASS_VALUE_TYPE_DATE: {

1157

rc = 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  bool

allow_prepared,

unsigned int

page_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  const

CassPrepared * prepared =

nullptr

;

1430  if

(allow_prepared) {

1441  RAISE_DB_ERROR

(eRsrcFailed,

string

(

"failed to create cassandra query"

));

1451

rc = 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) {

1463

rc = 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  auto

retry_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  const

CassPrepared * prepared =

nullptr

;

1524  if

(allow_prepared) {

1536  RAISE_DB_ERROR

(eRsrcFailed,

"failed to create cassandra query"

);

1542

rc = 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  auto

retry_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()) {

1619

params =

"; 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  return

cass_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) {

1718

rv = cass_future_wait_timed(

m_future

, timeoutmks);

1723

rv = 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"

);

1780

CassError 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  bool

has_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  const

CassValue * 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  const

CassValue * 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  const

CassValue * 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()) {

1951

params.append(

", "

);

1954  case

CASS_VALUE_TYPE_SET:

1955

params.append(

"?SET"

);

1957  case

CASS_VALUE_TYPE_LIST:

1958

params.append(

"?LIST"

);

1960  case

CASS_VALUE_TYPE_MAP:

1961

params.append(

"?MAP"

);

1963  case

CASS_VALUE_TYPE_TUPLE:

1964

params.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