Ate Douma pushed to branch release/5.0 at cms-community / hippo-repository

Commits:
4c583757 by Ate Douma at 2017-11-02T14:51:23+01:00
REPO-1879 prepare for backport: bump services version (not to be backported 
itself)

- - - - -
819ca19b by Ate Douma at 2017-11-03T17:35:50+01:00
REPO-1879 [Backport 12.0] Implement new LockManager service and replace all 
deprecated HippoLock and HippoLockManager usages

This is a cherry-picked and squashed backport from REPO-1811, REPO-1873, 
REPO-1874 and REPO-1875:

  REPO-1811 Implement in-memory lock manager

    (cherry picked from commit dfa6f279653256cbeaabe6ceb59d4171b64c508f)

  REPO-1811 To the RepositoryImpl add a Journal ConnectionHelper accessor

    Via this Journal ConnectionHelper we can access the Journal DataSource
    via the ConnectionHelperDataSourceAccessor.

    Admittedly, a bit clumsy but we need access to the Journal DataSource
    because we need to know whether we are dealing with a database *and*
    whether we have a clustered setup : Only in that case, the lock mechanism
    has to be upgraded from in memory locking to db base locking because
    needs to be cluster wide

    (cherry picked from commit 4750450f8d1dc505d404fb32ce1eac002df9b707)

  REPO-1811 Support for a Database lock manager

    The Database lock manager interaction is pretty much exactly the same
    as the MemoryLockManager interaction. The biggest difference is that
    the DbLockManager creates database based locks and the MemoryLockManager
    creates MemoryLocks. Note that a DbLock is the same as the MemoryLock
    but only contains a #destroy implementation that releases the database
    lock.

    The DbLockManager is still work in progress

    (cherry picked from commit e0f19fab9cdecc4fc6cb15bc79d55ffa30fff8fb)

  REPO-1811 Fix the LockClusterTest setup

    (still ignored but the setup failed since we do not allow SNS
    below jcr:root any more)

    (cherry picked from commit 1dba0d49778da55568fcafee6ddff4fdc6563190)

  REPO-1811 Support database locking

    (cherry picked from commit 92c914efffe6eaacb79bc638f71576e1463b9aa0)

  REPO-1811 Support background jobs in the Memory or Db LockManager

    - All the background jobs are run by a single thread
    - By default they run every 5 seconds with an initial delay of 5 seconds
    - Every background job is wrapped in a 'synchronized runnable' the 
synchronized
      on the LockManager instance: The reason for this is that we do not want
      background jobs to write concurrently to possibly the same records as
      other (background) jobs
    - We have the following background jobs:
      1) UnlockStoppedThreadJanitor : releases database locks for records
         that were held by a thread that is not alive any more
      2) DbResetExpiredLocksJanitor : Resets all database rows which have
         expired locks (rows with status 'RUNNING' or 'ABORT' 
and expirationTime
         has passed
      3) DbLockRefresher: Refreshes the expiresTime of a lock to currentTime + 
refreshRateSeconds
      4) LockThreadInterrupter : Interrupts the Thread that holds the lock that 
has been marked 'ABORT'

    (cherry picked from commit cbf14aedcc6518e81c94104d705765b492a92188)

  REPO-1811 Make sure getLocks and isLocked works cluster wide in case of a 
database

    (cherry picked from commit 441beff40149a15603e58e4670f33b64b1274eeb)

  REPO-1811 Fix sql statement

    (cherry picked from commit d3d25849c9ea0525df7eaf9e2e18e3de1f27a11d)

  REPO-1811 Extract abstract test and add an 'abort' test

    (cherry picked from commit 5ab1e55f7114e1cb24d671f076f7a7ed697f5c69)

  REPO-1811 use getHoldCount() instead of protected access

    (cherry picked from commit 7027fce32f09b750e7e9a8639ba4a8ca32fa2e3d)

  REPO-1811 improve feedback

    (cherry picked from commit 0bf87cb5a2897a598bdbaca9219fcc37067465d6)

  REPO-1811 use getHoldCount() instead of protected access

    (cherry picked from commit a268b5e6a7c4dab939e489a91d2afe88b82d69f9)

  REPO-1811 Fix abort statement

    (cherry picked from commit dac8d9cce79f4dcbaa564219cf725d6d108f45d8)

  REPO-1811 Encapsulate the localLocks object

    Since localLocks is a hashmap, all access to it should be synchronized.
    This can be easier achieved by encapsulating it and whenever needed by
    other classes, return a new object containing the same locks

    (cherry picked from commit cc3e10d9c50e4e0d1ecc0fbd0428c4915bcf0713)

  REPO-1811 Enhance abort tests

    (cherry picked from commit 43f170296b8c9027ca0b9f9a8f2464f3e9aa363c)

  REPO-1811 use auto closable in integration tests

    (cherry picked from commit 05143eddc4817c9fdb872cbd9c3be34a4543743d)

  REPO-1811 Correct the expiresTime parameter

    (cherry picked from commit 62bd68c27eebfcf6ade8ff0e8609aed3dfd86458)

  REPO-1811 Locks in status ABORT should also be refreshed

    Namely if a lock is in status ABORT and the lock is for the *CLUSTER NODE*
    on which the DbLockRefresher runs, then it means that on this cluster
    node the Thread that should be aborted did not yet abort (for example
    still busy with its job). All we can do is wait until that job finishes

    (cherry picked from commit f038ec5b4eae179ed6070ce98aab791ba943d6a2)

  REPO-1811 remove unneeded auto commit

    (cherry picked from commit 591ff0996ff219328172daf8fa806980519dbf5a)

  REPO-1811 If a Thread is already interrupted, don't interrupt again

    (cherry picked from commit 8a6b58b37696d7f58c007168ac3218dd802408d4)

  REPO-1811 Integration tests that confirm the correct working of the 
