/ Check-in [b97aca12]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Minor tweaks to restore_jrnl.tcl utility script.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: b97aca1200d959a1e7c08dd4e9dbce4724342119
User & Date: shaneh 2010-01-07 22:02:35
Context
2010-01-08
04:50
Added option to restore_jrnl.tcl utility to hex dump journal pages. check-in: 08c545f0 user: shaneh tags: trunk
2010-01-07
22:02
Minor tweaks to restore_jrnl.tcl utility script. check-in: b97aca12 user: shaneh tags: trunk
21:49
Small tool that attempts to repair a journal header. check-in: 05b18b5f user: shaneh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to tool/restore_jrnl.tcl.

    72     72   
    73     73   set db_fsize [file size $db_name]
    74     74   sqlite3 db $db_name
    75     75   set db_pgsz [db eval {PRAGMA page_size}]
    76     76   db close
    77     77   set db_npage [expr {$db_fsize / $db_pgsz}]
    78     78   
           79  +# restore in case get the page_size above changed things
           80  +copy_file $db_name.org $db_name
           81  +copy_file $jrnl_name.org $jrnl_name
           82  +
    79     83   # calculate checksum nonce
    80         -set pgno 1
           84  +set pgno 0
    81     85   set pg_offset [expr $sectsz+((4+$db_pgsz+4)*$pgno)]
    82     86   set nonce [hexio_get_int [hexio_read $jrnl_name [expr $pg_offset+4+$db_pgsz] 4]]
    83     87   for {set i [expr $db_pgsz-200]} {$i>0} {set i [expr $i-200]} {
    84     88     set byte [hexio_get_int [hexio_read $jrnl_name [expr $pg_offset+4+$i] 1]]
    85     89     set nonce [expr $nonce-$byte]
    86     90   }
    87     91   
................................................................................
   103    107   # write page size
   104    108   hexio_write $jrnl_name 24 [format %08x $db_pgsz]
   105    109   
   106    110   # check the integrity of the database.
   107    111   sqlite3 db $db_name
   108    112   do_test restore_jrnl-1.0 {
   109    113     catchsql {PRAGMA integrity_check}
   110         -} {0 {ok}}
          114  +} {0 ok}
   111    115   
   112    116   db close