make additional checking optional (more on ITS#5860)

This commit is contained in:
Pierangelo Masarati 2008-09-04 07:43:19 +00:00
parent bcbb456391
commit 8141cd4db7
2 changed files with 28 additions and 13 deletions

View file

@ -68,10 +68,29 @@ returned is less than <entry_limit>. Consistency check is performed every
proxycache \fBbdb 10000 1 50 100\fP
.RE
.TP
.B proxyattrset <index> <attrs...>
Used to associate a set of attributes <attrs..> with an <index>. Each attribute
set is associated with an integer from 0 to <numattrsets>-1. These indices are
used by the \fBproxytemplate\fP directive to define cacheable templates.
A set of attributes cannot be empty. A set of attributes can contain the
special attributes "*" (all user attributes), "+" (all operational attributes)
or both; in the latter case, any other attribute is redundant and should
be avoided for clarity. A set of attributes can contain "1.1" as the only
attribute; in this case, only the presence of the entries is cached.
.TP
.B proxycachequeries <queries>
Specify the maximum number of queries to cache. The default is 10000.
.TP
.B proxycheckcacheability { TRUE | FALSE }
Check whether the results of a query being cached can actually be returned
from the cache by the proxy DSA. When enabled, the entries being returned
while caching the results of a query are checked to ensure consistency
with the schema known to the proxy DSA. In case of failure, the query
is not cached. By default, the check is off.
.TP
.B proxysavequeries { TRUE | FALSE }
Specify whether the cached queries should be saved across restarts
@ -90,17 +109,6 @@ directives are not changed neither in order nor in contents.
If new sets and templates are added, or if other details of the pcache
overlay configuration changed, this feature should not be affected.
.TP
.B proxyattrset <index> <attrs...>
Used to associate a set of attributes <attrs..> with an <index>. Each attribute
set is associated with an integer from 0 to <numattrsets>-1. These indices are
used by the \fBproxytemplate\fP directive to define cacheable templates.
A set of attributes cannot be empty. A set of attributes can contain the
special attributes "*" (all user attributes), "+" (all operational attributes)
or both; in the latter case, any other attribute is redundant and should
be avoided for clarity. A set of attributes can contain "1.1" as the only
attribute; in this case, only the presence of the entries is cached.
.TP
.B proxytemplate <template_string> <attrset_index> <ttl> [<negttl> [<limitttl>]]
Specifies a cacheable template and "time to live" <ttl> of queries

View file

@ -182,6 +182,7 @@ typedef struct cache_manager_s {
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 */
@ -1963,7 +1964,7 @@ pcache_op_cleanup( Operation *op, SlapReply *rs ) {
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;
@ -2645,6 +2646,11 @@ static ConfigTable pccfg[] = {
"( 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 }
};
@ -2664,7 +2670,7 @@ static ConfigOCs pcocs[] = {
"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' "
@ -3157,6 +3163,7 @@ pcache_db_init(
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;