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

Trace INCLUDE_FILTER with [[:WHITESPACE:]]+ does not work when statement contains newline is issued [CORE5470] #5740

Closed
firebird-automations opened this issue Jan 26, 2017 · 9 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @pavel-zotov

1. Create following config for trace and launch it:

database
{
#⁠ Do we trace database events or not
enabled = true

include\_filter = "%\(recreate\|create\|alter\|drop\|comment on\)\[\[:WHITESPACE:\]\]\+\(domain\|generator\|sequence\|exception\|procedure\|table\|index\|view\|trigger\|role\|filter\|external function\)%"

time\_threshold = 0
log\_statement\_finish = true

}

2. Create empty database, connect via ISQL and run there:

C:\FB\40SS>C:\FB\40SS\isql /:e40
Database: /:e40, User: SYSDBA
SQL> select 1 from rdb$database where 'create or alter procedure sp_test10 as begin end;' similar to '%(create|alter)[[:WHITESPACE:]]{1,}(procedure)%';

CONSTANT

============
1

SQL> create or alter procedure sp_test10 as begin end;

(NOTE: there are 10 spaces between words "alter" & "procedure")

3. Look in the trace log. It will contain:

2017-01-26T12:08:52.9950 (2660:0000000004BE5540) EXECUTE_STATEMENT_FINISH
e40 (ATT_9, SYSDBA:NONE, NONE, TCPv6:fe80::c02:27a4:3d45:915c%4/50151)
C:\FB\40SS\isql.EXE:5448
(TRA_10, CONCURRENCY | WAIT | READ_WRITE)

Statement 28:
-------------------------------------------------------------------------------
select 1 from rdb$database where 'create or alter procedure sp_test10 as begin end;' similar to '%(create|alter)[[:WHITESPACE:]]{1,}(procedure)%'
1 records fetched
0 ms, 1 read(s), 11 fetch(es)

2017-01-26T12:09:12.1210 (2660:0000000004BE5540) EXECUTE_STATEMENT_FINISH
e40 (ATT_9, SYSDBA:NONE, NONE, TCPv6:fe80::c02:27a4:3d45:915c%4/50151)
C:\FB\40SS\isql.EXE:5448
(TRA_11, READ_COMMITTED | NO_REC_VERSION | WAIT | READ_WRITE)

-------------------------------------------------------------------------------
create or alter procedure sp_test10 as begin end
0 records fetched
0 ms

// so far so good.

========================================================================

4. Switch back in ISQL and try there:

SQL> create or alter
CON> procedure sp_test11 as begin end;

SQL> create or alter
CON> procedure sp_test10 as begin end;

SQL> select 1 from rdb$database where 'create or alter
CON> procedure sp_test10 as begin end;' similar to '%(create|alter)[[:WHITESPACE:]]{1,}(procedure)%';

CONSTANT

============
1

SQL> select 1 from rdb$database where 'create or alter
CON> procedure sp_test10 as begin end;' similar to '%(create|alter)[[:WHITESPACE:]]{1,}(procedure)%';

CONSTANT

============
1

You will NOT see in the trace log any messages for these statements.
So, we got TRUE when verify pattern in ISQL and EMPTY result in trace.

Is it my mistake somewhere or this is a bug ? (if the latter - please, fix it ...)

Check on:

WI-T4.0.0.494
WI-V3.0.2.32664
WI-V2.5.7.27038

Commits: 70ed61c a7d15ee a98d089 7e9d7dc

@firebird-automations
Copy link
Collaborator Author

Modified by: @hvlad

assignee: Vlad Khorsun [ hvlad ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @hvlad

> You will NOT see in the trace log any messages for these statements.
I.e. all kind of statements is affected, not DDL only.

@firebird-automations
Copy link
Collaborator Author

Modified by: @hvlad

summary: Trace INCLUDE_FILTER with [[:WHITESPACE:]]+ does not work when DDL statement contains newline is issued => Trace INCLUDE_FILTER with [[:WHITESPACE:]]+ does not work when statement contains newline is issued

@firebird-automations
Copy link
Collaborator Author

Commented by: @hvlad

Fix is committed into B3_0_Release, please verify

@firebird-automations
Copy link
Collaborator Author

Commented by: @pavel-zotov

Checked on WI-V3.0.2.32683, WI-T4.0.0.530 - all fine.

@firebird-automations
Copy link
Collaborator Author

Commented by: @hvlad

Fix is backported into B3_0_Release and B2_5_Release branches

@firebird-automations
Copy link
Collaborator Author

Modified by: @hvlad

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

resolution: Fixed [ 1 ]

Fix Version: 2.5.7 [ 10770 ]

Fix Version: 3.0.2 [ 10785 ]

Fix Version: 4.0 Alpha 1 [ 10731 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

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

QA Status: No test => Done successfully

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

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

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