Issue Details (XML | Word | Printable)

Key: CORE-342
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Vlad Khorsun
Reporter: Mustafa YILMAZ
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Firebird Core

sweep running on read_only databases

Created: 14/Jul/05 12:00 AM   Updated: 08/Mar/16 03:42 PM
Component/s: Engine
Affects Version/s: None
Fix Version/s: 3.0 Alpha 1, 2.5.3

File Attachments: 1. File core_0342_raw_fdb_files_prepared_for_running_on_FB_253_254_256.7z (28 kB)
2. File core_0342_raw_fdb_files_prepared_for_running_on_FB_30.7z (43 kB)


SF_ID: 1238128


 Description  « Hide
SFID: 1238128#
Submitted By: myilmaz

versions: fb 1.5.2, fb 2 alpha 2

test case:
create test db
set sweep internal to 0
set read_only to true

reconnect test db
execute 20000 times (move up transaction counter)
SELECT COUNT(*) FROM RDB$DATABASE;
COMMIT;

firebird 2 log message
internal gds software consistency check (cannot find tip
page (165), file: tra.cpp line: 2475)

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Vlad Khorsun added a comment - 07/Mar/16 10:24 PM
It was fixed at CORE-4134 which disabled sweep on read-only databases

Pavel Zotov added a comment - 08/Mar/16 11:51 AM
I still _can_ reproduce message in FB 2.5.3 ... 2.5.6 about "cannot find tip page", but with different line numbers:

internal Firebird consistency check (cannot find tip page (165), file: tra.cpp line: 2375) // WI-V2.5.3.26780
internal Firebird consistency check (cannot find tip page (165), file: tra.cpp line: 2383) // WI-V2.5.4.26856
internal Firebird consistency check (cannot find tip page (165), file: tra.cpp line: 2428) // WI-V2.5.6.26979

For each FB version I did following:
1) created empty database + quit
2) <this_FB_home>\bin\gfix -h 0 /:path\empty_database.fdb
3) <this_FB_home>\bin\gfix -mode read_only /:path\empty_database.fdb

Then I did connect to that database (by ISQL) and run script ("core_0342-run.sql " -- see attached .7z):
===
set list on;
select current_transaction from rdb$database;
set term ^;
execute block as
  declare n int = 100000;
  declare i int;
begin
  while (n>0) do
      in autonomous transaction do
      select :n-1 from rdb$database into n
  ;
end
^
set term ;^
===
(yes, it does 100'000 moves Tx counter instead of 20'000).

Please see attached .7z - there are all raw .fdb files (which were after step "3)" but before applying script) + .sql

Pavel Zotov added a comment - 08/Mar/16 12:05 PM
The same on 3.0! Please look:

Database: localhost/3333:C:\MIX\firebird\QA\fbt-repo\tmp\E30.FDb, User: SYSDBA
SQL> show version;
ISQL Version: WI-V3.0.0.32376 Firebird 3.0 Release Candidate 2
Server version:
Firebird/Windows/Intel/i386 (access method), version "WI-V3.0.0.32376 Firebird 3.0 Release Candidate 2"
Firebird/Windows/Intel/i386 (remote server), version "WI-V3.0.0.32376 Firebird 3.0 Release Candidate 2/tcp (cs
prog)/P13"
Firebird/Windows/Intel/i386 (remote interface), version "WI-V3.0.0.32376 Firebird 3.0 Release Candidate 2/tcp
(csprog)/P13"
on disk structure version 12.0
SQL> in core_0342-run.sql ;

CURRENT_TRANSACTION 5


Statement failed, SQLSTATE = XX000
internal Firebird consistency check (cannot find tip page (165), file: tra.cpp line: 2303)

Checked on SS, SC.

Classic (and ONLY this arch.) will add into firebird.log (after text about "cannot find tip page ") also this:

CSPROG Tue Mar 08 15:02:37 2016
INET/inet_error: read errno = 10054, client host = csprog, address = 192.168.43.154/1882, user = zotov

SuperServer will be crashed (service will be stopped).
Raw database for testing in FB 3.0 see also in attached .7z

Pavel Zotov added a comment - 08/Mar/16 12:22 PM
I found thresholds for 2.5.6 and 3.0: maximal number of autonomous transactions (which move Tx counters) should not exceed 16297 for 2.5.6 and 32681 for 3.0.0 -- at least for databases which are attached above:

So, the following script contains max. available values for 'n'; if we'll increase 'n' by 1 we get "internal Firebird consistency check (cannot find tip page (165), file: tra.cpp line: NNNN)":

set list on;
select current_transaction from rdb$database;
set term ^;
execute block as
  --declare n int = 16297; -- max for 2.5.6
  --declare n int = 32681; -- max for 3.0
  declare i int;
begin
  while (n>0) do
      in autonomous transaction do
      select :n-1 from rdb$database into n
  ;
end
^
set term ;^

BTW, I have *no* firebird.conf which contain 'bugcheckabort = 1'.

So, from where this does appear (I mean "bugcheck" word in following text):
===
Statement failed, SQLSTATE = XX000
internal Firebird consistency check (can't continue after bugcheck)
===
-- ?

Dmitry Yemanov added a comment - 08/Mar/16 12:36 PM
Your "threasholds" are easy to explain, they depend on the default page size (4KB in v2.5 and 8KB in v3.0). Every transaction state occupies two bits in TIP, so the page size should be multiplied by four to get these numbers.

Pavel Zotov added a comment - 08/Mar/16 01:04 PM
But what about this ticket state (resolved / fixed) ?

Vlad Khorsun added a comment - 08/Mar/16 02:28 PM
Pavel,
do you see a sweep in your tests ?

As for "cannot find tip page" see CORE-4645 and test next snapshot build of 2.5.6

Pavel Zotov added a comment - 08/Mar/16 02:44 PM
> do you see a sweep in your tests ?

_NO_ messages about sweep did appear in firebird.log for 2.5.3, 2.5.4, 2.5.6 & 3.0

Pavel Zotov added a comment - 08/Mar/16 02:46 PM
> do you see a sweep in your tests ?

OK, I understand. One need to make "integral test" for several tickets at once.

Pavel Zotov added a comment - 08/Mar/16 03:42 PM
I have to correct myself about 2.5.6: on _LAST_ snapshot (WI-V2.5.6.26980) all works fine.

Checked on SS and SC, with script that tries to increase Tx counter up to 1'000'000.
This script was launched in single and in two ISQL sessions (i.e. making Tx counters be increased in "parallel" mode, separately).

As of 4.0 - still get error message (see above; checked on WI-T4.0.0.32386 , build of 08-mar-2016).