Bacula-users

Re: [Bacula-users] Job renaming

2011-02-10 06:38:03
Subject: Re: [Bacula-users] Job renaming
From: Marcello Romani <mromani AT ottotecnica DOT com>
To: bacula-users AT lists.sourceforge DOT net
Date: Thu, 10 Feb 2011 12:36:06 +0100
Il 10/02/2011 10.38, Timo Neuvonen ha scritto:
>> Hallo,
>>      I found a typo in a Job resource that has been backed up for a
>> couple of weeks, so I wanted to rename it. Here are the steps I took. I
>> hope it will be useful to somebody else.
>> Bacula gurus feel free to burn me if this is heresy :-)
>>
>> References:
>> http://www.mail-archive.com/bacula-users AT lists.sourceforge DOT 
>> net/msg20479.html
>>
>> Let's call the job Mailserver and suppose the misspelled name is
>> Malserver (missing 'i').
>>
>> The database server is postgresql.
>>
>> - stop bacula-director to avoid catalog modifications while we are
>> working on it;
>>
>> - backup the catalog (e.g. with mysql or postgresql dump tools), just in
>> case;
>>
>> - rename the job in the bacula-dir config file;
>>
>> - connect to bacula database directly via db console (psql in my case)
>>    The table we'll work on is named "job".
>>    The columns that we have to modify are "job" and "name".
>>    The jobhist table should also be checked: if it has records, the
>> procedure should be applied there too.
>>
>> - count the number of records to be modified (just to check the update
>> command)
>> bacula=# SELECT COUNT(*) FROM job WHERE name='Malserver';
>> bacula=# SELECT COUNT(*) FROM job WHERE job LIKE 'Malserver%';
>> You should get the same number of records.
>>
>> - update the name column
>> bacula=# UPDATE job SET name='Mailserver' WHERE name='Malserver';
>>
>> - update the job column
>> bacula=# UPDATE job SET job=replace(job, 'Malserver', 'Mailserver')
>> WHERE job LIKE 'Malserver%';
>>
>> The two update commands should modify the same number of rows counted
>> before.
>>
>> - Check the jobhist row count and apply the rename procedure if it's not
>> zero.
>>
>> - restart the director
>>
>> The misspelled job name will remain unchanged in the "terminated jobs"
>> section of the status command, both on the director and on the client
>> nodes (*-fd). That's because that information is stored into status
>> files and not into the database.
>>
>>
>> - Test table
>> Before applying the update commands to the actual catalog, I tested them
>> on a temporary table. To create and populate it with the actual records,
>> I used the following commands:
>> bacula=# CREATE TABLE test_rename(jobid integer, job text, name text);
>> bacula=# INSERT INTO  test_rename(jobid, job, name) SELECT jobid, job,
>> name FROM job;
>> Obviously a DROP TABLE test should be issued at the end of the rename
>> procedure.
>>
>
> Nice trick. A couple of things that came into my mind:
>
> - I think the job's name (among other things) is used to calculate a hash to
> identify changes in the job. This propably will force next backups to be
> promoted to full?

The first job run after the renaming has been Incremental as expected, 
so at least at first glance it seems renaming doesn't cause a backup 
level promotion from I to F.

>
> - is the job's name inside the stored data in the physical volume too, or
> only in the catalog? I belive it's there, since there is a tool to re-build
> the catalog from the media. So, does restore still work, or will it crash
> because of some conflict between names?

I did a full restore of the client which the renamed job refers to.
The restore included one job run after the job was renamed and four job 
runs before the job was renamed.
The director completed the restore job without any warnings or errors.
A quick check with ls did not reveal any major inconsistency (I know the 
folder structure fairly well because it's my home folder).

>
> --
> TiN
>
>
>
> ------------------------------------------------------------------------------
> The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
> Pinpoint memory and threading errors before they happen.
> Find and fix more than 250 security defects in the development cycle.
> Locate bottlenecks in serial and parallel code that limit performance.
> http://p.sf.net/sfu/intel-dev2devfeb
> _______________________________________________
> Bacula-users mailing list
> Bacula-users AT lists.sourceforge DOT net
> https://lists.sourceforge.net/lists/listinfo/bacula-users

Thank you for your ideas.

Marcello

------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users

<Prev in Thread] Current Thread [Next in Thread>