From patchwork Thu Jan 7 19:38:11 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Jackson X-Patchwork-Id: 7979441 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E3291BEEE5 for ; Thu, 7 Jan 2016 19:41:52 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 17F912013D for ; Thu, 7 Jan 2016 19:41:52 +0000 (UTC) Received: from lists.xen.org (lists.xenproject.org [50.57.142.19]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A98C520142 for ; Thu, 7 Jan 2016 19:41:50 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aHGOG-0003Tj-Fi; Thu, 07 Jan 2016 19:38:32 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aHGOF-0003Sc-Ao for xen-devel@lists.xenproject.org; Thu, 07 Jan 2016 19:38:31 +0000 Received: from [85.158.143.35] by server-3.bemta-4.messagelabs.com id 32/EC-31122-6BEBE865; Thu, 07 Jan 2016 19:38:30 +0000 X-Env-Sender: prvs=807bdda5f=Ian.Jackson@citrix.com X-Msg-Ref: server-3.tower-21.messagelabs.com!1452195506!8498330!1 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 22679 invoked from network); 7 Jan 2016 19:38:28 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-3.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 7 Jan 2016 19:38:28 -0000 X-IronPort-AV: E=Sophos;i="5.20,534,1444694400"; d="scan'208";a="323534834" From: Ian Jackson To: Date: Thu, 7 Jan 2016 19:38:11 +0000 Message-ID: <1452195496-16016-3-git-send-email-ian.jackson@eu.citrix.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1452195496-16016-1-git-send-email-ian.jackson@eu.citrix.com> References: <1452195496-16016-1-git-send-email-ian.jackson@eu.citrix.com> MIME-Version: 1.0 X-DLP: MIA1 Cc: Ian Jackson , Ian Campbell Subject: [Xen-devel] [OSSTEST PATCH 2/7] Database locking: Tcl: Use db-execute-array X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Replace open-coded uses of pg_execute -array ARRAYVAR dbh STMT with jobdb::db-execute-array ARRAYVAR STMT. The only functional change is that if OSSTEST_TCL_JOBDB_DEBUG is set, there will be debugging output. But we are going to want to make db-execute-array do something more complicated involving pg_exec. Signed-off-by: Ian Jackson --- ms-ownerdaemon | 2 +- ms-queuedaemon | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ms-ownerdaemon b/ms-ownerdaemon index 33ee238..a228e3c 100755 --- a/ms-ownerdaemon +++ b/ms-ownerdaemon @@ -67,7 +67,7 @@ proc cmd/create-task {chan desc} { ( type, refkey, refinfo, live) VALUES ('ownd', [pg_quote $taskdesc], [clock seconds], 't') " - set nrows [pg_execute -array av dbh " + set nrows [jobdb::db-execute-array av " SELECT taskid FROM tasks WHERE live AND refkey = [pg_quote $taskdesc] diff --git a/ms-queuedaemon b/ms-queuedaemon index 08f88cf..b3a05ee 100755 --- a/ms-queuedaemon +++ b/ms-queuedaemon @@ -444,7 +444,7 @@ proc cmd/unwait {chan desc} { proc for-free-resources {varname body} { jobdb::transaction resources { - pg_execute -array free_resources_row dbh { + jobdb::db-execute-array free_resources_row { SELECT (restype || '/' || resname || '/' || shareix) AS r FROM resources WHERE NOT (SELECT live FROM tasks WHERE taskid=owntaskid) @@ -636,7 +636,7 @@ proc cmd/uptime {chan desc seconds} { set descpat "[regsub {\:\d+$} $desc {:%}]" transaction resources { set keys {} - pg_execute -array task dbh " + jobdb::db-execute-array task " SELECT * FROM tasks WHERE type = 'ownd' AND ( refkey LIKE [pg_quote $descpat]