]> git.sur5r.net Git - bacula/bacula/blob - bacula/kernstodo
restore + SQL editing cleanups
[bacula/bacula] / bacula / kernstodo
1                  Kern's ToDo List
2                  5 December 2002
3
4 Documentation to do: (a little bit at a time)
5 - Document running a test version.
6 - Make sure restore options are documented
7 - Document query file format.
8
9 Testing to do: (painful)
10 - that restore options work in FD (mostly done).
11 - that console command line options work
12 - blocksize recognition code.
13 - Test new BSR code (mostly done).
14
15
16 For 1.28 release:
17 - Add count output to restore.
18 - Need a verbose mode in restore, perhaps to bsr.
19 - Should we dump a SOS when starting a new tape?
20 - bscan without -v is too quiet -- perhaps show jobs.
21 - Get rid of bscan.c:534 error message (one time only).
22 - Print some statistics when get EOF on device in bscan -- feedback
23   to let user know it is working.
24 - Add code to reject whole blocks if not wanted on restore.
25 - Add watchdog timeout for child processes start_child_timer()
26   end_child_timer();
27
28 - Figure out how to allow multiple simultaneous file Volumes on
29   a single device.
30 - Start working on Base jobs.
31 - Implement FileOptions (see end of this document)
32 - Ensure that restore of differential jobs works (check SQL).
33 - Make sure the MaxVolFiles is fully implemented in SD
34 - Flush all the daemon messages at the end of every job.
35 - Check if both CatalogFiles and UseCatalog are set to SD.
36 - Check if we can bump Bacula FD priorty in Win2000
37 - Make bcopy read through bad tape records.
38 - Need return status on read_cb() from read_records(). Need multiple
39   records -- one per Job, maybe a JCR or some other structure with
40   a block and a record.
41
42 - Work more on how to to a Bacula restore beginning with
43   just a Bacula tape and a boot floppy (bare metal recovery).
44 - Try bare metal Windows restore
45 - Fix read_record to handle multiple sessions.
46 - Program files (i.e. execute a program to read/write files).
47   Pass read date of last backup, size of file last time.
48 - Put system type returned by FD into catalog.
49 - Possibly add email to Watchdog if drive is unmounted too
50   long and a job is waiting on the drive.
51 - Strip trailing slashes from Include directory names in the FD.
52 - Use read_record.c in SD code.
53 - Why don't we get an error message from Win32 FD when bootstrap 
54   file cannot be created for restore command?
55 - When Marking a file in Restore that is a hard link, also
56   mark the link so that the data will be reloaded.
57 - Restore program that errors in SD due to no tape reports
58   OK incorrectly in output.
59 - After unmount, if restore job started, ask to mount.
60 - Fix db_get_fileset in cats/sql_get.c for multiple records.
61 - Fix catalog filename truncation in sql_get and sql_create. Use
62   only a single filename split routine.
63 - Make Restore report an error if FD or SD term codes are not OK.
64 - Convert all %x substitution variables, which are hard to remember
65   and read to %(variable-name).  Idea from TMDA.
66 - Add JobLevel in FD status (but make sure it is defined).
67 - Make Pool resource handle Counter resources.
68 - Remove NextId for SQLite. Optimize.
69 - Fix gethostbyname() to use gethostbyname_r()
70 - Implement ./configure --with-client-only
71 - Strip trailing / from Include
72 - Move all SQL statements into a single location.
73 - Cleanup db_update_media and db_update_pool
74 - Add UA rc and history files.
75 - put termcap (used by console) in ./configure and
76   allow -with-termcap-dir.
77 - Enhance time and size scanning routines.
78 - Fix Autoprune for Volumes to respect need for full save.
79 - DateWritten field on tape may be wrong.
80 - Fix Win32 config file definition name on /install
81 - No READLINE_SRC if found in alternate directory.
82 - Add Client FS/OS id (Linux, Win95/98, ...).
83 - Test a second language e.g. french.
84 - Compare tape to Client files (attributes, or attributes and data) 
85 - Restore options (overwrite, overwrite if older,
86    overwrite if newer, never overwrite, ...)
87 - Restore to a particular time -- e.g. before date, after date. 
88 - Make all database Ids 64 bit.
89 - Write an applet for Linux.
90 - Add estimate to Console commands
91 - Find solution to blank filename (i.e. path only) problem.
92 - Implement new daemon communications protocol.
93 - Remove PoolId from Job table, it exists in Media.
94 - Allow console commands to detach or run in background.
95 - Fix status delay on storage daemon during rewind.
96 - Add SD message variables to control operator wait time
97   - Maximum Operator Wait
98   - Minimum Message Interval
99   - Maximum Message Interval
100 - Send Operator message when cannot read tape label.
101 - Verify level=Volume (scan only), level=Data (compare of data to file).
102   Verify level=Catalog, level=InitCatalog
103 - Events file
104 - Add keyword search to show command in Console.
105 - Fix Win2000 error with no messages during startup.
106 - Events : tape has more than xxx bytes.
107 - Restrict characters permitted in a Resource name.
108 - Complete  code in Bacula Resources -- this will permit
109   reading a new config file at any time.
110 - Handle ctl-c in Console
111 - Implement LabelTemplate (at least first cut).
112 - Implement script driven addition of File daemon to config files.
113 - Think about how to make Bacula work better with File archives.
114
115 - see setgroup and user for Bacula p4-5 of stunnel.c
116 - Implement new serialize subroutines
117    send(socket, "string", &Vol, "uint32", &i, NULL)
118 - Audit all UA commands to ensure that we always prompt where possible.
119 - If ./btape is called without /dev, assume argument is a Storage resource name.
120 - Put memory utilization in Status output of each daemon
121   if full status requested or if some level of debug on.
122 - Make database type selectable by .conf files i.e. at runtime
123 - gethostbyname failure in bnet_connect() continues
124   generating errors -- should stop.
125 - Add HOST to Volume label.
126 - Set flag for uname -a.  Add to Volume label.
127 - Implement throttled work queue.
128 - Check for EOT at ENOSPC or EIO or ENXIO (unix Pc)
129 - Allow multiple Storage specifications (or multiple names on
130   a single Storage specification) in the Job record. Thus a job 
131   can be backed up to a number of storage devices.
132 - Implement dump label to UA
133 - Copy volume using single drive.
134 - Concept of VolumeSet during restore which is a list
135   of Volume names needed.
136 - Restore files modified after date
137 - Restore file modified before date
138 - Emergency restore info:
139   - Backup Bacula
140   - Backup working directory
141   - Backup Catalog
142 - Restore -- do nothing but show what would happen
143 - SET LD_RUN_PATH=$HOME/mysql/lib/mysql
144 - Implement Restore FileSet=
145 - Create a protocol.h and protocol.c where all protocol messages
146   are concentrated.
147 - If SD cannot open a drive, make it periodically retry.
148 - Remove duplicate fields from jcr (e.g. jcr.level and jcr.jr.Level, ...).
149 - Timout a job or terminate if link goes down, or reopen link and query.
150 - Fill all fields in Vol/Job Header -- ensure that everything
151   needed is written to tape. Think about restore to Catalog
152   from tape.  Client record needs improving.
153 - Find general solution for sscanf size problems (as well
154   as sprintf. Do at run time?
155 - Concept of precious tapes (cannot be reused).
156 - Make bcopy copy with a single tape drive.
157 - Permit changing ownership during restore.
158
159 - Restore should get Device and Pool information from
160   job record rather than from config.
161 - Autolabel should be specified by DR instead of SD.
162 - Find out how to get the system tape block limits, e.g.:
163   Apr 22 21:22:10 polymatou kernel: st1: Block limits 1 - 245760 bytes.  
164   Apr 22 21:22:10 polymatou kernel: st0: Block limits 2 - 16777214 bytes.
165 - Storage daemon    
166   - Add media capacity
167   - AutoScan (check checksum of tape)
168   - Format command = "format /dev/nst0"
169   - MaxRewindTime
170   - MinRewindTime
171   - MaxBufferSize
172   - Seek resolution (usually corresponds to buffer size)
173   - EODErrorCode=ENOSPC or code
174   - Partial Read error code
175   - Partial write error code
176   - Nonformatted read error
177   - Nonformatted write error
178   - WriteProtected error
179   - IOTimeout
180   - OpenRetries
181   - OpenTimeout
182   - IgnoreCloseErrors=yes
183   - Tape=yes
184   - NoRewind=yes
185 - Pool
186   - Maxwrites
187   - Recycle period
188 - Job
189   - MaxWarnings
190   - MaxErrors (job?)
191 =====
192 - FD sends unsaved file list to Director at end of job. 
193 - Write a Storage daemon that uses pipes and
194   standard Unix programs to write to the tape.
195   See afbackup.
196 - Need something that monitors the JCR queue and
197   times out jobs by asking the deamons where they are.
198
199 - Enhance Jmsg code to permit buffering and saving to disk.
200 - device driver = "xxxx" for drives.
201 - restart: paranoid: read label fsf to
202   eom read append block, and go
203   super-paranoid: read label, read all files
204   in between, read append block, and go
205   verify: backspace, read append block, and go
206   permissive: same as above but frees drive
207   if tape is not valid.
208 - Verify from Volume
209 - Ensure that /dev/null works
210 - File daemon should build list of files skipped, and then
211   at end of save retry and report any errors.
212 - Need report class for messages. Perhaps
213   report resource where report=group of messages
214 - enhance scan_attrib and rename scan_jobtype, and
215   fill in code for "since" option 
216 - Need to save contents of FileSet to tape?
217 - Director needs a time after which the report status is sent
218   anyway -- or better yet, a retry time for the job.
219   Don't reschedule a job if previous incarnation is still running.
220 - Figure out how to save the catalog (possibly a special FileSet).
221 - Figure out how to restore the catalog.
222 - Some way to automatically backup everything is needed????
223 - Need a structure for pending actions:
224   - buffered messages
225   - termination status (part of buffered msgs?)
226 - Concept of grouping Storage devices and job can use
227   any of a number of devices
228 - Drive management
229   Read, Write, Clean, Delete
230 - Login to Bacula; Bacula users with different permissions:
231    owner, group, user, quotas
232 - Store info on each file system type (probably in the job header on tape.
233   This could be the output of df; or perhaps some sort of /etc/mtab record.
234
235 Longer term to do:
236 - Implement FSM (File System Modules).
237 - Identify unchanged or "system" files and save them to a
238   special tape thus removing them from the standard 
239   backup FileSet -- BASE backup.
240 - Turn virutally all sprintfs into snprintfs.
241 - Heartbeat between daemons.
242 - Audit M_ error codes to ensure they are correct and consistent.
243 - Add variable break characters to lex analyzer.
244   Either a bit mask or a string of chars so that
245   the caller can change the break characters.
246 - Make a single T_BREAK to replace T_COMMA, etc.
247 - Ensure that File daemon and Storage daemon can
248   continue a save if the Director goes down (this
249   is NOT currently the case). Must detect socket error,
250   buffer messages for later. 
251 - Enhance time/duration input to allow multiple qualifiers e.g. 3d2h
252
253   
254 Projects:
255             Bacula Projects Roadmap 
256                17 August 2002
257            last update 27 November 2002
258
259 Item 1:   Multiple simultaneous Jobs. (done)
260 Done
261
262   What:   Permit multiple simultaneous jobs in Bacula.
263
264   Why:    An enterprise level solution needs to go fast without the
265           need for the system administrator to carefully tweak
266           timing.  Based on the benchmarks, during a full
267           backup, NetWorker typically hit 10 times the bandwidth to
268           the tape compared to Bacula--largely. This is probably due to
269           running parallel jobs and multi-threaded filling of buffers
270           and writing them to tape.  This should also make things work
271           better when you have a mix of fast and slow machines backing
272           up at the same time.
273
274   Notes:  Bacula was designed to run multiple simultaneous jobs. Thus
275           implementing this is a matter of some small cleanups and
276           careful testing.
277
278
279 Item 2:   Make the Storage daemon use intermediate file storage to buffer data.
280 Deferred -- not necessary yet.
281
282   What:   If data is coming into the SD too fast, buffer it to 
283           disk if the user has configured this option.
284
285   Why:    This would be nice, especially if it more or less falls out
286           when implementing (1) above.  If not, it probably should not
287           be given a high priority because fundamentally the backup time
288           is limited by the tape bandwidth.  Even though you may finish a
289           client job quicker by spilling to disk, you still have to
290           eventually get it onto tape.  If intermediate disk buffering
291           allows us to improve write bandwidth to tape, it may make
292           sense.
293
294   Notes:  Whether or not this is implemented will depend upon performance
295           testing after item 1 is implemented.
296
297
298 Item 3:   Write the bscan program -- also write a bcopy program.
299 Done
300
301   What:   Write a program that reads a Bacula tape and puts all the 
302           appropriate data into the catalog. This allows recovery
303           from a tape that is no longer in the database, or it allows
304           re-creation of a database if lost.
305
306   Why:    This is a fundamental robustness and disaster recovery tool
307           which will increase the comfort level of a sysadmin
308           considering adopting Bacula.
309
310   Notes:  A skeleton of this program already exists, but much work
311           needs to be done. Implementing this will also make apparent
312           any deficiencies in the current Bacula tape format.
313
314
315 Item 4:   Implement Base jobs.
316
317   What:   A base job is sort of like a Full save except that you 
318           will want the FileSet to contain only files that are unlikely
319           to change in the future (i.e. a snapshot of most of your
320           system after installing it). After the base job has been run,
321           when you are doing a Full save, you can specify to exclude
322           all files saved by the base job that have not been modified.
323
324   Why:    This is something none of the competition does, as far as we know
325           (except BackupPC, which is a Perl program that saves to disk
326           only).  It is big win for the user, it makes Bacula stand out
327           as offering a unique optimization that immediately saves time
328           and money.
329
330   Notes:  Big savings in tape usage. Will require more resources because
331           the e. DIR must send FD a list of files/attribs, and the FD must
332           search the list and compare it for each file to be saved.
333
334
335 Item 5:   Implement Label templates
336
337   What:   This is a mechanism whereby Bacula can automatically create
338           a tape label for new tapes according to a detailed specification
339           provided by the user.
340
341   Why:    It is a major convenience item for folks who use automated label
342           creation.
343
344   Notes:  Bacula already has a working form of automatic tape label
345           creation, but it is very crude. The design for the complete
346           tape labeling project is already documented in the manual.
347
348
349 Item 6:   Write a regression script.
350 Started
351
352   What:   This is an automatic script that runs and tests as many features
353           of Bacula as possible. The output is compared to previous
354           versions of Bacula and any differences are reported.
355
356   Why:    This is an enormous help in preventing introduction of new
357           errors in parts of the program that already work correctly.
358
359   Notes:  This probably should be ranked higher, it's something the typical
360           user doesn't see.  Depending on how it's implemented, it may
361           make sense to defer it until the archival tape format and
362           user interface mature.
363
364
365 Item 7:   GUI for interactive restore
366 Item 8:   GUI for interactive backup
367
368   What:   The current interactive restore is implemented with a tty
369           interface. It would be much nicer to be able to "see" the
370           list of files backed up in typical GUI tree format.
371           The same mechanism could also be used for creating 
372           ad-hoc backup FileSets (item 8).
373
374   Why:    Ease of use -- especially for the end user.
375
376   Notes:  Rather than implementing in Gtk, we probably should go directly
377           for a Browser implementation, even if doing so meant the
378           capability wouldn't be available until much later.  Not only
379           is there the question of Windows sites, most
380           Solaris/HP/IRIX, etc,  shops can't currently run Gtk programs
381           without installing lots of stuff admins are very wary about.
382           Real sysadmins will always use the command line anyway, and
383           the user who's doing an interactive restore or backup of his
384           own files will in most cases be on a Windows machine running
385           Exploder.
386
387
388 Item 9:   Add SSL to daemon communications.
389
390   What:   This provides for secure communications between the daemons.
391
392   Why:    This would allow doing backup across the Internet without
393           privacy concerns (or with much less concern).
394
395   Notes:  The vast majority of near term potential users will be backing up
396           a single site over a LAN and, correctly or not, they probably
397           won't be concerned with security, at least not enough to go to
398           the trouble to set up keys, etc. to screw things down.  We suspect
399           that many users genuinely interested in multi-site backup
400           already run some form of VPN software in their internetwork
401           connections, and are willing to delegate security to that layer.
402
403
404 Item 10:  Define definitive tape format.
405 Done (version 1.27)
406
407   What:   Define that definitive tape format that will not change 
408           for the next millennium.
409
410   Why:    Stability, security.
411
412   Notes:  See notes for item 11 below.
413
414
415 Item 11:  New daemon communication protocol.
416
417   What:   The current daemon to daemon protocol is basically an ASCII
418           printf() and sending the buffer. On the receiving end, the
419           buffer is sscanf()ed to unpack it. The new scheme would
420           be a binary format that allows quick packing and unpacking
421           of any data type with named fields.
422
423   Why:    Using binary packing would be faster. Named fields will permit
424           error checking to ensure that what is sent is what the 
425           receiver really wants.
426
427   Notes:  These are internal improvements in the interest of the
428           long-term stability and evolution of the program.  On the one
429           hand, the sooner they're done, the less code we have to rip
430           up when the time comes to install them.  On the other hand, they
431           don't bring an immediately perceptible benefit to potential
432           users.  Item 10 and possibly item 11 should be deferred until Bacula
433           is well established with a growing user community more or
434           less happy with the feature set.  At that time, it will make a
435           good "next generation" upgrade in the interest of data
436           immortality.
437
438
439
440
441 ====================================
442
443                 Request For Comments
444                    10 November 2002
445
446 Subject: File Backup Options
447
448 Problem: 
449   A few days ago, a Bacula user who is backing up to file volumes and
450   using compression asked if it was possible to suppress compressing
451   all .gz files since it was a waste of CPU time. Although Bacula
452   currently permits using different options (compression, ...) on
453   a directory by directory basis, it cannot do it on a file by 
454   file basis, which is clearly what was desired.   
455
456 Proposed Implementation:
457   To solve this problem, I propose the following:
458
459   - Add a new Director resource type called FileOptions.  
460
461   - The FileOptions resource will have records for all
462     options that can currently be specified on the Include record 
463     (in a FileSet).  Examples below.
464
465   - The FileOptions resource will permit an exclude option as well
466     as a number of additional options.
467
468   - The heart of the FileOptions resource is the ability to
469     supply any number of ApplyTo records which specify POSIX
470     regular expressions.  These ApplyTo regular expressions are
471     applied to the fully qualified filename (path and all). If
472     one matches, then the FileOptions will be used.
473
474   - When an ApplyTo specification matches an included file, the
475     options specified in the FileOptions resource will override
476     the default options specified on the Include record.
477
478   - Include records will be modified to permit referencing one or
479     more FileOptions resources.  The FileOptions will be used
480     in the order listed on the Include record and the first
481     one that matches will be applied.
482
483   - Options (or specifications) currently supplied on the Include
484     record will be deprecated (i.e. removed in a later version a
485     year or so from now).
486
487   - The Exclude record will be deprecated as the same functionality
488     can be obtained by using an Exclude = yes in the FileOptions.
489
490 FileOptions records:
491   The following records can appear in the FileOptions resource. An
492   asterisk preceding the name indicates a feature not currently
493   implemented.
494
495   For Backup Jobs:
496     - Compression= (GZIP, ...)
497     - Signature=   (MD5, SHA1, ...)
498     - *Encryption=
499     - OneFs=      (yes/no)    - remain on one filesystem
500     - Recurse=    (yes/no)    - recurse into subdirectories
501     - Sparse=     (yes/no)    - do sparse file backup
502     - *Exclude=   (yes/no)    - exclude file from being saved
503     - *Reader=    (filename)  - external read (backup) program
504
505   For Verify Jobs:
506     - verify=     (ipnougsamc5) - verify options
507
508   For Restore Jobs:
509     - replace= (always/ifnewer/ifolder/never) - replace options currently
510                                                 implemented in 1.27
511     - *Writer= (filename)   - external write (restore) program
512
513
514 Implementation:
515   Currently options specifying compression, MD5 signatures, recursion,
516   ... of a FileSet are supplied on the Include record. These will now
517   all be collected into a FileOptions resource, which will be
518   specified on the Include in place of the options. Multiple FileOptions
519   may be specified.  Since the FileOptions contain regular expressions
520   that are applied to the full filename, this will give the ability
521   to specify backup options on a file by file basis to whatever level
522   of detail you wish.
523
524 Example:
525
526   Today:
527
528     FileSet {
529       Name = "FullSet"
530       Include = compression=GZIP signature=MD5 {
531         /
532       }
533     }
534
535   Proposal:
536
537     FileSet {
538       Name = "FullSet"
539       Include = FileOptions=Opts {
540         /
541       }
542     }
543     FileOptions {
544       Name = Opts
545       Compression = GZIP
546       Signature = MD5
547       ApplyTo = /*.?*/
548     }
549
550   That's a lot more to do the same thing, but it gives the ability to
551   apply options on a file by file basis.  For example, suppose you
552   want to compress all files but not any file with extensions .gz or .Z.
553   You could do so as follows:
554
555     FileSet {
556       Name = "FullSet"
557       Include = FileOptions=NoCompress FileOptions=Opts {
558         /
559       }
560     }
561     FileOptions {
562       Name = Opts
563       Compression = GZIP
564       Signature = MD5
565       ApplyTo = /*.?*/   # matches all files
566     }
567     FileOptions {
568       Name = NoCompress
569       Signature = MD5
570       # Note multiple ApplyTos are ORed
571       ApplyTo = /*.gz/   # matches .gz files */
572       ApplyTo = /*.Z/    # matches .Z files */
573     }
574
575   Now, since the NoCompress FileOptions is specified first on the
576   Include line, any *.gz or *.Z file will have an MD5 signature computed,
577   but will not be compressed. For all other files, the NoCompress will not
578   match, so the Opts options will be used which will include GZIP
579   compression.
580
581 Questions:
582   - Is it necessary to provide some means of ANDing regular expressions
583     and negation?  (not currently planned)
584
585     e.g.  ApplyTo = /*.gz/ && !/big.gz/
586
587   - I see that Networker has a "null" module which, if specified, does not 
588     backup the file, but does make an record of the file in the catalog
589     so that the catalog will reflect an exact picture of the filesystem.
590     The result is that the file can be "seen" when "browsing" the save
591     sets, but it cannot be restored.
592     
593     Is this really useful?  Should it be implemented in Bacula?
594   
595 Results:
596   After implementing the above, the user will be able to specify
597   on a file by file basis (using regular expressions) what options are
598   applied for the backup.
599 ====================================
600
601 Done: (see kernsdone for more)
602 - Add EOM records? No, not at this time. The current system works and
603   above all is simple.
604 - Add VolumeUseDuration and MaximumVolumeJobs to Pool db record and
605   to Media db record.
606 - Add VOLUME_CAT_INFO to the EOS tape record (as
607   well as to the EOD record). -- No, not at this time.
608 - Put MaximumVolumeSize in Director (MaximumVolumeJobs, MaximumVolumeFiles,
609    MaximumFileSize).
610 - Enhance schedule to have 1stSat, ...
611 - Make sure catalog doesn't keep growing.
612 - On I/O error, write EOF, then try to write again ? No, keep it simple.
613 - Figure out how compress everything except .gz,... files.
614   Implement FileOptions.
615 - Put Bacula version somewhere in Job stream, probably Start Session Labels.
616 - Fix start/end blocks for File devices
617 - Make Job err if WriteBootstrap fails.
618 - Test that mod of restore options works.
619 - Test that week position schedule code works.
620 - Make BSR accept count (total files to be restored).
621 - Add code to fast seek to proper place on tape/file when doing Restore.
622 - Replace popen() and pclose() -- fail safe and timeout, no SIG dep.
623 - Add code to put VolFile in bsr for restore command.
624 - Volumes can be listed multiple times in Restore volume list.
625