Subject | Re: [firebird-support] Re: Firebird 3.0 - invalid transaction handle (expecting explicit transaction start). |
---|---|
Author | Slavomir Skopalik |
Post date | 2016-06-17T11:59:28Z |
Hi Roland,
in some cases we did this to log all transaction starts commits (see
script below).
Set GenMonTransactions to value less 10000 will activate log function.
You can simply to change to log transaction commits or rollbacks as well.
And in application you can easy log transaction id that was requested.
Slavek
Create Table MON_Transactions (
tDateUTC TimeDateUTC NOT NULL,
sys_NETWORK_PROTOCOL Varchar(255),
sys_CLIENT_ADDRESS Varchar(255),
sys_CURRENT_USER Varchar(255),
sys_CURRENT_ROLE Varchar(255),
sys_SESSION_ID Varchar(255),
sys_TRANSACTION_ID Varchar(255),
sys_ISOLATION_LEVEL Varchar(255),
mon_REMOTE_PROCESS Varchar(255),
data TMemo
);
CREATE TRIGGER TRGMON_TransactionStart ON TRANSACTION START
AS
DECLARE i INTEGER;
DECLARE transactionID INTEGER;
DECLARE remoteProcess VARCHAR(255);
BEGIN
IF (10000 <= GEN_ID(GenMonTransactions, 0)) THEN BEGIN
EXIT;
END
i = GEN_ID(GenMonTransactions, 1);
transactionID = RDB$GET_CONTEXT('SYSTEM', 'TRANSACTION_ID');
SELECT FIRST 1 mon$remote_process
FROM mon$transactions T
JOIN mon$attachments A ON A.mon$attachment_id = T.mon$attachment_id
WHERE T.mon$transaction_id = :transactionID
INTO :remoteProcess;
INSERT INTO MON_Transactions(
sys_NETWORK_PROTOCOL,
sys_CLIENT_ADDRESS,
sys_CURRENT_USER,
sys_CURRENT_ROLE,
sys_SESSION_ID,
sys_TRANSACTION_ID,
sys_ISOLATION_LEVEL,
mon_REMOTE_PROCESS
) VALUES(
RDB$GET_CONTEXT('SYSTEM', 'NETWORK_PROTOCOL'),
RDB$GET_CONTEXT('SYSTEM', 'CLIENT_ADDRESS'),
RDB$GET_CONTEXT('SYSTEM', 'CURRENT_USER'),
RDB$GET_CONTEXT('SYSTEM', 'CURRENT_ROLE'),
RDB$GET_CONTEXT('SYSTEM', 'SESSION_ID'),
:transactionID,
RDB$GET_CONTEXT('SYSTEM', 'ISOLATION_LEVEL'),
:remoteProcess
);
END^
Ing. Slavomir Skopalik
Executive Head
Elekt Labs s.r.o.
Collection and evaluation of data from machines and laboratories
by means of system MASA (http://www.elektlabs.cz/m2demo)
-----------------------------------------------------------------
Address:
Elekt Labs s.r.o.
Chaloupky 158
783 72 Velky Tynec
Czech Republic
---------------------------------------------------------------
Mobile: +420 724 207 851
icq:199 118 333
skype:skopaliks
e-mail:skopalik@...
http://www.elektlabs.cz
On 17.6.2016 13:22, Roland Turcan konf@... [firebird-support]
wrote:
in some cases we did this to log all transaction starts commits (see
script below).
Set GenMonTransactions to value less 10000 will activate log function.
You can simply to change to log transaction commits or rollbacks as well.
And in application you can easy log transaction id that was requested.
Slavek
Create Table MON_Transactions (
tDateUTC TimeDateUTC NOT NULL,
sys_NETWORK_PROTOCOL Varchar(255),
sys_CLIENT_ADDRESS Varchar(255),
sys_CURRENT_USER Varchar(255),
sys_CURRENT_ROLE Varchar(255),
sys_SESSION_ID Varchar(255),
sys_TRANSACTION_ID Varchar(255),
sys_ISOLATION_LEVEL Varchar(255),
mon_REMOTE_PROCESS Varchar(255),
data TMemo
);
CREATE TRIGGER TRGMON_TransactionStart ON TRANSACTION START
AS
DECLARE i INTEGER;
DECLARE transactionID INTEGER;
DECLARE remoteProcess VARCHAR(255);
BEGIN
IF (10000 <= GEN_ID(GenMonTransactions, 0)) THEN BEGIN
EXIT;
END
i = GEN_ID(GenMonTransactions, 1);
transactionID = RDB$GET_CONTEXT('SYSTEM', 'TRANSACTION_ID');
SELECT FIRST 1 mon$remote_process
FROM mon$transactions T
JOIN mon$attachments A ON A.mon$attachment_id = T.mon$attachment_id
WHERE T.mon$transaction_id = :transactionID
INTO :remoteProcess;
INSERT INTO MON_Transactions(
sys_NETWORK_PROTOCOL,
sys_CLIENT_ADDRESS,
sys_CURRENT_USER,
sys_CURRENT_ROLE,
sys_SESSION_ID,
sys_TRANSACTION_ID,
sys_ISOLATION_LEVEL,
mon_REMOTE_PROCESS
) VALUES(
RDB$GET_CONTEXT('SYSTEM', 'NETWORK_PROTOCOL'),
RDB$GET_CONTEXT('SYSTEM', 'CLIENT_ADDRESS'),
RDB$GET_CONTEXT('SYSTEM', 'CURRENT_USER'),
RDB$GET_CONTEXT('SYSTEM', 'CURRENT_ROLE'),
RDB$GET_CONTEXT('SYSTEM', 'SESSION_ID'),
:transactionID,
RDB$GET_CONTEXT('SYSTEM', 'ISOLATION_LEVEL'),
:remoteProcess
);
END^
Ing. Slavomir Skopalik
Executive Head
Elekt Labs s.r.o.
Collection and evaluation of data from machines and laboratories
by means of system MASA (http://www.elektlabs.cz/m2demo)
-----------------------------------------------------------------
Address:
Elekt Labs s.r.o.
Chaloupky 158
783 72 Velky Tynec
Czech Republic
---------------------------------------------------------------
Mobile: +420 724 207 851
icq:199 118 333
skype:skopaliks
e-mail:skopalik@...
http://www.elektlabs.cz
On 17.6.2016 13:22, Roland Turcan konf@... [firebird-support]
wrote:
> <<< 17.06.2016 13:20 - Dimitry Sibiryakov sd@... [firebird-support] "firebird-support@yahoogroups.com" >>>
> DSsicfs> 17.06.2016 13:17, Roland Turcan konf@... [firebird-support] wrote:
>>> I don't want to post this issue into DEVEL, because it is a support
>>> question, but where are the guys able to answer or at least to point
>>> us to some hints.
> DSsicfs> Every time I saw this error, it was a bug in my
> DSsicfs> application. No exceptions so far.
>
> Dmitry, thanks for your reply, could you please tell me what was the
> problem in your case?
>
> PS: I have never had this issue with FB2.5 or older.
>