DbLockRefresher

    (cherry picked from commit a3bc5d1fc113d0cbb8885d6340841bf86bf072cf)

  REPO-1811 Tests to confirm lock expiration

    Integration tests that confirm the correct working of the
    DbResetExpiredLocksJanitor

    (cherry picked from commit c2284223b7ddc2cb766999c4f956955aa6d08f8e)

  REPO-1811 only run expires db lock test in integration test

    (cherry picked from commit 79490e4102f9b56d635c981dd6d9440ff8e0a793)

  REPO-1811 Fix test to have flexible logger node test

    (cherry picked from commit 547542ef06ff69322da19789469e315f36033436)

  REPO-1811 Improve exception handling and logging

    (cherry picked from commit 4fdb9278e386c29bcbbfc1e649f657e9da82dc02)

  REPO-1811 Improved destroy of the LockManager and other improvements

    (cherry picked from commit 589c19b86f23a0e2129a1c7377498611fdb53bb9)

  REPO-1811 Remove the 'refreshRateSeconds' logic

    Just fixed 60 seconds refresh rate

    (cherry picked from commit b51f32d91ac9e4e627f1115d8e31b970e0352a75)

  REPO-1811 Deprecate JCR (hippo) locking

    Note all usages of JCR Locking still need to be replaced

    (cherry picked from commit 04c1761783f49b29c1e7882d22867c057597ceb7)

  REPO-1811 Use the new LockManager instead of JCR Locking

    (cherry picked from commit 8ddbbc21ef5404a65e617b6dfc92b82744a55ed2)

  REPO-1811 Implement autocloseable LockResource and integration tests

    (cherry picked from commit ac0b839ddf10d11efbc5a10a22b352f48e39160a)

  REPO-1811 Use auto closeable

    (cherry picked from commit 6938d49cab9c7e72f6aac778ebfee0318e1761c7)

  REPO-1811 Add a cleanup background job that removes rows from database of old 
locks

    (cherry picked from commit bb1f233b78cbab94e49ba5e71147d5a5ad1aaaeb)

  REPO-1811 Implement new LockResource getters

    (cherry picked from commit e209d242788a81917e87b08571ee9efef1b00909)

  REPO-1811 Better tearDown

    Make sure tearDown with clearing the repository still removes
    also the database entries because if they are kept, consequent runs can fail

    (cherry picked from commit ffb7b9a6f5599cdbb7d050f707f8fc591791812f)

  REPO-1811 shorter keys

    (cherry picked from commit 87e1cb4b19af229b7316b3c4c5144762a3351358)

  REPO-1811 Support all databases and most specifically Oracle

    (cherry picked from commit 03072bf6cdc1bb314e408600b6a05322d415ae86)

  REPO-1811 Handle the interrupted exception gracefully

    When the lockmanager has an indication for 'abort' for the lock for 
the
    thread that is executing the UpdateExecutor, it means, that the current
    or a different cluster node has requested the task to be stopped. Invoking
    #cancel is the graceful stop of the job

    (cherry picked from commit 6354174bce85cceddf1daa574dd0c7f742f71c58)

  REPO-1811 further refactoring and cleanup of the new (Db)LockManager

    - construction moved to LocalHippoRepository as well as further generalized
    - LockManagerFactory moved to DbLockManagerFactory and now only is 
responsible for constructing a DbLockManager
    - DbLockManager: added support for schemaObjectPrefix and 
schemaCheckEnabled, like all JR schema definitions
    - Added (handling for) new AlreadyLockedException, indicating a lock retry 
might be feasible
    - Merged DbHelper logic into DbLockManager (which ittself now gets passed 
into background Runnables) and use JR ConnectionHelper to check if table 
already exists
    - Added LockManagerUtilsTest, in test module, for services-api provided 
LockManagerUtils

    (cherry picked from commit 035c7ff938df0ba8308bff7683a028182bec22ef)

  REPO-1811 Improve the logging statement

    (cherry picked from commit 11f334eec1bb8eb6bb39f0b50124c43f4343a6a3)

  REPO-1811 Make sure the lockThread finishes before tearDown kicks in

    (cherry picked from commit f81fb33e711c1fa7740a0e7d36ca4189d7d13aad)

  REPO-1811 license header

  (cherry picked from commit ab46d905e5d208f2f9113ece16089d4c267dc251)

  REPO-1811 fix unit tests

    (cherry picked from commit 84858ae4df4df53dd43fdd69aeeacc09afeb1039)

  REPO-1873 Support closing a LockResource by a different thread - 
