From owner-freebsd-www@FreeBSD.ORG Wed Feb 27 00:00:05 2008 Return-Path: Delivered-To: freebsd-www@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id DBB131065680 for ; Wed, 27 Feb 2008 00:00:05 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id B3E0513C467 for ; Wed, 27 Feb 2008 00:00:05 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m1R005Bk049667 for ; Wed, 27 Feb 2008 00:00:05 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m1R005Mq049666; Wed, 27 Feb 2008 00:00:05 GMT (envelope-from gnats) Resent-Date: Wed, 27 Feb 2008 00:00:05 GMT Resent-Message-Id: <200802270000.m1R005Mq049666@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-www@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Tommy Pham Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E3C0B106566C for ; 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 ; 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 ; 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 To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: www/121134: www/mod_log_sql2-dtc scoreboard problem X-BeenThere: freebsd-www@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD Project Webmasters List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Feb 2008 00:00:06 -0000 >Number: 121134 >Category: www >Synopsis: www/mod_log_sql2-dtc scoreboard problem >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-www >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Feb 27 00:00:05 UTC 2008 >Closed-Date: >Last-Modified: >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: >Unformatted: