Hello,

I have a working plugin which I'll push to Launchpad soon.  I have a question 
about using the update_func_arg of class sys_var_std_string to create a dynamic 
variable.  My plugin's class has a file descriptor to the open query log file, 
but the update function can't access it because it doesn't receive a pointer to 
the plugin's class.  I can make the file descriptor var global in my plugin's 
namespace, but I'd like to keep everything inside the class.  Is this possible? 
 I tried hacking and casting and passing a pointer to a non-static member 
function of the class, but I couldn't get that to work.  My update function is 
currently:

bool update_file(Session *, set_var *var)
{
  const char *new_file= var->value->str_value.ptr();

  if (fd)
    close(fd);
  fd= open_log_file(new_file);
  if (fd < 0)
    return false;  // error

  sysvar_file= new_file;

  return false;  // success
}

fd and sysvar_file are global in the plugin's namespace.  Does that code look 
correct?  (It work in fact.)  I don't think any other modules use the update 
func feature, so I don't have a basis for comparison.

Thanks,

Daniel 

Le 26 avr. 2011 à 08:46, Monty Taylor a écrit :

> I'm also in favor of this - but I have two additional suggestions:
> 
> Just make a new plugin - slow_query_log
> 
> Look in to using the new Event plugin type, rather than the Logging
> plugin type. (I believe Mark has been working on converting the syslog
> logger over to use this) It's a better/more flexible interface.
> 
> Go for it!
> 
> Monty
> 
> 
> On 04/25/2011 09:34 PM, Daniel Nichter wrote:
>> Hello,
>> 
>> I'd like to propose a new logging_query plugin.  The plugin is still, in
>> Mark's words from 2008, "currently very rough and crude: logging far too
>> much, in an awkward log format"
>> (http://fallenpegasus.livejournal.com/759373.html).  And
>> as https://bugs.launchpad.net/drizzle/+bug/723915 notes, it's not tested
>> either.
>> 
>> I think the CSV format will not serve users well in the long run for the
>> following reasons.
>> 
>> 1) Without a header there's no way to know which values are what.
>> Andrew mentioned via a comment to another blog post that this may be
>> added but there are still other problems...
>> 
>> 2) When should the header be printed?  Probably every time the log is
>> opened.  Once would surely not be enough.  In any case, chances are that
>> whenever or wherever it's printed it will get lost in a big log file.
>> So either a user will have to search for it by eye, or a log parsing
>> tool will have to search for it before it can know how to parse the log.
>> 
>> 3) Queries are flattened which may not be desirable in all cases.
>> Sometimes we want to get the original query from the log.  If a value
>> has a line in it like col="line1
>> line2"
>> then this will be lost.
>> 
>> 4) CSV requires quoting and escaping which, for one, adds overhead to
>> the plugin and, for two, makes the job of a log parsing tool more difficult.
>> 
>> 5) I'm sure that more information will be added to the Drizzle query log
>> over time, just as more was added to the MySQL slow log.  This will make
>> the CSV format even more unwieldy and quite possibly variable making the
>> issue of headers even more troublesome.
>> 
>> 6) Query logs are basically useless without a tool to parse them.  The
>> currently log format will need its own tool, but if it used the MySQL
>> slow log format, then there are already several tools that could parse it.
>> 
>> So I propose to rewrite logging_query in the style of the MySQL slow log
>> format but without all its gotchas, fluff and other stuff that make
>> parsing it a real pita. If Drizzle is not fondly attached to
>> logging_query in its current state, then I would like to rewrite it.
>> 
>> Yay, nay?
>> 
>> -Daniel
>> 
>> 
>> 
>> _______________________________________________
>> Mailing list: https://launchpad.net/~drizzle-discuss
>> Post to     : [email protected]
>> Unsubscribe : https://launchpad.net/~drizzle-discuss
>> More help   : https://help.launchpad.net/ListHelp
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~drizzle-discuss
> Post to     : [email protected]
> Unsubscribe : https://launchpad.net/~drizzle-discuss
> More help   : https://help.launchpad.net/ListHelp


_______________________________________________
Mailing list: https://launchpad.net/~drizzle-discuss
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~drizzle-discuss
More help   : https://help.launchpad.net/ListHelp

Reply via email to