OpenPKG CVS Repository
http://cvs.openpkg.org/
____________________________________________________________________________
Server: cvs.openpkg.org Name: Thomas Lotterer
Root: /v/openpkg/cvs Email: [EMAIL PROTECTED]
Module: openpkg-tools Date: 18-Feb-2005 13:00:57
Branch: HEAD Handle: 2005021812005500
Modified files:
openpkg-tools/cmd bf-db.pl
Log:
consequent use of SQLite lock retry logic
Summary:
Revision Changes Path
1.12 +22 -13 openpkg-tools/cmd/bf-db.pl
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: openpkg-tools/cmd/bf-db.pl
============================================================================
$ cvs diff -u -r1.11 -r1.12 bf-db.pl
--- openpkg-tools/cmd/bf-db.pl 17 Feb 2005 10:00:26 -0000 1.11
+++ openpkg-tools/cmd/bf-db.pl 18 Feb 2005 12:00:55 -0000 1.12
@@ -201,11 +201,14 @@
" pr_heartbeat ) " .
"VALUES ( ?, ?, ?, ?, ?, ?, ?, ? );"
);
- $rv = $sth->execute(
- $host, $arch, $os, $tag,
- $name, $version, $release,
- $time
- );
+ $retries = $lockretries; do {
+ $rv = $sth->execute(
+ $host, $arch, $os, $tag,
+ $name, $version, $release,
+ $time
+ );
+ } while (not $rv and $dbh->errstr =~ m|lock|i and sleep(1) and
$retries-- >= 1);
+ printf STDERR "DEBUG:$0: countdown from %d to %d\n", $lockretries,
$retries if($opt_verbose);
if (not $rv) {
print STDERR "ERROR:$0: SQLite error: ".$dbh->errstr."\n";
exit(2);
@@ -230,10 +233,13 @@
" st_inst_host = ? and st_inst_arch = ? and st_inst_os = ?
and st_inst_tag = ? and " .
" st_package_name = ? );"
);
- $rv = $sth->execute(
- $host, $arch, $os, $tag,
- $name
- );
+ $retries = $lockretries; do {
+ $rv = $sth->execute(
+ $host, $arch, $os, $tag,
+ $name
+ );
+ } while (not $rv and $dbh->errstr =~ m|lock|i and sleep(1) and
$retries-- >= 1);
+ printf STDERR "DEBUG:$0: countdown from %d to %d\n", $lockretries,
$retries if($opt_verbose);
if (not $rv) {
print STDERR "ERROR:$0: SQLite error: ".$dbh->errstr."\n";
exit(2);
@@ -246,10 +252,13 @@
" st_package_name, st_package_version, st_package_release
) " .
"VALUES ( ?, ?, ?, ?, ?, ?, ? );"
);
- my $rv = $sth->execute(
- $host, $arch, $os, $tag,
- $name, $version, $release,
- );
+ $retries = $lockretries; do {
+ $rv = $sth->execute(
+ $host, $arch, $os, $tag,
+ $name, $version, $release,
+ );
+ } while (not $rv and $dbh->errstr =~ m|lock|i and sleep(1) and
$retries-- >= 1);
+ printf STDERR "DEBUG:$0: countdown from %d to %d\n",
$lockretries, $retries if($opt_verbose);
if (not $rv) {
print STDERR "ERROR:$0: SQLite error: ".$dbh->errstr."\n";
exit(2);
@@ .
______________________________________________________________________
The OpenPKG Project www.openpkg.org
CVS Repository Commit List [email protected]