implementation

    (cherry picked from commit 8e6143235652e33e8316ece08f9ea0f2a4990806)

  REPO-1873 improve LocalHippoRepository instantiation extensibility

    (cherry picked from commit 79f365d360bfe74006018b9e840a70fca44210c5)

  REPO-1874 Leverage LockManager for the RepositoryScheduler replacing the 
deprecated HippoLock usage

    (cherry picked from commit 7e91d6c3a9b50aa1f444e877b0c4b83ac31cd824)

  REPO-1875 add support for mssql (Microsoft SQL Server)

    Also added test configurations for mssql, postgresql and oracle in 
repository-test module, and updated/aligned the repository.xml and 
test/connection parameters for each of these.

    (cherry picked from commit 92213cdadc16c7b23e06ed8eceae7aca744f1d13)

- - - - -
fac54766 by Ate Douma at 2017-11-03T17:36:00+01:00
REPO-1879 [Backport 12.0] Replaced ConfigurationLockManager JR Locking with new 
LockManager

(cherry picked from commit 035c7ff938df0ba8308bff7683a028182bec22ef)
(cherry picked from commit c64b87429c6fbb26cfa8e4245512eeb393c202d9)
(cherry picked from commit 2904fd4f0580e361e0b2dfe19a5f69b32b1542a9)

- - - - -


30 changed files:

- api/src/main/java/org/onehippo/repository/locking/HippoLock.java
- api/src/main/java/org/onehippo/repository/locking/HippoLockManager.java
- 
connector/src/main/java/org/hippoecm/repository/decorating/LockManagerDecorator.java
- engine/pom.xml
- + 
engine/src/main/java/org/apache/jackrabbit/core/journal/JournalConnectionHelperAccessorImpl.java
- + 
engine/src/main/java/org/apache/jackrabbit/core/util/db/ConnectionHelperDataSourceAccessor.java
- engine/src/main/java/org/hippoecm/repository/LocalHippoRepository.java
- engine/src/main/java/org/hippoecm/repository/impl/LockManagerDecorator.java
- engine/src/main/java/org/hippoecm/repository/quartz/JCRJobStore.java
- 
engine/src/main/java/org/hippoecm/repository/quartz/RepositorySchedulerImpl.java
- engine/src/main/java/org/hippoecm/repository/quartz/SchedulerModule.java
- engine/src/main/java/org/onehippo/cm/engine/ConfigurationLockManager.java
- engine/src/main/java/org/onehippo/cm/engine/ConfigurationServiceImpl.java
- + engine/src/main/java/org/onehippo/repository/lock/AbstractLockManager.java
- + engine/src/main/java/org/onehippo/repository/lock/InternalLockManager.java
- + engine/src/main/java/org/onehippo/repository/lock/MutableLock.java
- + 
engine/src/main/java/org/onehippo/repository/lock/db/DbLockCleanupJanitor.java
- + engine/src/main/java/org/onehippo/repository/lock/db/DbLockManager.java
- + 
engine/src/main/java/org/onehippo/repository/lock/db/DbLockManagerFactory.java
- + engine/src/main/java/org/onehippo/repository/lock/db/DbLockRefresher.java
- + 
engine/src/main/java/org/onehippo/repository/lock/db/DbResetExpiredLocksJanitor.java
- + 
engine/src/main/java/org/onehippo/repository/lock/db/LockThreadInterrupter.java
- + 
engine/src/main/java/org/onehippo/repository/lock/db/OracleDbLockManager.java
- + 
engine/src/main/java/org/onehippo/repository/lock/memory/MemoryLockManager.java
- 
engine/src/main/java/org/onehippo/repository/update/UpdaterExecutionModule.java
- engine/src/main/java/org/onehippo/repository/update/UpdaterExecutor.java
- engine/src/test/java/org/hippoecm/repository/RefreshTest.java
- engine/src/test/java/org/hippoecm/repository/quartz/JCRJobStoreTest.java
- 
engine/src/test/java/org/onehippo/cm/engine/ConfigurationBaselineServiceTest.java
- 
engine/src/test/java/org/onehippo/repository/journal/ExternalRepositorySyncRevisionServiceTest.java


The diff was not included because it is too large.


View it on GitLab: 
https://code.onehippo.org/cms-community/hippo-repository/compare/54620fce313e9727ae2fb02e1f6b4c7490bc7917...fac547666d510b53b892d1aa1ce17b074456e249

---
View it on GitLab: 
https://code.onehippo.org/cms-community/hippo-repository/compare/54620fce313e9727ae2fb02e1f6b4c7490bc7917...fac547666d510b53b892d1aa1ce17b074456e249
You're receiving this email because of your account on code.onehippo.org.
_______________________________________________
Hippocms-svn mailing list
Hippocms-svn@lists.onehippo.org
https://lists.onehippo.org/mailman/listinfo/hippocms-svn

Reply via email to