View Issue Details

IDProjectCategoryView StatusLast Update
0000368bareos-coreGeneralpublic2015-11-19 14:18
Reporterfvl Assigned To 
PriorityhighSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformX86_64OSGentoo LinuxOS Version~amd64
Product Version14.2.1 
Fixed in Version15.2.1 
Summary0000368: Bareos and PostgreSQL errors
DescriptionWhen i run two parallel jobs for clients i get the following errors:

24-Nov 05:03 backup-dir JobId 24: Query failed: CREATE TEMPORARY TABLE DelCandidates (JobId INTEGER NOT NULL, PurgedFiles SMALLINT, FileSetId INTEGER, JobFiles INTEGER, JobStatus char(1)): ERR=ERROR: current transaction is aborted, commands ignored until end of transaction block

24-Nov 05:03 backup-dir JobId 24: Begin pruning Files.
24-Nov 05:03 backup-dir JobId 24: Query failed: SELECT COUNT(1) FROM Job JOIN Client USING (ClientId) JOIN Pool ON (Job.PoolId = Pool.PoolId) WHERE PurgedFiles=0 AND JobTDate < 1411646616 AND Client.Name = 'backup-fd' AND Pool.Name = 'incremental-backup-pool' : ERR=ERROR: current transaction is aborted, commands ignored until end of transaction block
Additional InformationSee attached archive for logs and configurations.
TagsNo tags attached.

Activities

fvl

fvl

2014-11-24 13:17

reporter  

filebug.tar.gz (8,863 bytes)
mvwieringen

mvwieringen

2014-11-24 16:28

developer   ~0001075

First of all a beta of a database is not really something I'm to interested
in. Its seems the new version changed its behavior which is BAD. Things have
worked fine for ages so these kind of changes to the defaults are not the
smartest as to compatibility with older versions.

Given that this PostgreSQL version will take ages before any normal distribution
will make it a standard we still have time to find out what is happening and
maybe the PostgreSQL people will come to the conclusion that changing such
options is not very elegant.

Given that we in 14.x will not support PostgreSQL 8.4 anymore means that we
might try using the non portable SQL syntax for dropping a table.

You could try the attached patch and see if it fixes anything if not don't
expect things to get fixed soon as I don't believe it makes sense to support
a beta database version.
mvwieringen

mvwieringen

2014-11-24 16:29

developer  

0001-Use-DB-engine-specific-queries-fro-dropping-temp-tab.patch (1,574 bytes)   
From 53f8ebb99e268ce751bcb166841fdc228c97a7d2 Mon Sep 17 00:00:00 2001
From: Marco van Wieringen <marco.van.wieringen@bareos.com>
Date: Mon, 24 Nov 2014 14:35:06 +0100
Subject: [PATCH] Use DB engine specific queries fro dropping temp table.

Fixes #368: Bareos and PostgreSQL errors
---
 src/cats/sql_cmds.c |   17 +++++++++++++++--
 src/dird/ua_prune.c |    5 +----
 2 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/src/cats/sql_cmds.c b/src/cats/sql_cmds.c
index 9d8942a..83897bf 100644
--- a/src/cats/sql_cmds.c
+++ b/src/cats/sql_cmds.c
@@ -95,9 +95,22 @@ const char *sel_JobMedia =
    "AND Job.JobTDate<%s";
 
 /* Delete temp tables and indexes  */
+static const char *drop_deltabs_default =
+   "DROP TABLE DelCandidates";
+
 const char *drop_deltabs[] = {
-   "DROP TABLE DelCandidates",
-   NULL};
+   /* MySQL */
+   "DROP TABLE IF EXISTS DelCandidates",
+
+   /* Postgresql */
+   "DROP TABLE IF EXISTS DelCandidates",
+
+   /* SQLite3 */
+   drop_deltabs_default,
+
+   /* Ingres */
+   drop_deltabs_default
+};
 
 const char *create_delindex = "CREATE INDEX DelInx1 ON DelCandidates (JobId)";
 
diff --git a/src/dird/ua_prune.c b/src/dird/ua_prune.c
index 0a15cd0..3f1e586 100644
--- a/src/dird/ua_prune.c
+++ b/src/dird/ua_prune.c
@@ -566,10 +566,7 @@ bail_out:
 
 static void drop_temp_tables(UAContext *ua)
 {
-   int i;
-   for (i=0; drop_deltabs[i]; i++) {
-      db_sql_query(ua->db, drop_deltabs[i]);
-   }
+   db_sql_query(ua->db, drop_deltabs[db_get_type_index(ua->db)]);
 }
 
 static bool create_temp_tables(UAContext *ua)
-- 
1.7.3.2

fvl

fvl

2014-11-25 10:02

reporter   ~0001076

Yes, this patch solves problem.
Ticket closed.
mvwieringen

mvwieringen

2014-11-25 10:56

developer   ~0001079

Fix committed to bareos master branch with changesetid 2390.
fvl

fvl

2015-03-11 11:50

reporter   ~0001308

Whats wrong? Problem happen again in 14.2.3
joergs

joergs

2015-11-19 14:11

developer   ~0002001

Can you attach the current error messages? What version of Postgresql are you using? It only happens, when multiple jobs run at the same time?
mvwieringen

mvwieringen

2015-11-19 14:17

developer   ~0002002

We only have this fix in 15.2 and later will not be backported to 14.2
PostgreSQL 9.4 is not supported with 14.2 and lower.

Related Changesets

bareos: master 18d96762

2014-11-24 14:35

mvwieringen

Ported: N/A

Details Diff
Use DB engine specific queries for dropping temp table.

Fixes 0000368: Bareos and PostgreSQL errors
Affected Issues
0000368
mod - src/cats/sql_cmds.c Diff File
mod - src/dird/ua_prune.c Diff File

Issue History

Date Modified Username Field Change
2014-11-24 13:17 fvl New Issue
2014-11-24 13:17 fvl File Added: filebug.tar.gz
2014-11-24 13:31 mvwieringen Severity major => minor
2014-11-24 16:28 mvwieringen Note Added: 0001075
2014-11-24 16:29 mvwieringen File Added: 0001-Use-DB-engine-specific-queries-fro-dropping-temp-tab.patch
2014-11-24 16:29 mvwieringen Assigned To => mvwieringen
2014-11-24 16:29 mvwieringen Status new => feedback
2014-11-25 10:02 fvl Note Added: 0001076
2014-11-25 10:02 fvl Status feedback => assigned
2014-11-25 10:56 mvwieringen Changeset attached => bareos master 18d96762
2014-11-25 10:56 mvwieringen Note Added: 0001079
2014-11-25 10:56 mvwieringen Status assigned => resolved
2014-11-25 10:56 mvwieringen Resolution open => fixed
2014-11-25 11:24 mvwieringen Status resolved => closed
2014-11-25 11:24 mvwieringen Assigned To mvwieringen =>
2015-03-11 11:50 fvl Note Added: 0001308
2015-03-11 11:50 fvl Status closed => feedback
2015-03-11 11:50 fvl Resolution fixed => reopened
2015-11-19 14:10 joergs Status feedback => acknowledged
2015-11-19 14:11 joergs Note Added: 0002001
2015-11-19 14:11 joergs Assigned To => joergs
2015-11-19 14:11 joergs Status acknowledged => feedback
2015-11-19 14:17 mvwieringen Note Added: 0002002
2015-11-19 14:18 mvwieringen Status feedback => closed
2015-11-19 14:18 mvwieringen Assigned To joergs =>
2015-11-19 14:18 mvwieringen Resolution reopened => fixed
2015-11-19 14:18 mvwieringen Fixed in Version => 15.2.1