]> git.sur5r.net Git - bacula/bacula/blob - bacula/kernstodo
Update doc
[bacula/bacula] / bacula / kernstodo
1                  Kern's ToDo List
2                    29 July 2003 
3
4 Documentation to do: (any release a little bit at a time)
5 - Document running a test version.
6 - Document query file format.
7 - Document static linking
8 - Document problems with Verify and pruning.
9 - Document how to use multiple databases.
10 - For FreeBSD typical /dev/nrsa0 and for mtx /dev/pass1
11 - VXA drives have a "cleaning required"
12   indicator, but Exabyte recommends preventive cleaning after every 75
13   hours of operation.
14 - Lookup HP cleaning recommendations.
15 - Lookup HP tape replacement recommendations (see trouble shooting autochanger)
16 - Document FInclude ...
17 - Document all the status codes JobLevel, JobType, JobStatus.
18           
19 Testing to do: (painful)
20 - that ALL console command line options work and are always implemented
21 - blocksize recognition code.
22 - Test if rewind at end of tape waits for tape to rewind.
23 - Test cancel at EOM.       
24 - Test not zeroing Autochanger slot when it is wrong.
25 - Test recycling and purging (code changed in db_find_next_volume and
26   in recycle.c).
27 - Figure out how to use ssh or stunnel to protect Bacula communications.
28
29 For 1.31 release:
30
31
32
33 For 1.32:
34 - Maybe remove multiple simultaneous devices code in SD.
35 - On Windows with very long path names, it may be impossible to create 
36   a file (and thus restore it) because the total length is too long.
37   We must cd into the directory then create the file without the
38   full path name.
39 - lstat() is not going to work on Win32 for testing date.
40 - Something is not right in last block of fill command.
41 - Implement a Recycle command
42 - Implement List Volume Job=xxx  or List scheduled volumes or Status Director 
43 - Add FileSet to command line arguments for restore.
44 - Do full check the command line args in update (e.g. VolStatus ...).
45 - Allow multiple Storage specifications (or multiple names on
46   a single Storage specification) in the Job record. Thus a job 
47   can be backed up to a number of storage devices.
48 - Add client name to cram-md5 challenge so Director can immediately
49   verify if it is the correct client.
50 - Implement ClientRunBeforeJob and ClientRunAfterJob.
51 - Implement new alist in FileSet scanning.
52 - Add JobLevel in FD status (but make sure it is defined).
53 - Audit all UA commands to ensure that we always prompt where possible.
54 - Restrict characters permitted in a Resource name, and don't permit
55   duplicate names.
56 - Prohibit backing up archive device (findlib/find_one.c:128)
57 - Make | and < work on FD side.
58 - Check Jmsg in bnet, may not work, must dup bsock.
59 - Suppress Job Name in Jmsg for console
60 - Create Pools that are referenced in a Run statement at startup if possible.
61 - Use runbeforejob to unload, then reload a volume previously used,
62   then the next job run gets an error reading the drive.
63 - Make bootstrap filename unique.
64 - Test a second language e.g. french.
65 - Start working on Base jobs.
66 - Make "make binary-release" work from any directory.
67 - Unsaved Flag in Job record (use JobMissingFiles).
68 - Base Flag in Job record.
69 - Implement UnsavedFiles DB record.
70 - Implement argc/argv for daemon command line scanning using table driven
71   stuff below.
72 - Implement table driven single argc/argv scanner to pickup all arguments.
73   Much like xxx_conf.c scan table.
74   keyword, handler(store_routine), store_address, code, flags, default.
75 - From Phil Stracchino:
76   It would probably be a per-client option, and would be called
77   something like, say, "Automatically purge obsoleted jobs".  What it
78   would do is, when you successfully complete a Differential backup of a
79   client, it would automatically purge all Incremental backups for that
80   client that are rendered redundant by that Differential.  Likewise,
81   when a Full backup on a client completed, it would automatically purge
82   all Differential and Incremental jobs obsoleted by that Full backup.
83   This would let people minimize the number of tapes they're keeping on
84   hand without having to master the art of retention times.
85 - Implement new serialize subroutines
86    send(socket, "string", &Vol, "uint32", &i, NULL)
87 - Scratch Pool where the volumes can be re-assigned to any Pool.
88 - Implement a M_SECURITY message class.
89 - Implement forward spacing block/file: position_device(bsr) --
90   just before read_block_from_device();
91 - When doing a Backup send all attributes back to the Director, who
92   would then figure out what files have been deleted.
93 - Currently in mount.c:236 the SD simply creates a Volume. It should have
94   explicit permission to do so.  It should also mark the tape in error
95   if there is an error.
96 - Make sure all restore counters are working correctly in the FD.
97 - SD Bytes Read is wrong.
98 - Configure mtx-changer to have correct path to mtx.
99 - Look at ALL higher level routines that call block.c to be sure
100   they don't expect something in errmsg.
101 - Investigate doing RAW backup of Win32 partition.
102 - Add JobName= to VerifyToCatalog so that all verifies can be done at the end.
103 - Add thread specific data to hold the jcr -- send error messages from
104   low level routines by accessing it and using Jmsg().
105 - Cancel waiting for Client connect in SD if FD goes away.
106
107 - Add Progress command that periodically reports the progress of
108   a job or all jobs.
109 - One block was orphaned in the SD probably after cancel.
110 - Add all command line arguments to "update", e.g. slot=nn volStatus=append, ...
111
112
113 - Examine Bare Metal restore problem (a FD crash exists somewhere ...).
114 - Implement timeout in response() when it should come quickly.
115 - Implement console @echo command.
116 - Implement a Slot priority (loaded/not loaded).
117 - Implement "vacation" Incremental only saves.
118 - Implement single pane restore (much like the Gftp panes).
119 - Implement Automatic Mount even in operator wait.
120 - Implement create "FileSet"?
121 - Implement Release Device in the Job resource to unmount a drive.
122 - Implement Acquire Device in the Job resource to mount a drive,
123   be sure this works with admin jobs so that the user can get
124   prompted to insert the correct tape.  Possibly some way to say to
125   run the job but don't save the files.
126 - Implement all command line args on run.
127 - Implement command line "restore" args.
128 - Implement "restore current select=no"
129 - Fix watchdog pthread crash on Win32 (this is pthread_kill() Cygwin bug)
130 - Implement "scratch pool" where tapes are defined and can be
131   taken by any pool that needs them.
132 - Implement restore "current system", but take all files without
133   doing selection tree -- so that jobs without File records can
134   be restored.
135 - Implement disk spooling. Two parts: 1. Spool to disk then
136   immediately to tape to speed up tape operations. 2. Spool to
137   disk only when the tape is full, then when a tape is hung move
138   it to tape.
139 - Implement a relocatable bacula.spec 
140 - Implement dump/print label to UA
141 - Add prefixlinks to where or not where absolute links to FD.
142 - Issue message to mount a new tape before the rewind.
143 - Simplified client job initiation for portables.
144 - If SD cannot open a drive, make it periodically retry.
145 - Implement LabelTemplate (at least first cut).
146 - Add more of the config info to the tape label.
147 - Implement a Mount Command and an Unmount Command where
148   the users could specify a system command to be performed
149   to do the mount, after which Bacula could attempt to
150   read the device. This is for Removeable media such as a CDROM.
151   - Most likely, this mount command would be invoked explicitly
152   by the user using the current Console "mount" and "unmount" 
153   commands -- the Storage Daemon would do the right thing 
154   depending on the exact nature of the device.
155   - As with tape drives, when Bacula wanted a new removable
156   disk mounted, it would unmount the old one, and send a message
157   to the user, who would then use "mount" as described above 
158   once he had actually inserted the disk.
159
160 - Make some way so that if a machine is skipped because it is not up 
161   that Bacula will continue retrying for a specified period of time --
162   periodically.
163 - If tape is marked read-only, then try opening it read-only rather than
164   failing, and remember that it cannot be written.
165 - Refine SD waiting output:
166     Device is being positioned
167     >     Device is being positioned for append
168     >     Device is being positioned to file x
169     > 
170 - Figure out some way to estimate output size and to avoid splitting
171   a backup across two Volumes -- this could be useful for writing CDROMs
172   where you really prefer not to have it split -- not serious.
173 - Add RunBeforeJob and RunAfterJob to the Client program.
174 - Have SD compute MD5 or SHA1 and compare to what FD computes.
175 - Make VolumeToCatalog calculate an MD5 or SHA1 from the 
176   actual data on the Volume and compare it.                  
177 - Implement FileOptions (see end of this document)
178 - Implement Bacula plugins -- design API
179 - Make bcopy read through bad tape records.
180 - Fix read_record to handle multiple sessions.
181 - Program files (i.e. execute a program to read/write files).
182   Pass read date of last backup, size of file last time.
183 - Add Signature type to File DB record.
184 - CD into subdirectory when open()ing files for backup to
185   speed up things.  Test with testfind().
186 - Priority job to go to top of list.
187 - Why are save/restore of device different sizes (sparse?)   Yup! Fix it.
188 - Implement some way for the Console to dynamically create a job.
189 - Restore to a particular time -- e.g. before date, after date. 
190 - Solaris -I on tar for include list
191 - Need a verbose mode in restore, perhaps to bsr.
192 - bscan without -v is too quiet -- perhaps show jobs.
193 - Add code to reject whole blocks if not wanted on restore.
194 - Check if we can increase Bacula FD priorty in Win2000
195 - Make sure the MaxVolFiles is fully implemented in SD
196 - Check if both CatalogFiles and UseCatalog are set to SD.
197 - Need return status on read_cb() from read_records(). Need multiple
198   records -- one per Job, maybe a JCR or some other structure with
199   a block and a record.
200 - Figure out how to do a bare metal Windows restore
201 - Possibly add email to Watchdog if drive is unmounted too
202   long and a job is waiting on the drive.
203 - Use read_record.c in SD code.
204 - Restore program that errors in SD due to no tape reports
205   OK incorrectly in output.
206 - After unmount, if restore job started, ask to mount.
207 - Convert all %x substitution variables, which are hard to remember
208   and read to %(variable-name).  Idea from TMDA.
209 - Remove NextId for SQLite. Optimize.
210 - Move all SQL statements into a single location.
211 - Add UA rc and history files.
212 - put termcap (used by console) in ./configure and
213   allow -with-termcap-dir.
214 - Enhance time and size scanning routines.
215 - Fix Autoprune for Volumes to respect need for full save.
216 - Fix Win32 config file definition name on /install
217 - Compare tape to Client files (attributes, or attributes and data) 
218 - Make all database Ids 64 bit.
219 - Write an applet for Linux.
220 - Add estimate to Console commands
221 - Implement new daemon communications protocol.
222 - Allow console commands to detach or run in background.
223 - Fix status delay on storage daemon during rewind.
224 - Add SD message variables to control operator wait time
225   - Maximum Operator Wait
226   - Minimum Message Interval
227   - Maximum Message Interval
228 - Send Operator message when cannot read tape label.
229 - Verify level=Volume (scan only), level=Data (compare of data to file).
230   Verify level=Catalog, level=InitCatalog
231 - Events file
232 - Add keyword search to show command in Console.
233 - Events : tape has more than xxx bytes.
234 - Complete code in Bacula Resources -- this will permit
235   reading a new config file at any time.
236 - Handle ctl-c in Console
237 - Implement script driven addition of File daemon to config files.
238 - Think about how to make Bacula work better with File (non-tape) archives.
239 - Write Unix emulator for Windows.
240 - Put memory utilization in Status output of each daemon
241   if full status requested or if some level of debug on.
242 - Make database type selectable by .conf files i.e. at runtime
243 - Set flag for uname -a.  Add to Volume label.
244 - Implement throttled work queue.
245 - Restore files modified after date
246 - Restore file modified before date
247 - Restore -- do nothing but show what would happen
248 - SET LD_RUN_PATH=$HOME/mysql/lib/mysql
249 - Implement Restore FileSet=
250 - Create a protocol.h and protocol.c where all protocol messages
251   are concentrated.
252 - Remove duplicate fields from jcr (e.g. jcr.level and jcr.jr.Level, ...).
253 - Timout a job or terminate if link goes down, or reopen link and query.
254 - Concept of precious tapes (cannot be reused).
255 - Make bcopy copy with a single tape drive.
256 - Permit changing ownership during restore.
257
258 - From Phil:
259   > My suggestion:  Add a feature on the systray menu-icon menu to request
260   > an immediate backup now.  This would be useful for laptop users who may
261   > not be on the network when the regular scheduled backup is run.
262   > 
263   > My wife's suggestion: Add a setting to the win32 client to allow it to
264   > shut down the machine after backup is complete (after, of course,
265   > displaying a "System will shut down in one minute, click here to cancel"
266   > warning dialog).  This would be useful for sites that want user
267   > woorkstations to be shut down overnight to save power.
268   > 
269
270 - Autolabel should be specified by DIR instead of SD.
271 - Storage daemon    
272   - Add media capacity
273   - AutoScan (check checksum of tape)
274   - Format command = "format /dev/nst0"
275   - MaxRewindTime
276   - MinRewindTime
277   - MaxBufferSize
278   - Seek resolution (usually corresponds to buffer size)
279   - EODErrorCode=ENOSPC or code
280   - Partial Read error code
281   - Partial write error code
282   - Nonformatted read error
283   - Nonformatted write error
284   - WriteProtected error
285   - IOTimeout
286   - OpenRetries
287   - OpenTimeout
288   - IgnoreCloseErrors=yes
289   - Tape=yes
290   - NoRewind=yes
291 - Pool
292   - Maxwrites
293   - Recycle period
294 - Job
295   - MaxWarnings
296   - MaxErrors (job?)
297 =====
298 - FD sends unsaved file list to Director at end of job (see
299   RFC below).
300 - File daemon should build list of files skipped, and then
301   at end of save retry and report any errors.
302 - Write a Storage daemon that uses pipes and
303   standard Unix programs to write to the tape.
304   See afbackup.
305 - Need something that monitors the JCR queue and
306   times out jobs by asking the deamons where they are.
307 - Enhance Jmsg code to permit buffering and saving to disk.
308 - device driver = "xxxx" for drives.
309 - Verify from Volume
310 - Ensure that /dev/null works
311 - Need report class for messages. Perhaps
312   report resource where report=group of messages
313 - enhance scan_attrib and rename scan_jobtype, and
314   fill in code for "since" option 
315 - Director needs a time after which the report status is sent
316   anyway -- or better yet, a retry time for the job.
317 - Don't reschedule a job if previous incarnation is still running.
318 - Some way to automatically backup everything is needed????
319 - Need a structure for pending actions:
320   - buffered messages
321   - termination status (part of buffered msgs?)
322 - Drive management
323   Read, Write, Clean, Delete
324 - Login to Bacula; Bacula users with different permissions:
325    owner, group, user, quotas
326 - Store info on each file system type (probably in the job header on tape.
327   This could be the output of df; or perhaps some sort of /etc/mtab record.
328
329 Longer term to do:
330 - Design at hierarchial storage for Bacula. Migration and Clone. 
331 - Implement FSM (File System Modules).
332 - Audit M_ error codes to ensure they are correct and consistent.
333 - Add variable break characters to lex analyzer.
334   Either a bit mask or a string of chars so that
335   the caller can change the break characters.
336 - Make a single T_BREAK to replace T_COMMA, etc.
337 - Ensure that File daemon and Storage daemon can
338   continue a save if the Director goes down (this
339   is NOT currently the case). Must detect socket error,
340   buffer messages for later. 
341 - Enhance time/duration input to allow multiple qualifiers e.g. 3d2h
342 - Add ability to backup to two Storage devices (two SD sessions) at
343   the same time -- e.g. onsite, offsite.
344 - Add the ability to consolidate old backup sets (basically do a restore
345   to tape and appropriately update the catalog). Compress Volume sets.
346   Might need to spool via file is only one drive is available.
347 - Compress or consolidate Volumes of old possibly deleted files. Perhaps
348   someway to do so with every volume that has less than x% valid 
349   files.
350
351
352 Migration: Move a backup from one Volume to another
353 Clone:     Copy a backup -- two Volumes
354
355 Bacula Migration is based on Jobs (apparently Networker is file by file).
356
357 Migration triggered by:
358   Number of Jobs
359   Number of Volumes
360   Age of Jobs
361   Highwater mark (keep total size)
362   Lowwater mark
363   
364 Projects:
365             Bacula Projects Roadmap 
366                17 August 2002
367            last update 8 May 2003
368
369 Item 1:   Multiple simultaneous Jobs. (done)
370 Done -- Restore part needs better implementation to work correctly
371         Also, it needs considerable testing
372
373   What:   Permit multiple simultaneous jobs in Bacula.
374
375   Why:    An enterprise level solution needs to go fast without the
376           need for the system administrator to carefully tweak
377           timing.  Based on the benchmarks, during a full
378           backup, NetWorker typically hit 10 times the bandwidth to
379           the tape compared to Bacula--largely. This is probably due to
380           running parallel jobs and multi-threaded filling of buffers
381           and writing them to tape.  This should also make things work
382           better when you have a mix of fast and slow machines backing
383           up at the same time.
384
385   Notes:  Bacula was designed to run multiple simultaneous jobs. Thus
386           implementing this is a matter of some small cleanups and
387           careful testing.
388
389
390 Item 2:   Make the Storage daemon use intermediate file storage to buffer data.
391 Deferred -- not necessary yet -- possibly implement with Migration.
392
393   What:   If data is coming into the SD too fast, buffer it to 
394           disk if the user has configured this option.
395
396   Why:    This would be nice, especially if it more or less falls out
397           when implementing (1) above.  If not, it probably should not
398           be given a high priority because fundamentally the backup time
399           is limited by the tape bandwidth.  Even though you may finish a
400           client job quicker by spilling to disk, you still have to
401           eventually get it onto tape.  If intermediate disk buffering
402           allows us to improve write bandwidth to tape, it may make
403           sense.
404
405   Notes:  Whether or not this is implemented will depend upon performance
406           testing after item 1 is implemented.
407
408
409 Item 3:   Write the bscan program -- also write a bcopy program.
410 Done
411
412   What:   Write a program that reads a Bacula tape and puts all the 
413           appropriate data into the catalog. This allows recovery
414           from a tape that is no longer in the database, or it allows
415           re-creation of a database if lost.
416
417   Why:    This is a fundamental robustness and disaster recovery tool
418           which will increase the comfort level of a sysadmin
419           considering adopting Bacula.
420
421   Notes:  A skeleton of this program already exists, but much work
422           needs to be done. Implementing this will also make apparent
423           any deficiencies in the current Bacula tape format.
424
425
426 Item 4:   Implement Base jobs.
427
428   What:   A base job is sort of like a Full save except that you 
429           will want the FileSet to contain only files that are unlikely
430           to change in the future (i.e. a snapshot of most of your
431           system after installing it). After the base job has been run,
432           when you are doing a Full save, you can specify to exclude
433           all files saved by the base job that have not been modified.
434
435   Why:    This is something none of the competition does, as far as we know
436           (except BackupPC, which is a Perl program that saves to disk
437           only).  It is big win for the user, it makes Bacula stand out
438           as offering a unique optimization that immediately saves time
439           and money.
440
441   Notes:  Big savings in tape usage. Will require more resources because
442           the e. DIR must send FD a list of files/attribs, and the FD must
443           search the list and compare it for each file to be saved.
444
445
446 Item 5:   Implement Label templates
447 Done 
448
449   What:   This is a mechanism whereby Bacula can automatically create
450           a tape label for new tapes according to a detailed specification
451           provided by the user.
452
453   Why:    It is a major convenience item for folks who use automated label
454           creation.
455
456   Notes:  Bacula already has a working form of automatic tape label
457           creation, but it is very crude. The design for the complete
458           tape labeling project is already documented in the manual.
459
460
461 Item 6:   Write a regression script.
462 Done --   Continue to expand its testing.
463
464   What:   This is an automatic script that runs and tests as many features
465           of Bacula as possible. The output is compared to previous
466           versions of Bacula and any differences are reported.
467
468   Why:    This is an enormous help in preventing introduction of new
469           errors in parts of the program that already work correctly.
470
471   Notes:  This probably should be ranked higher, it's something the typical
472           user doesn't see.  Depending on how it's implemented, it may
473           make sense to defer it until the archival tape format and
474           user interface mature.
475
476
477 Item 7:   GUI for interactive restore
478 Item 8:   GUI for interactive backup
479
480   What:   The current interactive restore is implemented with a tty
481           interface. It would be much nicer to be able to "see" the
482           list of files backed up in typical GUI tree format.
483           The same mechanism could also be used for creating 
484           ad-hoc backup FileSets (item 8).
485
486   Why:    Ease of use -- especially for the end user.
487
488   Notes:  Rather than implementing in Gtk, we probably should go directly
489           for a Browser implementation, even if doing so meant the
490           capability wouldn't be available until much later.  Not only
491           is there the question of Windows sites, most
492           Solaris/HP/IRIX, etc,  shops can't currently run Gtk programs
493           without installing lots of stuff admins are very wary about.
494           Real sysadmins will always use the command line anyway, and
495           the user who's doing an interactive restore or backup of his
496           own files will in most cases be on a Windows machine running
497           Exploder.
498
499
500 Item 9:   Add SSL to daemon communications.
501
502   What:   This provides for secure communications between the daemons.
503
504   Why:    This would allow doing backup across the Internet without
505           privacy concerns (or with much less concern).
506
507   Notes:  The vast majority of near term potential users will be backing up
508           a single site over a LAN and, correctly or not, they probably
509           won't be concerned with security, at least not enough to go to
510           the trouble to set up keys, etc. to screw things down.  We suspect
511           that many users genuinely interested in multi-site backup
512           already run some form of VPN software in their internetwork
513           connections, and are willing to delegate security to that layer.
514
515
516 Item 10:  Define definitive tape format.
517 Done (version 1.27)
518
519   What:   Define that definitive tape format that will not change 
520           for the next millennium.
521
522   Why:    Stability, security.
523
524   Notes:  See notes for item 11 below.
525
526
527 Item 11:  New daemon communication protocol.
528
529   What:   The current daemon to daemon protocol is basically an ASCII
530           printf() and sending the buffer. On the receiving end, the
531           buffer is sscanf()ed to unpack it. The new scheme would
532           be a binary format that allows quick packing and unpacking
533           of any data type with named fields.
534
535   Why:    Using binary packing would be faster. Named fields will permit
536           error checking to ensure that what is sent is what the 
537           receiver really wants.
538
539   Notes:  These are internal improvements in the interest of the
540           long-term stability and evolution of the program.  On the one
541           hand, the sooner they're done, the less code we have to rip
542           up when the time comes to install them.  On the other hand, they
543           don't bring an immediately perceptible benefit to potential
544           users.  Item 10 and possibly item 11 should be deferred until Bacula
545           is well established with a growing user community more or
546           less happy with the feature set.  At that time, it will make a
547           good "next generation" upgrade in the interest of data
548           immortality.
549
550
551
552
553 ======================================================
554         Base Jobs design
555 It is somewhat like a Full save becomes an incremental since
556 the Base job (or jobs) plus other non-base files.
557 Need:
558 - New BaseFile table that contains:
559     JobId, BaseJobId, FileId (from Base).
560   i.e. for each base file that exists but is not saved because
561   it has not changed, the File daemon sends the JobId, BaseId,
562   and FileId back to the Director who creates the DB entry.
563 - To initiate a Base save, the Director sends the FD 
564   the FileId, and full filename for each file in the Base.
565 - When the FD finds a Base file, he requests the Director to
566   send him the full File entry (stat packet plus MD5), or
567   conversely, the FD sends it to the Director and the Director
568   says yes or no. This can be quite rapid if the FileId is kept
569   by the FD for each Base Filename.          
570 - It is probably better to have the comparison done by the FD
571   despite the fact that the File entry must be sent across the
572   network.
573 - An alternative would be to send the FD the whole File entry
574   from the start. The disadvantage is that it requires a lot of
575   space. The advantage is that it requires less communications
576   during the save.
577 - The Job record must be updated to indicate that one or more
578   Bases were used.
579 - At end of Job, FD returns:   
580    1. Count of base files/bytes not written to tape (i.e. matches)
581    2. Count of base file that were saved i.e. had changed.
582 - No tape record would be written for a Base file that matches, in the
583   same way that no tape record is written for Incremental jobs where
584   the file is not saved because it is unchanged.
585 - On a restore, all the Base file records must explicitly be
586   found from the BaseFile tape. I.e. for each Full save that is marked
587   to have one or more Base Jobs, search the BaseFile for all occurrences
588   of JobId.
589 - An optimization might be to make the BaseFile have:
590      JobId
591      BaseId
592      FileId
593   plus
594      FileIndex
595   This would avoid the need to explicitly fetch each File record for
596   the Base job.  The Base Job record will be fetched to get the
597   VolSessionId and VolSessionTime.
598 =========================================================  
599
600   
601
602 =============================================================
603
604                 Request For Comments For File Backup Options
605                    10 November 2002
606
607 Subject: File Backup Options
608
609 Problem: 
610   A few days ago, a Bacula user who is backing up to file volumes and
611   using compression asked if it was possible to suppress compressing
612   all .gz files since it was a waste of CPU time. Although Bacula
613   currently permits using different options (compression, ...) on
614   a directory by directory basis, it cannot do it on a file by 
615   file basis, which is clearly what was desired.   
616
617 Proposed Implementation:
618   To solve this problem, I propose the following:
619
620   - Add a new Director resource type called FileOptions.  
621
622   - The FileOptions resource will have records for all
623     options that can currently be specified on the Include record 
624     (in a FileSet).  Examples below.
625
626   - The FileOptions resource will permit an exclude option as well
627     as a number of additional options.
628
629   - The heart of the FileOptions resource is the ability to
630     supply any number of ApplyTo records which specify POSIX
631     regular expressions.  These ApplyTo regular expressions are
632     applied to the fully qualified filename (path and all). If
633     one matches, then the FileOptions will be used.
634
635   - When an ApplyTo specification matches an included file, the
636     options specified in the FileOptions resource will override
637     the default options specified on the Include record.
638
639   - Include records will be modified to permit referencing one or
640     more FileOptions resources.  The FileOptions will be used
641     in the order listed on the Include record and the first
642     one that matches will be applied.
643
644   - Options (or specifications) currently supplied on the Include
645     record will be deprecated (i.e. removed in a later version a
646     year or so from now).
647
648   - The Exclude record will be deprecated as the same functionality
649     can be obtained by using an Exclude = yes in the FileOptions.
650
651 FileOptions records:
652   The following records can appear in the FileOptions resource. An
653   asterisk preceding the name indicates a feature not currently
654   implemented.
655
656   For Backup Jobs:
657     - Compression= (GZIP, ...)
658     - Signature=   (MD5, SHA1, ...)
659     - *Encryption=
660     - OneFs=      (yes/no)    - remain on one filesystem
661     - Recurse=    (yes/no)    - recurse into subdirectories
662     - Sparse=     (yes/no)    - do sparse file backup
663     - *Exclude=   (yes/no)    - exclude file from being saved
664     - *Reader=    (filename)  - external read (backup) program
665     - *Plugin=    (filename)  - read/write plugin module
666
667   For Verify Jobs:
668     - verify=     (ipnougsamc5) - verify options
669
670   For Restore Jobs:
671     - replace= (always/ifnewer/ifolder/never) - replace options currently
672                                                 implemented in 1.27
673     - *Writer= (filename)   - external write (restore) program
674
675
676 Implementation:
677   Currently options specifying compression, MD5 signatures, recursion,
678   ... of a FileSet are supplied on the Include record. These will now
679   all be collected into a FileOptions resource, which will be
680   specified on the Include in place of the options. Multiple FileOptions
681   may be specified.  Since the FileOptions contain regular expressions
682   that are applied to the full filename, this will give the ability
683   to specify backup options on a file by file basis to whatever level
684   of detail you wish.
685
686 Example:
687
688   Today:
689
690     FileSet {
691       Name = "FullSet"
692       Include = compression=GZIP signature=MD5 {
693         /
694       }
695     }
696
697   Proposal:
698
699     FileSet {
700       Name = "FullSet"
701       Include = FileOptions=Opts {
702         /
703       }
704     }
705     FileOptions {
706       Name = Opts
707       Compression = GZIP
708       Signature = MD5
709       ApplyTo = /*.?*/
710     }
711
712   That's a lot more to do the same thing, but it gives the ability to
713   apply options on a file by file basis.  For example, suppose you
714   want to compress all files but not any file with extensions .gz or .Z.
715   You could do so as follows:
716
717     FileSet {
718       Name = "FullSet"
719       Include = FileOptions=NoCompress FileOptions=Opts {
720         /
721       }
722     }
723     FileOptions {
724       Name = Opts
725       Compression = GZIP
726       Signature = MD5
727       ApplyTo = /*.?*/   # matches all files
728     }
729     FileOptions {
730       Name = NoCompress
731       Signature = MD5
732       # Note multiple ApplyTos are ORed
733       ApplyTo = /*.gz/   # matches .gz files */
734       ApplyTo = /*.Z/    # matches .Z files */
735     }
736
737   Now, since the NoCompress FileOptions is specified first on the
738   Include line, any *.gz or *.Z file will have an MD5 signature computed,
739   but will not be compressed. For all other files, the NoCompress will not
740   match, so the Opts options will be used which will include GZIP
741   compression.
742
743 Questions:
744   - Is it necessary to provide some means of ANDing regular expressions
745     and negation?  (not currently planned)
746
747     e.g.  ApplyTo = /*.gz/ && !/big.gz/
748
749   - I see that Networker has a "null" module which, if specified, does not 
750     backup the file, but does make an record of the file in the catalog
751     so that the catalog will reflect an exact picture of the filesystem.
752     The result is that the file can be "seen" when "browsing" the save
753     sets, but it cannot be restored.
754     
755     Is this really useful?  Should it be implemented in Bacula?
756   
757 Results:
758   After implementing the above, the user will be able to specify
759   on a file by file basis (using regular expressions) what options are
760   applied for the backup.
761
762
763 =============================================
764
765 ========================================================== 
766     Unsaved File design
767 For each Incremental job that is run, there may be files that
768 were found but not saved because they were locked (this applies
769 only to Windows). Such a system could send back to the Director
770 a list of Unsaved files.
771 Need:
772 - New UnSavedFiles table that contains:
773   JobId
774   PathId
775   FilenameId
776 - Then in the next Incremental job, the list of Unsaved Files will be
777   feed to the FD, who will ensure that they are explicitly chosen even
778   if standard date/time check would not have selected them.
779 =============================================================
780
781
782 Done: (see kernsdone for more)
783 - Heartbeat between daemons.
784 - Fix Dir heartbeat in restore and verify vol.  Be sure to make
785   bnet_recv() ignore BNET_HEARTBEAT.
786 - Implement HEART_BEAT while SD waiting for tapes.
787 - Include RunBeforeJob and RunAfterJob output in the message
788   stream.
789 - Change M_INFO to M_RESTORED for all restored files.
790 - Fix command prompt in gnome-console by checking on Ready.
791 - Merge SQLite, MySQL, and Rel spec into a single file.
792 - Fix config of "console"
793 - Check if cancel works with FD (fixed).
794 - Properly configure console and gconsole (currently for source not
795   configured for installation).
796 - Error labeling tape from console gets Jmsg error because of no Job.
797 - Test and implement get_pint and get_yesno.
798 - Implement global with DB name and add to btraceback.gdb
799 - Remove subsysdir from conf files (used only in autostart scripts).
800 - Fix the following:
801   rufus-dir: Max configured use duration exceeded. Marking Volume "MatouBackup" as Used.
802    rufus-sd: Volume "" previously written, moving to end of data.
803    rufus-sd: Matou.2003-05-10_10.39.18 Error: I canot write on this volume because:
804       The number of files mismatch! Volume=1 Catalog=0
805    rufus-sd: Matou.2003-05-10_10.39.18 Error: askdir.c:155 NULL Volume name. This shouldn't happen!!!
806 - Shell character expansion is failing occassionally.
807 - Add a section to the doc on Manual cycling of Volumes.
808 - Check if Job/File retentions apply to multivolume jobs.
809 - Fix missing casette in autoloader during read:
810   14-May-2003 14:41 undef-sd: RestoreFiles.2003-05-14_14.41.00 Warning: acquire.c:106 Volume name mismatch. Wanted TestVolume0005 got TestVolume0010
811   14-May-2003 14:41 undef-sd: 3301 Issuing autochanger "loaded" command.
812   14-May-2003 14:41 undef-sd: 3302 Issuing autochanger "unload" command.
813   14-May-2003 14:42 undef-sd: 3303 Issuing autochanger "load slot 1" command.
814   14-May-2003 14:42 undef-sd: 3304 Autochanger "load slot 1" status is OK.
815   14-May-2003 14:42 undef-sd: RestoreFiles.2003-05-14_14.41.00 Warning: acquire.c:106 Volume name mismatch. Wanted TestVolume0005 got TestVolume0009
816   14-May-2003 14:42 undef-sd: 3301 Issuing autochanger "loaded" command.
817   14-May-2003 14:42 undef-sd: RestoreFiles.2003-05-14_14.41.00 Warning: acquire.c:106 Volume name mismatch. Wanted TestVolume0005 got TestVolume0009
818   14-May-2003 14:42 undef-sd: 3301 Issuing autochanger "loaded" command.
819   14-May-2003 14:42 undef-sd: RestoreFiles.2003-05-14_14.41.00 Warning: acquire.c:106 Volume name mismatch. Wanted TestVolume0005 got TestVolume0009
820   14-May-2003 14:42 undef-sd: 3301 Issuing autochanger "loaded" command.
821   14-May-2003 14:42 undef-sd: RestoreFiles.2003-05-14_14.41.00 Warning: acquire.c:106 Volume name mismatch. Wanted TestVolume0005 got TestVolume0009
822   14-May-2003 14:42 undef-sd: 3301 Issuing autochanger "loaded" command.
823   14-May-2003 14:42 undef-sd: RestoreFiles.2003-05-14_14.41.00 Fatal error: acquire.c:129 Too many errors trying to mount device "/dev/nrsa0".
824   14-May-2003 14:42 undef-dir: Bacula 1.31 (12May03): 14-May-2003 14:42
825 - Fix problem reported by Christopher McCurdy <cmccurdy@eecis.udel.edu>
826    xeon-fd:      Could not stat c:/Documents and Settings/All 
827    Users/Application Data/Humc:\Documents and Settings\All User98_AIX.kbf: 
828    ERR=No such file or directory
829    Cannot reproduce.
830 - The following  Re-read last block at EOT failed. ERR=block.c:523 Read zero bytes on device /dev/nrsa0.
831     undef-sd: block.c:523 Read zero bytes on device /dev/nrsa0.
832   apparently masks the standard EOM message.
833 - BSD (probably) does not have strtoll()
834 - BSD does not have ioctl() MTEOM
835 - BSD defines a number of MT_xxx variables which conflict
836   with those defined by Bacula.
837 - Make default duration days if no qualifier (e.g. s) is specified.
838 - BSDI fix finding gcc version
839 - When the FD errs (e.g. disk full) have a more graceful shutdown.
840 - Make sure Bacula prunes/purges canceled and failed jobs too and all
841   jobs with zero JobFiles.
842 - Implement Volume name checking.
843 - Document what characters can go into Volume names.
844 - Getting the following on all directories on Win32
845   19-May-2003 01:14 tibs-fd:      Could not access c:/cygwin/home/kern/rxvt: ERR=Permission denied
846 - Cancellation caused JobMedia error:
847      babylon5-dir: Last FULL backup time not found. Doing FULL backup.               
848      babylon5-dir: Start Backup JobId 416, Job=Zocalo_Save.2003-05-19_02.15.06       
849      babylon5-sd: End of media on Volume VXA-V17-Inc-001 Bytes=31,982,900,672 Blocks=495,781.
850      babylon5-sd: Job Zocalo_Save.2003-05-19_02.15.06 waiting. Cannot find any appendable volumes.
851      babylon5-sd: Someone woke me up, but I cannot find any appendable volumes
852        for Job=Zocalo_Save.2003-05-19_02.15.06.                                
853      babylon5-sd: Zocalo_Save.2003-05-19_02.15.06 Fatal error: Job
854        Zocalo_Save.2003-05-19_02.15.06 canceled while waiting for mount on
855        Storage Device "Ecrix_VXA-1".
856      babylon5-sd: Zocalo_Save.2003-05-19_02.15.06 Fatal error: Cannot fixup device
857        error. Job Zocalo_Save.2003-05-19_02.15.06 canceled while waiting for
858        mount on Storage Device "Ecrix_VXA-1".
859                                                                                      
860      babylon5-dir: Zocalo_Save.2003-05-19_02.15.06 Error: Catalog error creating
861        JobMedia record. sql_create.c:125 Create JobMedia failed. Record already
862        exists.
863      babylon5-sd: Zocalo_Save.2003-05-19_02.15.06 Error: Error creating JobMedia
864        record: 1991 Update JobMedia error
865                                                                                      
866      babylon5-sd: Zocalo_Save.2003-05-19_02.15.06 Error: askdir.c:158 NULL Volume
867        name. This shouldn't happen!!!
868      zocalo-fd: Zocalo_Save.2003-05-19_02.15.06 Error: bnet.c:310 Write error
869        sending to Storage daemon:babylon5:9103: ERR=Broken pipe
870 - Volume names with spaces get jammed into the catalog with 0x1 
871   i.e. the SD bashes the Volume but they are not unbased by Dir.
872   jerom-dir: MonthlySave.2003-05-10_17.12.01 Error: Unable to get Media
873   record for Volume Tape^A1: ERR=sql_get.c:788 Media record for Volume
874   "Tape^A1" not found.
875    jerom-sd: MonthlySave.2003-05-10_17.12.01 Error: Error updating Volume
876    Info: 1991 Catalog Request failed: sql_get.c:788 Media record for Volume
877    "Tape^A1" not found.
878 - ChangeServiceConfig2A does not exist on WinNT (ADVAPI32.DLL).
879 - Fix "access not allowed" for backup of files on WinXP.
880 - Check for existence of all new Win32 API's.  See LoadLibrary in 
881   winservice.cpp
882 - Count errors during restore and print them in the Job report.
883 - Bug: fix access problems on files restored on WinXP.
884 - Put system type returned by FD into catalog.
885 - Finish WIN32_DATA stream code (bextract, check if can handle stream)
886 - Make SD keep track of Files, Bytes during restore.
887 - If you enter the userid by hand for restore, you get:
888   Enter JobId(s), comma separated, to restore: 74
889   You have selected the following JobId: 74
890   Building directory tree for JobId 74 ...
891   134645140 items inserted into the tree and marked for extraction.
892 - Add SDWriteSeqNo to SD, and probably Read on FD side.
893 - If bootstrap is non-zero for restore, do not show JobId in the
894   OK to run? (yes/mod/no): list.
895 - When all cassettes in magazine are used, got:
896   22-May-2003 18:24 undef-sd: 3304 Autochanger "load slot 1" status is OK.
897   22-May-2003 18:24 undef-sd: NightlySave.2003-05-22_14.08.16 Warning: mount.c:245 Director wanted Volume "TestVolume0009".
898       Current Volume "TestVolume0005" not acceptable because:
899       1998 Volume "TestVolume0005" not Append or Recycle.
900   22-May-2003 18:24 undef-sd: NightlySave.2003-05-22_14.08.16 Error: Autochanger Volume "TestVolume0009" not found in slot 1.
901       Setting slot to zero in catalog.
902   22-May-2003 18:24 undef-sd: Please mount Volume "TestVolume0009" on Storage Device "ARCHIVE 4586" for Job NightlySave.2003-05-22_14
903   .08.16
904   Use "mount" command to release Job.
905   22-May-2003 19:24 undef-sd: Please mount Volume "TestVolume0009" on Storage Device "ARCHIVE 4586" for Job NightlySave.2003-05-22_14
906   .08.16
907   Use "mount" command to release Job.
908 - Don't zero the Slot when the wrong volume is found -- simply ask
909   the operator.
910 - Implement MTIOCERRSTAT on FreeBSD to clear tape error conditions.
911 - Shell expansion fails for working_directory in SD from time to time.
912 - File the Automatically selected: xxx
913   to say Automatically selected Pool: xxx
914 - Default duration with no qualifier is sec should be 1 day
915 - zap sd_auth_key in SD after FD connection.
916 - Find a solution for the multiple FileSet problem (when it is changed). Add date?
917 - Look at Python for a Bacula scripting language -- www.python.org
918 - When Marking a file in Restore that is a hard link, also
919   mark the link so that the data will be reloaded.
920 - Emergency restore info:
921   - Backup Bacula
922   - Backup working directory
923   - Backup Catalog
924 - Why don't we get an error message from Win32 FD when bootstrap 
925   file cannot be created for restore command?
926 - Fix Win2000 error with no messages during startup.
927 - Make restore more robust in counting error and not immediately bailing
928   out. Also print error message once, but try to continue.
929 - Add code to check that blocks are sequential on restore.
930 - Remove "rufus" and such references from regress.
931 - No READLINE_SRC if found in alternate directory.
932 - If ./btape is called without /dev, assume argument is a Storage resource name.
933 - Find general solution for sscanf size problems (as well as sprintf. Do at run time?
934 - Bytes restored is wrong.
935 - The "List last 20 Jobs run" doesnt work correctly in restore.
936   It doesnt show the last 20 jobs , but some older ones.
937 - Fix Verify VolumeToCatalog to use BSRs -- it is broken.
938 - Implement Release Storage=xxx
939 - Fix restore on Win95/98  
940 - Remove the Jmsg() in sql_find.c:102 or only print on hard error.
941 - Implement FileSet VolIndex -- done, but must update old records.
942 - Check this below from Phil.
943   This was SD reported data rather than FD data!
944   > When the job was done, Bacula reported 11084 files restored:
945   > 
946   > JobId:                  527                                                     
947   > Job:                    Zocalo_Restore.2003-06-05_16.42.01                      
948   > Client:                 Zocalo                                                  
949   > Start time:             05-Jun-2003 16:42                                       
950   > End time:               06-Jun-2003 01:21                                       
951   > Files Restored:         11,084                                                  
952   > Bytes Restored:         65,474,772                                              
953   > Rate:                   2.1 KB/s                                                
954   > FD termination status:  OK                                                      
955   > Termination:            Restore OK                                              
956   > 
957   > when it should probably have reported 11084 files scanned, 250 restored.
958   > The bytes restored count looks about right.
959   > 
960 - Should Bacula make an Append tape as Purged when purging?
961 - Use switch() in backup.c and restore.c in FD instead of giant if statement.
962 - If during a restore, a hard linked file already exists (on option), delete
963   the file and re-link it.  This is to avoid the possibility that the
964   user had re-linked the file between the backup and the restore.
965   Do lstat() to see if it is already properly linked.
966   Same for symlinked file.
967   Make sure ifnewer, ifolder, never, ... apply correctly.
968 - Flag so that no connect does not error, and Reschedule a job.
969 - Implement "Reschedule OnError=yes interval=nnn times=xxx"
970 - That restoring a hard link that already exists works correctly.
971   Same for soft link.
972 - Make Pool resource handle Counter resources.
973 - Fix first block number after label to be zero instead of 1 (reset after label).
974 - Grep for Backup OK in regression script.
975 - Do NOT reuse same JobId if tape written.
976 - Implement non-blocking writes and bsock->terminate in heartbeat
977   thread, or set it in status.c cancel (used pthread_kill() instead of
978   non-blocking I/O.
979 - Add restore to specific date.
980 - Instrument use_count on DEVICE packets and ensure that the device is
981   being close()ed at the appropriate time.
982 - Test long path names (>64 chars) in Windows -- crashes FD?
983 - Implement fast block rejection: match_bsr_block().
984 - Complain if record dropped in bnet_recv because too long.
985 - Test multiple simultaneous Volumes
986 - Document recycling algorithm.
987 - Make Restore report an error if FD or SD term codes are not OK.
988 - To link with mysqlclient_r may require -lssl -lcrypto
989 - Document Heart beat code 
990 - Non-fatal errors are not correct counting attribs.c:277
991 - Check that Block number in JobMedia are correct.
992 - The bsr for Dan's job has file indexes covering the whole range rather
993   than only the range contained on the volume.
994   Constrain FileIndex to be within range for Volume.
995 - Pass prefix_links to FD.
996 - Fix restore list of volumes if Volume not selected.
997 - Complete (or turn off) the command line code in update.
998 - Testing Tibs job erred and hung director on Storage resource.  This was
999   because there were a whole pile of jobs hanging around in the SD  
1000   waiting for a connection from the FD that was never coming.
1001 - Possibly update all client records at startup.
1002 - Listing of Win32 restored files has ??????? for user.
1003 - In Win portable restore the directory is not create    
1004    27-Jun-2003 16:52 tibs-fd: kernsrestore.2003-06-27_16.52.20 Error:
1005    create_file.c:175 Could not create
1006    /tmp/bacula-restores/cygwin/home/kern/bacula/k/src/dird/dird_conf.o: 0
1007    ERR=The system cannot find the path specified.
1008 - Finish Windows implementation (add setting of correct type on restore,
1009   add Portable Data Format flag).
1010 - Document portable=yes
1011 - Document c:/working directory better than /working directory.
1012 - Document run "yes".
1013 - Document update volume: jobid, current, before, all
1014 - Document that bscan does not work with multiple simultaneous jobs.
1015 - Update Automatic Volume Labeling in disk.wml
1016 - Figure out how to handle DHCP IP addresses -- use dynamic DNS.
1017 - Add OS, GCC version to traceback output.
1018 - Implement a Recycle or Prune Current Volume (as from Nic Bellamy),
1019   possibly implement Prune Oldest Volume.
1020 - Backup on havana gave:
1021   Total Bytes Read=4,629,249,084,728,272,628 Blocks Read=0 Bytes/block=134,735,604
1022 - Move JobFiles and JobBytes to SD rather than FD -- more correct.
1023 - Test of last block is correct in JobMedia when splitting file 
1024   over two volumes.
1025 - Doc win32 table from Marc Brueckner der Megauser
1026 - Fix default time in seconds without qualifier -- bacula-dir.conf
1027 - Add Nic Bellamy's backup scheme.
1028 - Document using multiple Pools for daily rotating tapes.
1029 - Check if Incremental is working correctly when it looks for the previous Job 
1030   (Phil's problem).
1031 - Increment DB version prior to releasing.
1032 - Turn off FULL_DEBUG prior to releasing.