Hello guys,

I experience race condition if I try to start 2 or more  simulatenous
restore jobs (at the very same time). There are 2 temporary tables,
which are created during restore, with names "temp" and "temp1". The
definition of these tables can be seen here: File: sql_cmds.c (Bacula
5.2.13) 

######################## 
File: ~/src/cats/sql_cmds.c


660: const char *uar_create_temp[] = {
.....
719: const char *uar_create_temp1[] = {
.....
########################



The problem is that if I start the jobs at the very same time (which
I'm able to reproduce without problem), the race conditions happens and
then the restore fails, also giving the following error: 


########################
Query failed: INSERT INTO temp1 SELECT Job.JobId,JobTdate FROM
Client,Job,JobMedia,Media,FileSet WHERE Client.ClientId=1 AND
Job.ClientId=1 AND Job.StartTime < '2013-07-23 23:59:59' AND Level='F'
AND JobStatus IN ('T','W') AND Type='B' AND JobMedia.JobId=Job.JobId
AND Media.Enabled=1 AND JobMedia.MediaId=Media.MediaId AND
Job.FileSetId=FileSet.FileSetId AND
FileSet.FileSet='internav_shared-fileset' ORDER BY Job.JobTDate DESC
LIMIT 1: ERR=ERROR:  relation "temp1" does not exist LINE 1: INSERT
INTO temp1 SELECT Job.JobId,JobTdate FROM Client,Job,...
########################

I'm also concerned if this race condition could result in restoring
wrong files on the wrong place ? 


I suppose(I'm not familiar with bacula source code) that the simplest
resolution would be to append some dynamic (unique) value to the names
of these tables (temp$RAND , temp1$RAND2).

It seems that there are few more temporary tables, where this problem

is considered and the names are dynamically unique, for example:
######################### 
File: ~/src/cats/sql_cmds.c

432: static const char *create_temp_accurate_jobids_default =
433: "CREATE TABLE btemp3%s AS "
#########################

Regards

------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Bacula-devel mailing list
Bacula-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-devel

Reply via email to