Bug 121134 - www/mod_log_sql2-dtc scoreboard problem
Summary: www/mod_log_sql2-dtc scoreboard problem
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-apache (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-02-27 00:00 UTC by Tommy Pham
Modified: 2010-09-06 20:40 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tommy Pham 2008-02-27 00:00:05 UTC
Is the port www/mod_log_sql2-dtc 's scoreboard broken?  I have mass
vhost on with adequate rights (insert, update, create, select) where
required - the apache error log has no error and preserve file is
empty.  Everything logs great except for the scoreboard.  It inserts:
`vhost`, `month`, `year`, `count_impressions` ok but failed to update
properly?

here's the scoreboard table sample data:

domain 	vhost 	month 	  year 	count_impressions 	bytes_sent
www 	default-domain.tld 	2 	2008 	2 	165632
www 	default-domain.tld 	2 	2008 	3 	248448
www 	default-domain.tld 	2 	2008 	1 	82816

is that how it's supposed to be?  Is it supposed to query for an
existing `domain`,`vhost`,`month`,`year`, before any inserts?  If the
required the data exists, it updates `count_impressions` and
`bytes_sent` right?  I thought the idea for this table is to see the #
of hits (ie count_impressions) and bandwidth used (bytes_sent) for the
month for each domain/vhost? If that's the case, then I think the
scoreboard is bugged because it's gonna fill up the scoreboard table
quickly with every hit/requests.

Here's the C code in file patch-mod_log_sql.c:
+                       score_query_insert = apr_psprintf(r->pool,
"insert ignore into %s (domain,vhost,month,year,count_impressions)
values ('%s','%s','%s','%s','0')"
+                              
,scoreboard_table_name,scoreboard_domain,scoreboard_subdomain,sql_month,sql_year);
+                      
safe_sql_insert(orig,LOGSQL_TABLE_SCORE,"score_board",score_query_insert);
+                       score_query_update = apr_psprintf(r->pool,
"update %s SET count_impressions = count_impressions+1, bytes_sent =
bytes_sent+%s WHERE domain='%s' AND vhost='%s' AND month='%s' AND
year='%s'"
+                              
,scoreboard_table_name,extract_bytes_sent(r,
a),scoreboard_domain,scoreboard_subdomain,sql_month,sql_year);
+                      
safe_sql_insert(orig,LOGSQL_TABLE_SCORE,"score_board",score_query_update);

I don't see a select statement to check for existing data. :(  I
wouldn't mind fixing it and post the patch except my C coding sucks and
I don't know how use patch in FreeBSD :(

Also, the scoreboard table isn't created automatically with mass vhost
on with create rights.  I had to create a table named 'scoreboard' with
the these fields.

Field 	Type 	Null 	Key 	Default 	Extra
domain  varchar(20)  	YES  	MUL  	NULL
vhost 	varchar(20) 	YES 	  	NULL
month 	tinyint(3) unsigned 	YES 	  	0
year 	smallint(5) unsigned 	YES 	  	0
count_impressions 	int(10) unsigned 	YES 	  	0 
bytes_sent 	int(10) unsigned 	YES 	  	0

Running MySQL 5.1.23 + Apache 2.2.8.  Port is built w/o DBI.
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2008-02-27 02:26:31 UTC
Responsible Changed
From-To: freebsd-www->scrappy

Make this a 'ports' PR and assign.  The GNATS 'www' category is only for 
things relating to the FreeBSD.org website.
Comment 2 Philip M. Gollucci freebsd_committer freebsd_triage 2008-12-27 20:34:30 UTC
Responsible Changed
From-To: scrappy->apache

apache team
Comment 3 Philip M. Gollucci freebsd_committer freebsd_triage 2009-12-27 01:46:40 UTC
State Changed
From-To: open->feedback

is this still an issue in 1.101 ?
Comment 4 Philip M. Gollucci freebsd_committer freebsd_triage 2010-05-14 06:08:49 UTC
State Changed
From-To: feedback->closed

feedback timeout (> 5 months)
Comment 5 dfilter service freebsd_committer freebsd_triage 2010-09-06 20:30:02 UTC
pgollucci    2010-09-06 19:29:52 UTC

  FreeBSD ports repository

  Modified files:
    www/mod_log_sql2-dtc Makefile 
    www/mod_log_sql2-dtc/files patch-mod_log_sql.c 
                               patch-mod_log_sql.h 
  Added files:
    www/mod_log_sql2-dtc/files patch-mod_log_sql_mysql.c 
                               patch-mod_log_sql_pgsql.c 
  Log:
  - Fix bytes_sent bug [1]
  - Fix a apache scoreboard bug
  
  PR:              ports/150296, ports/121134
  Submitted by:    Charles Sprickman <css@morefoo.com>
  Obtained from:   Fernando Kiernan, http://www.imagenesdigitales.com.ar/ [1]
  
  Revision  Changes    Path
  1.15      +1 -1      ports/www/mod_log_sql2-dtc/Makefile
  1.3       +33 -13    ports/www/mod_log_sql2-dtc/files/patch-mod_log_sql.c
  1.2       +11 -2     ports/www/mod_log_sql2-dtc/files/patch-mod_log_sql.h
  1.1       +23 -0     ports/www/mod_log_sql2-dtc/files/patch-mod_log_sql_mysql.c (new)
  1.1       +23 -0     ports/www/mod_log_sql2-dtc/files/patch-mod_log_sql_pgsql.c (new)
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"