MCPcopy Create free account
hub / github.com/bloomberg/comdb2 / stmt_cache_put_distributed

Function stmt_cache_put_distributed

db/sql_stmt_cache.c:587–607  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

585}
586
587int stmt_cache_put_distributed(struct sqlthdstate *thd,
588 struct sqlclntstate *clnt, struct sql_state *rec,
589 int outrc, int distributed)
590{
591 int rc;
592
593 dohsql_wait_for_master((rec) ? rec->stmt : NULL, clnt);
594
595 rc = stmt_cache_put_int(thd, clnt, rec, 0, outrc, distributed);
596 if (rc != 0 && rec->stmt) {
597 sqlite3_finalize(rec->stmt);
598 rec->stmt = NULL;
599 }
600 if ((rec->status & CACHE_HAS_HINT) && (rec->status & CACHE_FOUND_STR)) {
601 char *k = rec->cache_hint;
602 Pthread_mutex_lock(&gbl_sql_lock);
603 lrucache_release(sql_hints, &k);
604 Pthread_mutex_unlock(&gbl_sql_lock);
605 }
606 return rc;
607}
608
609/**
610 * Cache a stmt if needed; struct sql_state is prepared by

Callers 2

sqlite_doneFunction · 0.85
stmt_cache_putFunction · 0.85

Calls 4

dohsql_wait_for_masterFunction · 0.85
stmt_cache_put_intFunction · 0.85
sqlite3_finalizeFunction · 0.85
lrucache_releaseFunction · 0.85

Tested by

no test coverage detected