Author: kpvdr
Date: 2008-10-17 16:42:21 -0400 (Fri, 17 Oct 2008)
New Revision: 2652
Modified:
store/trunk/cpp/lib/JournalImpl.cpp
store/trunk/cpp/lib/JournalImpl.h
store/trunk/cpp/lib/MessageStoreImpl.cpp
store/trunk/cpp/lib/MessageStoreImpl.h
store/trunk/cpp/lib/StorePlugin.cpp
store/trunk/cpp/lib/jrnl/jcntl.cpp
store/trunk/cpp/lib/jrnl/jcntl.hpp
store/trunk/cpp/lib/jrnl/jinf.cpp
store/trunk/cpp/tests/jrnl/_st_basic.cpp
store/trunk/cpp/tests/jrnl/_st_basic_txn.cpp
store/trunk/cpp/tests/jrnl/_st_helper_fns.hpp
store/trunk/cpp/tests/jrnl/_st_read.cpp
store/trunk/cpp/tests/jrnl/_st_read_txn.cpp
store/trunk/cpp/tests/jrnl/jtt/_ut_jrnl_init_params.cpp
store/trunk/cpp/tests/jrnl/jtt/_ut_jrnl_instance.cpp
store/trunk/cpp/tests/jrnl/jtt/jrnl_init_params.cpp
store/trunk/cpp/tests/jrnl/jtt/jrnl_init_params.hpp
store/trunk/cpp/tests/jrnl/jtt/jrnl_instance.cpp
store/trunk/cpp/tests/jrnl/jtt/jrnl_instance.hpp
Log:
Added store parameters for controlling auto-expand and wired them to the tests and
journal.
Modified: store/trunk/cpp/lib/JournalImpl.cpp
===================================================================
--- store/trunk/cpp/lib/JournalImpl.cpp 2008-10-17 19:10:47 UTC (rev 2651)
+++ store/trunk/cpp/lib/JournalImpl.cpp 2008-10-17 20:42:21 UTC (rev 2652)
@@ -127,6 +127,8 @@
void
JournalImpl::initialize(const u_int16_t num_jfiles,
+ const bool auto_expand,
+ const u_int16_t ae_max_jfiles,
const u_int32_t jfsize_sblks,
const u_int16_t wcache_num_pages,
const u_int32_t wcache_pgsize_sblks,
@@ -138,8 +140,8 @@
oss << " wcache_pgsize_sblks=" << wcache_pgsize_sblks;
oss << " wcache_num_pages=" << wcache_num_pages;
log(LOG_DEBUG, oss.str());
- jcntl::initialize(num_jfiles, jfsize_sblks, wcache_num_pages, wcache_pgsize_sblks,
rd_cb,
- wr_cb);
+ jcntl::initialize(num_jfiles, auto_expand, ae_max_jfiles, jfsize_sblks,
wcache_num_pages, wcache_pgsize_sblks,
+ rd_cb, wr_cb);
log(LOG_DEBUG, "Initialization complete");
if (_mgmtObject != 0)
@@ -154,6 +156,8 @@
void
JournalImpl::recover(const u_int16_t num_jfiles,
+ const bool auto_expand,
+ const u_int16_t ae_max_jfiles,
const u_int32_t jfsize_sblks,
const u_int16_t wcache_num_pages,
const u_int32_t wcache_pgsize_sblks,
@@ -186,11 +190,11 @@
prep_xid_list.push_back(i->xid);
}
- jcntl::recover(num_jfiles, jfsize_sblks, wcache_num_pages, wcache_pgsize_sblks,
rd_cb, wr_cb,
- &prep_xid_list, highest_rid);
+ jcntl::recover(num_jfiles, auto_expand, ae_max_jfiles, jfsize_sblks,
wcache_num_pages, wcache_pgsize_sblks,
+ rd_cb, wr_cb, &prep_xid_list, highest_rid);
} else {
- jcntl::recover(num_jfiles, jfsize_sblks, wcache_num_pages, wcache_pgsize_sblks,
rd_cb, wr_cb,
- 0, highest_rid);
+ jcntl::recover(num_jfiles, auto_expand, ae_max_jfiles, jfsize_sblks,
wcache_num_pages, wcache_pgsize_sblks,
+ rd_cb, wr_cb, 0, highest_rid);
}
// Populate PreparedTransaction lists from _tmap
Modified: store/trunk/cpp/lib/JournalImpl.h
===================================================================
--- store/trunk/cpp/lib/JournalImpl.h 2008-10-17 19:10:47 UTC (rev 2651)
+++ store/trunk/cpp/lib/JournalImpl.h 2008-10-17 20:42:21 UTC (rev 2652)
@@ -99,6 +99,8 @@
virtual ~JournalImpl();
void initialize(const u_int16_t num_jfiles,
+ const bool auto_expand,
+ const u_int16_t ae_max_jfiles,
const u_int32_t jfsize_sblks,
const u_int16_t wcache_num_pages,
const u_int32_t wcache_pgsize_sblks,
@@ -106,14 +108,18 @@
const journal::wr_aio_cb wr_cb);
inline void initialize(const u_int16_t num_jfiles,
+ const bool auto_expand,
+ const u_int16_t ae_max_jfiles,
const u_int32_t jfsize_sblks,
const u_int16_t wcache_num_pages,
const u_int32_t wcache_pgsize_sblks) {
- initialize(num_jfiles, jfsize_sblks, wcache_num_pages,
wcache_pgsize_sblks, 0,
- &aio_wr_callback);
+ initialize(num_jfiles, auto_expand, ae_max_jfiles, jfsize_sblks,
wcache_num_pages, wcache_pgsize_sblks,
+ 0, &aio_wr_callback);
}
void recover(const u_int16_t num_jfiles,
+ const bool auto_expand,
+ const u_int16_t ae_max_jfiles,
const u_int32_t jfsize_sblks,
const u_int16_t wcache_num_pages,
const u_int32_t wcache_pgsize_sblks,
@@ -124,14 +130,16 @@
u_int64_t queue_id);
inline void recover(const u_int16_t num_jfiles,
+ const bool auto_expand,
+ const u_int16_t ae_max_jfiles,
const u_int32_t jfsize_sblks,
const u_int16_t wcache_num_pages,
const u_int32_t wcache_pgsize_sblks,
boost::ptr_list<msgstore::PreparedTransaction>*
prep_tx_list_ptr,
u_int64_t& highest_rid,
u_int64_t queue_id) {
- recover(num_jfiles, jfsize_sblks, wcache_num_pages, wcache_pgsize_sblks,
0,
- &aio_wr_callback, prep_tx_list_ptr, highest_rid, queue_id);
+ recover(num_jfiles, auto_expand, ae_max_jfiles, jfsize_sblks,
wcache_num_pages, wcache_pgsize_sblks,
+ 0, &aio_wr_callback, prep_tx_list_ptr, highest_rid,
queue_id);
}
void recover_complete();
Modified: store/trunk/cpp/lib/MessageStoreImpl.cpp
===================================================================
--- store/trunk/cpp/lib/MessageStoreImpl.cpp 2008-10-17 19:10:47 UTC (rev 2651)
+++ store/trunk/cpp/lib/MessageStoreImpl.cpp 2008-10-17 20:42:21 UTC (rev 2652)
@@ -71,6 +71,8 @@
bindingDb(&env, 0),
generalDb(&env, 0),
numJrnlFiles(0),
+ autoJrnlExpand(false),
+ autoJrnlExpandMaxFiles(0),
jrnlFsizeSblks(0),
wCachePgSizeSblks(0),
wCacheNumPages(0),
@@ -166,6 +168,47 @@
}
}
+void MessageStoreImpl::chkJrnlAutoExpandOptions(const StoreOptions* opts,
+ bool& autoJrnlExpand,
+ u_int16_t& autoJrnlExpandMaxFiles,
+ const std::string&
autoJrnlExpandMaxFilesParamName,
+ const u_int16_t numJrnlFiles,
+ const std::string&
numJrnlFilesParamName)
+{
+ if (!opts->autoJrnlExpand) {
+ // auto-expand disabled
+ autoJrnlExpand = false;
+ autoJrnlExpandMaxFiles = 0;
+ return;
+ }
+ u_int16_t p = opts->autoJrnlExpandMaxFiles;
+ if (numJrnlFiles == JRNL_MAX_NUM_FILES) {
+ // num-jfiles at max; disable auto-expand
+ autoJrnlExpand = false;
+ autoJrnlExpandMaxFiles = 0;
+ QPID_LOG(warning, "parameter " << autoJrnlExpandMaxFilesParamName
<< " (" << p << ") must be higher than parameter "
<< numJrnlFilesParamName << " (" << numJrnlFiles <<
") which is at the maximum allowable value; disabling auto-expand.");
+ return;
+ }
+ if (p > JRNL_MAX_NUM_FILES) {
+ // auto-expand-max-jfiles higher than max allowable, adjust
+ autoJrnlExpand = true;
+ autoJrnlExpandMaxFiles = JRNL_MAX_NUM_FILES;
+ QPID_LOG(warning, "parameter " << autoJrnlExpandMaxFilesParamName
<< " (" << p << ") is above allowable maximum ("
<< JRNL_MAX_NUM_FILES << "); changing this parameter to maximum
value.");
+ return;
+ }
+ if (p <= numJrnlFiles) {
+ // auto-expand-max-jfiles less than num-jfiles, adjust to num-jfiles + 2 (or
num-jfiles + 1 if jfiles is only one less than max allowable)
+ u_int16_t incr = JRNL_MAX_NUM_FILES - numJrnlFiles > 1 ? 2 : 1;
+ autoJrnlExpand = true;
+ autoJrnlExpandMaxFiles = numJrnlFiles + incr;
+ QPID_LOG(warning, "parameter " << autoJrnlExpandMaxFilesParamName
<< " (" << p << ") is not above that of parameter "
<< numJrnlFilesParamName << " (" << numJrnlFiles <<
"); changing this parameter to value of parameter " <<
numJrnlFilesParamName << " plus " << incr << " ("
<< autoJrnlExpandMaxFiles << ").");
+ return;
+ }
+ // No adjustments req'd, set values
+ autoJrnlExpand = true;
+ autoJrnlExpandMaxFiles = p;
+}
+
void MessageStoreImpl::initManagement (Broker* broker)
{
if (broker != 0) {
@@ -193,16 +236,19 @@
bool MessageStoreImpl::init(const qpid::Options* options)
{
// Extract and check options
- const Options* opts = static_cast<const Options*>(options);
+ const StoreOptions* opts = static_cast<const StoreOptions*>(options);
u_int16_t numJrnlFiles = chkJrnlNumFilesParam(opts->numJrnlFiles,
"num-jfiles");
u_int32_t jrnlFsizePgs = chkJrnlFileSizeParam(opts->jrnlFsizePgs,
"jfile-size-pgs");
u_int32_t jrnlWrCachePageSizeKib = chkJrnlWrPageCacheSize(opts->wCachePageSizeKib,
"wcache-page-size");
u_int16_t tplNumJrnlFiles = chkJrnlNumFilesParam(opts->tplNumJrnlFiles,
"tpl-num-jfiles");
u_int32_t tplJrnlFSizePgs = chkJrnlFileSizeParam(opts->tplJrnlFsizePgs,
"tpl-jfile-size-pgs");
u_int32_t tplJrnlWrCachePageSizeKib =
chkJrnlWrPageCacheSize(opts->tplWCachePageSizeKib, "tpl-wcache-page-size");
+ bool autoJrnlExpand;
+ u_int16_t autoJrnlExpandMaxFiles;
+ chkJrnlAutoExpandOptions(opts, autoJrnlExpand, autoJrnlExpandMaxFiles,
"auto-expand-max-jfiles", numJrnlFiles, "num-jfiles");
// Pass option values to init(...)
- return init(opts->storeDir, numJrnlFiles, jrnlFsizePgs, jrnlWrCachePageSizeKib,
tplNumJrnlFiles, tplJrnlFSizePgs, tplJrnlWrCachePageSizeKib);
+ return init(opts->storeDir, numJrnlFiles, jrnlFsizePgs, jrnlWrCachePageSizeKib,
tplNumJrnlFiles, tplJrnlFSizePgs, tplJrnlWrCachePageSizeKib, autoJrnlExpand,
autoJrnlExpandMaxFiles);
}
// These params, taken from options, are assumed to be correct and verified
@@ -212,7 +258,9 @@
u_int32_t wCachePageSizeKib,
u_int16_t tplJfiles,
u_int32_t tplJfileSizePgs,
- u_int32_t tplWCachePageSizeKib)
+ u_int32_t tplWCachePageSizeKib,
+ bool autoJExpand,
+ u_int16_t autoJExpandMaxFiles)
{
if (isInit) return true;
@@ -225,6 +273,8 @@
tplJrnlFsizeSblks = tplJfileSizePgs * JRNL_RMGR_PAGE_SIZE;
tplWCachePgSizeSblks = tplWCachePageSizeKib * 1024 / JRNL_DBLK_SIZE / JRNL_SBLK_SIZE;
// convert from KiB to number sblks
tplWCacheNumPages = getJrnlWrNumPages(tplWCachePageSizeKib);
+ autoJrnlExpand = autoJExpand;
+ autoJrnlExpandMaxFiles = autoJExpandMaxFiles;
if (dir.size()>0) storeDir = dir;
@@ -266,6 +316,8 @@
isInit = true;
QPID_LOG(notice, "Store module initialized; dir=" << dir);
QPID_LOG(info, "> Default files per journal: " << jfiles);
+ QPID_LOG(info, "> Auto-expand " << (autoJrnlExpand ?
"enabled" : "disabled"));
+ if (autoJrnlExpand) QPID_LOG(info, "> Max auto-expand journal files: "
<< autoJrnlExpandMaxFiles);
QPID_LOG(info, "> Default jrournal file size: " << jfileSizePgs
<< " (wpgs)");
QPID_LOG(info, "> Default write cache page size: " <<
wCachePageSizeKib << " (Kib)");
QPID_LOG(info, "> Default number of write cache pages: " <<
wCacheNumPages);
@@ -282,7 +334,7 @@
qpid::sys::Mutex::ScopedLock sl(jrnlCreateLock);
if (!tplStorePtr->is_ready()) {
journal::jdir::create_dir(getTplBaseDir());
- tplStorePtr->initialize(tplNumJrnlFiles, tplJrnlFsizeSblks,
tplWCacheNumPages, tplWCachePgSizeSblks);
+ tplStorePtr->initialize(tplNumJrnlFiles, false, 0, tplJrnlFsizeSblks,
tplWCacheNumPages, tplWCachePgSizeSblks);
if (mgmtObject != 0) mgmtObject->set_tplIsInitialized(true);
}
}
@@ -350,13 +402,15 @@
FieldTable::ValuePtr value;
u_int16_t localFileCount = numJrnlFiles;
+ bool localAutoExpandFlag = autoJrnlExpand;
+ u_int16_t localAutoExpandMaxFileCount = autoJrnlExpandMaxFiles;
u_int32_t localFileSizeSblks = jrnlFsizeSblks;
- value = args.get ("qpid.file_count");
+ value = args.get("qpid.file_count");
if (value.get() != 0 && !value->empty() &&
value->convertsTo<int>())
localFileCount = (u_int16_t) value->get<int>();
- value = args.get ("qpid.file_size");
+ value = args.get("qpid.file_size");
if (value.get() != 0 && !value->empty() &&
value->convertsTo<int>())
localFileSizeSblks = (u_int32_t) value->get<int>() *
JRNL_RMGR_PAGE_SIZE;
@@ -368,10 +422,18 @@
defJournalFlushTimeout);
}
+ value = args.get("qpid.auto_expand");
+ if (value.get() != 0 && !value->empty() &&
value->convertsTo<bool>())
+ localAutoExpandFlag = (bool) value->get<bool>();
+
+ value = args.get("qpid.auto_expand_max_jfiles");
+ if (value.get() != 0 && !value->empty() &&
value->convertsTo<int>())
+ localAutoExpandMaxFileCount = (u_int16_t) value->get<int>();
+
queue.setExternalQueueStore(dynamic_cast<ExternalQueueStore*>(jQueue));
try {
// init will create the deque's for the init...
- jQueue->initialize(localFileCount, localFileSizeSblks, wCacheNumPages,
wCachePgSizeSblks);
+ jQueue->initialize(localFileCount, localAutoExpandFlag,
localAutoExpandMaxFileCount, localFileSizeSblks, wCacheNumPages, wCachePgSizeSblks);
} catch (const journal::jexception& e) {
THROW_STORE_EXCEPTION(std::string("Queue ") + queue.getName() + ":
create() failed: " + e.what());
}
@@ -638,7 +700,7 @@
long rcnt = 0L; // recovered msg count
long idcnt = 0L; // in-doubt msg count
u_int64_t thisHighestRid = 0;
- jQueue->recover(numJrnlFiles, jrnlFsizeSblks, wCacheNumPages,
wCachePgSizeSblks, &prepared, thisHighestRid, key.id); // start recovery
+ jQueue->recover(numJrnlFiles, autoJrnlExpand, autoJrnlExpandMaxFiles,
jrnlFsizeSblks, wCacheNumPages, wCachePgSizeSblks, &prepared, thisHighestRid, key.id);
// start recovery
if (thisHighestRid > highestRid)
highestRid = thisHighestRid;
recoverMessages(txn, registry, queue, prepared, messages, rcnt, idcnt);
@@ -1011,7 +1073,7 @@
{
if (journal::jdir::exists(tplStorePtr->jrnl_dir() +
tplStorePtr->base_filename() + ".jinf")) {
u_int64_t thisHighestRid;
- tplStorePtr->recover(tplNumJrnlFiles, tplJrnlFsizeSblks, tplWCachePgSizeSblks,
tplWCacheNumPages, 0, thisHighestRid, 0);
+ tplStorePtr->recover(tplNumJrnlFiles, false, 0, tplJrnlFsizeSblks,
tplWCachePgSizeSblks, tplWCacheNumPages, 0, thisHighestRid, 0);
if (thisHighestRid > highestRid)
highestRid = thisHighestRid;
@@ -1670,34 +1732,41 @@
return dir.str();
}
-MessageStoreImpl::Options::Options(const std::string& name) :
- qpid::Options(name),
- numJrnlFiles(defNumJrnlFiles),
- jrnlFsizePgs(defJrnlFileSizePgs),
- wCachePageSizeKib(defWCachePageSize),
- tplNumJrnlFiles(defTplNumJrnlFiles),
- tplJrnlFsizePgs(defTplJrnlFileSizePgs),
- tplWCachePageSizeKib(defTplWCachePageSize)
+MessageStoreImpl::StoreOptions::StoreOptions(const std::string& name) :
+ qpid::Options(name),
+ numJrnlFiles(defNumJrnlFiles),
+ autoJrnlExpand(defAutoJrnlExpand),
+
autoJrnlExpandMaxFiles(defAutoJrnlExpandMaxFiles),
+ jrnlFsizePgs(defJrnlFileSizePgs),
+ wCachePageSizeKib(defWCachePageSize),
+ tplNumJrnlFiles(defTplNumJrnlFiles),
+ tplJrnlFsizePgs(defTplJrnlFileSizePgs),
+ tplWCachePageSizeKib(defTplWCachePageSize)
{
addOptions()
("store-dir", qpid::optValue(storeDir, "DIR"),
- "Store directory location for persistence (instead of using --data-dir
value). "
- "Must be supplied if --no-data-dir is also used.")
+ "Store directory location for persistence (instead of using
--data-dir value). "
+ "Required if --no-data-dir is also used.")
("num-jfiles", qpid::optValue(numJrnlFiles, "N"),
- "Default number of files for each journal instance")
+ "Default number of files for each journal instance (queue).")
+ ("auto-expand", qpid::optValue(autoJrnlExpand, "yes|no"),
+ "If yes|true|1, allows journal to auto-expand by adding additional
journal files as needed. "
+ "If no|false|0, the number of journal files will remain fixed
(num-jfiles).")
+ ("auto-expand-max-jfiles", qpid::optValue(autoJrnlExpandMaxFiles,
"N"),
+ "Maximum number of journal files allowed from auto-expanding; must
be greater than --num-jfiles parameter.")
("jfile-size-pgs", qpid::optValue(jrnlFsizePgs, "N"),
- "Default size for each journal file in multiples of read pages (1 read page
= 64kiB)")
+ "Default size for each journal file in multiples of read pages (1
read page = 64kiB)")
("wcache-page-size", qpid::optValue(wCachePageSizeKib, "N"),
- "Size of the pages in the write page cache in KiB. "
- "Allowable values - powers of 2: 1, 2, 4, ... , 128. "
- "Lower values decrease latency at the expense of throughput.")
+ "Size of the pages in the write page cache in KiB. "
+ "Allowable values - powers of 2: 1, 2, 4, ... , 128. "
+ "Lower values decrease latency at the expense of throughput.")
("tpl-num-jfiles", qpid::optValue(tplNumJrnlFiles, "N"),
- "Number of files for transaction prepared list journal instance")
+ "Number of files for transaction prepared list journal
instance")
("tpl-jfile-size-pgs", qpid::optValue(tplJrnlFsizePgs, "N"),
- "Size of each transaction prepared list journal file in multiples of read
pages (1 read page = 64kiB)")
+ "Size of each transaction prepared list journal file in multiples of
read pages (1 read page = 64kiB)")
("tpl-wcache-page-size", qpid::optValue(tplWCachePageSizeKib,
"N"),
- "Size of the pages in the transaction prepared list write page cache in
KiB. "
- "Allowable values - powers of 2: 1, 2, 4, ... , 128. "
- "Lower values decrease latency at the expense of throughput.")
+ "Size of the pages in the transaction prepared list write page cache
in KiB. "
+ "Allowable values - powers of 2: 1, 2, 4, ... , 128. "
+ "Lower values decrease latency at the expense of throughput.")
;
}
Modified: store/trunk/cpp/lib/MessageStoreImpl.h
===================================================================
--- store/trunk/cpp/lib/MessageStoreImpl.h 2008-10-17 19:10:47 UTC (rev 2651)
+++ store/trunk/cpp/lib/MessageStoreImpl.h 2008-10-17 20:42:21 UTC (rev 2652)
@@ -53,6 +53,21 @@
*/
class MessageStoreImpl : public qpid::broker::MessageStore, public
qpid::management::Manageable
{
+ public:
+ struct StoreOptions : public qpid::Options {
+ StoreOptions(const std::string& name="Store Options");
+ std::string clusterName;
+ std::string storeDir;
+ u_int16_t numJrnlFiles;
+ bool autoJrnlExpand;
+ u_int16_t autoJrnlExpandMaxFiles;
+ u_int32_t jrnlFsizePgs;
+ u_int32_t wCachePageSizeKib;
+ u_int16_t tplNumJrnlFiles;
+ u_int32_t tplJrnlFsizePgs;
+ u_int32_t tplWCachePageSizeKib;
+ };
+
protected:
typedef std::map<u_int64_t, qpid::broker::RecoverableQueue::shared_ptr>
queue_index;
typedef std::map<u_int64_t, qpid::broker::RecoverableExchange::shared_ptr>
exchange_index;
@@ -81,6 +96,8 @@
static const u_int16_t defTplNumJrnlFiles = 8;
static const u_int32_t defTplJrnlFileSizePgs = 24;
static const u_int32_t defTplWCachePageSize = defWCachePageSize / 8;
+ static const bool defAutoJrnlExpand = true;
+ static const u_int16_t defAutoJrnlExpandMaxFiles = 16;
std::list<Db*> dbs;
DbEnv env;
@@ -102,6 +119,8 @@
IdSequence messageIdSequence;
std::string storeDir;
u_int16_t numJrnlFiles;
+ bool autoJrnlExpand;
+ u_int16_t autoJrnlExpandMaxFiles;
u_int32_t jrnlFsizeSblks;
u_int32_t wCachePgSizeSblks;
u_int16_t wCacheNumPages;
@@ -125,6 +144,12 @@
static u_int32_t chkJrnlWrPageCacheSize(const u_int32_t param,
const std::string paramName);
static u_int16_t getJrnlWrNumPages(const u_int32_t wrPageSizeKib);
+ void chkJrnlAutoExpandOptions(const MessageStoreImpl::StoreOptions* opts,
+ bool& autoJrnlExpand,
+ u_int16_t& autoJrnlExpandMaxFiles,
+ const std::string&
autoJrnlExpandMaxFilesParamName,
+ const u_int16_t numJrnlFiles,
+ const std::string& numJrnlFilesParamName);
void recoverQueues(TxnCtxt& txn,
qpid::broker::RecoveryManager& recovery,
@@ -240,18 +265,6 @@
}
public:
- struct Options : public qpid::Options {
- Options(const std::string& name="Store Options");
- std::string clusterName;
- std::string storeDir;
- u_int16_t numJrnlFiles;
- u_int32_t jrnlFsizePgs;
- u_int32_t wCachePageSizeKib;
- u_int16_t tplNumJrnlFiles;
- u_int32_t tplJrnlFsizePgs;
- u_int32_t tplWCachePageSizeKib;
- };
-
typedef boost::shared_ptr<MessageStoreImpl> shared_ptr;
MessageStoreImpl(const char* envpath = 0);
@@ -266,7 +279,9 @@
u_int32_t wCachePageSize = defWCachePageSize,
u_int16_t tplJfiles = defTplNumJrnlFiles,
u_int32_t tplJfileSizePgs = defTplJrnlFileSizePgs,
- u_int32_t tplWCachePageSize = defTplWCachePageSize);
+ u_int32_t tplWCachePageSize = defTplWCachePageSize,
+ bool autoJExpand = defAutoJrnlExpand,
+ u_int16_t autoJExpandMaxFiles = defAutoJrnlExpandMaxFiles);
void initManagement (qpid::broker::Broker* broker);
Modified: store/trunk/cpp/lib/StorePlugin.cpp
===================================================================
--- store/trunk/cpp/lib/StorePlugin.cpp 2008-10-17 19:10:47 UTC (rev 2651)
+++ store/trunk/cpp/lib/StorePlugin.cpp 2008-10-17 20:42:21 UTC (rev 2652)
@@ -35,7 +35,7 @@
struct StorePlugin : public Plugin {
- mrg::msgstore::MessageStoreImpl::Options options;
+ mrg::msgstore::MessageStoreImpl::StoreOptions options;
MessageStore *store;
Options* getOptions() { return &options; }
Modified: store/trunk/cpp/lib/jrnl/jcntl.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.cpp 2008-10-17 19:10:47 UTC (rev 2651)
+++ store/trunk/cpp/lib/jrnl/jcntl.cpp 2008-10-17 20:42:21 UTC (rev 2652)
@@ -87,8 +87,8 @@
}
void
-jcntl::initialize(const u_int16_t num_jfiles, const u_int32_t jfsize_sblks,
- const u_int16_t wcache_num_pages, const u_int32_t wcache_pgsize_sblks,
+jcntl::initialize(const u_int16_t num_jfiles, const bool auto_expand, const u_int16_t
ae_max_jfiles,
+ const u_int32_t jfsize_sblks, const u_int16_t wcache_num_pages, const u_int32_t
wcache_pgsize_sblks,
const rd_aio_cb rd_cb, const wr_aio_cb wr_cb)
{
_init_flag = false;
@@ -112,7 +112,7 @@
// Clear any existing journal files
_jdir.clear_dir();
- _lfmgr.initialize(num_jfiles, false, 0, this, &new_fcntl);
+ _lfmgr.initialize(num_jfiles, auto_expand, ae_max_jfiles, this, &new_fcntl);
_wrfc.initialize(_jfsize_sblks);
_rrfc.initialize();
@@ -128,10 +128,10 @@
}
void
-jcntl::recover(const u_int16_t num_jfiles, const u_int32_t jfsize_sblks,
- const u_int16_t wcache_num_pages, const u_int32_t wcache_pgsize_sblks,
- const rd_aio_cb rd_cb, const wr_aio_cb wr_cb,
- const std::vector<std::string>* prep_txn_list_ptr, u_int64_t&
highest_rid)
+jcntl::recover(const u_int16_t num_jfiles, const bool auto_expand, const u_int16_t
ae_max_jfiles,
+ const u_int32_t jfsize_sblks, const u_int16_t wcache_num_pages, const u_int32_t
wcache_pgsize_sblks,
+ const rd_aio_cb rd_cb, const wr_aio_cb wr_cb, const
std::vector<std::string>* prep_txn_list_ptr,
+ u_int64_t& highest_rid)
{
_init_flag = false;
_stop_flag = false;
@@ -154,7 +154,7 @@
// Verify journal dir and journal files
_jdir.verify_dir();
- _rcvdat.reset(num_jfiles, false, 0);
+ _rcvdat.reset(num_jfiles, auto_expand, ae_max_jfiles);
rcvr_janalyze(_rcvdat, prep_txn_list_ptr);
highest_rid = _rcvdat._h_rid;
Modified: store/trunk/cpp/lib/jrnl/jcntl.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.hpp 2008-10-17 19:10:47 UTC (rev 2651)
+++ store/trunk/cpp/lib/jrnl/jcntl.hpp 2008-10-17 20:42:21 UTC (rev 2652)
@@ -177,6 +177,14 @@
* used.</b>
*
* \param num_jfiles The number of journal files to be created.
+ * \param auto_expand If true, allows journal file auto-expansion. In this mode,
the journal will automatically
+ * add files to the journal if it runs out of space. No more than
ae_max_jfiles may be added. If false, then
+ * no files are added and an exception will be thrown if the journal runs out
of file space.
+ * \param ae_max_jfiles Upper limit of journal files for auto-expand mode. When
auto_expand is true, this is the
+ * maximum total number of files allowed in the journal (original plus those
added by auto-expand mode). If
+ * this number of files exist and the journal runs out of space, an exception
will be thrown. This number
+ * must be greater than the num_jfiles parameter value but cannot exceed the
maximum number of files for a
+ * single journal; if num_jfiles is already at its maximum value, then
auto-expand wil be disabled.
* \param jfsize_sblks The size of each journal file expressed in softblocks.
* \param wcache_num_pages The number of write cache pages to create.
* \param wcache_pgsize_sblks The size in sblks of each write cache page.
@@ -185,8 +193,8 @@
*
* \exception TODO
*/
- void initialize(const u_int16_t num_jfiles, const u_int32_t jfsize_sblks,
- const u_int16_t wcache_num_pages, const u_int32_t wcache_pgsize_sblks,
+ void initialize(const u_int16_t num_jfiles, const bool auto_expand, const
u_int16_t ae_max_jfiles,
+ const u_int32_t jfsize_sblks, const u_int16_t wcache_num_pages, const
u_int32_t wcache_pgsize_sblks,
const rd_aio_cb rd_cb, const wr_aio_cb wr_cb);
/**
@@ -205,6 +213,14 @@
* used.</b>
*
* \param num_jfiles The number of journal files to be created.
+ * \param auto_expand If true, allows journal file auto-expansion. In this mode,
the journal will automatically
+ * add files to the journal if it runs out of space. No more than
ae_max_jfiles may be added. If false, then
+ * no files are added and an exception will be thrown if the journal runs out
of file space.
+ * \param ae_max_jfiles Upper limit of journal files for auto-expand mode. When
auto_expand is true, this is the
+ * maximum total number of files allowed in the journal (original plus those
added by auto-expand mode). If
+ * this number of files exist and the journal runs out of space, an exception
will be thrown. This number
+ * must be greater than the num_jfiles parameter value but cannot exceed the
maximum number of files for a
+ * single journal; if num_jfiles is already at its maximum value, then
auto-expand wil be disabled.
* \param jfsize_sblks The size of each journal file expressed in softblocks.
* \param wcache_num_pages The number of write cache pages to create.
* \param wcache_pgsize_sblks The size in sblks of each write cache page.
@@ -215,10 +231,10 @@
*
* \exception TODO
*/
- void recover(const u_int16_t num_jfiles, const u_int32_t jfsize_sblks,
- const u_int16_t wcache_num_pages, const u_int32_t wcache_pgsize_sblks,
- const rd_aio_cb rd_cb, const wr_aio_cb wr_cb,
- const std::vector<std::string>* prep_txn_list_ptr, u_int64_t&
highest_rid);
+ void recover(const u_int16_t num_jfiles, const bool auto_expand, const u_int16_t
ae_max_jfiles,
+ const u_int32_t jfsize_sblks, const u_int16_t wcache_num_pages, const
u_int32_t wcache_pgsize_sblks,
+ const rd_aio_cb rd_cb, const wr_aio_cb wr_cb, const
std::vector<std::string>* prep_txn_list_ptr,
+ u_int64_t& highest_rid);
/**
* \brief Notification to the journal that recovery is complete and that normal
operation
Modified: store/trunk/cpp/lib/jrnl/jinf.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jinf.cpp 2008-10-17 19:10:47 UTC (rev 2651)
+++ store/trunk/cpp/lib/jrnl/jinf.cpp 2008-10-17 20:42:21 UTC (rev 2652)
@@ -343,7 +343,7 @@
oss << " <journal_file_geometry>" << std::endl;
oss << " <number_jrnl_files value=\"" << _num_jfiles
<< "\" />" << std::endl;
oss << " <auto_expand value=\"" << (_ae ?
"true" : "false") << "\" />" <<
std::endl;
- if (_ae) oss << " <auto_expand_max_number_jrnl_files
value=\"" << _ae_max_jfiles << "\" />" <<
std::endl;
+ if (_ae) oss << " <auto_expand_max_jrnl_files value=\""
<< _ae_max_jfiles << "\" />" << std::endl;
oss << " <jrnl_file_size_sblks value=\"" <<
_jfsize_sblks << "\" />" << std::endl;
oss << " <JRNL_SBLK_SIZE value=\"" <<
_sblk_size_dblks << "\" />" << std::endl;
oss << " <JRNL_DBLK_SIZE value=\"" << _dblk_size
<< "\" />" << std::endl;
@@ -384,7 +384,7 @@
_num_jfiles = u_int16_value(buff);
else if(std::strstr(buff, "auto_expand"))
_ae = bool_value(buff);
- else if(std::strstr(buff, "auto_expand_max_number_jrnl_files"))
+ else if(std::strstr(buff, "auto_expand_max_jrnl_files"))
_ae_max_jfiles = u_int16_value(buff);
else if(std::strstr(buff, "jrnl_file_size_sblks"))
_jfsize_sblks = u_int32_value(buff);
Modified: store/trunk/cpp/tests/jrnl/_st_basic.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_st_basic.cpp 2008-10-17 19:10:47 UTC (rev 2651)
+++ store/trunk/cpp/tests/jrnl/_st_basic.cpp 2008-10-17 20:42:21 UTC (rev 2652)
@@ -64,7 +64,7 @@
{
test_jrnl jc(test_name, test_dir, test_name);
BOOST_CHECK_EQUAL(jc.is_ready(), false);
- jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+ jc.initialize(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS);
BOOST_CHECK_EQUAL(jc.is_ready(), true);
}
catch(const exception& e) { BOOST_FAIL(e.what()); }
@@ -79,7 +79,7 @@
string msg;
test_jrnl jc(test_name, test_dir, test_name);
- jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+ jc.initialize(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS);
for (int m=0; m<NUM_MSGS; m++)
BOOST_CHECK_EQUAL(enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false),
u_int64_t(m));
for (int m=0; m<NUM_MSGS; m++)
@@ -97,7 +97,7 @@
string msg;
test_jrnl jc(test_name, test_dir, test_name);
- jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+ jc.initialize(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS);
for (int m=0; m<2*NUM_MSGS; m+=2)
{
BOOST_CHECK_EQUAL(enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false),
u_int64_t(m));
@@ -116,7 +116,7 @@
string msg;
test_jrnl jc(test_name, test_dir, test_name);
- jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+ jc.initialize(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS);
unsigned n = num_msgs_to_full(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS *
JRNL_SBLK_SIZE,
MSG_REC_SIZE_DBLKS, true);
for (unsigned m=0; m<3*2*n; m+=2) // overwrite files 3 times
@@ -139,7 +139,7 @@
test_jrnl jc(test_name, test_dir, test_name);
BOOST_CHECK_EQUAL(jc.is_ready(), false);
BOOST_CHECK_EQUAL(jc.is_read_only(), false);
- jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+ jc.initialize(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS);
BOOST_CHECK_EQUAL(jc.is_ready(), true);
BOOST_CHECK_EQUAL(jc.is_read_only(), false);
}
@@ -149,7 +149,7 @@
test_jrnl jc(test_name, test_dir, test_name);
BOOST_CHECK_EQUAL(jc.is_ready(), false);
BOOST_CHECK_EQUAL(jc.is_read_only(), false);
- jc.recover(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS, 0, hrid);
+ jc.recover(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS, 0, hrid);
BOOST_CHECK_EQUAL(jc.is_ready(), true);
BOOST_CHECK_EQUAL(jc.is_read_only(), true);
BOOST_CHECK_EQUAL(hrid, u_int64_t(0));
@@ -160,7 +160,7 @@
test_jrnl jc(test_name, test_dir, test_name);
BOOST_CHECK_EQUAL(jc.is_ready(), false);
BOOST_CHECK_EQUAL(jc.is_read_only(), false);
- jc.recover(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS, 0, hrid);
+ jc.recover(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS, 0, hrid);
BOOST_CHECK_EQUAL(jc.is_ready(), true);
BOOST_CHECK_EQUAL(jc.is_read_only(), true);
BOOST_CHECK_EQUAL(hrid, u_int64_t(0));
@@ -182,7 +182,7 @@
string msg;
test_jrnl jc(test_name, test_dir, test_name);
- jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+ jc.initialize(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS);
for (int m=0; m<NUM_MSGS; m++)
enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
}
@@ -190,7 +190,7 @@
u_int64_t hrid;
test_jrnl jc(test_name, test_dir, test_name);
- jc.recover(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS, 0, hrid);
+ jc.recover(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS, 0, hrid);
BOOST_CHECK_EQUAL(hrid, u_int64_t(NUM_MSGS - 1));
jc.recover_complete();
for (int m=0; m<NUM_MSGS; m++)
@@ -214,10 +214,10 @@
{
test_jrnl jc(test_name, test_dir, test_name);
if (m == 0)
- jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS); // First time
only
+ jc.initialize(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS); // First
time only
else
{
- jc.recover(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS, 0, hrid);
+ jc.recover(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS, 0, hrid);
BOOST_CHECK_EQUAL(hrid, u_int64_t(m - 1));
jc.recover_complete();
}
@@ -225,7 +225,7 @@
}
{
test_jrnl jc(test_name, test_dir, test_name);
- jc.recover(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS, 0, hrid);
+ jc.recover(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS, 0, hrid);
BOOST_CHECK_EQUAL(hrid, u_int64_t(m));
jc.recover_complete();
deq_msg(jc, m);
@@ -245,7 +245,7 @@
string msg;
test_jrnl jc(test_name, test_dir, test_name);
- jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+ jc.initialize(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS);
// Transient msgs - should not recover
for (int m=0; m<NUM_MSGS; m++)
enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), true);
@@ -264,7 +264,7 @@
u_int64_t hrid;
test_jrnl jc(test_name, test_dir, test_name);
- jc.recover(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS, 0, hrid);
+ jc.recover(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS, 0, hrid);
// Recover non-transient msgs
for (int m=NUM_MSGS; m<NUM_MSGS*2; m++)
{
@@ -339,7 +339,7 @@
string msg;
test_jrnl jc(test_name, test_dir, test_name);
- jc.initialize(NUM_DEFAULT_JFILES, DEFAULT_JFSIZE_SBLKS);
+ jc.initialize(NUM_DEFAULT_JFILES, false, 0, DEFAULT_JFSIZE_SBLKS);
unsigned m;
// Fill journal to just below threshold
@@ -375,7 +375,7 @@
string msg;
test_jrnl jc(test_name, test_dir, test_name);
- jc.initialize(NUM_DEFAULT_JFILES, DEFAULT_JFSIZE_SBLKS);
+ jc.initialize(NUM_DEFAULT_JFILES, false, 0, DEFAULT_JFSIZE_SBLKS);
unsigned m;
// Fill journal to just below threshold
@@ -404,7 +404,7 @@
string msg;
test_jrnl jc(test_name, test_dir, test_name);
- jc.initialize(NUM_DEFAULT_JFILES, DEFAULT_JFSIZE_SBLKS);
+ jc.initialize(NUM_DEFAULT_JFILES, false, 0, DEFAULT_JFSIZE_SBLKS);
// 5 cycles of enqueue/dequeue blocks of half threshold exception size
u_int32_t t = num_msgs_to_threshold(NUM_DEFAULT_JFILES, DEFAULT_JFSIZE_SBLKS *
JRNL_SBLK_SIZE,
@@ -429,7 +429,7 @@
string msg;
test_jrnl jc(test_name, test_dir, test_name);
- jc.initialize(NUM_DEFAULT_JFILES, DEFAULT_JFSIZE_SBLKS);
+ jc.initialize(NUM_DEFAULT_JFILES, false, 0, DEFAULT_JFSIZE_SBLKS);
// 5 cycles of enqueue/dequeue blocks of half threshold exception size
u_int32_t t = num_msgs_to_threshold(NUM_DEFAULT_JFILES, DEFAULT_JFSIZE_SBLKS *
JRNL_SBLK_SIZE,
@@ -460,12 +460,12 @@
test_jrnl jc(test_name, test_dir, test_name);
if (i)
{
- jc.recover(NUM_DEFAULT_JFILES, DEFAULT_JFSIZE_SBLKS, 0, hrid);
+ jc.recover(NUM_DEFAULT_JFILES, false, 0, DEFAULT_JFSIZE_SBLKS, 0, hrid);
BOOST_CHECK_EQUAL(hrid, u_int64_t(2*i*t - 1));
jc.recover_complete();
}
else
- jc.initialize(NUM_DEFAULT_JFILES, DEFAULT_JFSIZE_SBLKS);
+ jc.initialize(NUM_DEFAULT_JFILES, false, 0, DEFAULT_JFSIZE_SBLKS);
for (unsigned m=2*i*t; m<(2*i+1)*t; m++)
enq_msg(jc, m, create_msg(msg, m, LARGE_MSG_SIZE), false);
@@ -493,12 +493,12 @@
test_jrnl jc(test_name, test_dir, test_name);
if (i)
{
- jc.recover(NUM_DEFAULT_JFILES, DEFAULT_JFSIZE_SBLKS, 0, hrid);
+ jc.recover(NUM_DEFAULT_JFILES, false, 0, DEFAULT_JFSIZE_SBLKS, 0, hrid);
BOOST_CHECK_EQUAL(hrid, u_int64_t(2*i*t - 1));
jc.recover_complete();
}
else
- jc.initialize(NUM_DEFAULT_JFILES, DEFAULT_JFSIZE_SBLKS);
+ jc.initialize(NUM_DEFAULT_JFILES, false, 0, DEFAULT_JFSIZE_SBLKS);
for (unsigned m=2*i*t; m<2*(i+1)*t; m+=2)
{
@@ -519,7 +519,7 @@
string msg;
test_jrnl jc(test_name, test_dir, test_name);
- jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+ jc.initialize(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS);
u_int64_t rid = enq_msg(jc, 0, create_msg(msg, 0, MSG_SIZE), false);
deq_msg(jc, rid);
try{ deq_msg(jc, rid); BOOST_ERROR("Did not throw exception on second
dequeue."); }
Modified: store/trunk/cpp/tests/jrnl/_st_basic_txn.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_st_basic_txn.cpp 2008-10-17 19:10:47 UTC (rev 2651)
+++ store/trunk/cpp/tests/jrnl/_st_basic_txn.cpp 2008-10-17 20:42:21 UTC (rev 2652)
@@ -54,7 +54,7 @@
string xid;
test_jrnl jc(test_name, test_dir, test_name);
- jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+ jc.initialize(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS);
create_xid(xid, 0, XID_SIZE);
for (int m=0; m<NUM_MSGS; m++)
BOOST_CHECK_EQUAL(enq_txn_msg(jc, m, create_msg(msg, m, MSG_SIZE), xid,
false),
@@ -76,7 +76,7 @@
string xid;
test_jrnl jc(test_name, test_dir, test_name);
- jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+ jc.initialize(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS);
create_xid(xid, 0, XID_SIZE);
for (int m=0; m<NUM_MSGS; m++)
BOOST_CHECK_EQUAL(enq_txn_msg(jc, m, create_msg(msg, m, MSG_SIZE), xid,
false),
@@ -105,7 +105,7 @@
string xid;
test_jrnl jc(test_name, test_dir, test_name);
- jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+ jc.initialize(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS);
for (int m=0; m<NUM_MSGS; m++)
{
create_xid(xid, m, XID_SIZE);
@@ -128,7 +128,7 @@
string xid;
test_jrnl jc(test_name, test_dir, test_name);
- jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+ jc.initialize(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS);
for (int m=0; m<NUM_MSGS; m++)
{
create_xid(xid, m, XID_SIZE);
@@ -156,7 +156,7 @@
string xid;
test_jrnl jc(test_name, test_dir, test_name);
- jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+ jc.initialize(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS);
create_xid(xid, 0, XID_SIZE);
for (int m=0; m<NUM_MSGS; m++)
BOOST_CHECK_EQUAL(enq_txn_msg(jc, m, create_msg(msg, m, MSG_SIZE), xid,
false),
@@ -178,7 +178,7 @@
string xid;
test_jrnl jc(test_name, test_dir, test_name);
- jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+ jc.initialize(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS);
create_xid(xid, 0, XID_SIZE);
for (int m=0; m<NUM_MSGS; m++)
BOOST_CHECK_EQUAL(enq_txn_msg(jc, m, create_msg(msg, m, MSG_SIZE), xid,
false),
@@ -200,7 +200,7 @@
string xid;
test_jrnl jc(test_name, test_dir, test_name);
- jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+ jc.initialize(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS);
for (int m=0; m<NUM_MSGS; m++)
{
create_xid(xid, m, XID_SIZE);
@@ -223,7 +223,7 @@
string xid;
test_jrnl jc(test_name, test_dir, test_name);
- jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+ jc.initialize(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS);
for (int m=0; m<NUM_MSGS; m++)
{
create_xid(xid, m, XID_SIZE);
Modified: store/trunk/cpp/tests/jrnl/_st_helper_fns.hpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_st_helper_fns.hpp 2008-10-17 19:10:47 UTC (rev 2651)
+++ store/trunk/cpp/tests/jrnl/_st_helper_fns.hpp 2008-10-17 20:42:21 UTC (rev 2652)
@@ -67,14 +67,16 @@
test_jrnl(const std::string& jid, const std::string& jdir, const
std::string& base_filename) :
jcntl(jid, jdir, base_filename) {}
virtual ~test_jrnl() {}
- void initialize(const u_int16_t num_jfiles, const u_int32_t jfsize_sblks)
+ void initialize(const u_int16_t num_jfiles, const bool ae, const u_int16_t
ae_max_jfiles,
+ const u_int32_t jfsize_sblks)
{
- jcntl::initialize(num_jfiles, jfsize_sblks, JRNL_WMGR_DEF_PAGES,
JRNL_WMGR_DEF_PAGE_SIZE, 0, &aio_wr_callback);
+ jcntl::initialize(num_jfiles, ae, ae_max_jfiles, jfsize_sblks,
JRNL_WMGR_DEF_PAGES, JRNL_WMGR_DEF_PAGE_SIZE, 0,
+ &aio_wr_callback);
_jdir.create_dir();
}
- void recover(const u_int16_t num_jfiles, const u_int32_t jfsize_sblks,
vector<string>* txn_list,
- u_int64_t& highest_rid)
- { jcntl::recover(num_jfiles, jfsize_sblks, JRNL_WMGR_DEF_PAGES,
JRNL_WMGR_DEF_PAGE_SIZE, 0,
+ void recover(const u_int16_t num_jfiles, const bool ae, const u_int16_t
ae_max_jfiles, const u_int32_t jfsize_sblks,
+ vector<string>* txn_list, u_int64_t& highest_rid)
+ { jcntl::recover(num_jfiles, ae, ae_max_jfiles, jfsize_sblks, JRNL_WMGR_DEF_PAGES,
JRNL_WMGR_DEF_PAGE_SIZE, 0,
&aio_wr_callback, txn_list, highest_rid); }
private:
static void aio_wr_callback(jcntl*, std::vector<data_tok*>& dtokl)
Modified: store/trunk/cpp/tests/jrnl/_st_read.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_st_read.cpp 2008-10-17 19:10:47 UTC (rev 2651)
+++ store/trunk/cpp/tests/jrnl/_st_read.cpp 2008-10-17 20:42:21 UTC (rev 2652)
@@ -58,7 +58,7 @@
bool externalFlag;
test_jrnl jc(test_name, test_dir, test_name);
- jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+ jc.initialize(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS);
read_msg(jc, rmsg, xid, transientFlag, externalFlag, RHM_IORES_EMPTY);
}
catch(const exception& e) { BOOST_FAIL(e.what()); }
@@ -77,7 +77,7 @@
bool externalFlag;
test_jrnl jc(test_name, test_dir, test_name);
- jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+ jc.initialize(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS);
for (int m=0; m<NUM_MSGS; m++)
enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
jc.flush();
@@ -110,7 +110,7 @@
bool externalFlag;
test_jrnl jc(test_name, test_dir, test_name);
- jc.initialize(2*NUM_TEST_JFILES, 10*TEST_JFSIZE_SBLKS);
+ jc.initialize(2*NUM_TEST_JFILES, false, 0, 10*TEST_JFSIZE_SBLKS);
for (int m=0; m<NUM_MSGS*2000; m++)
enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
jc.flush();
@@ -143,7 +143,7 @@
bool externalFlag;
test_jrnl jc(test_name, test_dir, test_name);
- jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+ jc.initialize(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS);
for (int m=0; m<2*NUM_MSGS; m+=2)
{
enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
@@ -171,7 +171,7 @@
string msg;
test_jrnl jc(test_name, test_dir, test_name);
- jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+ jc.initialize(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS);
for (int m=0; m<NUM_MSGS; m++)
enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
}
@@ -184,7 +184,7 @@
bool externalFlag;
test_jrnl jc(test_name, test_dir, test_name);
- jc.recover(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS, 0, hrid);
+ jc.recover(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS, 0, hrid);
BOOST_CHECK_EQUAL(hrid, u_int64_t(NUM_MSGS - 1));
jc.recover_complete();
for (int m=0; m<NUM_MSGS; m++)
@@ -213,7 +213,7 @@
string msg;
test_jrnl jc(test_name, test_dir, test_name);
- jc.initialize(2*NUM_TEST_JFILES, 10*TEST_JFSIZE_SBLKS);
+ jc.initialize(2*NUM_TEST_JFILES, false, 0, 10*TEST_JFSIZE_SBLKS);
for (int m=0; m<NUM_MSGS*2000; m++)
enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
}
@@ -226,7 +226,7 @@
bool externalFlag;
test_jrnl jc(test_name, test_dir, test_name);
- jc.recover(2*NUM_TEST_JFILES, 10*TEST_JFSIZE_SBLKS, 0, hrid);
+ jc.recover(2*NUM_TEST_JFILES, false, 0, 10*TEST_JFSIZE_SBLKS, 0, hrid);
BOOST_CHECK_EQUAL(hrid, u_int64_t(NUM_MSGS*2000 - 1));
jc.recover_complete();
for (int m=0; m<NUM_MSGS*2000; m++)
@@ -255,7 +255,7 @@
string msg;
test_jrnl jc(test_name, test_dir, test_name);
- jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+ jc.initialize(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS);
for (int m=0; m<NUM_MSGS; m++)
enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
}
@@ -268,7 +268,7 @@
bool externalFlag;
test_jrnl jc(test_name, test_dir, test_name);
- jc.recover(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS, 0, hrid);
+ jc.recover(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS, 0, hrid);
BOOST_CHECK_EQUAL(hrid, u_int64_t(NUM_MSGS - 1));
for (int m=0; m<NUM_MSGS; m++)
{
@@ -289,7 +289,7 @@
bool externalFlag;
test_jrnl jc(test_name, test_dir, test_name);
- jc.recover(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS, 0, hrid);
+ jc.recover(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS, 0, hrid);
BOOST_CHECK_EQUAL(hrid, u_int64_t(NUM_MSGS - 1));
for (int m=0; m<NUM_MSGS; m++)
{
@@ -330,7 +330,7 @@
bool externalFlag;
test_jrnl jc(test_name, test_dir, test_name);
- jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+ jc.initialize(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS);
unsigned m;
for (m=0; m<2*NUM_MSGS; m+=2)
{
@@ -358,7 +358,7 @@
bool externalFlag;
test_jrnl jc(test_name, test_dir, test_name);
- jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+ jc.initialize(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS);
unsigned m;
unsigned read_buffer_size_dblks = JRNL_RMGR_PAGES * JRNL_RMGR_PAGE_SIZE *
JRNL_SBLK_SIZE;
unsigned n = num_msgs_to_full(1, read_buffer_size_dblks, MSG_REC_SIZE_DBLKS,
true);
@@ -388,7 +388,7 @@
bool externalFlag;
test_jrnl jc(test_name, test_dir, test_name);
- jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+ jc.initialize(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS);
unsigned read_buffer_size_dblks = JRNL_RMGR_PAGES * JRNL_RMGR_PAGE_SIZE *
JRNL_SBLK_SIZE;
unsigned n = num_msgs_to_full(1, read_buffer_size_dblks, MSG_REC_SIZE_DBLKS,
true);
unsigned m = 0;
Modified: store/trunk/cpp/tests/jrnl/_st_read_txn.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_st_read_txn.cpp 2008-10-17 19:10:47 UTC (rev 2651)
+++ store/trunk/cpp/tests/jrnl/_st_read_txn.cpp 2008-10-17 20:42:21 UTC (rev 2652)
@@ -58,7 +58,7 @@
bool transientFlag;
bool externalFlag;
test_jrnl jc(test_name, test_dir, test_name);
- jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+ jc.initialize(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS);
create_xid(xid, 0, XID_SIZE);
for (int m=0; m<NUM_MSGS; m++)
enq_txn_msg(jc, m, create_msg(msg, m, MSG_SIZE), xid, false);
@@ -93,7 +93,7 @@
bool externalFlag;
test_jrnl jc(test_name, test_dir, test_name);
- jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+ jc.initialize(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS);
for (int m=0; m<NUM_MSGS; m++)
{
create_xid(xid, m, XID_SIZE);
@@ -125,7 +125,7 @@
bool transientFlag;
bool externalFlag;
test_jrnl jc(test_name, test_dir, test_name);
- jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+ jc.initialize(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS);
create_xid(xid, 1, XID_SIZE);
for (int m=0; m<NUM_MSGS; m++)
enq_txn_msg(jc, m, create_msg(msg, m, MSG_SIZE), xid, false);
@@ -152,7 +152,7 @@
bool externalFlag;
test_jrnl jc(test_name, test_dir, test_name);
- jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+ jc.initialize(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS);
for (int m=0; m<NUM_MSGS; m++)
{
create_xid(xid, m, XID_SIZE);
@@ -181,7 +181,7 @@
bool externalFlag;
test_jrnl jc(test_name, test_dir, test_name);
- jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+ jc.initialize(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS);
create_xid(xid, 2, XID_SIZE);
for (int m=0; m<NUM_MSGS; m++)
enq_txn_msg(jc, m, create_msg(msg, m, MSG_SIZE), xid, false);
@@ -208,7 +208,7 @@
bool externalFlag;
test_jrnl jc(test_name, test_dir, test_name);
- jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+ jc.initialize(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS);
for (int m=0; m<NUM_MSGS; m++)
{
create_xid(xid, m, XID_SIZE);
@@ -237,7 +237,7 @@
create_xid(xid, 3, XID_SIZE);
test_jrnl jc(test_name, test_dir, test_name);
- jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+ jc.initialize(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS);
for (int m=0; m<NUM_MSGS; m++)
enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
for (int m=0; m<NUM_MSGS; m++)
@@ -265,7 +265,7 @@
bool externalFlag;
test_jrnl jc(test_name, test_dir, test_name);
- jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+ jc.initialize(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS);
for (int m=0; m<3*NUM_MSGS; m+=3)
{
enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
@@ -296,7 +296,7 @@
create_xid(xid, 4, XID_SIZE);
test_jrnl jc(test_name, test_dir, test_name);
- jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+ jc.initialize(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS);
for (int m=0; m<NUM_MSGS; m++)
enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
for (int m=0; m<NUM_MSGS; m++)
@@ -332,7 +332,7 @@
bool externalFlag;
test_jrnl jc(test_name, test_dir, test_name);
- jc.initialize(NUM_TEST_JFILES, TEST_JFSIZE_SBLKS);
+ jc.initialize(NUM_TEST_JFILES, false, 0, TEST_JFSIZE_SBLKS);
for (int m=0; m<3*NUM_MSGS; m+=3)
{
enq_msg(jc, m, create_msg(msg, m, MSG_SIZE), false);
Modified: store/trunk/cpp/tests/jrnl/jtt/_ut_jrnl_init_params.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/_ut_jrnl_init_params.cpp 2008-10-17 19:10:47 UTC (rev
2651)
+++ store/trunk/cpp/tests/jrnl/jtt/_ut_jrnl_init_params.cpp 2008-10-17 20:42:21 UTC (rev
2652)
@@ -40,12 +40,16 @@
const string jdir = "jdir";
const string bfn = "base filename";
const u_int16_t num_jfiles = 123;
- const u_int32_t jfsize_sblks = 456;
- jrnl_init_params jip(jid, jdir, bfn, num_jfiles, jfsize_sblks);
+ const bool ae = false;
+ const u_int16_t ae_max_jfiles = 456;
+ const u_int32_t jfsize_sblks = 789;
+ jrnl_init_params jip(jid, jdir, bfn, num_jfiles, ae, ae_max_jfiles, jfsize_sblks);
BOOST_CHECK_EQUAL(jip.jid(), jid);
BOOST_CHECK_EQUAL(jip.jdir(), jdir);
BOOST_CHECK_EQUAL(jip.base_filename(), bfn);
BOOST_CHECK_EQUAL(jip.num_jfiles(), num_jfiles);
+ BOOST_CHECK_EQUAL(jip.is_ae(), ae);
+ BOOST_CHECK_EQUAL(jip.ae_max_jfiles(), ae_max_jfiles);
BOOST_CHECK_EQUAL(jip.jfsize_sblks(), jfsize_sblks);
cout << "ok" << endl;
}
@@ -57,13 +61,17 @@
const string jdir = "jdir";
const string bfn = "base filename";
const u_int16_t num_jfiles = 123;
- const u_int32_t jfsize_sblks = 456;
- jrnl_init_params jip1(jid, jdir, bfn, num_jfiles, jfsize_sblks);
+ const bool ae = false;
+ const u_int16_t ae_max_jfiles = 456;
+ const u_int32_t jfsize_sblks = 789;
+ jrnl_init_params jip1(jid, jdir, bfn, num_jfiles, ae, ae_max_jfiles, jfsize_sblks);
jrnl_init_params jip2(jip1);
BOOST_CHECK_EQUAL(jip2.jid(), jid);
BOOST_CHECK_EQUAL(jip2.jdir(), jdir);
BOOST_CHECK_EQUAL(jip2.base_filename(), bfn);
BOOST_CHECK_EQUAL(jip2.num_jfiles(), num_jfiles);
+ BOOST_CHECK_EQUAL(jip2.is_ae(), ae);
+ BOOST_CHECK_EQUAL(jip2.ae_max_jfiles(), ae_max_jfiles);
BOOST_CHECK_EQUAL(jip2.jfsize_sblks(), jfsize_sblks);
cout << "ok" << endl;
}
@@ -75,13 +83,17 @@
const string jdir = "jdir";
const string bfn = "base filename";
const u_int16_t num_jfiles = 123;
- const u_int32_t jfsize_sblks = 456;
- jrnl_init_params::shared_ptr p(new jrnl_init_params(jid, jdir, bfn, num_jfiles,
jfsize_sblks));
+ const bool ae = false;
+ const u_int16_t ae_max_jfiles = 456;
+ const u_int32_t jfsize_sblks = 789;
+ jrnl_init_params::shared_ptr p(new jrnl_init_params(jid, jdir, bfn, num_jfiles, ae,
ae_max_jfiles, jfsize_sblks));
jrnl_init_params jip2(p.get());
BOOST_CHECK_EQUAL(jip2.jid(), jid);
BOOST_CHECK_EQUAL(jip2.jdir(), jdir);
BOOST_CHECK_EQUAL(jip2.base_filename(), bfn);
BOOST_CHECK_EQUAL(jip2.num_jfiles(), num_jfiles);
+ BOOST_CHECK_EQUAL(jip2.is_ae(), ae);
+ BOOST_CHECK_EQUAL(jip2.ae_max_jfiles(), ae_max_jfiles);
BOOST_CHECK_EQUAL(jip2.jfsize_sblks(), jfsize_sblks);
cout << "ok" << endl;
}
Modified: store/trunk/cpp/tests/jrnl/jtt/_ut_jrnl_instance.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/_ut_jrnl_instance.cpp 2008-10-17 19:10:47 UTC (rev
2651)
+++ store/trunk/cpp/tests/jrnl/jtt/_ut_jrnl_instance.cpp 2008-10-17 20:42:21 UTC (rev
2652)
@@ -47,13 +47,15 @@
const string jdir = test_dir + "/test1";
const string bfn = "test";
const u_int16_t num_jfiles = 20;
+ const bool ae = false;
+ const u_int16_t ae_max_jfiles = 45;
const u_int32_t jfsize_sblks = 128;
args a("a1");
using mrg::jtt::test_case;
- test_case::shared_ptr p(new test_case(1, 0, 0, 0, false, 0, 0,
test_case::JTT_PERSISTNET,
- test_case::JDL_INTERNAL, "t1"));
- jrnl_instance ji(jid, jdir, bfn, num_jfiles, jfsize_sblks);
+ test_case::shared_ptr p(new test_case(1, 0, 0, 0, false, 0, 0,
test_case::JTT_PERSISTNET, test_case::JDL_INTERNAL,
+ "t1"));
+ jrnl_instance ji(jid, jdir, bfn, num_jfiles, ae, ae_max_jfiles, jfsize_sblks);
ji.init_tc(p, &a);
ji.run_tc();
ji.tc_wait_compl();
@@ -70,14 +72,15 @@
const string jdir = test_dir + "/test2";
const string bfn = "test";
const u_int16_t num_jfiles = 20;
+ const bool ae = false;
+ const u_int16_t ae_max_jfiles = 45;
const u_int32_t jfsize_sblks = 128;
args a("a2");
using mrg::jtt::test_case;
- test_case::shared_ptr p(new test_case(2, 0, 0, 0, false, 0, 0,
test_case::JTT_PERSISTNET,
- test_case::JDL_INTERNAL, "t2"));
- jrnl_init_params::shared_ptr jpp(new jrnl_init_params(jid, jdir, bfn, num_jfiles,
- jfsize_sblks));
+ test_case::shared_ptr p(new test_case(2, 0, 0, 0, false, 0, 0,
test_case::JTT_PERSISTNET, test_case::JDL_INTERNAL,
+ "t2"));
+ jrnl_init_params::shared_ptr jpp(new jrnl_init_params(jid, jdir, bfn, num_jfiles, ae,
ae_max_jfiles, jfsize_sblks));
jrnl_instance ji(jpp);
ji.init_tc(p, &a);
ji.run_tc();
@@ -95,14 +98,15 @@
const string jdir = test_dir + "/test3";
const string bfn = "test";
const u_int16_t num_jfiles = 20;
+ const bool ae = false;
+ const u_int16_t ae_max_jfiles = 45;
const u_int32_t jfsize_sblks = 128;
args a("a3");
using mrg::jtt::test_case;
- test_case::shared_ptr p(new test_case(3, 0, 0, 0, false, 0, 0,
test_case::JTT_PERSISTNET,
- test_case::JDL_INTERNAL, "t3"));
- jrnl_init_params::shared_ptr jpp(new jrnl_init_params(jid, jdir, bfn, num_jfiles,
- jfsize_sblks));
+ test_case::shared_ptr p(new test_case(3, 0, 0, 0, false, 0, 0,
test_case::JTT_PERSISTNET, test_case::JDL_INTERNAL,
+ "t3"));
+ jrnl_init_params::shared_ptr jpp(new jrnl_init_params(jid, jdir, bfn, num_jfiles, ae,
ae_max_jfiles, jfsize_sblks));
jrnl_instance ji(jpp);
ji.init_tc(p, &a);
ji.run_tc();
@@ -120,14 +124,15 @@
const string jdir = test_dir + "/test5";
const string bfn = "test";
const u_int16_t num_jfiles = 20;
+ const bool ae = false;
+ const u_int16_t ae_max_jfiles = 0;
const u_int32_t jfsize_sblks = 128;
args a("a4");
using mrg::jtt::test_case;
- test_case::shared_ptr p(new test_case(5, 0, 0, 0, false, 0, 0,
test_case::JTT_PERSISTNET,
- test_case::JDL_INTERNAL, "t5"));
- jrnl_init_params::shared_ptr jpp(new jrnl_init_params(jid, jdir, bfn, num_jfiles,
- jfsize_sblks));
+ test_case::shared_ptr p(new test_case(5, 0, 0, 0, false, 0, 0,
test_case::JTT_PERSISTNET, test_case::JDL_INTERNAL,
+ "t5"));
+ jrnl_init_params::shared_ptr jpp(new jrnl_init_params(jid, jdir, bfn, num_jfiles, ae,
ae_max_jfiles, jfsize_sblks));
jrnl_instance ji(jpp);
ji.init_tc(p, &a);
ji.run_tc();
@@ -151,15 +156,16 @@
const string jdir = test_dir + "/test6";
const string bfn = "test";
const u_int16_t num_jfiles = 20;
+ const bool ae = false;
+ const u_int16_t ae_max_jfiles = 0;
const u_int32_t jfsize_sblks = 128;
args a("a5");
a.recover_mode = true;
using mrg::jtt::test_case;
- test_case::shared_ptr p(new test_case(6, 0, 0, 0, false, 0, 0,
test_case::JTT_PERSISTNET,
- test_case::JDL_INTERNAL, "t6"));
- jrnl_init_params::shared_ptr jpp(new jrnl_init_params(jid, jdir, bfn, num_jfiles,
- jfsize_sblks));
+ test_case::shared_ptr p(new test_case(6, 0, 0, 0, false, 0, 0,
test_case::JTT_PERSISTNET, test_case::JDL_INTERNAL,
+ "t6"));
+ jrnl_init_params::shared_ptr jpp(new jrnl_init_params(jid, jdir, bfn, num_jfiles, ae,
ae_max_jfiles, jfsize_sblks));
jrnl_instance ji(jpp);
ji.init_tc(p, &a);
ji.run_tc();
Modified: store/trunk/cpp/tests/jrnl/jtt/jrnl_init_params.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/jrnl_init_params.cpp 2008-10-17 19:10:47 UTC (rev
2651)
+++ store/trunk/cpp/tests/jrnl/jtt/jrnl_init_params.cpp 2008-10-17 20:42:21 UTC (rev
2652)
@@ -28,14 +28,15 @@
namespace jtt
{
-jrnl_init_params::jrnl_init_params(const std::string& jid, const std::string&
jdir,
- const std::string& base_filename, const u_int16_t num_jfiles,
- const u_int32_t jfsize_sblks, const u_int16_t wcache_num_pages,
- const u_int32_t wcache_pgsize_sblks):
+jrnl_init_params::jrnl_init_params(const std::string& jid, const std::string&
jdir, const std::string& base_filename,
+ const u_int16_t num_jfiles, const bool ae, const u_int16_t ae_max_jfiles, const
u_int32_t jfsize_sblks,
+ const u_int16_t wcache_num_pages, const u_int32_t wcache_pgsize_sblks):
_jid(jid),
_jdir(jdir),
_base_filename(base_filename),
_num_jfiles(num_jfiles),
+ _ae(ae),
+ _ae_max_jfiles(ae_max_jfiles),
_jfsize_sblks(jfsize_sblks),
_wcache_num_pages(wcache_num_pages),
_wcache_pgsize_sblks(wcache_pgsize_sblks)
@@ -46,6 +47,8 @@
_jdir(jp._jdir),
_base_filename(jp._base_filename),
_num_jfiles(jp._num_jfiles),
+ _ae(jp._ae),
+ _ae_max_jfiles(jp._ae_max_jfiles),
_jfsize_sblks(jp._jfsize_sblks),
_wcache_num_pages(jp._wcache_num_pages),
_wcache_pgsize_sblks(jp._wcache_pgsize_sblks)
@@ -56,6 +59,8 @@
_jdir(jp_ptr->_jdir),
_base_filename(jp_ptr->_base_filename),
_num_jfiles(jp_ptr->_num_jfiles),
+ _ae(jp_ptr->_ae),
+ _ae_max_jfiles(jp_ptr->_ae_max_jfiles),
_jfsize_sblks(jp_ptr->_jfsize_sblks),
_wcache_num_pages(jp_ptr->_wcache_num_pages),
_wcache_pgsize_sblks(jp_ptr->_wcache_pgsize_sblks)
@@ -64,6 +69,8 @@
// static initializers
const u_int16_t jrnl_init_params::def_num_jfiles = 8;
+const bool jrnl_init_params::def_ae = false;
+const u_int16_t jrnl_init_params::def_ae_max_jfiles = 0;
const u_int32_t jrnl_init_params::def_jfsize_sblks = 0xc00;
const u_int16_t jrnl_init_params::def_wcache_num_pages = 32;
const u_int32_t jrnl_init_params::def_wcache_pgsize_sblks = 64;
Modified: store/trunk/cpp/tests/jrnl/jtt/jrnl_init_params.hpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/jrnl_init_params.hpp 2008-10-17 19:10:47 UTC (rev
2651)
+++ store/trunk/cpp/tests/jrnl/jtt/jrnl_init_params.hpp 2008-10-17 20:42:21 UTC (rev
2652)
@@ -37,6 +37,8 @@
{
public:
static const u_int16_t def_num_jfiles;
+ static const bool def_ae;
+ static const u_int16_t def_ae_max_jfiles;
static const u_int32_t def_jfsize_sblks;
static const u_int16_t def_wcache_num_pages;
static const u_int32_t def_wcache_pgsize_sblks;
@@ -48,14 +50,16 @@
std::string _jdir;
std::string _base_filename;
u_int16_t _num_jfiles;
+ bool _ae;
+ u_int16_t _ae_max_jfiles;
u_int32_t _jfsize_sblks;
u_int16_t _wcache_num_pages;
u_int32_t _wcache_pgsize_sblks;
public:
- jrnl_init_params(const std::string& jid, const std::string& jdir,
- const std::string& base_filename, const u_int16_t num_jfiles =
def_num_jfiles,
- const u_int32_t jfsize_sblks = def_jfsize_sblks,
+ jrnl_init_params(const std::string& jid, const std::string& jdir, const
std::string& base_filename,
+ const u_int16_t num_jfiles = def_num_jfiles, const bool ae = def_ae,
+ const u_int16_t ae_max_jfiles = def_ae_max_jfiles, const u_int32_t
jfsize_sblks = def_jfsize_sblks,
const u_int16_t wcache_num_pages = def_wcache_num_pages,
const u_int32_t wcache_pgsize_sblks = def_wcache_pgsize_sblks);
jrnl_init_params(const jrnl_init_params& jp);
@@ -65,6 +69,8 @@
inline const std::string& jdir() const { return _jdir; }
inline const std::string& base_filename() const { return _base_filename; }
inline u_int16_t num_jfiles() const { return _num_jfiles; }
+ inline bool is_ae() const { return _ae; }
+ inline u_int16_t ae_max_jfiles() const { return _ae_max_jfiles; }
inline u_int32_t jfsize_sblks() const { return _jfsize_sblks; }
inline u_int16_t wcache_num_pages() const { return _wcache_num_pages; }
inline u_int32_t wcache_pgsize_sblks() const { return _wcache_pgsize_sblks; }
Modified: store/trunk/cpp/tests/jrnl/jtt/jrnl_instance.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/jrnl_instance.cpp 2008-10-17 19:10:47 UTC (rev 2651)
+++ store/trunk/cpp/tests/jrnl/jtt/jrnl_instance.cpp 2008-10-17 20:42:21 UTC (rev 2652)
@@ -38,11 +38,11 @@
namespace jtt
{
-jrnl_instance::jrnl_instance(const std::string& jid, const std::string& jdir,
- const std::string& base_filename, const u_int16_t num_jfiles, const u_int32_t
jfsize_sblks,
+jrnl_instance::jrnl_instance(const std::string& jid, const std::string& jdir,
const std::string& base_filename,
+ const u_int16_t num_jfiles, const bool ae, const u_int16_t ae_max_jfiles, const
u_int32_t jfsize_sblks,
const u_int16_t wcache_num_pages, const u_int32_t wcache_pgsize_sblks):
mrg::journal::jcntl(jid, jdir, base_filename),
- _jpp(new jrnl_init_params(jid, jdir, base_filename, num_jfiles, jfsize_sblks,
+ _jpp(new jrnl_init_params(jid, jdir, base_filename, num_jfiles, ae,
ae_max_jfiles, jfsize_sblks,
wcache_num_pages, wcache_pgsize_sblks)),
_args_ptr(0),
_dtok_master_enq_list(),
@@ -111,23 +111,23 @@
try
{
u_int64_t highest_rid;
- recover(_jpp->num_jfiles(), _jpp->jfsize_sblks(),
_jpp->wcache_num_pages(),
- _jpp->wcache_pgsize_sblks(), aio_rd_callback, aio_wr_callback,
+ recover(_jpp->num_jfiles(), _jpp->is_ae(), _jpp->ae_max_jfiles(),
_jpp->jfsize_sblks(),
+ _jpp->wcache_num_pages(), _jpp->wcache_pgsize_sblks(),
aio_rd_callback, aio_wr_callback,
0, highest_rid);
recover_complete();
}
catch (const mrg::journal::jexception& e)
{
if (e.err_code() == mrg::journal::jerrno::JERR_JDIR_STAT)
- initialize(_jpp->num_jfiles(), _jpp->jfsize_sblks(),
_jpp->wcache_num_pages(),
- _jpp->wcache_pgsize_sblks(), aio_rd_callback,
aio_wr_callback);
+ initialize(_jpp->num_jfiles(), _jpp->is_ae(),
_jpp->ae_max_jfiles(), _jpp->jfsize_sblks(),
+ _jpp->wcache_num_pages(), _jpp->wcache_pgsize_sblks(),
aio_rd_callback, aio_wr_callback);
else
throw;
}
}
else
- initialize(_jpp->num_jfiles(), _jpp->jfsize_sblks(),
_jpp->wcache_num_pages(),
- _jpp->wcache_pgsize_sblks(), aio_rd_callback, aio_wr_callback);
+ initialize(_jpp->num_jfiles(), _jpp->is_ae(), _jpp->ae_max_jfiles(),
_jpp->jfsize_sblks(),
+ _jpp->wcache_num_pages(), _jpp->wcache_pgsize_sblks(),
aio_rd_callback, aio_wr_callback);
}
catch (const mrg::journal::jexception& e) { _tcrp->add_exception(e); }
catch (const std::exception& e) { _tcrp->add_exception(e.what()); }
Modified: store/trunk/cpp/tests/jrnl/jtt/jrnl_instance.hpp
===================================================================
--- store/trunk/cpp/tests/jrnl/jtt/jrnl_instance.hpp 2008-10-17 19:10:47 UTC (rev 2651)
+++ store/trunk/cpp/tests/jrnl/jtt/jrnl_instance.hpp 2008-10-17 20:42:21 UTC (rev 2652)
@@ -72,6 +72,8 @@
jrnl_instance(const std::string& jid, const std::string& jdir,
const std::string& base_filename,
const u_int16_t num_jfiles = jrnl_init_params::def_num_jfiles,
+ const bool ae = jrnl_init_params::def_ae,
+ const u_int16_t ae_max_jfiles = jrnl_init_params::def_ae_max_jfiles,
const u_int32_t jfsize_sblks = jrnl_init_params::def_jfsize_sblks,
const u_int16_t wcache_num_pages = jrnl_init_params::def_wcache_num_pages,
const u_int32_t wcache_pgsize_sblks =
jrnl_init_params::def_wcache_pgsize_sblks);