bug #5710

Changing the database connection must reset all caches

Added by Andreas Müller about 4 years ago. Updated 1 day ago.

Target version:
Start date:
Due date:
% Done:


Found in Version:


In standalone the caches for static methods were reset during creation of the spring context. This does not take place anymore therefore we need to reload or empty all caches.

This is especially the second level cache (currently called CdmServiceCacher) for terms and vocabularies and all static methods (e.g. in Rank and NomenclaturalStatusType).

This is a critical issue as it is a regression and it may create incorrect or even invalid data.

Probably duplicated by #5512 and #5539

In my case it created an alternative name instead of a later homonym relationship.

Associated revisions

Revision d68c7480 (diff)
Added by Katja Luther about 4 years ago

fix for #5710 reset the terms when changing the datasource in remoting

Revision fdb1753a (diff)
Added by Andreas Müller about 1 month ago

ref #5710 run term reset on all Term classes

Revision 9d700cfc (diff)
Added by Andreas Müller 1 day ago

ref #5710 add reset to TermManager after reconnect


#1 Updated by Katja Luther about 4 years ago

r27708 should fix this.

#2 Updated by Katja Luther about 4 years ago

  • Status changed from New to Resolved
  • Assignee changed from k.luther - to Andreas Müller

reset the terms before connecting to a new datasource see r27765

#3 Updated by Andreas Müller about 4 years ago

In Mexico Rubiaceae I observered that I added NamedAreaLevel und Type to existing areas but they resulted in wrong ID in the database. This very much reminded me to this ticket. I am not 100% sure if I added level and type after changing the database connection but definetely we need to test this ticket intensively before closing.

#4 Updated by Andreas Müller about 1 month ago

  • Description updated (diff)
  • Status changed from Resolved to Feedback
  • Target version changed from Release 4.0 to Release 5.17
  • Private changed from Yes to No

This is not yet fixed as we watched in the past multiple times that switching between instances created serious problems as terms were referencing wrong ids after the switch.

I did now improve the first reset() functionality (reset for static methods) to include not only the Rank and NomenclaturalStatusType class but all managed term classes.
We need to check how far this solves the problem.

However, I guess that also the term term cache(s) (terms and vocabularies) need to be fully emptied/replaced. I can't see that this is already done in the code, but maybe I only look at the wrong place.

#5 Updated by Andreas Müller 12 days ago

  • Status changed from Feedback to In Progress

#6 Updated by Andreas Müller 1 day ago

  • Description updated (diff)

It looks like emptying the cache is done in CdmStoreConnector in this line

CdmStore.setInstance(applicationController, cdmSource);

Which calls

CdmApplicationState.setCdmServiceCacher(new CdmServiceCacher());

and calling the construtor of CdmServiceCacher calls setup() in this class which then calls


and resets the cache in DefinedTermBase (and others) this way

#7 Updated by Andreas Müller 1 day ago

  • Status changed from In Progress to Resolved
  • % Done changed from 0 to 40

There is a cache also in TermManager !!!

This is currently not emptied when connecting to a new datasource.

I added TermManager.reset() with commit 9d700cfc23f6e13931

#8 Updated by Andreas Müller 1 day ago

This needs to be checked if this fully solves the problem

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 40 MB)