From nobody@FreeBSD.org  Tue Feb 26 23:50:01 2008
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E3C0B106566C
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 26 Feb 2008 23:50:01 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id C1FF213C447
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 26 Feb 2008 23:50:01 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.2/8.14.2) with ESMTP id m1QNlGUR055965
	for <freebsd-gnats-submit@FreeBSD.org>; Tue, 26 Feb 2008 23:47:16 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.2/8.14.1/Submit) id m1QNlGsf055963;
	Tue, 26 Feb 2008 23:47:16 GMT
	(envelope-from nobody)
Message-Id: <200802262347.m1QNlGsf055963@www.freebsd.org>
Date: Tue, 26 Feb 2008 23:47:16 GMT
From: Tommy Pham <tommyhp2@yahoo.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: www/mod_log_sql2-dtc scoreboard problem
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         121134
>Category:       ports
>Synopsis:       www/mod_log_sql2-dtc scoreboard problem
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    apache
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Feb 27 00:00:05 UTC 2008
>Closed-Date:    Fri May 14 05:08:49 UTC 2010
>Last-Modified:  Mon Sep  6 19:40:06 UTC 2010
>Originator:     Tommy Pham
>Release:        FreeBSD 7.0-RC2 amd64
>Organization:
>Environment:
USER=tommy
LOGNAME=tommy
HOME=/root
MAIL=/var/mail/tommy
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/root/bin
TERM=xterm
FTP_PASSIVE_MODE=yes
BLOCKSIZE=K
SHELL=/bin/csh
SSH_CLIENT=192.168.1.15 1917 22
SSH_CONNECTION=192.168.1.15 1917 192.168.1.201 22
SSH_TTY=/dev/ttyp0
HOSTTYPE=FreeBSD
VENDOR=unknown
OSTYPE=FreeBSD
MACHTYPE=unknown
SHLVL=3
PWD=/usr/ports/www/mod_log_sql2-dtc/files
GROUP=wheel
HOST=www1.sointe.local
REMOTEHOST=
ACVS=anoncvs@anoncvs1.freebsd.org:/home/ncvs
EDITOR=vi
PAGER=more
>Description:
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.
>How-To-Repeat:

>Fix:


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-www->scrappy 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Wed Feb 27 02:26:31 UTC 2008 
Responsible-Changed-Why:  
Make this a 'ports' PR and assign.  The GNATS 'www' category is only for 
things relating to the FreeBSD.org website. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=121134 
Responsible-Changed-From-To: scrappy->apache 
Responsible-Changed-By: pgollucci 
Responsible-Changed-When: Sat Dec 27 20:34:30 UTC 2008 
Responsible-Changed-Why:  
apache team 

http://www.freebsd.org/cgi/query-pr.cgi?pr=121134 
State-Changed-From-To: open->feedback 
State-Changed-By: pgollucci 
State-Changed-When: Sun Dec 27 01:46:40 UTC 2009 
State-Changed-Why:  
is this still an issue in 1.101 ? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=121134 
State-Changed-From-To: feedback->closed 
State-Changed-By: pgollucci 
State-Changed-When: Fri May 14 05:08:49 UTC 2010 
State-Changed-Why:  
feedback timeout (> 5 months) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=121134 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: ports/121134: commit references a PR
Date: Mon,  6 Sep 2010 19:30:02 +0000 (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"
 
>Unformatted:
