Skip to main content

journal-recover

In abnormal scenarios, like a sudden power loss, the Ember Journal may become corrupted.

To repair the corrupted journal, you can use the bin/journal-recover tool. This tool is designed to recover the journal and restore it to a consistent state.

If you are using Docker, this tool is available as /opt/deltix/ember/bin/journal-recover. You may need to redefine Ember entrypoint to shell.

Here is a sample output of this tool:

Flags:              00000000
Version: 20
SegmentCount: 8
SegmentSize: 8388608 (8 MB)
PartitionSize: 1073741824 (1 GB)
CreationTime: 1586443608152 (2020/04/09 14:46:48.152 UTC)
DirtySegment: 1
ActiveSegment: 2
ConsumerPosition: 20227952 (partition: 0, segment: 2, segmentOffset: 3450736)
SegmentTails:
#0: 34359738368 (position: 67108864, partition: 0, segment: 8, segmentOffset: 0)
#1: 4303356032 (position: 16777216, partition: 0, segment: 1, segmentOffset: 8388608)
#2: 8593385328 (position: 20227952, partition: 0, segment: 2, segmentOffset: 3450736)
#3: 12884901888 (position: 25165824, partition: 0, segment: 3, segmentOffset: 0)
#4: 17179869184 (position: 33554432, partition: 0, segment: 4, segmentOffset: 0)
#5: 21474836480 (position: 41943040, partition: 0, segment: 5, segmentOffset: 0)
#6: 25769803776 (position: 50331648, partition: 0, segment: 6, segmentOffset: 0)
#7: 30064771072 (position: 58720256, partition: 0, segment: 7, segmentOffset: 0)

Partitions: 1
data0: 72 MB INCOMPLETE (position: 16068776, segment: 1, segmentOffset: 7680168)

Snapshots: 0

Fences: 0

Summary: BAD

Recovery: 2 steps
Correct Partition: C:\Temp\Projects\Ember\corruption\journal\data0 <- (zeroOffset: 16068776, zeroLength: 59428696, fileSize: 75497472)
Correct Meta: C:\Temp\Projects\Ember\corruption\journal\meta <- (dirtySegment: 1, activeSegment: 1, consumerPosition: 16068776, segmentTails: [34359738368, 4302647464, 8589934592, 12884901888, 17179869184, 21474836480, 25769803776, 30064771072])

Recovery: OK

Sequence: OK (+1000000000)

This tool provides several options to customize the recovery process. The journal-recover tool has the ability to append a trading halt command to the recovered journal. This allows the operator to inspect the system state before normal trading activity resumes.

You can use the following flags while executing the journal-recover tool:

Usage: journal-recover [--add-sequence <arg>] [--cancel-orders] [--force] [--halt-trading]
    --add-sequence <arg>   Adds the specified value to sequence. Default is 1000000000
    --cancel-orders        Cancels orders (only if --halt-trading)
    --force                Answers 'yes' to all questions (quiet mode)
    --halt-trading         Halts trading