unsigned long num_cached_queries; /* total number of cached queries */
unsigned long max_queries; /* upper bound on # of cached queries */
int save_queries; /* save cached queries across restarts */
+ int check_cacheability; /* check whether a query is cacheable */
int numattrsets; /* number of attribute sets */
int cur_entries; /* current number of entries cached */
int max_entries; /* max number of entries cached */
Filter f = { 0 };
char filtbuf[ LDAP_LUTIL_UUIDSTR_BUFSIZE + STRLENOF( "(entryUUID=)" ) ];
AttributeAssertion ava = ATTRIBUTEASSERTION_INIT;
- AttributeName attrs[ 2 ] = { 0 };
+ AttributeName attrs[ 2 ] = {{{ 0 }}};
int s, rc;
if ( op == NULL ) {
Filter f = { 0 };
char filter_str[ LDAP_LUTIL_UUIDSTR_BUFSIZE + STRLENOF( "(queryId=)" ) ];
AttributeAssertion ava = ATTRIBUTEASSERTION_INIT;
- AttributeName attrs[ 2 ] = { 0 };
+ AttributeName attrs[ 2 ] = {{{ 0 }}};
int rc;
BerVarray vals = NULL;
if ( !si->over ) {
/* check if the entry contains undefined
* attributes/objectClasses (ITS#5680) */
- if ( test_filter( op, rs->sr_entry, si->query.filter ) != LDAP_COMPARE_TRUE ) {
+ if ( cm->check_cacheability && test_filter( op, rs->sr_entry, si->query.filter ) != LDAP_COMPARE_TRUE ) {
Debug( pcache_debug, "%s: query not cacheable because of schema issues in DN \"%s\"\n",
op->o_log_prefix, rs->sr_entry->e_name.bv_val, 0 );
goto over;
"( OLcfgOvAt:2.6 NAME 'olcProxySaveQueries' "
"DESC 'Save cached queries for hot restart' "
"SYNTAX OMsBoolean )", NULL, NULL },
+ { "proxyCheckCacheability", "TRUE|FALSE",
+ 2, 2, 0, ARG_ON_OFF|ARG_OFFSET, (void *)offsetof(cache_manager, check_cacheability),
+ "( OLcfgOvAt:2.7 NAME 'olcProxyCheckCacheability' "
+ "DESC 'Check whether the results of a query are cacheable, e.g. for schema issues' "
+ "SYNTAX OMsBoolean )", NULL, NULL },
{ NULL, NULL, 0, 0, 0, ARG_IGNORED }
};
-/* Need to no-op this keyword for dynamic config */
-static ConfigTable pcdummy[] = {
- { "", "", 0, 0, 0, ARG_IGNORED,
- NULL, "( OLcfgGlAt:13 NAME 'olcDatabase' "
- "DESC 'The backend type for a database instance' "
- "SUP olcBackend SINGLE-VALUE X-ORDERED 'SIBLINGS' )", NULL, NULL },
- { NULL, NULL, 0, 0, 0, ARG_IGNORED }
-};
-
static ConfigOCs pcocs[] = {
{ "( OLcfgOvOc:2.1 "
"NAME 'olcPcacheConfig' "
"DESC 'ProxyCache configuration' "
"SUP olcOverlayConfig "
"MUST ( olcProxyCache $ olcProxyAttrset $ olcProxyTemplate ) "
- "MAY ( olcProxyResponseCB $ olcProxyCacheQueries $ olcProxySaveQueries ) )",
+ "MAY ( olcProxyResponseCB $ olcProxyCacheQueries $ olcProxySaveQueries $ olcProxyCheckCacheability ) )",
Cft_Overlay, pccfg, NULL, pc_cfadd },
{ "( OLcfgOvOc:2.2 "
"NAME 'olcPcacheDatabase' "
"DESC 'Cache database configuration' "
- "AUXILIARY )", Cft_Misc, pcdummy, pc_ldadd },
+ "AUXILIARY )", Cft_Misc, olcDatabaseDummy, pc_ldadd },
{ NULL, 0, NULL }
};
/* FIXME: should not hardcode "olcDatabase" here */
bv.bv_len = snprintf( ca->cr_msg, sizeof( ca->cr_msg ),
"olcDatabase=%s", cm->db.bd_info->bi_type );
- if ( bv.bv_len < 0 || bv.bv_len >= sizeof( ca->cr_msg ) ) {
+ if ( bv.bv_len >= sizeof( ca->cr_msg ) ) {
return -1;
}
bv.bv_val = ca->cr_msg;
cm->cur_entries = 0;
cm->max_queries = 10000;
cm->save_queries = 0;
+ cm->check_cacheability = 0;
cm->response_cb = PCACHE_RESPONSE_CB_TAIL;
cm->defer_db_open = 1;
cm->cc_period = 1000;
BerVarray vals = NULL;
Filter f = { 0 }, f2 = { 0 };
AttributeAssertion ava = ATTRIBUTEASSERTION_INIT;
- AttributeName attrs[ 2 ] = { 0 };
+ AttributeName attrs[ 2 ] = {{{ 0 }}};
connection_fake_init( &conn, &opbuf, thrctx );
op = &opbuf.ob_op;
slap_callback cb = { 0 };
SlapReply rs = { REP_RESULT };
- Modifications mod = { 0 };
+ Modifications mod = {{ 0 }};
thrctx = ldap_pvt_thread_pool_context();
code = config_register_schema( pccfg, pcocs );
if ( code ) return code;
- {
- const char *text;
- code = slap_str2ad( "olcDatabase", &pcdummy[0].ad, &text );
- if ( code ) return code;
- }
return overlay_register( &pcache );
}