Subject | Database replication - problem with uncommited transactions. |
---|---|
Author | franbenz |
Post date | 2010-03-22T21:19:28Z |
I'm developing a replication scheme and I need to copy cronologically modifications of a database to another one.
I have a audit table in which actions from different users are logged.
Let's say it has this records(I'm only showing the first two fields and a description of when it was created/commited ):
pkey | query
-----------------
1 | insert ... COMMITED RECORD( by transaction #1 )
2 | update ... COMMITED RECORD( by transaction #1 )
3 | insert ... COMMITED RECORD( by transaction #2 )
4 | insert ... RECORD INSERTED BY TRANSACTION #3 CURRENTLY UNCOMMITED (invisible to my current transaction)
5 | update ... COMMITED RECORD( by transaction #2 )
6 | update ... COMMITED RECORD( by transaction #2 )
If I connect to the database with transaction #4 I need to know which one is the last record, previous to any unncommited transaction. My expected answer is pkey = 3.
How can I get this answer with a query?
Can I use the value in MON$TRANSACTIONS.MON$OLDEST_ACTIVE to find out this?
Thanks.
I have a audit table in which actions from different users are logged.
Let's say it has this records(I'm only showing the first two fields and a description of when it was created/commited ):
pkey | query
-----------------
1 | insert ... COMMITED RECORD( by transaction #1 )
2 | update ... COMMITED RECORD( by transaction #1 )
3 | insert ... COMMITED RECORD( by transaction #2 )
4 | insert ... RECORD INSERTED BY TRANSACTION #3 CURRENTLY UNCOMMITED (invisible to my current transaction)
5 | update ... COMMITED RECORD( by transaction #2 )
6 | update ... COMMITED RECORD( by transaction #2 )
If I connect to the database with transaction #4 I need to know which one is the last record, previous to any unncommited transaction. My expected answer is pkey = 3.
How can I get this answer with a query?
Can I use the value in MON$TRANSACTIONS.MON$OLDEST_ACTIVE to find out this?
Thanks.