Codebase list kopanocore / 1c21bcd
Committing svn revision 41176: Merged [40330] [40690] [40693] [40779] [40871] [40898] [41049] [41050] [41059] : Fixes ZCP-11457 john 11 years ago
22 changed file(s) with 381 addition(s) and 100 deletion(s). Raw diff Collapse all Expand all
215215 { "list-companyquota-recipients", 0, NULL, OPT_LIST_CQUOTA_RECIPIENT },
216216 { "purge-softdelete", 1, NULL, OPT_PURGE_SOFTDELETE },
217217 { "purge-deferred", 0, NULL, OPT_PURGE_DEFERRED },
218 { "clear-cache", 0, NULL, OPT_CLEAR_CACHE },
218 { "clear-cache", 2, NULL, OPT_CLEAR_CACHE },
219219 { "config", 1, NULL, OPT_CONFIG },
220220 { "utf8", 0, NULL, OPT_UTF8 },
221221 { "force-resync", 0, NULL, OPT_FORCE_RESYNC },
24602460 IMAPIFolder *lpDeletedStoresFolder = NULL;
24612461 IMAPIFolder *lpRootFolder = NULL;
24622462 ULONG ulObjType = 0;
2463 ULONG ulCachePurgeMode = PURGE_CACHE_ALL;
24632464
24642465 InputValidator validateInput;
24652466
27272728 break;
27282729 case OPT_CLEAR_CACHE:
27292730 mode = MODE_CLEAR_CACHE;
2731 if (my_optarg)
2732 ulCachePurgeMode = strtol(my_optarg, NULL, 0);
27302733 break;
27312734 case OPT_PURGE_DEFERRED:
27322735 mode = MODE_PURGE_DEFERRED;
42114214 cout << "Softdelete purge done." << endl;
42124215 break;
42134216 case MODE_CLEAR_CACHE:
4214 hr = lpServiceAdmin->PurgeCache(PURGE_CACHE_ALL);
4217 hr = lpServiceAdmin->PurgeCache(ulCachePurgeMode);
42154218 if (hr != hrSuccess) {
42164219 cerr << "Cache clear failed" << endl;
42174220 goto exit;
42184221 }
4219 cout << "Cache cleared." << endl;
4222 if (ulCachePurgeMode != PURGE_CACHE_ALL) {
4223 cout << "Cache cleared with flags " << ulCachePurgeMode << endl;
4224 } else {
4225 cout << "Cache cleared." << endl;
4226 }
42204227 break;
42214228 case MODE_PURGE_DEFERRED:
42224229 while(1) {
149149
150150 size_type Size() const
151151 {
152 return (m_map.size() * sizeof(typename _MapType::value_type) + 64) + m_ulSize;
152 // it works with map and hash_map
153 return (m_map.size() * (sizeof(typename _MapType::value_type) + sizeof(_MapType) )) + m_ulSize;
153154 }
154155
155156 ECRESULT RemoveCacheItem(const key_type &key)
164165 }
165166
166167 m_ulSize -= GetCacheAdditionalSize(iter->second);
168 m_ulSize -= GetCacheAdditionalSize(key);
167169 m_map.erase(iter);
168170
169171 exit:
247249 } else {
248250 // We just inserted a new entry.
249251 m_ulSize += GetCacheAdditionalSize(value);
252 m_ulSize += GetCacheAdditionalSize(key);
250253
251254 result.first->second.ulLastAccess = GetProcessTime();
252255
289292 iterMap = iterEntry->key;
290293
291294 m_ulSize -= GetCacheAdditionalSize(iterMap->second);
295 m_ulSize -= GetCacheAdditionalSize(iterMap->first);
292296 m_map.erase(iterMap);
293297 }
294298
15481548
15491549 pthread_mutex_lock(&mLock);
15501550
1551 ulSize += mapRow.size() * sizeof(ECTableRowMap::value_type);
1551 ulSize += MEMORY_USAGE_MAP(mapRow.size(), ECTableRowMap);
15521552
15531553 for(iterRow = mapRow.begin(); iterRow != mapRow.end(); iterRow++)
15541554 ulSize += iterRow->second->GetObjectSize();
15551555
1556 ulSize += m_mapBookmarks.size() * sizeof(ECBookmarkMap::value_type);
1556 ulSize += MEMORY_USAGE_MAP(m_mapBookmarks.size(), ECBookmarkMap);
15571557
15581558 pthread_mutex_unlock(&mLock);
15591559
237237
238238 /* Define to 1 if you have the <sys/un.h> header file. */
239239 #undef HAVE_SYS_UN_H
240
241 /* Google TCMalloc available */
242 #undef HAVE_TCMALLOC
240243
241244 /* Define to 1 if you have the `timegm' function. */
242245 #undef HAVE_TIMEGM
4646 *
4747 */
4848
49 #define PROJECT_VERSION_SERVER 7,1,4,41175
50 #define PROJECT_VERSION_SERVER_STR "7,1,4,41175"
51 #define PROJECT_VERSION_CLIENT 7,1,4,41175
52 #define PROJECT_VERSION_CLIENT_STR "7,1,4,41175"
53 #define PROJECT_VERSION_EXT_STR "7,1,4,41175"
54 #define PROJECT_VERSION_SPOOLER_STR "7,1,4,41175"
55 #define PROJECT_VERSION_GATEWAY_STR "7,1,4,41175"
56 #define PROJECT_VERSION_CALDAV_STR "7,1,4,41175"
57 #define PROJECT_VERSION_DAGENT_STR "7,1,4,41175"
58 #define PROJECT_VERSION_PROFADMIN_STR "7,1,4,41175"
59 #define PROJECT_VERSION_MONITOR_STR "7,1,4,41175"
60 #define PROJECT_VERSION_PASSWD_STR "7,1,4,41175"
61 #define PROJECT_VERSION_FBSYNCER_STR "7,1,4,41175"
62 #define PROJECT_VERSION_SEARCH_STR "7,1,4,41175"
63 #define PROJECT_VERSION_ARCHIVER_STR "7,1,4,41175"
49 #define PROJECT_VERSION_SERVER 7,1,4,41176
50 #define PROJECT_VERSION_SERVER_STR "7,1,4,41176"
51 #define PROJECT_VERSION_CLIENT 7,1,4,41176
52 #define PROJECT_VERSION_CLIENT_STR "7,1,4,41176"
53 #define PROJECT_VERSION_EXT_STR "7,1,4,41176"
54 #define PROJECT_VERSION_SPOOLER_STR "7,1,4,41176"
55 #define PROJECT_VERSION_GATEWAY_STR "7,1,4,41176"
56 #define PROJECT_VERSION_CALDAV_STR "7,1,4,41176"
57 #define PROJECT_VERSION_DAGENT_STR "7,1,4,41176"
58 #define PROJECT_VERSION_PROFADMIN_STR "7,1,4,41176"
59 #define PROJECT_VERSION_MONITOR_STR "7,1,4,41176"
60 #define PROJECT_VERSION_PASSWD_STR "7,1,4,41176"
61 #define PROJECT_VERSION_FBSYNCER_STR "7,1,4,41176"
62 #define PROJECT_VERSION_SEARCH_STR "7,1,4,41176"
63 #define PROJECT_VERSION_ARCHIVER_STR "7,1,4,41176"
6464 #define PROJECT_VERSION_DOT_STR "7.1.4"
6565 #define PROJECT_SPECIALBUILD "beta"
66 #define PROJECT_SVN_REV_STR "41175"
66 #define PROJECT_SVN_REV_STR "41176"
6767 #define PROJECT_VERSION_MAJOR 7
6868 #define PROJECT_VERSION_MINOR 1
69 #define PROJECT_VERSION_REVISION 41175
69 #define PROJECT_VERSION_REVISION 41176
151151
152152 #define ZARAFA_API
153153
154
155 /**
156 * Memory usage calculation macros
157 */
158 #define MEMALIGN(x) (((x) + sizeof(void*) - 1) & ~(sizeof(void*) - 1))
159
160 #define MEMORY_USAGE_MAP(items, map) (items * (sizeof(map) + sizeof(map::value_type)))
161 #define MEMORY_USAGE_LIST(items, list) (items * (MEMALIGN(sizeof(list) + sizeof(list::value_type))))
162 #define MEMORY_USAGE_HASHMAP(items, map) MEMORY_USAGE_MAP(items, map)
163 #define MEMORY_USAGE_STRING(str) ( (str.capacity() + 1) * sizeof(char) )
164 #define MEMORY_USAGE_MULTIMAP(items, map) MEMORY_USAGE_MAP(items, map)
165
166
154167 #endif // PLATFORM_H
978978 enable_release
979979 enable_unicode
980980 enable_tcmalloc
981 enable_tcmalloc_full
981982 enable_sparsehash
982983 with_distro
983984 enable_oss
16621663 --enable-release enable release mode (compile flags -O2 and no DEBUG
16631664 defines)
16641665 --enable-unicode enable unicode mode (compile flags -DUNICODE)
1665 --enable-tcmalloc enable use of tcmalloc lib
1666 --enable-tcmalloc enable use of tcmalloc minimal lib
1667 --enable-tcmalloc-full enable use of tcmalloc full lib
16661668 --enable-sparsehash enable use of sparsehash
16671669 --enable-oss enable opensource mode
16681670 --enable-debug enable debug mode (Adds debug code)
51545156 else
51555157 lt_cv_nm_interface="BSD nm"
51565158 echo "int some_variable = 0;" > conftest.$ac_ext
5157 (eval echo "\"\$as_me:5158: $ac_compile\"" >&5)
5159 (eval echo "\"\$as_me:5160: $ac_compile\"" >&5)
51585160 (eval "$ac_compile" 2>conftest.err)
51595161 cat conftest.err >&5
5160 (eval echo "\"\$as_me:5161: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
5162 (eval echo "\"\$as_me:5163: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
51615163 (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
51625164 cat conftest.err >&5
5163 (eval echo "\"\$as_me:5164: output\"" >&5)
5165 (eval echo "\"\$as_me:5166: output\"" >&5)
51645166 cat conftest.out >&5
51655167 if $GREP 'External.*some_variable' conftest.out > /dev/null; then
51665168 lt_cv_nm_interface="MS dumpbin"
63666368 ;;
63676369 *-*-irix6*)
63686370 # Find out which ABI we are using.
6369 echo '#line 6370 "configure"' > conftest.$ac_ext
6371 echo '#line 6372 "configure"' > conftest.$ac_ext
63706372 if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
63716373 (eval $ac_compile) 2>&5
63726374 ac_status=$?
78657867 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
78667868 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
78677869 -e 's:$: $lt_compiler_flag:'`
7868 (eval echo "\"\$as_me:7869: $lt_compile\"" >&5)
7870 (eval echo "\"\$as_me:7871: $lt_compile\"" >&5)
78697871 (eval "$lt_compile" 2>conftest.err)
78707872 ac_status=$?
78717873 cat conftest.err >&5
7872 echo "$as_me:7873: \$? = $ac_status" >&5
7874 echo "$as_me:7875: \$? = $ac_status" >&5
78737875 if (exit $ac_status) && test -s "$ac_outfile"; then
78747876 # The compiler can only warn and ignore the option if not recognized
78757877 # So say no if there are warnings other than the usual output.
82048206 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
82058207 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
82068208 -e 's:$: $lt_compiler_flag:'`
8207 (eval echo "\"\$as_me:8208: $lt_compile\"" >&5)
8209 (eval echo "\"\$as_me:8210: $lt_compile\"" >&5)
82088210 (eval "$lt_compile" 2>conftest.err)
82098211 ac_status=$?
82108212 cat conftest.err >&5
8211 echo "$as_me:8212: \$? = $ac_status" >&5
8213 echo "$as_me:8214: \$? = $ac_status" >&5
82128214 if (exit $ac_status) && test -s "$ac_outfile"; then
82138215 # The compiler can only warn and ignore the option if not recognized
82148216 # So say no if there are warnings other than the usual output.
83098311 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
83108312 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
83118313 -e 's:$: $lt_compiler_flag:'`
8312 (eval echo "\"\$as_me:8313: $lt_compile\"" >&5)
8314 (eval echo "\"\$as_me:8315: $lt_compile\"" >&5)
83138315 (eval "$lt_compile" 2>out/conftest.err)
83148316 ac_status=$?
83158317 cat out/conftest.err >&5
8316 echo "$as_me:8317: \$? = $ac_status" >&5
8318 echo "$as_me:8319: \$? = $ac_status" >&5
83178319 if (exit $ac_status) && test -s out/conftest2.$ac_objext
83188320 then
83198321 # The compiler can only warn and ignore the option if not recognized
83648366 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
83658367 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
83668368 -e 's:$: $lt_compiler_flag:'`
8367 (eval echo "\"\$as_me:8368: $lt_compile\"" >&5)
8369 (eval echo "\"\$as_me:8370: $lt_compile\"" >&5)
83688370 (eval "$lt_compile" 2>out/conftest.err)
83698371 ac_status=$?
83708372 cat out/conftest.err >&5
8371 echo "$as_me:8372: \$? = $ac_status" >&5
8373 echo "$as_me:8374: \$? = $ac_status" >&5
83728374 if (exit $ac_status) && test -s out/conftest2.$ac_objext
83738375 then
83748376 # The compiler can only warn and ignore the option if not recognized
1074810750 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
1074910751 lt_status=$lt_dlunknown
1075010752 cat > conftest.$ac_ext <<_LT_EOF
10751 #line 10752 "configure"
10753 #line 10754 "configure"
1075210754 #include "confdefs.h"
1075310755
1075410756 #if HAVE_DLFCN_H
1084410846 lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
1084510847 lt_status=$lt_dlunknown
1084610848 cat > conftest.$ac_ext <<_LT_EOF
10847 #line 10848 "configure"
10849 #line 10850 "configure"
1084810850 #include "confdefs.h"
1084910851
1085010852 #if HAVE_DLFCN_H
1452314525 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
1452414526 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
1452514527 -e 's:$: $lt_compiler_flag:'`
14526 (eval echo "\"\$as_me:14527: $lt_compile\"" >&5)
14528 (eval echo "\"\$as_me:14529: $lt_compile\"" >&5)
1452714529 (eval "$lt_compile" 2>conftest.err)
1452814530 ac_status=$?
1452914531 cat conftest.err >&5
14530 echo "$as_me:14531: \$? = $ac_status" >&5
14532 echo "$as_me:14533: \$? = $ac_status" >&5
1453114533 if (exit $ac_status) && test -s "$ac_outfile"; then
1453214534 # The compiler can only warn and ignore the option if not recognized
1453314535 # So say no if there are warnings other than the usual output.
1462214624 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
1462314625 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
1462414626 -e 's:$: $lt_compiler_flag:'`
14625 (eval echo "\"\$as_me:14626: $lt_compile\"" >&5)
14627 (eval echo "\"\$as_me:14628: $lt_compile\"" >&5)
1462614628 (eval "$lt_compile" 2>out/conftest.err)
1462714629 ac_status=$?
1462814630 cat out/conftest.err >&5
14629 echo "$as_me:14630: \$? = $ac_status" >&5
14631 echo "$as_me:14632: \$? = $ac_status" >&5
1463014632 if (exit $ac_status) && test -s out/conftest2.$ac_objext
1463114633 then
1463214634 # The compiler can only warn and ignore the option if not recognized
1467414676 -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
1467514677 -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
1467614678 -e 's:$: $lt_compiler_flag:'`
14677 (eval echo "\"\$as_me:14678: $lt_compile\"" >&5)
14679 (eval echo "\"\$as_me:14680: $lt_compile\"" >&5)
1467814680 (eval "$lt_compile" 2>out/conftest.err)
1467914681 ac_status=$?
1468014682 cat out/conftest.err >&5
14681 echo "$as_me:14682: \$? = $ac_status" >&5
14683 echo "$as_me:14684: \$? = $ac_status" >&5
1468214684 if (exit $ac_status) && test -s out/conftest2.$ac_objext
1468314685 then
1468414686 # The compiler can only warn and ignore the option if not recognized
1611016112 fi
1611116113
1611216114
16115 # Check whether --enable-tcmalloc-full was given.
16116 if test "${enable_tcmalloc_full+set}" = set; then :
16117 enableval=$enable_tcmalloc_full; want_tcmalloc_full=${enableval}
16118 else
16119 want_tcmalloc_full=no
16120 fi
16121
16122
1611316123 # Check whether --enable-sparsehash was given.
1611416124 if test "${enable_sparsehash+set}" = set; then :
1611516125 enableval=$enable_sparsehash; want_sparsehash=${enableval}
1846318473 CPPFLAGS=$CPPFLAGS_system
1846418474
1846518475 # Check for google perftools tcmalloc availability
18466 if test "$want_tcmalloc" = "yes"; then
18476 if test "$want_tcmalloc_full" = "yes"; then
18477
18478 # Check whether --with-tcmalloc-prefix was given.
18479 if test "${with_tcmalloc_prefix+set}" = set; then :
18480 withval=$with_tcmalloc_prefix; TCMALLOC_PREFIX=${withval}
18481 else
18482 TCMALLOC_PREFIX=/usr/lib
18483 fi
18484
18485 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for open in -ltcmalloc" >&5
18486 $as_echo_n "checking for open in -ltcmalloc... " >&6; }
18487 if test "${ac_cv_lib_tcmalloc_open+set}" = set; then :
18488 $as_echo_n "(cached) " >&6
18489 else
18490 ac_check_lib_save_LIBS=$LIBS
18491 LIBS="-ltcmalloc $LIBS"
18492 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
18493 /* end confdefs.h. */
18494
18495 /* Override any GCC internal prototype to avoid an error.
18496 Use char because int might match the return type of a GCC
18497 builtin and then its argument prototype would still apply. */
18498 #ifdef __cplusplus
18499 extern "C"
18500 #endif
18501 char open ();
18502 int
18503 main ()
18504 {
18505 return open ();
18506 ;
18507 return 0;
18508 }
18509 _ACEOF
18510 if ac_fn_cxx_try_link "$LINENO"; then :
18511 ac_cv_lib_tcmalloc_open=yes
18512 else
18513 ac_cv_lib_tcmalloc_open=no
18514 fi
18515 rm -f core conftest.err conftest.$ac_objext \
18516 conftest$ac_exeext conftest.$ac_ext
18517 LIBS=$ac_check_lib_save_LIBS
18518 fi
18519 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_tcmalloc_open" >&5
18520 $as_echo "$ac_cv_lib_tcmalloc_open" >&6; }
18521 if test "x$ac_cv_lib_tcmalloc_open" = x""yes; then :
18522 TCMALLOC_LIBS="${TCMALLOC_PREFIX}/libtcmalloc.so"
18523 $as_echo "#define HAVE_TCMALLOC 1" >>confdefs.h
18524
18525 else
18526 WITH_TCMALLOC=no
18527 fi
18528
18529
18530 elif test "$want_tcmalloc" = "yes"; then
1846718531
1846818532 # Check whether --with-tcmalloc-prefix was given.
1846918533 if test "${with_tcmalloc_prefix+set}" = set; then :
1851018574 $as_echo "$ac_cv_lib_tcmalloc_minimal_open" >&6; }
1851118575 if test "x$ac_cv_lib_tcmalloc_minimal_open" = x""yes; then :
1851218576 TCMALLOC_LIBS="${TCMALLOC_PREFIX}/libtcmalloc_minimal.a"
18577 $as_echo "#define HAVE_TCMALLOC 1" >>confdefs.h
18578
1851318579 else
1851418580 WITH_TCMALLOC=no
1851518581 fi
122122 ZCXXFLAGS="$ZCXXFLAGS -DUNICODE"
123123 fi
124124
125 AC_ARG_ENABLE(tcmalloc, AC_HELP_STRING([--enable-tcmalloc],[enable use of tcmalloc lib]),
125 AC_ARG_ENABLE(tcmalloc, AC_HELP_STRING([--enable-tcmalloc],[enable use of tcmalloc minimal lib]),
126126 [want_tcmalloc=${enableval}],[want_tcmalloc=no])
127
128 AC_ARG_ENABLE(tcmalloc-full, AC_HELP_STRING([--enable-tcmalloc-full],[enable use of tcmalloc full lib]),
129 [want_tcmalloc_full=${enableval}],[want_tcmalloc_full=no])
127130
128131 AC_ARG_ENABLE(sparsehash, AC_HELP_STRING([--enable-sparsehash],[enable use of sparsehash]),
129132 [want_sparsehash=${enableval}],[want_sparsehash=no])
476479 CPPFLAGS=$CPPFLAGS_system
477480
478481 # Check for google perftools tcmalloc availability
479 if test "$want_tcmalloc" = "yes"; then
482 if test "$want_tcmalloc_full" = "yes"; then
483 AC_ARG_WITH(tcmalloc-prefix,
484 AC_HELP_STRING([--with-tcmalloc-prefix=PATH],[path to tcmalloc lib, e.g. /usr/lib/]),
485 [TCMALLOC_PREFIX=${withval}],[TCMALLOC_PREFIX=/usr/lib])
486 AC_CHECK_LIB(tcmalloc, [open],
487 [ TCMALLOC_LIBS="${TCMALLOC_PREFIX}/libtcmalloc.so" AC_DEFINE(HAVE_TCMALLOC, [1], [Google TCMalloc available]) ],
488 [ WITH_TCMALLOC=no ])
489 AC_SUBST(TCMALLOC_LIBS)
490 elif test "$want_tcmalloc" = "yes"; then
480491 AC_ARG_WITH(tcmalloc-prefix,
481492 AC_HELP_STRING([--with-tcmalloc-prefix=PATH],[path to tcmalloc lib, e.g. /usr/lib/]),
482493 [TCMALLOC_PREFIX=${withval}],[TCMALLOC_PREFIX=/usr/lib])
483494 AC_CHECK_LIB(tcmalloc_minimal, [open],
484 [ TCMALLOC_LIBS="${TCMALLOC_PREFIX}/libtcmalloc_minimal.a" ],
495 [ TCMALLOC_LIBS="${TCMALLOC_PREFIX}/libtcmalloc_minimal.a" AC_DEFINE(HAVE_TCMALLOC, [1], [Google TCMalloc available]) ],
485496 [ WITH_TCMALLOC=no ])
486497 AC_SUBST(TCMALLOC_LIBS)
487498 else
20922092 any data requested after the cache is cleared needs to be
20932093 re-requested from the database or LDAP server. Normally this
20942094 option is never needed; it is mostly used as a diagnostics
2095 tool.</para>
2095 tool.</para>
2096 <para>Optionally use <parameter>--clear-cache=</parameter> to specify a set
2097 of purge options. The following options can be used:
2098 <simplelist type='horiz' columns='1'>
2099 <member>0x0000 Release no longer used memory back to the kernel</member>
2100 <member>0x0001 Purge the quota cache</member>
2101 <member>0x0002 Purge the quota default cache</member>
2102 <member>0x0004 Purge the object cache</member>
2103 <member>0x0008 Purge the store cache</member>
2104 <member>0x0010 Purge the ACL cache</member>
2105 <member>0x0020 Purge the cell cache</member>
2106 <member>0x0040 Purge the index1 cache</member>
2107 <member>0x0080 Purge the index2 cache</member>
2108 <member>0x0100 Purge the indexproperty cache</member>
2109 <member>0x0200 Purge the user object cache</member>
2110 <member>0x0400 Purge the externid cache</member>
2111 <member>0x0800 Purge the userdetails cache</member>
2112 <member>0x1000 Purge the server cache</member>
2113 </simplelist>
2114 </para>
20962115 </listitem>
20972116 </varlistentry>
20982117
370370 \fB\-\-clear\-cache\fR
371371 .RS 4
372372 Clears the server\*(Aqs caches\&. All data cached inside the zarafa\-server is cleared\&. Although this can never cause any data loss, it can affect the performance of your server, since any data requested after the cache is cleared needs to be re\-requested from the database or LDAP server\&. Normally this option is never needed; it is mostly used as a diagnostics tool\&.
373 .sp
374 Optionally use
375 \fI\-\-clear\-cache=\fR
376 to specify a set of purge options\&. The following options can be used:
377 .RS 4
378 0x0000 Release no longer used memory back to the kernel
379 .RE
380 .RS 4
381 0x0001 Purge the quota cache
382 .RE
383 .RS 4
384 0x0002 Purge the quota default cache
385 .RE
386 .RS 4
387 0x0004 Purge the object cache
388 .RE
389 .RS 4
390 0x0008 Purge the store cache
391 .RE
392 .RS 4
393 0x0010 Purge the ACL cache
394 .RE
395 .RS 4
396 0x0020 Purge the cell cache
397 .RE
398 .RS 4
399 0x0040 Purge the index1 cache
400 .RE
401 .RS 4
402 0x0080 Purge the index2 cache
403 .RE
404 .RS 4
405 0x0100 Purge the indexproperty cache
406 .RE
407 .RS 4
408 0x0200 Purge the user object cache
409 .RE
410 .RS 4
411 0x0400 Purge the externid cache
412 .RE
413 .RS 4
414 0x0800 Purge the userdetails cache
415 .RE
416 .RS 4
417 0x1000 Purge the server cache
418 .RE
373419 .RE
374420 .PP
375421 \fB\-\-purge\-softdelete\fR \fIdays\fR
285285 property_mv_map::iterator mvi;
286286 std::list<std::string>::iterator istr;
287287
288 ulSize += sizeof(property_map::value_type) * m_mapProps.size();
288 ulSize += MEMORY_USAGE_MAP(m_mapProps.size(), property_map);
289289 for (i = m_mapProps.begin(); i != m_mapProps.end(); i++)
290 ulSize += i->second.size();
291
292 ulSize += sizeof(property_mv_map::value_type) * m_mapMVProps.size();
290 ulSize += MEMORY_USAGE_STRING(i->second);
291
292 ulSize += MEMORY_USAGE_MAP(m_mapMVProps.size(), property_mv_map);
293293
294294 for (mvi = m_mapMVProps.begin(); mvi != m_mapMVProps.end(); mvi++) {
295 ulSize += mvi->second.size() * sizeof(std::string);
296295 for (istr = mvi->second.begin(); istr != mvi->second.end(); istr++)
297 ulSize += (*istr).size();
296 ulSize += MEMORY_USAGE_STRING((*istr));
298297 }
299298
300299 return ulSize;
9393 return val.GetSize();
9494 }
9595
96 template<>
97 unsigned int GetCacheAdditionalSize(const std::string &val) {
98 return MEMORY_USAGE_STRING(val);
99 }
100
101 template<>
102 unsigned int GetCacheAdditionalSize(const ECsUEIdKey &val) {
103 return MEMORY_USAGE_STRING(val.strExternId);
104 }
96105
97106 ECCacheManager::ECCacheManager(ECConfig *lpConfig, ECDatabaseFactory *lpDatabaseFactory, ECLogger *lpLogger)
98107 : m_QuotaCache("quota", atoi(lpConfig->GetSetting("cache_quota_size")), atoi(lpConfig->GetSetting("cache_quota_lifetime")) * 60)
33393339 ulSize += SortOrderArraySize(lpsSortOrderArray);
33403340 ulSize += PropTagArraySize(lpsPropTagArray);
33413341 ulSize += RestrictTableSize(lpsRestrict);
3342 ulSize += m_listMVSortCols.size() * sizeof(ECListInt::value_type);
3343
3344 ulSize += mapObjects.size() * sizeof(ECObjectTableMap::value_type);
3342 ulSize += MEMORY_USAGE_LIST(m_listMVSortCols.size(), ECListInt);
3343
3344 ulSize += MEMORY_USAGE_MAP(mapObjects.size(), ECObjectTableMap);
33453345 ulSize += lpKeyTable->GetObjectSize();
33463346
3347 ulSize += m_mapCategories.size() * sizeof(ECCategoryMap::value_type);
3347 ulSize += MEMORY_USAGE_MAP(m_mapCategories.size(), ECCategoryMap);
33483348 for(iterCat = m_mapCategories.begin(); iterCat != m_mapCategories.end(); iterCat++) {
33493349 ulSize += iterCat->second->GetObjectSize();
33503350 }
33513351
3352 ulSize += m_mapLeafs.size() * sizeof(ECLeafMap::value_type);
3352 ulSize += MEMORY_USAGE_MAP(m_mapLeafs.size(), ECLeafMap);
33533353
33543354 pthread_mutex_unlock(&m_hLock);
33553355
16301630 unsigned int ECSecurity::GetObjectSize()
16311631 {
16321632 unsigned int ulSize = sizeof(*this);
1633 unsigned int ulItems;
16331634
16341635 list<localobjectdetails_t>::iterator iter;
16351636
16361637 ulSize += m_details.GetObjectSize();
1638 ulSize += m_impersonatorDetails.GetObjectSize();
1639
16371640
16381641 if (m_lpGroups) {
1639 for (iter = m_lpGroups->begin(); iter != m_lpGroups->end(); iter++)
1642 for (iter = m_lpGroups->begin(), ulItems = 0; iter != m_lpGroups->end(); iter++, ulItems++)
16401643 ulSize += iter->GetObjectSize();
1644
1645 ulSize += MEMORY_USAGE_LIST(ulItems, list<localobjectdetails_t>);
16411646 }
16421647
16431648 if (m_lpViewCompanies)
16441649 {
1645 for (iter = m_lpViewCompanies->begin(); iter != m_lpViewCompanies->end(); iter++)
1650 for (iter = m_lpViewCompanies->begin(), ulItems = 0; iter != m_lpViewCompanies->end(); iter++, ulItems++)
16461651 ulSize += iter->GetObjectSize();
1652
1653 ulSize += MEMORY_USAGE_LIST(ulItems, list<localobjectdetails_t>);
16471654 }
16481655
16491656 if (m_lpAdminCompanies)
16501657 {
1651 for (iter = m_lpAdminCompanies->begin(); iter != m_lpAdminCompanies->end(); iter++)
1658 for (iter = m_lpAdminCompanies->begin(), ulItems = 0; iter != m_lpAdminCompanies->end(); iter++, ulItems++)
16521659 ulSize += iter->GetObjectSize();
1660
1661 ulSize += MEMORY_USAGE_LIST(ulItems, list<localobjectdetails_t>);
16531662 }
16541663
16551664 return ulSize;
150150 m_lpUserManagement = NULL;
151151 m_ulRequests = 0;
152152
153 m_ulLastRequestPort = 0;
154
153155 // Protects the object from deleting while a thread is running on a method in this object
154156 pthread_cond_init(&m_hThreadReleased, NULL);
155157 pthread_mutex_init(&m_hThreadReleasedMutex, NULL);
271273 unsigned int BTSession::GetRequests()
272274 {
273275 return m_ulRequests;
276 }
277
278 void BTSession::GetRequestURL(std::string *lpstrClientURL)
279 {
280 lpstrClientURL->assign(m_strLastRequestURL);
281 }
282
283 void BTSession::GetProxyHost(std::string *lpstrProxyHost)
284 {
285 lpstrProxyHost->assign(m_strProxyHost);
286 }
287
288 void BTSession::GetClientPort(unsigned int *lpulPort)
289 {
290 *lpulPort = m_ulLastRequestPort;
291 }
292
293 size_t BTSession::GetInternalObjectSize()
294 {
295 return MEMORY_USAGE_STRING(m_strSourceAddr) +
296 MEMORY_USAGE_STRING(m_strLastRequestURL) +
297 MEMORY_USAGE_STRING(m_strProxyHost);
274298 }
275299
276300 //////////////////////////////////////////////////////////////////////
621645 lpstrClientApp->assign(m_strClientApp);
622646 }
623647
624 void ECSession::GetRequestURL(std::string *lpstrClientURL)
625 {
626 lpstrClientURL->assign(m_strLastRequestURL);
627 }
628
629 void ECSession::GetProxyHost(std::string *lpstrProxyHost)
630 {
631 lpstrProxyHost->assign(m_strProxyHost);
632 }
633
634 void ECSession::GetClientPort(unsigned int *lpulPort)
635 {
636 *lpulPort = m_ulLastRequestPort;
637 }
638648
639649 /**
640650 * Get the object id of the object specified by the provided entryid.
703713
704714 exit:
705715 return er;
716 }
717
718 size_t ECSession::GetObjectSize()
719 {
720 size_t ulSize = sizeof(*this);
721
722 ulSize += GetInternalObjectSize();
723 ulSize += MEMORY_USAGE_STRING(m_strClientApp) +
724 MEMORY_USAGE_STRING(m_strUsername) +
725 MEMORY_USAGE_STRING(m_strClientVersion);
726
727 ulSize += MEMORY_USAGE_MAP(m_mapBusyStates.size(), BusyStateMap);
728 ulSize += MEMORY_USAGE_MAP(m_mapLocks.size(), LockMap);
729
730 if (m_lpEcSecurity)
731 ulSize += m_lpEcSecurity->GetObjectSize();
732
733
734 // The Table manager size is not callculated here
735 // ulSize += GetTableManager()->GetObjectSize();
736
737 return ulSize;
706738 }
707739
708740
14491481 return er;
14501482 }
14511483
1484 size_t ECAuthSession::GetObjectSize()
1485 {
1486 size_t ulSize = sizeof(*this);
1487
1488 return ulSize;
1489 }
1490
14521491
14531492 ECAuthSessionOffline::ECAuthSessionOffline(const std::string &strSourceAddr, ECSESSIONID sessionID, ECDatabaseFactory *lpDatabaseFactory, ECSessionManager *lpSessionManager, unsigned int ulCapabilities) :
14541493 ECAuthSession(strSourceAddr, sessionID, lpDatabaseFactory, lpSessionManager, ulCapabilities)
122122 virtual void RecordRequest(struct soap *soap);
123123 virtual unsigned int GetRequests();
124124
125 virtual void GetClientPort(unsigned int *lpulPort);
126 virtual void GetRequestURL(std::string *lpstrURL);
127 virtual void GetProxyHost(std::string *lpstrProxyHost);
128
129 size_t GetInternalObjectSize();
130 virtual size_t GetObjectSize() = 0;
131
125132 time_t GetIdleTime();
126133 std::string GetSourceAddr();
127134
193200 void GetClocks(double *lpdblUser, double *lpdblSystem, double *lpdblReal);
194201 void GetClientVersion(std::string *lpstrVersion);
195202 void GetClientApp(std::string *lpstrClientApp);
196 void GetClientPort(unsigned int *lpulPort);
197 void GetRequestURL(std::string *lpstrURL);
198 void GetProxyHost(std::string *lpstrProxyHost);
203
204 size_t GetObjectSize();
199205
200206 unsigned int ClientVersion() const { return m_ulClientVersion; }
201207
207213 ECSecurity *m_lpEcSecurity;
208214
209215 pthread_mutex_t m_hStateLock;
210 std::map<pthread_t, BUSYSTATE> m_mapBusyStates; /* which thread does what function */
216 typedef std::map<pthread_t, BUSYSTATE> BusyStateMap;
217 BusyStateMap m_mapBusyStates; /* which thread does what function */
211218 double m_dblUser;
212219 double m_dblSystem;
213220 double m_dblReal;
240247
241248 virtual ECRESULT CreateECSession(ECSESSIONGROUPID ecSessionGroupId, std::string strClientVersion, std::string strClientApp, ECSESSIONID *sessionID, ECSession **lppNewSession);
242249
250 size_t GetObjectSize();
251
243252 protected:
244253 unsigned int m_ulUserID;
245254 unsigned int m_ulImpersonatorID; // The ID of the user who's credentials were used to login when using impersonation
583583 {
584584 NOTIFICATIONLIST::iterator iterlNotify;
585585 unsigned int ulSize = 0;
586
587 pthread_mutex_lock(&m_hNotificationLock);
588
589 ulSize += m_listNotification.size() * sizeof(NOTIFICATIONLIST::value_type);
590 ulSize += m_mapSubscribe.size() * sizeof(SUBSCRIBEMAP::value_type);
591 ulSize += m_mapChangeSubscribe.size() * sizeof(CHANGESUBSCRIBEMAP::value_type);
592
593 for(iterlNotify = m_listNotification.begin(); iterlNotify != m_listNotification.end(); iterlNotify++)
586 unsigned int ulItems;
587
588 pthread_mutex_lock(&m_hNotificationLock);
589
590 ulSize += MEMORY_USAGE_MAP(m_mapSubscribe.size(), SUBSCRIBEMAP);
591 ulSize += MEMORY_USAGE_MAP(m_mapChangeSubscribe.size(), CHANGESUBSCRIBEMAP);
592
593 for(iterlNotify = m_listNotification.begin(), ulItems = 0; iterlNotify != m_listNotification.end(); iterlNotify++, ulItems++)
594594 {
595595 ulSize += iterlNotify->GetObjectSize();
596596 }
597 ulSize += MEMORY_USAGE_LIST(ulItems, NOTIFICATIONLIST);
597598
598599 pthread_mutex_unlock(&m_hNotificationLock);
599600
600601 ulSize += sizeof(*this);
601602
602603 pthread_mutex_lock(&m_hSessionMapLock);
603 ulSize += m_mapSessions.size() * sizeof(SESSIONINFOMAP::value_type);
604 ulSize += MEMORY_USAGE_MAP(m_mapSessions.size(), SESSIONINFOMAP);
604605 pthread_mutex_unlock(&m_hSessionMapLock);
605606
606607 pthread_mutex_lock(&m_mutexSubscribedStores);
607 ulSize += m_mapSubscribedStores.size() * sizeof(unsigned int);
608 ulSize += MEMORY_USAGE_MULTIMAP(m_mapSubscribedStores.size(), SUBSCRIBESTOREMULTIMAP);
608609 pthread_mutex_unlock(&m_mutexSubscribedStores);
609610
610611 return ulSize;
8282
8383 typedef std::list<ECNotification> NOTIFICATIONLIST;
8484 typedef std::map<unsigned int, subscribeItem> SUBSCRIBEMAP;
85 typedef std::multimap<unsigned int, unsigned int> SUBSCRIBESTOREMULTIMAP;
8586
8687 struct changeSubscribeItem {
8788 ECSESSIONID ulSession;
181182 ECSessionManager * m_lpSessionManager;
182183
183184 /* Multimap of subscriptions that we have (key -> store id) */
184 std::multimap<unsigned int, unsigned int> m_mapSubscribedStores;
185 SUBSCRIBESTOREMULTIMAP m_mapSubscribedStores;
185186 pthread_mutex_t m_mutexSubscribedStores;
186187
187188 private:
14121412 pthread_rwlock_rdlock(&m_hCacheRWLock);
14131413
14141414 sStats.session.ulItems = m_mapSessions.size();
1415 sStats.session.ullSize = sStats.session.ulItems * sizeof(SESSIONMAP::value_type);
1415 sStats.session.ullSize = MEMORY_USAGE_MAP(sStats.session.ulItems, SESSIONMAP);
14161416
14171417 // lock and copy sessions so we can release the main sessionmanager lock before we call the tablemanager to avoid other locks
14181418
14351435 lpSess = *i;
14361436 lpSess->GetTableManager()->GetStats(&ulTmpTables, &ulTmpTableSize);
14371437
1438 sStats.session.ullSize += lpSess->GetSecurity()->GetObjectSize();
1438 sStats.session.ullSize += lpSess->GetObjectSize();
14391439 sStats.session.ulOpenTables += ulTmpTables;
14401440 sStats.session.ulTableSize += ulTmpTableSize;
14411441
14461446 pthread_rwlock_rdlock(&m_hGroupLock);
14471447
14481448 sStats.group.ulItems = m_mapSessionGroups.size();
1449 sStats.group.ullSize = sStats.group.ulItems * sizeof(SESSIONGROUPMAP::value_type);
1449 sStats.group.ullSize = MEMORY_USAGE_HASHMAP(sStats.group.ulItems, SESSIONGROUPMAP);
14501450
14511451 for (itersg = m_mapSessionGroups.begin(); itersg != m_mapSessionGroups.end(); itersg++) {
14521452 sStats.group.ullSize += itersg->second->GetObjectSize();
14581458 pthread_mutex_lock(&m_mutexPersistent);
14591459
14601460 sStats.ulPersistentByConnection = m_mapPersistentByConnection.size();
1461 sStats.ulPersistentByConnectionSize = sStats.ulPersistentByConnection * sizeof(PERSISTENTBYCONNECTION::value_type);
1461 sStats.ulPersistentByConnectionSize = MEMORY_USAGE_HASHMAP(sStats.ulPersistentByConnection, PERSISTENTBYCONNECTION);
14621462
14631463 sStats.ulPersistentBySession = m_mapPersistentBySession.size();
1464 sStats.ulPersistentBySessionSize = sStats.ulPersistentBySession * sizeof(PERSISTENTBYSESSION::value_type);
1464 sStats.ulPersistentBySessionSize = MEMORY_USAGE_HASHMAP(sStats.ulPersistentBySession, PERSISTENTBYSESSION);
14651465
14661466 pthread_mutex_unlock(&m_mutexPersistent);
14671467
14691469 pthread_mutex_lock(&m_mutexTableSubscriptions);
14701470
14711471 sStats.ulTableSubscriptions = m_mapTableSubscriptions.size();
1472 sStats.ulTableSubscriptionSize = sStats.ulTableSubscriptions * sizeof(TABLESUBSCRIPTIONMULTIMAP::value_type);
1472 sStats.ulTableSubscriptionSize = MEMORY_USAGE_MULTIMAP(sStats.ulTableSubscriptions, TABLESUBSCRIPTIONMULTIMAP);
14731473
14741474 pthread_mutex_unlock(&m_mutexTableSubscriptions);
14751475
14771477 pthread_mutex_lock(&m_mutexObjectSubscriptions);
14781478
14791479 sStats.ulObjectSubscriptions = m_mapObjectSubscriptions.size();
1480 sStats.ulObjectSubscriptionSize = sStats.ulObjectSubscriptions * sizeof(OBJECTSUBSCRIPTIONSMULTIMAP::value_type);
1480 sStats.ulObjectSubscriptionSize = MEMORY_USAGE_MULTIMAP(sStats.ulObjectSubscriptions, OBJECTSUBSCRIPTIONSMULTIMAP);
14811481
14821482 pthread_mutex_unlock(&m_mutexObjectSubscriptions);
14831483
6565
6666 #include "ECStatsCollector.h"
6767
68 #ifdef HAVE_TCMALLOC
69 #include "google/malloc_extension.h"
70 #endif
71
72
6873 // Link to provider/server
6974 void zarafa_get_server_stats(unsigned int *lpulQueueLen, double *lpDblQueueAge, unsigned int *lpulThreads, unsigned int *lpulIdleThreads);
7075
130135 //lpSession->GetSessionManager()->GetLicensedUsers(1/*SERVICE_TYPE_ARCHIVE*/, &ulLicensedArchivedUsers);
131136 //GetStatsCollectorData("??????????", "Number of allowed archive users", stringify(ulLicensedArchivedUsers), this);
132137
138 #ifdef HAVE_TCMALLOC
139 size_t value = 0;
140 MallocExtension::instance()->GetNumericProperty("generic.current_allocated_bytes", &value);
141 GetStatsCollectorData("tc_allocated", "Current allocated memory by TCMalloc", stringify_int64(value), this); // Bytes in use by application
142
143 value = 0;
144 MallocExtension::instance()->GetNumericProperty("generic.heap_size", &value);
145 GetStatsCollectorData("tc_reserved", "Bytes of system memory reserved by TCMalloc", stringify_int64(value), this);
146
147 value = 0;
148 MallocExtension::instance()->GetNumericProperty("tcmalloc.pageheap_free_bytes", &value);
149 GetStatsCollectorData("tc_page_map_free", "Number of bytes in free, mapped pages in page heap", stringify_int64(value), this);
150
151 value = 0;
152 MallocExtension::instance()->GetNumericProperty("tcmalloc.pageheap_unmapped_bytes", &value);
153 GetStatsCollectorData("tc_page_unmap_free", "Number of bytes in free, unmapped pages in page heap (released to OS)", stringify_int64(value), this);
154
155 value = 0;
156 MallocExtension::instance()->GetNumericProperty("tcmalloc.max_total_thread_cache_bytes", &value);
157 GetStatsCollectorData("tc_threadcache_max", "A limit to how much memory TCMalloc dedicates for small objects", stringify_int64(value), this);
158
159 value = 0;
160 MallocExtension::instance()->GetNumericProperty("tcmalloc.current_total_thread_cache_bytes", &value);
161 GetStatsCollectorData("tc_threadcache_cur", "Current allocated memory in bytes for thread cache", stringify_int64(value), this);
162
163 #ifdef DEBUG
164 char test[2048] = {0};
165 MallocExtension::instance()->GetStats(test, sizeof(test));
166 GetStatsCollectorData("tc_stats_string", "TCMalloc memory debug data", test, this);
167 #endif
168
169 #endif
133170
134171 // add all items to the keytable
135172 for (i = 0; i < id; i++) {
763763 pthread_mutex_lock(&hListMutex);
764764
765765 ulTables = mapTable.size();
766 ulSize = ulTables * (sizeof(TABLEENTRYMAP::value_type) + sizeof(TABLE_ENTRY));
766 ulSize = MEMORY_USAGE_MAP(ulTables, TABLEENTRYMAP);
767767
768768 for(iterEntry = mapTable.begin(); iterEntry != mapTable.end(); iterEntry++) {
769769 if(iterEntry->second->ulTableType != TABLE_ENTRY::TABLE_TYPE_SYSTEMSTATS) // Skip system stats since it would recursively include itself
113113
114114 #include "ZarafaCmdUtil.h"
115115 #include "ECThreadPool.h"
116
117 #ifdef HAVE_TCMALLOC
118 #include "google/malloc_extension.h"
119 #endif
116120
117121 #define STRIN_FIX(s) (bSupportUnicode ? (s) : ECStringCompat::WTF1252_to_UTF8(soap, (s)))
118122 #define STROUT_FIX(s) (bSupportUnicode ? (s) : ECStringCompat::UTF8_to_WTF1252(soap, (s)))
58465850
58475851 er = g_lpSessionManager->GetCacheManager()->PurgeCache(ulFlags);
58485852
5853 #ifdef HAVE_TCMALLOC
5854 MallocExtension::instance()->ReleaseFreeMemory();
5855 #endif
5856
58495857 g_lpStatsCollector->SetTime(SCN_SERVER_LAST_CACHECLEARED, time(NULL));
58505858 exit:
58515859 ;