Attaching patch 1a.
This patch primarily addresses incorrect synchronization in BasicDependencyManager. The rule was already described in the class, but the implementation didn't obey them:
o use synchronized (this) when accessing in-memory dependencies (deps stored in BasicDependencyManager)
o don't use synchronized (this) when accessing stored dependencies, but rely on database locking (deps stored in the data dictionary / a system table)
I haven't come across cases where we need to synchronize over both sets of dependencies (at the same time).
Main changes in BasicDependecyManager:
o split body of addDepencendy into addInMemoryDependency and addStoredDependency
o corrected JavaDoc for coreInvalidateFor (the flag 'forSync' doesn't exist)
o fixed synchronization in clearDependencies (this is where the automatic index stats update feature got stuck in a deadlock)
o reformatted (+tiny refactoring) clearInMemoryDependencies
o deleted commented out methods getAllProviders and getAllProvidersInfos
o removed synchronized for getPersistentProvidersInfos and rewrote method
o removed synchronized for copyDependencies
o fixed synchronization in countDependencies
o deleted unused method dumpDependencies (and then bubbleSort)
o rewrote methods getProviders and getDependents for new sync rules
o replaced HashTable with Map
o removed methods newSList
Changes in ViewsTest and BaseJDBCTestCase:
o added method assertStatementErrorUnordered, as the ordering of in-memory and stored dependencies changed to to the changes described above (this can easily be switched back, but I don't see why - decided to make the test more resilient to varying ordering instead).
o used the new assert method were the test failed
Re-running regression tests.
Patch ready for review.