13.08.2021 19:02, Dimitry Sibiryakov wrote:
   Hello All,

  As I see in TraceManager code every trace session is receiving not only events it is subscribed for with trace_needs() but also everything that previous sessions were subscribed for.
   For me it looks like a rather strange design. What is the purpose of that?

  I'm not an original author of the trace subsystem, so below is just how I 
remember
and understand original impl and my own conclusions about it.

  At initial impl there was nor interfaces nor objects, just plain C. Trace 
plugin
fills vector with implemented "hooks entrypoints" and passes it to the engine. 
I.e.
plugin could set some entrypoint to NULL and engine should not pass 
corresponding
events into such plugin instance. But this was never used - trace plugin (the 
only
one existing) implements all known entrypoints. Maybe it was planned to be used 
in
next versions of C-style plugin when engine and plugin knows different set of
entrypoints. But this compatibility task is solved by another way in Firebird 
plugin API.

  Currently, bitmask "trace_needs" always have all bits set and useless. Yes, 
it could
be used as kind of optimization to allow engine to not pass unneeded events 
into given
trace plugin instance. It requires to move trace_needs() from ITraceFactory to
ITracePlugin, btw. TraceManager also requires some changes.

Regards,
Vlad

PS it was expected that such questions arise few years ago when Trace API was 
introduced,
but there was no interest from 3rd party devs, unfortunately. Thus, currently 
we have what
we have.


Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to