Author: kpvdr
Date: 2008-09-22 11:47:59 -0400 (Mon, 22 Sep 2008)
New Revision: 2520
Modified:
store/trunk/cpp/lib/jrnl/jinf.cpp
Log:
commented out test code that accidentally got checked in
Modified: store/trunk/cpp/lib/jrnl/jinf.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jinf.cpp 2008-09-22 15:31:44 UTC (rev 2519)
+++ store/trunk/cpp/lib/jrnl/jinf.cpp 2008-09-22 15:47:59 UTC (rev 2520)
@@ -145,17 +145,69 @@
u_int16_t
jinf::analyze()
{
- 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
-
+// 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();
+// 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
<< fid;
+// 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 (!fid)
+// throw jexception(jerrno::JERR_JINF_JDATEMPTY, "jinf",
"analyze");
+// _frot = true;
+// done = true;
+// }
+// else
+// {
+// 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);
+// }
+// }
+// jifs.close();
+// } // 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();
- bool done = false;
- for (u_int16_t fid=0; fid<_num_jfiles && !done; fid++)
+ 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
<< fid;
+ oss << std::setw(4) << std::setfill('0') << std::hex
<< fnum;
oss << "." << JRNL_DATA_EXTENSION;
std::ifstream jifs(oss.str().c_str());
if (!jifs.good())
@@ -164,80 +216,28 @@
jifs.read((char*)&fhdr, sizeof(fhdr));
if (fhdr._magic != RHM_JDAT_FILE_MAGIC) // No file header
{
- if (!fid)
+ if (!fnum)
throw jexception(jerrno::JERR_JINF_JDATEMPTY, "jinf",
"analyze");
_frot = true;
done = true;
}
- else
+ else if (fnum == 0) // First file only
{
- 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);
- }
+ 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();
- } // 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;
+ fnum++;
+ }
+ _start_file = ffid;
_analyzed_flag = true;
return _start_file;
}
Show replies by date