X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 1EB74D1B9EB for ; Mon, 5 Apr 2004 21:38:19 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 91726-08 for ; Mon, 5 Apr 2004 18:38:49 -0300 (ADT) Received: from ganymede.hub.org (u46n208.hfx.eastlink.ca [24.222.46.208]) by svr1.postgresql.org (Postfix) with ESMTP id A1CE1D1B9A4 for ; Mon, 5 Apr 2004 18:38:16 -0300 (ADT) Received: by ganymede.hub.org (Postfix, from userid 1000) id 46FC6459A3; Mon, 5 Apr 2004 18:39:08 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by ganymede.hub.org (Postfix) with ESMTP id 3B40D459A0; Mon, 5 Apr 2004 18:39:08 -0300 (ADT) Date: Mon, 5 Apr 2004 18:39:08 -0300 (ADT) From: "Marc G. Fournier" X-X-Sender: scrappy@ganymede.hub.org To: Matt Clark Cc: Tom Lane , pgsql-admin@postgresql.org Subject: Re: Frequent 'deadlock detected' in 7.4 ... or just my bad In-Reply-To: Message-ID: <20040405183841.N57651@ganymede.hub.org> References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200404/76 X-Sequence-Number: 13049 That appears to have fixed it, thanks ... at least it hasn't happened in a few hours, and it was happening at least once an hour previously ... On Mon, 5 Apr 2004, Matt Clark wrote: > > 1. a traffic table is read in, and loaded into a hash table that is > > ordered by company_id, ip_id and port: > > > > $traffic{$ip_rec{$ip}{'company_id'}}{$ip_id}{$port} += $bytes1 + $bytes2; > > > > 2. a foreach loop is run on that resultant list to do the updates to the > > database: > > > > foreach $company_id ( keys %traffic ) { > > foreach $ip_id ( keys %{$traffic{$company_id}} ) { > > foreach $port ( keys %{$traffic{$company_id}{$ip_id}} ) { > > > > and the updates are done based on those 3 values, plus the byte value > > of $traffic{$company_id}{$ip_id}{$port} ... > > > > Now, my first mistake may be that I'm mis-assuming that the hashes will > > be read in a sorted order ... ? If this is the case, though, then sort > > order shouldn't be an issue, as all servers would be sorted the same way > > The output of keys(%hash) is NOT ordered! Try: > > foreach $company_id ( sort keys %traffic ) { > foreach $ip_id ( sort keys %{$traffic{$company_id}} ) { > foreach $port ( sort keys %{$traffic{$company_id}{$ip_id}} ) { > > > Matt > > ---- Marc G. Fournier Hub.Org Networking Services (http://www.hub.org) Email: scrappy@hub.org Yahoo!: yscrappy ICQ: 7615664