Kim van der Riet created QPID-5483:
--------------------------------------

             Summary: [linearstore] Recovery of journal with partly written 
record fails with "JERR_JREC_BADRECTAIL: Invalid data record tail" error message
                 Key: QPID-5483
                 URL: https://issues.apache.org/jira/browse/QPID-5483
             Project: Qpid
          Issue Type: Bug
          Components: C++ Broker
            Reporter: Kim van der Riet
            Assignee: Kim van der Riet


When recovering a store journal which contains a partly written record (such 
that the header is present, but the tail record is not), the broker terminates 
with the message
{color:blue}{{critical Unexpected error: Queue tq1: recoverMessages() failed: 
jexception 0x0701 enq_rec::decode() threw JERR_JREC_BADRECTAIL: Invalid data 
record tail. (Magic: expected 0x9aacb3ae; found 0x0)}}{color}

Expected behavior: The broker should handle such recoveries by treating the 
partly written record as invalid and, if necessary, adding filler records so 
that the next write can take place on an softblock boundary.

To reproduce:
1. Start the broker:
{color:blue}{{./qpidd --load-module linearstore.so -m no --auth no 
--default-flow-stop-threshold 0 --default-flow-resume-threshold 0 
--default-queue-limit 0 --store-dir /home/kpvdr/RedHat --log-enable info+ 
--truncate yes}}{color}

2. Run a client to create some records in a queue:
{color:blue}{{./qpid-send -a "tq1;{create:always,node:{type:queue,durable:true} 
}" --durable true --tx 0 --content-size 1000 --messages 100}}{color}

3. Use a hex editor (eg hexedit) to partly overwrite the last record from the 
middle of the data section (containing the 'X' characters through to the end of 
the last write (where all the '\0' characters start) so that the record header 
and part of the data is still present, but the tail end of the data and record 
tail (and any filler records) are overwritten.

4. Restart the broker to recover the store:
{color:blue}{{./qpidd --load-module linearstore.so -m no --auth no 
--default-flow-stop-threshold 0 --default-flow-resume-threshold 0 
--default-queue-limit 0 --store-dir /home/kpvdr/RedHat --log-enable info+ 
--truncate no}}{color}

The broker first detects the bad alignment:
{color:blue}
{{2014-01-15 16:38:45 \[Store\] warning Linear Store: Journal "tq1": Bad record 
alignment found at fid=0x1 offs=0x139800 (likely journal overwrite boundary); 
16 filler record(s) required.}}
{{2014-01-15 16:38:45 \[Store\] notice Linear Store: Journal "tq1": Recover 
phase write: Wrote filler record: fid=0x1 offs=0x139800}}
{{...}}
{color}
but terminates with the error message at the top of this description.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org
For additional commands, e-mail: dev-h...@qpid.apache.org

Reply via email to