View Issue Details

IDProjectCategoryView StatusLast Update
0000010Bacula-Webbugpublic2013-11-19 15:06
ReporterdavideAssigned Todavide 
PriorityhighSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version5.0.3 
Target Version5.2.2Fixed in Version5.2.2 
Summary0000010: Improve postgreSQL
Description[davidb]
I've downloaded your postgres port...
Remaining bugs follows:
- in the file classes.inc
line 134
database_size is not recognized (only on postgresql >= 8.0) -> changed temporarly to "select 0" solves the problem (but the reported database size is wrong). I've no idea to get the actual database size on postgres < 8.0

line 365 should be:
$res = $DB_bacula->link->query("select Name from Job where EndTime > now() - 1 * interval '$this->elapsed s' group by Name order by Name desc")

line 367 should be:
$resdata = $DB_bacula->link->query("select to_char(EndTime,'YY-MM-DD') from Job where EndTime > NOW() - 1*interval '$this->elapsed s' group by EndTime order by EndTime")

line 390 should be:
$result = $DB_bacula->link->query("select to_char(EndTime,'YY-MM-DD'),SUM(JobBytes) as sum,Name,count(Name) as Nname from Job WHERE EndTime like '%$tmpdata[0]%' group by EndTime,Name order by Name desc")
-> this implies changes on line 393 which should be:
$spr2 = array_merge($spr2,array($row["name"]=>$row["sum"]));


- in the file index.php line 133
A ) is placed at the end of the line and should not be present


Hope this will help you
TagsNo tags attached.

Activities

davide

2010-09-06 21:51

manager   ~0000004

[bcabezas]
In addition to davidb reported bugs, seems that total backup time ($TotalElapsed) is not properly calculated.

The php script spects "number of seconds" from the sql query, but postgresql query is currently returning an INTERVAL string of type HH:MM:SS.

Using the postgresql function to_char(interval,'SSSS') works for me (maybe is not the correct solution).

This is the output from "diff -u" command:


--- /home/bcabezas/bacula-web/index.php 2005-10-06 16:45:48.000000000 +0200
+++ index.php 2005-10-19 17:34:24.000000000 +0200
@@ -115,7 +115,7 @@
           $ret = $dbSql->link->query("select UNIX_TIMESTAMP(EndTime)-UNIX_TIMESTAMP(StartTime) as elapsed from Job where EndTime <= NOW() and UNIX_TIMESTAMP(EndTime) > UNIX_TIMESTAMP(NOW())-84600")
                 or die ("Error at row 110");
         if ( $dbSql->driver == "pgsql" )
- $ret = $dbSql->link->query("select EndTime - StartTime as elapsed from Job where EndTime <= NOW() and EndTime > NOW() - 84600 * interval '1 second'")
+ $ret = $dbSql->link->query("select to_char(EndTime - StartTime,'SSSS') as elapsed from Job where EndTime <= NOW() and EndTime > ( NOW() - 84600 * interval '1 second')")
                 or die ("Error at row 113");
         while ( $res = $ret->fetchRow() ) {
                 if ( $TotalElapsed < 1000000000 ) // Temporal "workaround" ;) Fix later
@@ -136,7 +136,7 @@
                                 LEFT JOIN Pool ON Job.PoolId=Pool.PoolId where EndTime <= NOW() and UNIX_TIMESTAMP(EndTime) >UNIX_TIMESTAMP(NOW())-86400
                                 order by elapsed "; // Full report array
         if ( $dbSql->driver == "pgsql")
- $query = "select Job.EndTime - Job.StartTime )
+ $query = "select Job.EndTime - Job.StartTime
                                 as elapsed,Job.Name,Job.StartTime,Job.EndTime,Job.Level,Pool.Name,Job.JobStatus from Job
                                 LEFT JOIN Pool ON Job.PoolId=Pool.PoolId where EndTime <= NOW() and EndTime > NOW() - 86400 * interval '1 second'
                                 order by elapsed ";


Regards

davide

2011-12-11 14:44

manager   ~0000078

Bug with postgreSQL fixed

davide

2013-11-19 15:06

manager   ~0000348

Issue closed

Issue History

Date Modified Username Field Change
2010-09-06 21:50 davide New Issue
2010-09-06 21:50 davide Status new => assigned
2010-09-06 21:50 davide Assigned To => davide
2010-09-06 21:51 davide Note Added: 0000004
2011-07-21 23:57 davide Product Version => 5.0.3
2011-07-21 23:57 davide Fixed in Version => 5.1.0 - alpha
2011-07-21 23:57 davide Target Version => 5.1.0 - alpha
2011-07-25 23:03 davide Fixed in Version 5.1.0 - alpha =>
2011-07-25 23:03 davide Target Version 5.1.0 - alpha => 5.1.0 - beta
2011-11-06 12:54 davide Target Version 5.1.0 - beta => 5.2.2
2011-12-11 14:44 davide Fixed in Version => 5.2.2
2011-12-11 14:44 davide Note Added: 0000078
2011-12-11 14:44 davide Status assigned => resolved
2011-12-11 14:44 davide Resolution open => fixed
2013-11-19 15:06 davide Status resolved => closed
2013-11-19 15:06 davide Note Added: 0000348