Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
firebird-automations opened this issue Dec 30, 2013 · 9 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @pavel-zotov

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

Commits: 5e3c596 FirebirdSQL/fbt-repository@0fc7945

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

summary: CACHE WRITER' => 'Cache Writer' record in MON$ATTACHMENTS dissapear when delete other connection that running some 'heavy update' on big table via delete from MON$ATTACHMENTS

@firebird-automations
Copy link
Collaborator Author

Commented by: Sean Leyne (seanleyne)

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.

@firebird-automations
Copy link
Collaborator Author

Modified by: @hvlad

assignee: Vlad Khorsun [ hvlad ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @hvlad

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.

@firebird-automations
Copy link
Collaborator Author

Modified by: @hvlad

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 3.0 Alpha 2 [ 10560 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @hvlad

Version: 3.0 Alpha 1 [ 10331 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

Fix Version: 3.0 Beta 1 [ 10332 ]

Fix Version: 3.0 Alpha 2 [ 10560 ] =>

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

status: Resolved [ 5 ] => Closed [ 6 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: Closed [ 6 ] => Closed [ 6 ]

QA Status: No test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants