Menu

#515 Firebird 3 + TZTransaction + Commit - not closed? accumulated?

8.0-Beta
open
nobody
Bug Report
2021-09-02
2021-05-22
sundoctor
No

Hi!

I notice that TZTransaction.Commit does not move Olders/Next transaction counters in FB3.
But TZConnection.Commit - does.

How I notice that.

I write SQL query and fetch it one per 10 seconds in cycle (by timer)

ZTransaction1.AutoCommit:=false;
if not ZTransaction1.Active then
  ZTransaction1.StartTransaction;
ZQuery1.Open; { Any SELECT  }
if not (ZQuery.EOF and ZQuery.BOF) then sleep(1);
ZQuery1.Close;
if ZTransaction1.Active then
  ZTransaction1.Commit;

Attention: last command "Commit" - does not move FB transaction counters and every next cycle I notice new record in MON$TRANSACTIONS table.

But if I change last condition to

if ZTransaction1.Active then
begin
  ZTransaction1.Commit;
  ZTransaction1.Connection.Commit;
end
  • then only one raw is in MON$TRANSACTIONS table and Oldest/Next transaction counters are moved synchronously.

What's the matter?

Discussion

  • sundoctor

    sundoctor - 2021-05-23
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -5,7 +5,7 @@
    
     How I notice that.
    
    -I white SQL query and fetch it one per 10 seconds in cycle (by timer)
    +I write SQL query and fetch it one per 10 seconds in cycle (by timer)
    
     ~~~
     ZTransaction1.AutoCommit:=false;
    
     
  • marsupilami79

    marsupilami79 - 2021-08-27

    Hello,

    notice that TZTransaction.Commit does not move Olders/Next transaction counters in FB3.
    But TZConnection.Commit - does.

    Just Firebird transaction counters count started transactions - not committed ones. I assume that TZTransaction.Commit will only commit the current transaction and not start a new one. Whereas TZConnection.Commit will commit the current transaction and start a new transaction immediately. This newly started transaction will then increase the transaction counter.

    Best regards,

    Jan

     
    • sundoctor

      sundoctor - 2021-09-01

      Hmm... What will be the result if the transaction does not move the counters:

      Transaction1.Commit
      Transaction2.Commit
      Connection.Rollback

      ?

       
      • marsupilami79

        marsupilami79 - 2021-09-02

        I am not sure, what you are going at and I hate to try to guess what other people do or think.

        It really all depends on what counter you look. So if there is a need to discuss things please describe the exact setup you are using and at which point you look at which transaction counter.

        So - basically the "Next Transaction" number should increase whenever a transaction is Started. Commits and Rollbacks shouldn't touch this number.
        The "Oldes Active" Can move when Commit or Rollback are called. But it doesn't need to.
        So in most cases it doesn't make sense to look at the transaction counters when you do Commits or Rollbacks because they very well might be the transactions in the middle that dont touch the OAT.

         
      • marsupilami79

        marsupilami79 - 2021-09-02
         

Log in to post a comment.

MongoDB Logo MongoDB