Better error message on DB_VERSION_MISMATCH errors
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
This commit is contained in:
parent
48060cea0a
commit
b375be9f75
@ -0,0 +1,42 @@
|
|||||||
|
From b89d65e5ca0552b2a33db7c82d72cfc81677588d Mon Sep 17 00:00:00 2001
|
||||||
|
From: Panu Matilainen <pmatilai@redhat.com>
|
||||||
|
Date: Tue, 19 Sep 2017 09:56:36 +0200
|
||||||
|
Subject: [PATCH] Fall back to DB_PRIVATE on DB_VERSION_MISMATCH from rpmdb
|
||||||
|
open
|
||||||
|
|
||||||
|
This happens when libdb or glibc gets updated in the transaction so
|
||||||
|
its version appears newer than the currently used one requiring libdb
|
||||||
|
to reconstruct its environment, but the environment is in use by the
|
||||||
|
running transaction so it can't do that. Since libsolv only opens
|
||||||
|
it for reading, DB_PRIVATE is the lesser evil compared to just failing.
|
||||||
|
Also print out a diagnostic so we don't need to keep guessing whether
|
||||||
|
the fix is in place or not. dbenv->errx() needs to be used for the
|
||||||
|
message to get through in the right context, fprintf() get either eaten
|
||||||
|
or printed long after the fact.
|
||||||
|
---
|
||||||
|
ext/repo_rpmdb.c | 9 ++++++++-
|
||||||
|
1 file changed, 8 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/ext/repo_rpmdb.c b/ext/repo_rpmdb.c
|
||||||
|
index ceaf351..a0140a0 100644
|
||||||
|
--- a/ext/repo_rpmdb.c
|
||||||
|
+++ b/ext/repo_rpmdb.c
|
||||||
|
@@ -1247,7 +1247,14 @@ opendbenv(struct rpmdbstate *state)
|
||||||
|
{
|
||||||
|
#if defined(FEDORA) || defined(MAGEIA)
|
||||||
|
int serialize_fd = serialize_dbenv_ops(state);
|
||||||
|
- r = dbenv->open(dbenv, dbpath, DB_CREATE|DB_INIT_CDB|DB_INIT_MPOOL, 0644);
|
||||||
|
+ int eflags = DB_CREATE|DB_INIT_CDB|DB_INIT_MPOOL;
|
||||||
|
+ r = dbenv->open(dbenv, dbpath, eflags, 0644);
|
||||||
|
+ if (r == DB_VERSION_MISMATCH)
|
||||||
|
+ {
|
||||||
|
+ eflags |= DB_PRIVATE;
|
||||||
|
+ dbenv->errx(dbenv, "warning: DB_VERSION_MISMATCH, retrying with DB_PRIVATE");
|
||||||
|
+ r = dbenv->open(dbenv, dbpath, eflags, 0644);
|
||||||
|
+ }
|
||||||
|
if (serialize_fd >= 0)
|
||||||
|
close(serialize_fd);
|
||||||
|
#else
|
||||||
|
--
|
||||||
|
2.15.0
|
||||||
|
|
@ -1,31 +0,0 @@
|
|||||||
From a7adb20f24a3acc4cd300b9fb12e07ee3dcfb8e3 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Panu Matilainen <pmatilai@redhat.com>
|
|
||||||
Date: Tue, 19 Sep 2017 09:56:36 +0200
|
|
||||||
Subject: [PATCH] fall back to DB_PRIVATE on DB_VERSION_MISMATCH
|
|
||||||
|
|
||||||
---
|
|
||||||
ext/repo_rpmdb.c | 8 +++++++-
|
|
||||||
1 file changed, 7 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/ext/repo_rpmdb.c b/ext/repo_rpmdb.c
|
|
||||||
index c7000a9..85e327c 100644
|
|
||||||
--- a/ext/repo_rpmdb.c
|
|
||||||
+++ b/ext/repo_rpmdb.c
|
|
||||||
@@ -1246,7 +1246,13 @@ opendbenv(struct rpmdbstate *state)
|
|
||||||
{
|
|
||||||
#if defined(FEDORA) || defined(MAGEIA)
|
|
||||||
int serialize_fd = serialize_dbenv_ops(state);
|
|
||||||
- r = dbenv->open(dbenv, dbpath, DB_CREATE|DB_INIT_CDB|DB_INIT_MPOOL, 0644);
|
|
||||||
+ int eflags = DB_CREATE|DB_INIT_CDB|DB_INIT_MPOOL;
|
|
||||||
+ r = dbenv->open(dbenv, dbpath, eflags, 0644);
|
|
||||||
+ if (r == DB_VERSION_MISMATCH)
|
|
||||||
+ {
|
|
||||||
+ eflags |= DB_PRIVATE;
|
|
||||||
+ r = dbenv->open(dbenv, dbpath, eflags, 0644);
|
|
||||||
+ }
|
|
||||||
if (serialize_fd >= 0)
|
|
||||||
close(serialize_fd);
|
|
||||||
#else
|
|
||||||
--
|
|
||||||
2.14.1
|
|
||||||
|
|
@ -38,14 +38,14 @@
|
|||||||
|
|
||||||
Name: lib%{libname}
|
Name: lib%{libname}
|
||||||
Version: 0.6.30
|
Version: 0.6.30
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
Summary: Package dependency solver
|
Summary: Package dependency solver
|
||||||
|
|
||||||
License: BSD
|
License: BSD
|
||||||
URL: https://github.com/openSUSE/libsolv
|
URL: https://github.com/openSUSE/libsolv
|
||||||
Source: %{url}/archive/%{version}/%{name}-%{version}.tar.gz
|
Source: %{url}/archive/%{version}/%{name}-%{version}.tar.gz
|
||||||
# https://bugzilla.redhat.com/show_bug.cgi?id=1483553
|
# https://bugzilla.redhat.com/show_bug.cgi?id=1483553
|
||||||
Patch0: 0001-fall-back-to-DB_PRIVATE-on-DB_VERSION_MISMATCH.patch
|
Patch0: 0001-Fall-back-to-DB_PRIVATE-on-DB_VERSION_MISMATCH-from-.patch
|
||||||
|
|
||||||
BuildRequires: cmake
|
BuildRequires: cmake
|
||||||
BuildRequires: gcc-c++
|
BuildRequires: gcc-c++
|
||||||
@ -288,6 +288,9 @@ popd
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Nov 06 2017 Panu Matilainen <pmatilai@redhat.com> - 0.6.30-2
|
||||||
|
- Better error message on DB_VERSION_MISMATCH errors
|
||||||
|
|
||||||
* Tue Oct 24 2017 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 0.6.30-1
|
* Tue Oct 24 2017 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 0.6.30-1
|
||||||
- Update to 0.6.30
|
- Update to 0.6.30
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user