wt_ctx * wt_ctx_get(Operation *op, struct wt_info *wi){ int rc; void *data; wt_ctx *wc = NULL; rc = ldap_pvt_thread_pool_getkey(op->o_threadctx, wt_ctx_get, &data, NULL ); if( rc ){ wc = wt_ctx_init(wi); if( !wc ) { Debug( LDAP_DEBUG_ANY, LDAP_XSTRING(wt_ctx) ": wt_ctx_init failed\n", 0, 0, 0 ); return NULL; } rc = ldap_pvt_thread_pool_setkey( op->o_threadctx, wt_ctx_get, wc, wt_ctx_free, NULL, NULL ); if( rc ) { Debug( LDAP_DEBUG_ANY, "wt_ctx: setkey error(%d)\n", rc, 0, 0 ); return NULL; } return wc; } return (wt_ctx *)data; }
int wt_tool_entry_open( BackendDB *be, int mode ) { struct wt_info *wi = (struct wt_info *) be->be_private; WT_CONNECTION *conn = wi->wi_conn; int rc; wc = wt_ctx_init(wi); if( !wc ){ Debug( LDAP_DEBUG_ANY, LDAP_XSTRING(wt_tool_entry_open) ": wt_ctx_get failed: %s (%d)\n", 0, 0, 0 ); return -1; } rc = wc->session->open_cursor(wc->session, WT_TABLE_ID2ENTRY"(entry)" ,NULL, NULL, &reader); if ( rc ) { Debug( LDAP_DEBUG_ANY, LDAP_XSTRING(wt_tool_entry_open) ": cursor open failed: %s (%d)\n", wiredtiger_strerror(rc), rc, 0 ); return -1; } return 0; }