Skip to content

Commit

Permalink
Merge branch 'master' into port2firebird_tablespaces2
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Zhdanov committed Nov 12, 2024
2 parents 362ee8d + 01c64fe commit b3ffc01
Show file tree
Hide file tree
Showing 13 changed files with 520 additions and 21 deletions.
123 changes: 121 additions & 2 deletions doc/README.isql_enhancements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -327,10 +327,129 @@ SQL> SET PER_TAB OFF;



12) SET WIRE_STATS option.

Author: Vladyslav Khorsun <hvlad at users sourceforge net>

When set to ON shows wire (network) statistics after query execution.
It is set to OFF by default. The name WIRE_STATS could be shortened up to WIRE.

The statistics counters shown in two groups: 'logical' and 'physical':
- logical counters show numbers of packets in terms of Firebird wire protocol
and number of bytes send before compression and received after decompression;
- physical counters show number of physical packets and bytes send and
received over the wire, number of bytes could be affected by wire compression,
if present. Also, number of network roundtrips is shown: it is number of
changes of IO direction from 'send' to 'receive'.

Note, wire statistics is gathered by Remote provider only, i.e. it is always
zero for embedded connections. Also, it is collected by client and IO direction
(send, receive) is shown from client point of view.

Examples:

1. INET protocol with wire compression.
Set WireCompression = true in firebird.conf

>isql inet://employee

SQL> SET;
Print statistics: OFF
Print per-table stats: OFF
Print wire stats: OFF
...

SQL> SET WIRE;
SQL>
SQL> SELECT COUNT(*) FROM RDB$RELATIONS;

COUNT
=====================
67

Wire logical statistics:
send packets = 6
recv packets = 5
send bytes = 184
recv bytes = 224
Wire physical statistics:
send packets = 3
recv packets = 2
send bytes = 123
recv bytes = 88
roundtrips = 2

Note difference due to wire compression in send/recv bytes for logical and
physical stats.


2. XNET protocol (wire compression is not used).

>isql xnet://employee

SQL> SET WIRE;
SQL>
SQL> SELECT COUNT(*) FROM RDB$RELATIONS;

COUNT
=====================
67

Wire logical statistics:
send packets = 5
recv packets = 6
send bytes = 176
recv bytes = 256
Wire physical statistics:
send packets = 5
recv packets = 5
send bytes = 176
recv bytes = 256
roundtrips = 5

Note, send/recv bytes for logical and physical stats are equal.


3. Embedded connection (wire statistics is absent).

SQL> SET WIRE;
SQL>
SQL> select count(*) from rdb$relations;

COUNT
=====================
67

Wire logical statistics:
send packets = 0
recv packets = 0
send bytes = 0
recv bytes = 0
Wire physical statistics:
send packets = 0
recv packets = 0
send bytes = 0
recv bytes = 0
roundtrips = 0



13) SHOW WIRE_STATISTICS command.

Author: Vladyslav Khorsun <hvlad at users sourceforge net>

New ISQL command that shows accumulated wire statistics. There is also
shortened alias WIRE_STATS.

The command show values of wire statistics counters, accumulated since the
connection start time. Format is the same as of SET STATS above.



Isql enhancements in Firebird v6.
---------------------------------

12) EXPLAIN statement.
14) EXPLAIN statement.

Author: Adriano dos Santos Fernandes

Expand All @@ -355,7 +474,7 @@ SQL>
SQL> set term ;!


13) SET AUTOTERM ON/OFF
15) SET AUTOTERM ON/OFF

Author: Adriano dos Santos Fernandes

Expand Down
6 changes: 6 additions & 0 deletions src/burp/BurpTasks.h
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,13 @@ class IOBuffer
if (!m_mutex.tryEnter(FB_FUNCTION))
return;

fb_assert(m_locked >= 0);
const bool lockedByMe = (m_locked != 0);

m_mutex.leave();

if (!lockedByMe)
return;
}

fb_assert(m_locked > 0);
Expand Down
11 changes: 11 additions & 0 deletions src/include/firebird/impl/inf_pub.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,17 @@ enum db_info_types

fb_info_parallel_workers = 149,

// Wire stats items, implemented by Remote provider only
fb_info_wire_out_packets = 150,
fb_info_wire_in_packets = 151,
fb_info_wire_out_bytes = 152,
fb_info_wire_in_bytes = 153,
fb_info_wire_snd_packets = 154,
fb_info_wire_rcv_packets = 155,
fb_info_wire_snd_bytes = 156,
fb_info_wire_rcv_bytes = 157,
fb_info_wire_roundtrips = 158,

isc_info_db_last_value /* Leave this LAST! */
};

Expand Down
9 changes: 9 additions & 0 deletions src/include/gen/Firebird.pas
Original file line number Diff line number Diff line change
Expand Up @@ -4507,6 +4507,15 @@ IProfilerStatsImpl = class(IProfilerStats)
fb_info_username = byte(147);
fb_info_sqlrole = byte(148);
fb_info_parallel_workers = byte(149);
fb_info_wire_out_packets = byte(150);
fb_info_wire_in_packets = byte(151);
fb_info_wire_out_bytes = byte(152);
fb_info_wire_in_bytes = byte(153);
fb_info_wire_snd_packets = byte(154);
fb_info_wire_rcv_packets = byte(155);
fb_info_wire_snd_bytes = byte(156);
fb_info_wire_rcv_bytes = byte(157);
fb_info_wire_roundtrips = byte(158);
fb_info_crypt_encrypted = $01;
fb_info_crypt_process = $02;
fb_feature_multi_statements = byte(1);
Expand Down
Loading

0 comments on commit b3ffc01

Please sign in to comment.