Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Berkeley DB Java Edition version 4.0.103
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sleepycat.je.util
Class DbTruncateLog

    java.lang.Object
      com.sleepycat.je.util.DbTruncateLog

    public class DbTruncateLog

extends Object

DbTruncateLog is a utility that lets the user truncate the JE log at a specified file and offset. Generally used in replication systems for handling com.sleepycat.je.rep.RollbackProhibitedException, to permit the application to interject application specific handling. Should be used with caution.

The parameters for DbTruncateLog are provided through the RollbackProhibitedException instance, and the exception message. The goal is to truncate the JE log at a specified file number and file offset. DbTruncateLog will only affect the specified file. Any files that follow the specified file should be manually moved away.

For example, suppose the JE log consists of these files:

        00000002.jdb
        0000000e.jdb
        0000000f.jdb
        00000010.jdb
        00000012.jdb
        0000001d.jdb
        0000001e.jdb
        0000001f.jdb

And the log must be truncated at file 0x1d, offset 0x34567. The following steps should be taken:

1. Move all files greater than 0x1d (0000001e.jdb, 0000001f.jdb} to a temp directory.
2. Copy file 0000001d.jdb to the temp directory
3. Truncate file 0000001d.jdb with the command DbTruncateLog -h <envDir> -f 0x1d -o 0x34567
4. Restart the environment and do appropriate testing to ensure that the environment is valid.
5. At this point, you may discard the files in the temp directory.

Constructor Summary
`DbTruncateLog()`

Method Summary
`static void` | `main(String[] argv)` Usage:
`void` | `truncateLog(File env, long truncFileNum, long truncOffset)` Truncate the JE log to the given file and offset.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DbTruncateLog

    public DbTruncateLog()

Method Detail

### main

    public static void main(String[] argv)

  Usage:

        -h environmentDirectory
        -f file number. If hex, prefix with "0x"
        -o file offset byte. If hex, prefix with "0x"

  For example, to truncate a log to file 0xa, offset 0x1223:

       DbTruncateLog -h <environmentDir> -f 0xa -o 0x1223

### truncateLog

    public void truncateLog(File env,
                            long truncFileNum,
                            long truncOffset)
                     throws IOException

  Truncate the JE log to the given file and offset. For unit tests.

  Throws:
    `IOException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Berkeley DB Java Edition version 4.0.103
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 2004-2010 Oracle. All rights reserved.