All of lore.kernel.org
 help / color / mirror / Atom feed
* ulogd's SQLITE3 "buffer" option
@ 2015-12-29 23:38 Alex Xu
  2015-12-30  0:19 ` Pablo Neira Ayuso
  0 siblings, 1 reply; 3+ messages in thread
From: Alex Xu @ 2015-12-29 23:38 UTC (permalink / raw)
  To: netfilter

I was attempting to configure sqlite3 output in ulogd and could not
determine the function of the "buffer" configuration option.

$ grep buffer output/sqlite3/ulogd_output_sqlite3.c
        int buffer_size;
        int buffer_curr;
                        .key = "buffer",
#define buffer_ce(pi)   (pi)->config_kset->ces[2].u.value
                priv->buffer_curr++;
        /* initialize our buffer size and counter */
        priv->buffer_size = buffer_ce(pi);
        priv->buffer_curr = 0;
$ grep -rF buffer_curr .
output/sqlite3/ulogd_output_SQLITE3.c:  int buffer_curr;
output/sqlite3/ulogd_output_SQLITE3.c:          priv->buffer_curr++;
output/sqlite3/ulogd_output_SQLITE3.c:  priv->buffer_curr = 0;

Now, it is quite likely that I am missing something, but it would
appear that buffer_curr is never actually *read*, only *written*,
and it's a basic fact of programming that a variable can have no effect
if it is never read from. [citation needed]

It would appear that the original code in ulogd-1.x employed a 'buffer'
which was actually a counter for when to tell sqlite to sync to disk.
When the code was rewritten by "Holger" and committed by Pablo Neira
Ayuso (8f7bb61), the syncing part was removed but the buffer variable
was simply renamed.

Nobody noticed because one fsync every few seconds is tiny.

Therefore, I think we should remove the "buffer" option entirely.

Thoughts? I will send a patch if there are no objections.

Please CC me on replies.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-01-01 10:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-29 23:38 ulogd's SQLITE3 "buffer" option Alex Xu
2015-12-30  0:19 ` Pablo Neira Ayuso
2016-01-01 10:04   ` Eric Leblond

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.