TAFJ-Lock Manager
TAFJ-Lock Manager
R20
TAFJ-Lo c k M a n a g e r
Amendment History:
Revisio
Date Amended Name Description
n
7st February
2 H. Aubert R12GA review
2012
16th January
3 R. Vincent R13GA review
2013
10th March
7 H. Aubert R15 AMR review
2015
Page 2
TAFJ-Lo c k M a n a g e r
15 7th Feb 2018 M.Kumar Database locking mode to show blocking locks only
Muthukrishnan
17 22nd Mar 2019 R19 AMR review
P
Basheer
18 6th Jun 2019 ORCL locking changes, related to hash generation
Ahamed
Page 3
TAFJ-Lo c k M a n a g e r
Copyri g h t
Temenos Headquarters SA
2 Rue de l’Ecole-de-Chimie,
CH - 1205 Geneva,
Switzerland
Please include your name, company, address, and telephone and fax numbers, and email
address if applicable. [email protected]
Page 4
TAFJ-Lo c k M a n a g e r
Table of Contents
Copyright................................................................................................................................................ 4
Errata and Comments............................................................................................................................ 4
TAFJ tLockManager............................................................................................................................... 6
Introduction............................................................................................................................ 6
Syntax................................................................................................................................... 6
TAFJ tLockManager.............................................................................................................. 7
TAFJ tLockManager (Resilient)............................................................................................. 9
TAFJ JDBC Lock Manager................................................................................................................... 10
TAFJ DATABASE Lock Manager......................................................................................................... 11
TAFJ Oracle Lock Manager.................................................................................................................. 16
TAFJ MSQL Lock Manager.................................................................................................................. 17
Monitoring............................................................................................................................................. 19
In Verbose Mode: (PROC).................................................................................................. 19
In DBTools:.......................................................................................................................... 20
In Java Mission Control with --jmx options:......................................................................... 20
With the TAFJTrace.properties........................................................................................... 21
WARNING !.......................................................................................................................................... 23
Page 5
TAFJ-Lo c k M a n a g e r
TAFJ tLoc k M a n a g e r
Intr o d u c t i o n
Pessimistic locking is needed within T24. Pessimistic locking assumes that the lock is not
taken and a specific request is needed to take the lock. This can be accomplished in TAFJ
by either using tLockManager (a process outside of the database) or one of the mechanisms
for database locking.
Syn t a x
Options:
Page 6
TAFJ-Lo c k M a n a g e r
TAFJ tLoc k M a n a g e r
Example
To launch it, go in the bin directory of your TAFJ installation and just type
> tLockManager -i (if you want to run in background mode then you can remove -i)
If you are using the LockManager in PROCHASH, start the lockManager with the option –m2
> tLockManager -i -m2
If you are running the Lockmanager in background, you can pass specific JMV argument
with the option –jvm
> tLockManager -i -jvm="-Xms256M –Xmx2048M -XX:MaxPermSize=256M"
If you are using the LockManager in interactive mode you can pass the options –verbose
then –debug. You will have all the information in the screen about what’s going on in the
tLockManager. The option –Verbose add an overhead of about 5% and the option –debug
add an overhead of about 11% on the performance.
> tLockManager -i -m2 --verbose
> tLockManager -i -m2 --verbose --debug
If you want to monitor JMX MBean of the tLockManager, you need to specify the option –jmx.
> tLockManager -i -m2 --jmx
Page 7
TAFJ-Lo c k M a n a g e r
Once done, you can configure your instance by editing your <project>.properties file with
following fields:
temn.tafj.locking.mode = PROCHASH
Page 8
TAFJ-Lo c k M a n a g e r
To make tLockManager resilient, you need to install a load balancer on top of two or more
tLockmanager. The policy of the LoadBalancer to switch to a different tLockmanager is by
query the http health page of the tLockManagers on the port number + 1. If the
LockManager dies, the loadbancer will switch to a other one and all T24 connections will be
restart/reset.
T24 /T24
Load Balancer
Server 1,server2
Port 7526
tLockManager tLockManager
Server 1 Server 1
Port 7526 Port 7526
Http 7527 Http 7527
Page 9
TAFJ-Lo c k M a n a g e r
SESSIONID VARCHAR2(50)
This method works well within an application server context where a separate datasource
can be set up for locking. However, it performs worse than tLockManager and ORCL
locking. Edit properties file and set:
temn.tafj.locking.mode = JDBC
Page 10
TAFJ-Lo c k M a n a g e r
temn.tafj.locking.mode = DATABASE
The mode can be switched to Mode 2 by adding the below property with false in properties
file.
temn.tafj.jdbc.db.locking.insert.rows.on.demand = false
Mode 1:
This mode handles the inserts and deletes in the technical table
TAFJ_NONEXISTING_ROWS on demand as a part of transaction boundary.
In cases of JVM going down suddenly there is a clean up mechanism in place for application
server which execute the JBC routine CLEANUP.STALE.ENTRIES which is shipped along
with TAFJ in TAFJBasic.jar.
Page 11
TAFJ-Lo c k M a n a g e r
The cleanup mechanism for standalone TAFJ is not in place out of box, alternatively the
above routine CLEAUP.STALE.ENTRIES should be executed from a shell prompt to perform
the cleanup.
tRun CLEANUP.STALE.ENTRIES
Before:
RECID | CREATEDTIME
Page 12
TAFJ-Lo c k M a n a g e r
Mode 2:
This mode makes use of an internal technical number table TAFJ_HASHLOCKS containing
values ranging from 0 – 2147483647 (Integer. MAX)
The procedure runs for around 1 ~ 2 hrs depending on the hardware of the database server.
For oracle database, the procedure need to run in SYSDBA login as it involves creation of
index/primary key/Altering user data files/altering temp table spaces to accommodate the
huge table inside the DB.
TAFJ can take locks by using the underlying database locks. For READU and other locking
commands where records exists, the lock manager will issue a SELECT FOR UPDATE
(either blocking or non-blocking depending on the READU clause also has a LOCKED
clause) to the database to lock the record before an anticipated write. This means that a
JBC statement RELEASE will have no effect until a commit or rollback is performed. T24 is
wrapped inside transactional boundaries where the RELEASE statement is ignored until the
transactional boundary ends. Any L2/L3 code must conform to the same to use DATABASE
locking mode.
TAFJ can take locks by using the underlying database locks. For READU and other locking
commands where records exists, the lock manager will issue a SELECT FOR UPDATE
(either blocking or non-blocking depending on the READU clause also has a LOCKED
clause) to the database to lock the record before an anticipated write. This means that a
JBC statement RELEASE will have no effect until a commit or rollback is performed. T24 is
Page 13
TAFJ-Lo c k M a n a g e r
wrapped inside transactional boundaries where the RELEASE statement is ignored until the
transactional boundary ends. Any L2/L3 code must conform to the same to use DATABASE
locking mode.
Once the rollback from first session, the other one grabs the lock.
Page 14
TAFJ-Lo c k M a n a g e r
Page 15
TAFJ-Lo c k M a n a g e r
Reporting locks with DBTools (with the LOCKS command) will appear a bit different when
using this. When issuing the LOCKS command, the only blocking locks can be viewed under
this mode.
i.e example :
Session A takes a lock on FBNK.CURRENCY CHF without a LOCKED clause and session B
does the same, the session B hangs till it manages to obtain the lock to continue further. In
this case an entry in LOCKS command will show up as blocking lock along with the time in
seconds from which this is blocked.
Page 16
TAFJ-Lo c k M a n a g e r
Page 17
TAFJ-Lo c k M a n a g e r
temn.tafj.locking.mode = ORCL
For return values of DBMS_LOCK for locking and releasing, please see the following URL.
http://docs.oracle.com/cd/B19306_01/appdev.102/b14258/d_lock.htm#i997159
temn.tafj.locking.orcl.allocate.unique.exp.secs=<value>
If the property is disabled/ removed from properties file a default value of 2 days (172800
seconds) will be added by runtime.
ORCL locking architecture has been changed such that only the tables defined in the
property 'temn.tafj.orcl.table.list.for.unqiue.locking' would use dbms_lock.allocate_unique to
generate unique hash for lock/release. For other tables, internal processing will be applied to
generate the hash for lock/release of tables.
To use this feature, add the tables to the below property in tafj.properties file
temn.tafj.orcl.table.list.for.unqiue.locking =
Default value for the property is null and tables should be added to the property, as advised
by PACS team.
Note: Table names should be Oracle table names, not J4file names. Multiple table names
can be added to this property, separated by semi-colon (;)
Whenever this property is modified, a server restart is required, for the changes to take
effect.
Page 18
TAFJ-Lo c k M a n a g e r
By setting this parameter, tables defined in the parameter will make use of Oracle unique
lock mechanism, which will resolve the 'waiting for lock' scenario during COB services.
temn.tafj.locking.mode = MSQL
For return values for locking and releasing, please see the following URL.
https://msdn.microsoft.com/en-us/library/ms189823.aspx
Note that MSQL LockManager will crash Eclipse with sqljdbc_4.1 drivers and will not
produce the right results (DBTools LOCKS command). It should also be noted that sp_lock
command truncates data. Version sqljdbc_1.2 of drivers have been tested and work.
Page 19
TAFJ-Lo c k M a n a g e r
Mon i t o r i n g
The lock manager offers several ways to monitor locks. One easy way of seeing what is
going on is to run the EX Basic File using tRun
Example:
tRun EX
The output will be:
If you’re running tLockManager in verbose mode (ie tLockManager --verbose -i ) then, you
will get some information while running EX basic.
Page 20
TAFJ-Lo c k M a n a g e r
In DBT o o l s :
Page 21
TAFJ-Lo c k M a n a g e r
With th e TAFJTrac e . p r o p e r t i e s
log4j.logger.LOCKING=DEBUG, locking
The log file is <TAFJ_HOME>/log/locking.log
log4j.logger.LOCKING_SERVER=DEBUG, locking_server
The log file is <TAFJ_HOME>/log/locking_server.log
Page 22
TAFJ-Lo c k M a n a g e r
Page 23
TAFJ-Lo c k M a n a g e r
WARNI N G !
The verbose mode and DEBUG mode degrade the performance.
The option --verbose add an overhead of about 5% and the option --debug add an
overhead of about 11% on the performance.
Page 24