Author: kpvdr
Date: 2008-09-22 11:31:44 -0400 (Mon, 22 Sep 2008)
New Revision: 2519
Added:
store/trunk/cpp/lib/jrnl/lf_map.cpp
store/trunk/cpp/lib/jrnl/lf_map.hpp
Modified:
store/trunk/cpp/lib/Makefile.am
store/trunk/cpp/lib/jrnl/file_hdr.hpp
store/trunk/cpp/lib/jrnl/jcntl.cpp
store/trunk/cpp/lib/jrnl/jerrno.cpp
store/trunk/cpp/lib/jrnl/jerrno.hpp
store/trunk/cpp/lib/jrnl/jinf.cpp
store/trunk/cpp/lib/jrnl/jinf.hpp
store/trunk/cpp/lib/jrnl/wmgr.cpp
store/trunk/cpp/lib/jrnl/wmgr.hpp
store/trunk/cpp/tests/jrnl/_ut_rec_hdr.cpp
store/trunk/cpp/tests/jrnl/jtt/jfile_chk.py
Log:
Backport of r.2518 on 1.0 branch: Further bug uncovered by testing for BZ458053. This is a
logic error handling recovered records where the end of the record coincides with the end
of the file.
Modified: store/trunk/cpp/lib/Makefile.am
===================================================================
--- store/trunk/cpp/lib/Makefile.am 2008-09-22 15:30:26 UTC (rev 2518)
+++ store/trunk/cpp/lib/Makefile.am 2008-09-22 15:31:44 UTC (rev 2519)
@@ -55,6 +55,7 @@
jrnl/jexception.cpp \
jrnl/jinf.cpp \
jrnl/jrec.cpp \
+ jrnl/lf_map.cpp \
jrnl/pmgr.cpp \
jrnl/rmgr.cpp \
jrnl/rrfc.cpp \
@@ -84,6 +85,7 @@
jrnl/jexception.hpp \
jrnl/jinf.hpp \
jrnl/jrec.hpp \
+ jrnl/lf_map.hpp \
jrnl/pmgr.hpp \
jrnl/rcvdat.hpp \
jrnl/rec_hdr.hpp \
Modified: store/trunk/cpp/lib/jrnl/file_hdr.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/file_hdr.hpp 2008-09-22 15:30:26 UTC (rev 2518)
+++ store/trunk/cpp/lib/jrnl/file_hdr.hpp 2008-09-22 15:31:44 UTC (rev 2519)
@@ -65,7 +65,7 @@
* +---+---+---+---+---+---+---+---+ | struct hdr
* | first rid in file | |
* +---+---+---+---+---+---+---+---+ -+
- * | fid | reserved (0) |
+ * | fid | lid | reserved (0) |
* +---+---+---+---+---+---+---+---+
* | fro |
* +---+---+---+---+---+---+---+---+
@@ -77,6 +77,7 @@
* number should be incremented)
* e = endian flag, false (0x00) for little endian, true (0x01) for big endian
* fid = File ID (number used in naming file)
+ * lid = Logical ID (order used in circular buffer)
* fro = First record offset, offset from start of file to first record header
* </pre>
*
@@ -87,12 +88,13 @@
*/
struct file_hdr : rec_hdr
{
- u_int32_t _fid; ///< File ID (fid)
+ u_int16_t _fid; ///< File ID (fid)
+ u_int16_t _lid; ///< Logical ID (lid)
u_int32_t _res; ///< Reserved (for alignment/flags)
#if defined(JRNL_BIG_ENDIAN) && defined(JRNL_32_BIT)
u_int32_t _filler0; ///< Big-endian filler for 32-bit size_t
#endif
- std::size_t _fro; ///< First record offset
+ std::size_t _fro; ///< First record offset
#if defined(JRNL_LITTLE_ENDIAN) && defined(JRNL_32_BIT)
u_int32_t _filler0; ///< Little-endian filler for 32-bit size_t
#endif
@@ -114,7 +116,7 @@
/**
* \brief Default constructor, which sets all values to 0.
*/
- inline file_hdr(): rec_hdr(), _fid(0), _res(0),
+ inline file_hdr(): rec_hdr(), _fid(0), _lid(0), _res(0),
#if defined(JRNL_BIG_ENDIAN) && defined(JRNL_32_BIT)
_filler0(0),
#endif
@@ -142,8 +144,9 @@
* \brief Convenience constructor which initializes values during construction.
*/
inline file_hdr(const u_int32_t magic, const u_int8_t version, const u_int64_t
rid,
- const u_int32_t fid, const std::size_t fro, const bool owi, const bool
settime = false):
- rec_hdr(magic, version, rid, owi), _fid(fid), _res(0),
+ const u_int16_t fid, const u_int16_t lid, const std::size_t fro,
+ const bool owi, const bool settime = false):
+ rec_hdr(magic, version, rid, owi), _fid(fid), _lid(lid), _res(0),
#if defined(JRNL_BIG_ENDIAN) && defined(JRNL_32_BIT)
_filler0(0),
#endif
Modified: store/trunk/cpp/lib/jrnl/jcntl.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.cpp 2008-09-22 15:30:26 UTC (rev 2518)
+++ store/trunk/cpp/lib/jrnl/jcntl.cpp 2008-09-22 15:31:44 UTC (rev 2519)
@@ -860,7 +860,7 @@
rd._eo = start_file_offs;
return false;
}
- if (!jfile_cycle(fid, ifsp, lowi, rd, false))
+ if (!done && !jfile_cycle(fid, ifsp, lowi, rd, false))
return false;
}
return true;
Modified: store/trunk/cpp/lib/jrnl/jerrno.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jerrno.cpp 2008-09-22 15:30:26 UTC (rev 2518)
+++ store/trunk/cpp/lib/jrnl/jerrno.cpp 2008-09-22 15:31:44 UTC (rev 2519)
@@ -117,6 +117,7 @@
const u_int32_t jerrno::JERR_JINF_NOVALUESTR = 0x0c01;
const u_int32_t jerrno::JERR_JINF_BADVALUESTR = 0x0c02;
const u_int32_t jerrno::JERR_JINF_JDATEMPTY = 0x0c03;
+const u_int32_t jerrno::JERR_JINF_TOOMANYFILES = 0x0c04;
// static initialization fn
@@ -218,6 +219,7 @@
_err_map[JERR_JINF_BADVALUESTR] = "JERR_JINF_BADVALUESTR: "
"Bad format for value attribute in jinf file";
_err_map[JERR_JINF_JDATEMPTY] = "JERR_JINF_JDATEMPTY: Journal data files
empty.";
+ _err_map[JERR_JINF_TOOMANYFILES] = "JERR_JINF_TOOMANYFILES: Too many journal
data files.";
//_err_map[] = "";
Modified: store/trunk/cpp/lib/jrnl/jerrno.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jerrno.hpp 2008-09-22 15:30:26 UTC (rev 2518)
+++ store/trunk/cpp/lib/jrnl/jerrno.hpp 2008-09-22 15:31:44 UTC (rev 2519)
@@ -135,6 +135,7 @@
static const u_int32_t JERR_JINF_NOVALUESTR; ///< No value attr found in
jinf file
static const u_int32_t JERR_JINF_BADVALUESTR; ///< Bad format for value attr
in jinf file
static const u_int32_t JERR_JINF_JDATEMPTY; ///< Journal data files empty
+ static const u_int32_t JERR_JINF_TOOMANYFILES; ///< Too many journal data
files
/**
* \brief Method to access error message from known error number.
Modified: store/trunk/cpp/lib/jrnl/jinf.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jinf.cpp 2008-09-22 15:30:26 UTC (rev 2518)
+++ store/trunk/cpp/lib/jrnl/jinf.cpp 2008-09-22 15:31:44 UTC (rev 2519)
@@ -38,6 +38,7 @@
#include "jrnl/file_hdr.hpp"
#include "jrnl/jcntl.hpp"
#include "jrnl/jerrno.hpp"
+#include "jrnl/lf_map.hpp"
#include <sstream>
namespace mrg
@@ -112,6 +113,12 @@
oss << "; minimum=" << JRNL_MIN_NUM_FILES <<
std::endl;
err = true;
}
+ if (_num_jfiles > JRNL_MAX_NUM_FILES)
+ {
+ oss << "Number of journal files too large: found=" <<
_num_jfiles;
+ oss << "; maximum=" << JRNL_MAX_NUM_FILES <<
std::endl;
+ err = true;
+ }
if (_jfsize_sblks < JRNL_MIN_FILE_SIZE)
{
oss << "Journal file size too small: found=" <<
_jfsize_sblks;
@@ -138,18 +145,17 @@
u_int16_t
jinf::analyze()
{
- u_int16_t ffid = 0xffff;
- bool owi = false;
- bool done = false;
-
+ lf_map early_map; // map for all owi flags same as fid 0
+ lf_map late_map; // map for all owi flags opposite to fid 0
+
if (!_valid_flag)
validate();
- u_int16_t fnum=0;
- while (!done && fnum < _num_jfiles)
+ bool done = false;
+ for (u_int16_t fid=0; fid<_num_jfiles && !done; fid++)
{
std::ostringstream oss;
oss << _jdir << "/" << _base_filename <<
".";
- oss << std::setw(4) << std::setfill('0') << std::hex
<< fnum;
+ oss << std::setw(4) << std::setfill('0') << std::hex
<< fid;
oss << "." << JRNL_DATA_EXTENSION;
std::ifstream jifs(oss.str().c_str());
if (!jifs.good())
@@ -158,28 +164,80 @@
jifs.read((char*)&fhdr, sizeof(fhdr));
if (fhdr._magic != RHM_JDAT_FILE_MAGIC) // No file header
{
- if (!fnum)
+ if (!fid)
throw jexception(jerrno::JERR_JINF_JDATEMPTY, "jinf",
"analyze");
_frot = true;
done = true;
}
- else if (fnum == 0) // First file only
+ else
{
- owi = fhdr.get_owi();
- _initial_owi = owi;
- ffid = 0;
+ assert(fid == fhdr._fid);
+ if (fid == 0)
+ {
+ _initial_owi = fhdr.get_owi();
+ early_map.insert(fhdr._lid, fid);
+ }
+ else
+ {
+ if (_initial_owi == fhdr.get_owi())
+ early_map.insert(fhdr._lid, fid);
+ else
+ late_map.insert(fhdr._lid, fid);
+ }
}
- else if (fhdr.get_owi() != owi) // Change in OWI
- {
- ffid = fnum;
- done = true;
- }
- else
- _end_file = fnum;
jifs.close();
- fnum++;
- }
- _start_file = ffid;
+ } // for (fid)
+
+ // If this is not the first rotation, all files should be in either early or late
maps
+ if (!_frot) assert(early_map.size() + late_map.size() == _num_jfiles);
+
+ if (late_map.empty())
+ _start_file = 0;
+ else
+ _start_file = (*late_map.begin()).second;
+// -------------------
+// u_int16_t ffid = 0xffff;
+// bool owi = false;
+// bool done = false;
+//
+// if (!_valid_flag)
+// validate();
+// u_int16_t fnum=0;
+// while (!done && fnum < _num_jfiles)
+// {
+// std::ostringstream oss;
+// oss << _jdir << "/" << _base_filename <<
".";
+// oss << std::setw(4) << std::setfill('0') << std::hex
<< fnum;
+// oss << "." << JRNL_DATA_EXTENSION;
+// std::ifstream jifs(oss.str().c_str());
+// if (!jifs.good())
+// throw jexception(jerrno::JERR__FILEIO, oss.str(), "jinf",
"analyze");
+// file_hdr fhdr;
+// jifs.read((char*)&fhdr, sizeof(fhdr));
+// if (fhdr._magic != RHM_JDAT_FILE_MAGIC) // No file header
+// {
+// if (!fnum)
+// throw jexception(jerrno::JERR_JINF_JDATEMPTY, "jinf",
"analyze");
+// _frot = true;
+// done = true;
+// }
+// else if (fnum == 0) // First file only
+// {
+// owi = fhdr.get_owi();
+// _initial_owi = owi;
+// ffid = 0;
+// }
+// else if (fhdr.get_owi() != owi) // Change in OWI
+// {
+// ffid = fnum;
+// done = true;
+// }
+// else
+// _end_file = fnum;
+// jifs.close();
+// fnum++;
+// }
+// _start_file = ffid;
_analyzed_flag = true;
return _start_file;
}
@@ -197,6 +255,14 @@
}
u_int16_t
+jinf::incr_num_jfiles()
+{
+ if (_num_jfiles >= JRNL_MAX_NUM_FILES)
+ throw jexception(jerrno::JERR_JINF_TOOMANYFILES, "jinf",
"incr_num_jfiles");
+ return ++_num_jfiles;
+}
+
+u_int16_t
jinf::get_start_file()
{
if (!_analyzed_flag)
Modified: store/trunk/cpp/lib/jrnl/jinf.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jinf.hpp 2008-09-22 15:30:26 UTC (rev 2518)
+++ store/trunk/cpp/lib/jrnl/jinf.hpp 2008-09-22 15:31:44 UTC (rev 2519)
@@ -89,6 +89,7 @@
inline const std::string& base_filename() const { return _base_filename; }
inline const timespec& ts() const { return _ts; }
inline u_int16_t num_jfiles() const { return _num_jfiles; }
+ u_int16_t incr_num_jfiles();
inline u_int32_t jfsize_sblks() const { return _jfsize_sblks; }
inline u_int16_t sblk_size_dblks() const { return _sblk_size_dblks; }
inline u_int32_t dblk_size() const { return _dblk_size; }
Added: store/trunk/cpp/lib/jrnl/lf_map.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/lf_map.cpp (rev 0)
+++ store/trunk/cpp/lib/jrnl/lf_map.cpp 2008-09-22 15:31:44 UTC (rev 2519)
@@ -0,0 +1,65 @@
+/**
+* \file lf_map.cpp
+*
+* Red Hat Messaging - Message Journal
+*
+* File containing code for class mrg::journal::lf_map (logical file map). See
+* comments in file lf_map.hpp for details.
+*
+* Copyright (C) 2007, 2008 Red Hat Inc.
+*
+* This file is part of Red Hat Messaging.
+*
+* Red Hat Messaging is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this library; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+* USA
+*
+* The GNU Lesser General Public License is available in the file COPYING.
+*/
+
+#include "jrnl/lf_map.hpp"
+
+#include "jrnl/jerrno.hpp"
+#include "jrnl/jexception.hpp"
+#include <sstream>
+
+namespace mrg
+{
+namespace journal
+{
+lf_map::lf_map() : _map() {}
+lf_map::~lf_map() {}
+
+void
+lf_map::insert(u_int16_t lid, u_int16_t fid)
+{
+ lfpair ip = lfpair(lid, fid);
+ lfret ret = _map.insert(ip);
+ if (ret.second == false)
+ {
+ std::ostringstream oss;
+ oss << std::hex << "lid=0x" << lid << "
fid=0x" << fid;
+ throw jexception(jerrno::JERR_MAP_DUPLICATE, oss.str(), "lf_map",
"insert");
+ }
+}
+
+void
+lf_map::get_fid_list(std::vector<u_int16_t>& fid_list)
+{
+ for (lfmap_citr i = _map.begin(); i != _map.end(); i++)
+ fid_list.push_back(i->second);
+}
+
+} // namespace journal
+} // namespace mrg
Added: store/trunk/cpp/lib/jrnl/lf_map.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/lf_map.hpp (rev 0)
+++ store/trunk/cpp/lib/jrnl/lf_map.hpp 2008-09-22 15:31:44 UTC (rev 2519)
@@ -0,0 +1,76 @@
+/**
+* \file lf_map.hpp
+*
+* Red Hat Messaging - Message Journal
+*
+* File containing code for class mrg::journal::lf_map (logical file map).
+* See class documentation for details.
+*
+* \author Kim van der Riet
+*
+* Copyright (C) 2007 Red Hat Inc.
+*
+* This file is part of Red Hat Messaging.
+*
+* Red Hat Messaging is free software; you can redistribute it and/or
+* modify it under the terms of the GNU Lesser General Public
+* License as published by the Free Software Foundation; either
+* version 2.1 of the License, or (at your option) any later version.
+*
+* This library is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+* Lesser General Public License for more details.
+*
+* You should have received a copy of the GNU Lesser General Public
+* License along with this library; if not, write to the Free Software
+* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+* USA
+*
+* The GNU Lesser General Public License is available in the file COPYING.
+*/
+
+#ifndef mrg_journal_lf_map_hpp
+#define mrg_journal_lf_map_hpp
+
+#include <map>
+#include <sys/types.h>
+#include <vector>
+
+namespace mrg
+{
+namespace journal
+{
+ /**
+ * \class lf_map
+ * \brief Maps the logical file id (lid) to the physical file id (fid)
+ * in the journal. NOTE: NOT THREAD SAFE - use only in
+ * single-threaded environments.
+ */
+ class lf_map
+ {
+ public:
+ typedef std::map<u_int16_t, u_int16_t> lfmap;
+ typedef lfmap::const_iterator lfmap_citr;
+
+ private:
+ typedef std::pair<u_int16_t, u_int16_t> lfpair;
+ typedef std::pair<lfmap::iterator, bool> lfret;
+ lfmap _map;
+
+ public:
+ lf_map();
+ virtual ~lf_map();
+
+ void insert(u_int16_t lid, u_int16_t fid);
+ inline u_int16_t size() const { return u_int16_t(_map.size()); }
+ inline bool empty() const { return _map.empty(); }
+ inline lfmap_citr begin() { return _map.begin(); }
+ inline lfmap_citr end() { return _map.end(); }
+ void get_fid_list(std::vector<u_int16_t>& fid_list);
+ };
+
+} // namespace journal
+} // namespace mrg
+
+#endif // ifndef mrg_journal_lf_map_hpp
Modified: store/trunk/cpp/lib/jrnl/wmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wmgr.cpp 2008-09-22 15:30:26 UTC (rev 2518)
+++ store/trunk/cpp/lib/jrnl/wmgr.cpp 2008-09-22 15:31:44 UTC (rev 2519)
@@ -217,7 +217,7 @@
}
else
fro = JRNL_SBLK_SIZE * JRNL_DBLK_SIZE;
- write_fhdr(rid, _wrfc.index(), fro);
+ write_fhdr(rid, _wrfc.index(), _wrfc.index(), fro);
}
// Is the page full? If so, flush.
@@ -358,7 +358,7 @@
}
else
fro = JRNL_SBLK_SIZE * JRNL_DBLK_SIZE;
- write_fhdr(rid, _wrfc.index(), fro);
+ write_fhdr(rid, _wrfc.index(), _wrfc.index(), fro);
}
// Is the page full? If so, flush.
@@ -497,7 +497,7 @@
}
else
fro = JRNL_SBLK_SIZE * JRNL_DBLK_SIZE;
- write_fhdr(rid, _wrfc.index(), fro);
+ write_fhdr(rid, _wrfc.index(), _wrfc.index(), fro);
}
// Is the page full? If so, flush.
@@ -632,7 +632,7 @@
}
else
fro = JRNL_SBLK_SIZE * JRNL_DBLK_SIZE;
- write_fhdr(rid, _wrfc.index(), fro);
+ write_fhdr(rid, _wrfc.index(), _wrfc.index(), fro);
}
// Is the page full? If so, flush.
@@ -1048,9 +1048,9 @@
}
void
-wmgr::write_fhdr(u_int64_t rid, u_int32_t fid, std::size_t fro)
+wmgr::write_fhdr(u_int64_t rid, u_int16_t fid, u_int16_t lid, std::size_t fro)
{
- file_hdr fhdr(RHM_JDAT_FILE_MAGIC, RHM_JDAT_VERSION, rid, fid, fro, _wrfc.owi(),
true);
+ file_hdr fhdr(RHM_JDAT_FILE_MAGIC, RHM_JDAT_VERSION, rid, fid, lid, fro, _wrfc.owi(),
true);
std::memcpy(_fhdr_ptr_arr[fid], &fhdr, sizeof(fhdr));
#ifdef RHM_CLEAN
std::memset((char*)_fhdr_ptr_arr[fid] + sizeof(fhdr), RHM_CLEAN_CHAR, _sblksize -
sizeof(fhdr));
Modified: store/trunk/cpp/lib/jrnl/wmgr.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wmgr.hpp 2008-09-22 15:30:26 UTC (rev 2518)
+++ store/trunk/cpp/lib/jrnl/wmgr.hpp 2008-09-22 15:31:44 UTC (rev 2519)
@@ -133,7 +133,7 @@
iores write_flush();
iores rotate_file();
void dblk_roundup();
- void write_fhdr(u_int64_t rid, u_int32_t fid, std::size_t fro);
+ void write_fhdr(u_int64_t rid, u_int16_t fid, u_int16_t lid, std::size_t fro);
void rotate_page();
void clean();
};
Modified: store/trunk/cpp/tests/jrnl/_ut_rec_hdr.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_ut_rec_hdr.cpp 2008-09-22 15:30:26 UTC (rev 2518)
+++ store/trunk/cpp/tests/jrnl/_ut_rec_hdr.cpp 2008-09-22 15:31:44 UTC (rev 2519)
@@ -144,7 +144,8 @@
const u_int8_t version = 0xa5;
const u_int16_t uflag = 0x5537;
const u_int64_t rid = 0xfedcba9876543210ULL;
- const u_int32_t fid = 0xfedcba98UL;
+ const u_int16_t fid = 0xfedcU;
+ const u_int16_t lid = 0xf0e1U;
#ifdef JRNL_32_BIT
const std::size_t fro = 0xfedcba98UL;
#else
@@ -161,6 +162,7 @@
BOOST_CHECK_EQUAL(fh1._uflag, 0);
BOOST_CHECK_EQUAL(fh1._rid, 0ULL);
BOOST_CHECK_EQUAL(fh1._fid, 0UL);
+ BOOST_CHECK_EQUAL(fh1._lid, 0U);
BOOST_CHECK_EQUAL(fh1._fro, std::size_t(0));
BOOST_CHECK_EQUAL(fh1._ts_sec, std::time_t(0));
BOOST_CHECK_EQUAL(fh1._ts_nsec, uint32_t(0));
@@ -168,7 +170,7 @@
}
{
- file_hdr fh2(magic, version, rid, fid, fro, owi, false);
+ file_hdr fh2(magic, version, rid, fid, lid, fro, owi, false);
BOOST_CHECK_EQUAL(fh2._magic, magic);
BOOST_CHECK_EQUAL(fh2._version, version);
#ifdef JRNL_LITTLE_ENDIAN
@@ -178,7 +180,8 @@
#endif
BOOST_CHECK_EQUAL(fh2._uflag, (const
u_int16_t)rec_hdr::HDR_OVERWRITE_INDICATOR_MASK);
BOOST_CHECK_EQUAL(fh2._rid, rid);
- BOOST_CHECK_EQUAL(fh2._fid,fid );
+ BOOST_CHECK_EQUAL(fh2._fid, fid );
+ BOOST_CHECK_EQUAL(fh2._lid, lid);
BOOST_CHECK_EQUAL(fh2._fro, fro);
BOOST_CHECK_EQUAL(fh2._ts_sec, std::time_t(0));
BOOST_CHECK_EQUAL(fh2._ts_nsec, uint32_t(0));
@@ -202,7 +205,7 @@
}
{
- file_hdr fh3(magic, version, rid, fid, fro, owi, true);
+ file_hdr fh3(magic, version, rid, fid, lid, fro, owi, true);
BOOST_CHECK_EQUAL(fh3._magic, magic);
BOOST_CHECK_EQUAL(fh3._version, version);
#ifdef JRNL_LITTLE_ENDIAN
@@ -213,6 +216,7 @@
BOOST_CHECK_EQUAL(fh3._uflag, (const
u_int16_t)rec_hdr::HDR_OVERWRITE_INDICATOR_MASK);
BOOST_CHECK_EQUAL(fh3._rid, rid);
BOOST_CHECK_EQUAL(fh3._fid, fid);
+ BOOST_CHECK_EQUAL(fh3._lid, lid);
BOOST_CHECK_EQUAL(fh3._fro, fro);
BOOST_CHECK(fh3._ts_sec - ts.tv_sec <= 1); // No more than 1 sec difference
}
Modified: store/trunk/cpp/tests/jrnl/jtt/jfile_chk.py
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/jfile_chk.py 2008-09-22 15:30:26 UTC (rev 2518)
+++ store/trunk/cpp/tests/jrnl/jtt/jfile_chk.py 2008-09-22 15:31:44 UTC (rev 2519)
@@ -222,16 +222,17 @@
class FileHdr(Hdr):
- format = '=I4x3Q'
+ format = '=2H4x3Q'
- def init(self, f, foffs, fid, fro, time_sec, time_ns):
+ def init(self, f, foffs, fid, lid, fro, time_sec, time_ns):
self.fid = fid
+ self.lid = lid
self.fro = fro
self.time_sec = time_sec
self.time_ns = time_ns
def __str__(self):
- return '%s fid=%d fro=0x%08x t=%s' % (Hdr.__str__(self), self.fid,
self.fro, self.timestamp_str())
+ return '%s fid=%d lid=%d fro=0x%08x t=%s' % (Hdr.__str__(self), self.fid,
self.lid, self.fro, self.timestamp_str())
def skip(self, f):
f.read(rem_in_blk(f, sblk_size))