Issue Details (XML | Word | Printable)

Key: CORE-4309
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Vlad Khorsun
Reporter: Pavel Zotov
Votes: 0
Watchers: 2
Operations

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

'Cache Writer' record in MON$ATTACHMENTS dissapear when delete other connection that running some 'heavy update' on big table via delete from MON$ATTACHMENTS

Created: 30/Dec/13 06:32 PM   Updated: 18/Jan/16 03:40 PM
Component/s: None
Affects Version/s: 3.0 Alpha 1
Fix Version/s: 3.0 Beta 1

QA Status: No test


 Description  « Hide
DDL:
####
set term ^;
execute block as
declare n int = 100000000;
declare i int = 0;
begin
  while (i<n) do begin

     insert into t(id,s01,s02)
     values( :i
             ,rpad('', 8, uuid_to_char(gen_uuid()))
             ,rpad('', 8, uuid_to_char(gen_uuid()))
            );
     if (mod(i,1000000)=0) then i=i+0*gen_id(g,1000000);

     i=i+1;
  end
end ^
set term ;^
commit;

TEST:
#####

attach #1
=======
$ isql localhost/3330:/var/db/fb30/tmp_30813_extents.fdb
SQL> update t set s01=s02, s02=s01; -- heavy query that will run a few minutes

attach #2 (during attach #1 performs update)
=======
$ isql localhost/3330:/var/db/fb30/tmp_30813_extents.fdb
SQL> set list on;
SQL> commit; select * from mon$attachments where mon$user containing 'writer';

MON$ATTACHMENT_ID 292
MON$SERVER_PID 8882
MON$STATE 0
MON$ATTACHMENT_NAME /var/db/fb30/tmp_30813_extents.fdb
MON$USER Cache Writer
MON$ROLE <null>
MON$REMOTE_PROTOCOL <null>
MON$REMOTE_ADDRESS <null>
MON$REMOTE_PID <null>
MON$CHARACTER_SET_ID 0
MON$TIMESTAMP 2013-12-30 20:18:16.2360
MON$GARBAGE_COLLECTION 1
MON$REMOTE_PROCESS <null>
MON$STAT_ID 11
MON$CLIENT_VERSION <null>
MON$REMOTE_VERSION <null>
MON$REMOTE_HOST <null>
MON$REMOTE_OS_USER <null>
MON$AUTH_METHOD <null>

SQL> commit; delete from mon$attachments where mon$attachment_id<>current_connection;
SQL> commit; select * from mon$attachments where mon$user containing 'writer';
SQL> -- no rows! --

Where record for 'CACHE WRITER' disappear ?

PS.
SQL> show version;
ISQL Version: LI-T3.0.0.30813 Firebird 3.0 Alpha 2
Server version:
Firebird/Linux/AMD/Intel/x64 (access method), version "LI-T3.0.0.30813 Firebird 3.0 Alpha 2"
Firebird/Linux/AMD/Intel/x64 (remote server), version "LI-T3.0.0.30813 Firebird 3.0 Alpha 2/tcp (oel64)/P13:C"
Firebird/Linux/AMD/Intel/x64 (remote interface), version "LI-T3.0.0.30813 Firebird 3.0 Alpha 2/tcp (oel64)/P13:C"
on disk structure version 12.0
SQL> show database;
Database: localhost/3330:/var/db/fb30/tmp_30813_extents.fdb
        Owner: SYSDBA
PAGE_SIZE 4096
Number of DB pages allocated = 1804832
Sweep interval = 20000
Forced Writes are ON
Transaction - oldest = 478
Transaction - oldest active = 539
Transaction - oldest snapshot = 539
Transaction - Next = 551
ODS = 12.0
Default Character set: NONE

 All   Comments   Change History   Subversion Commits      Sort Order: Descending order - Click to sort in ascending order
Vlad Khorsun added a comment - 11/Jan/14 09:14 AM
Internal attachments, used by background threads, are marked as "system" now.
New field MON$SYSTEM_FLAG is added into the MON$ATTACHMENTS table.
Delete request for system attachments is silently ignored, i.e. such attachments is skipped when DELETE FROM MON$ATTACHMENTS is processed.

Sean Leyne added a comment - 30/Dec/13 09:03 PM - edited
The case details, for clarity, should include value of the "current_connection" (i.e. SELECT Current_Connection from RDB$Database) as well as the username for the ISQL connections/sessions.