Documentum D2 Cache

Usually when working with D2 one common problem is the cache and how/when to refresh it in order to see changes (attribute labels, dictionary values, etc.).

The common solution for every problem suggested by support is usually to delete “Tomcat’s temp folder”, where you’ll find the following files:

  • c2file-cache.data
  • folder-cache.data
  • o2attrconfig-cache.data
  • taxonomy_level-cache.data
  • skin-cache.data
  • dictionary_dql-cache.data
  • xml-cache.index
  • xml-cache.data
  • D2FileCleaningTracker_D2.ser
  • X3Image<random numbers>.png (multiple files)

This is most often a workaround for “refresh cache” option from D2-Config, which most of the times won’t work because it works by appending a /Servlet/refreshCache to the URL configured in the setting. Why does this not work? Well, it (mostly) does if you run a single server, however, if you’re running a cluster of multiple application server, which one is receiving the call and cleaning its cache? well, good luck guessing 😀

Besides, JMS also has these cached files (well, not all those files), and this cache is placed on /tmp. Is this a problem? No if you have a single Content Server on your server or if you are not running an application server (not Tomcat) with the different credentials from Documentum.

But, what happens if you happen to run, let’s say, several Content Servers on the same host, with different D2 versions in each one, and you run different application servers on your server, with different D2 versions? Well, what happens is havoc.

You’ll found the cache files on /tmp, but those will be “locked” by the user that created those files on the first place. Why this behaviour? Well, if we check support page, we’ll find KB6269196:

Summary
Because D2 does not contain any ehcache.xml configuration files, the default behavior of the ehcache library is to store the cache data files in the path specified by java.io.tmpdir.

Resolution
Append the -Djava.io.tmpdir option
Modify and change to default run time JAVA_OPTS
usage: -Djava.io.tmpdir=/home/dmadmin/temp”

So, we can get some conclusions from this support note:

1. D2 cache is stored in java.io.tmpdir, which in Tomcat is its temp folder, and in Linux is /tmp.

2. Support likes using sledgehammers to crack nuts (changing the default temporary folder of the application server for a couple of files???, really???)

3. Support/engineering/talented team just don’t bother or they can’t read

Why do I say that? Because D2 has indeed a configuration file (actually has three configuration files in JMS and two in D2/D2-Config) and the default behaviour of ehcache is not storing cache on java.io.tmpdir. Let’s take a look to the documentation of the (obsolete, as usual) version bundled in D2:

<!–
DiskStore configuration
=======================
The diskStore element is optional. To turn off disk store path creation, comment out the diskStore element below.
Configure it if you have overflowToDisk or diskPersistent enabled for any cache.
If it is not configured, and a cache is created which requires a disk store, a warning will be issued and java.io.tmpdir will automatically be used.
diskStore has only one attribute – “path”. It is the path to the directory where.data and .index files will be created.
If the path is one of the following Java System Property it is replaced by its value in the running VM. For backward compatibility these are not specified without being enclosed in the ${token} replacement syntax.

The following properties are translated:
* user.home – User’s home directory
* user.dir – User’s current working directory
* java.io.tmpdir – Default temp file path
* ehcache.disk.store.dir – A system property you would normally specify on the command line e.g. java -Dehcache.disk.store.dir=/u01/myapp/diskdir …

Subdirectories can be specified below the property e.g. java.io.tmpdir/one
–>

<diskStore path=”java.io.tmpdir”/>

So, if “nothing” is specified, ehcache will fallback to java.io.tmpdir or the value specified in the ecache-failsafe.xml (located in ehcache.jar), which happens to be pointing to java.io.tmpdir too.

So we’ve already found one configuration file in ehcache.jar, where’s the second one? Well, look into WEB-INF/lib/C6-Common.jar/com/emc/common/java/cache/d2-cache.xml in D2.war/D2-Config.war or in $JMS_DEPLOYMENT_DIR/ServerApps.ear/lib/C6-Common.jar/com/emc/common/java/cache/d2-cache.xml:

<diskStore path=”java.io.tmpdir”/>

Second configuration file (and the one actually being picked up, you can check the D2/D2-Config/JMS logs on DEBUG for confirmation) which contains a value… Actually you can change this to a hardcoded value or to a more suitable solution by setting ehcache.disk.store.dir as value and changing JAVA_OPTS in order to include -Dehcache.disk.store.dir=<your temp path for ehcache files>, which is way less aggresive than changing java.io.tmpdir.

And the third one? Take a look to your JMS ServerApps.ear/APP-INF/classes/d2-ehcache.xml, but note that this file is useless as it not picked by the classpath.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s