rhmessaging commits: r2652 - in store/trunk/cpp: lib/jrnl and 2 other directories.
by rhmessaging-commits@lists.jboss.org
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);
16 years, 2 months
rhmessaging commits: r2651 - store/trunk/cpp/tests/jrnl.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2008-10-17 15:10:47 -0400 (Fri, 17 Oct 2008)
New Revision: 2651
Modified:
store/trunk/cpp/tests/jrnl/_ut_lfmgr.cpp
Log:
added static casts to satisfy older compilers on type conversion issues
Modified: store/trunk/cpp/tests/jrnl/_ut_lfmgr.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_ut_lfmgr.cpp 2008-10-17 19:09:35 UTC (rev 2650)
+++ store/trunk/cpp/tests/jrnl/_ut_lfmgr.cpp 2008-10-17 19:10:47 UTC (rev 2651)
@@ -335,8 +335,9 @@
unsigned j = ae_max_jfiles ? ae_max_jfiles : JRNL_MAX_NUM_FILES;
while (ae && j > num_jfiles)
{
- const u_int16_t posn = (lm.num_jfiles() - 1) * ::drand48();
- const u_int16_t incr = 1 + (lm.ae_jfiles_rem() > 4 ? 3 : lm.ae_jfiles_rem() - 1) * ::drand48();
+ const u_int16_t posn = static_cast<u_int16_t>((lm.num_jfiles() - 1) * ::drand48());
+ const u_int16_t incr = 1 + static_cast<u_int16_t>((lm.ae_jfiles_rem() > 4
+ ? 3 : lm.ae_jfiles_rem() - 1) * ::drand48());
check_insert(lfm, lm, jc, posn, incr);
j -= incr;
}
16 years, 2 months
rhmessaging commits: r2650 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-10-17 15:09:35 -0400 (Fri, 17 Oct 2008)
New Revision: 2650
Modified:
mgmt/trunk/cumin/python/cumin/job.py
mgmt/trunk/cumin/python/cumin/job.strings
mgmt/trunk/cumin/python/cumin/limits.strings
mgmt/trunk/cumin/python/cumin/scheduler.strings
mgmt/trunk/cumin/python/cumin/submitter.strings
Log:
1st crack at job search
Modified: mgmt/trunk/cumin/python/cumin/job.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/job.py 2008-10-17 17:51:24 UTC (rev 2649)
+++ mgmt/trunk/cumin/python/cumin/job.py 2008-10-17 19:09:35 UTC (rev 2650)
@@ -167,7 +167,7 @@
name = fmt_shorten(data["submitter"])
return fmt_olink(branch, submitter, name=name)
else:
- return data["scheduler"]
+ return data["submitter"]
class SchedulerColumn(SqlTableColumn):
def render_title(self, session, data):
@@ -204,6 +204,36 @@
self.__release = JobReleaseButton(app, "release")
self.add_child(self.__release)
+ self.job_search = self.JobSearch(app, "job_search")
+ self.add_child(self.job_search)
+
+
+ def find_job(self, session):
+ search = self.job_search.get(session)
+ if search:
+ self.job_search.set(session, None)
+ job = self.safe_sql_find_job(session, search)
+ if job:
+ branch = session.branch()
+ self.frame.show_job(branch, job).show_view(branch)
+ self.page.set_redirect_url(session, branch.marshal())
+
+ def safe_sql_find_job(self, session, search):
+ #job = Job.select("custom_id = '%s'" % search)[0]
+ try:
+ conn = self.get_connection(session)
+ if conn:
+ cursor = conn.cursor()
+ sql = "select id from job where custom_id = %(search_term)s"
+ sql_values = {"search_term": search}
+
+ cursor.execute(sql, sql_values)
+ data = cursor.fetchone()
+ return Identifiable(data[0])
+ except:
+ pass
+
+
def get_visible_columns(self, session):
return self.get_request_visible_columns(session, ["custom_group", "scheduler", "submitter"])
@@ -217,7 +247,26 @@
if phase == "All":
phase = ""
return "%i %s %s" % (count, phase, count == 1 and "Job" or "Jobs")
+
+ class JobSearch(StringInput):
+ """ displays the input box and button used to search for job id """
+
+ def __init__(self, app, name):
+ super(JobTab.JobSearch, self).__init__(app, name)
+
+ self.__go = self.JobSearchButton(app, "go")
+ self.add_child(self.__go)
+
+ def find_job(self, session):
+ self.parent.find_job(session)
+ class JobSearchButton(FormButton):
+ def process_submit(self, session):
+ self.parent.find_job(session)
+
+ def render_content(self, session):
+ return "Go"
+
class JobSetFrame(object):
""" Intermediate class to consolidate the show_xxx methods associated with a jobset
Modified: mgmt/trunk/cumin/python/cumin/job.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/job.strings 2008-10-17 17:51:24 UTC (rev 2649)
+++ mgmt/trunk/cumin/python/cumin/job.strings 2008-10-17 19:09:35 UTC (rev 2650)
@@ -33,10 +33,49 @@
inner join submitter as b on b.id = j.submitter_id
{sql_where}
+[JobTab.css]
+input.search_input {
+ color: #444;
+ border: 1px solid #333;
+ font-size: 0.9em;
+ font-weight: normal;
+ padding-left: 0.25em;
+}
+div.searchbox {
+ padding-top: 2px;
+}
+
+[JobTab.javascript]
+function JobSearchFocus() {
+ var val = this.value;
+ if (val == this.default_value) {
+ this.value = "";
+ this.style.color = "#000";
+ }
+}
+function JobSearchBlur() {
+ var val = this.value;
+ if (val == "") {
+ this.style.color = "#444";
+ this.value = this.default_value;
+ }
+}
+
+function attachJobSearch() {
+ var oInput = document.getElementById("job_search");
+ if (oInput) {
+ oInput.default_value = "Enter Job ID";
+ oInput.onfocus = JobSearchFocus;
+ oInput.onblur = JobSearchBlur;
+ }
+}
+addEvent(window, "load", attachJobSearch);
+
[JobTab.html]
<form id="{id}" method="post" action="?">
<div class="sactions">
+ {job_search}
<h2>Act on Selected Jobs:</h2>
{hold} {release} {remove}
</div>
@@ -56,6 +95,13 @@
<div>{hidden_inputs}</div>
</form>
+[JobSearch.html]
+ <div class="rfloat searchbox">
+ <h2><label for="job_search">Search for a Job:</label></h2>
+ <input class="search_input" type="text" name="{name}" id="job_search" value="Enter Job ID" />
+ {go}
+ </div>
+
[JobGroupSet.sql]
select distinct
j.custom_group as id,
@@ -114,6 +160,7 @@
<form id="{id}" style="clear:right;" method="post" action="?">
<div class="sactions">
+ {job_search}
<h2>Act on Selected Jobs:</h2>
{hold} {release} {remove}
</div>
Modified: mgmt/trunk/cumin/python/cumin/limits.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/limits.strings 2008-10-17 17:51:24 UTC (rev 2649)
+++ mgmt/trunk/cumin/python/cumin/limits.strings 2008-10-17 19:09:35 UTC (rev 2650)
@@ -80,6 +80,7 @@
<form id="{id}" style="clear:right;" method="post" action="?">
<div class="sactions">
+ {job_search}
<h2>Act on Selected Jobs:</h2>
{hold} {release} {remove}
</div>
Modified: mgmt/trunk/cumin/python/cumin/scheduler.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/scheduler.strings 2008-10-17 17:51:24 UTC (rev 2649)
+++ mgmt/trunk/cumin/python/cumin/scheduler.strings 2008-10-17 19:09:35 UTC (rev 2650)
@@ -68,6 +68,7 @@
<form id="{id}" style="clear:right;" method="post" action="?">
<div class="sactions">
+ {job_search}
<h2>Act on Selected Jobs:</h2>
{hold} {release} {remove}
</div>
Modified: mgmt/trunk/cumin/python/cumin/submitter.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/submitter.strings 2008-10-17 17:51:24 UTC (rev 2649)
+++ mgmt/trunk/cumin/python/cumin/submitter.strings 2008-10-17 19:09:35 UTC (rev 2650)
@@ -44,6 +44,7 @@
<form id="{id}" style="clear:right;" method="post" action="?">
<div class="sactions">
+ {job_search}
<h2>Act on Selected Jobs:</h2>
{hold} {release} {remove}
</div>
16 years, 2 months
rhmessaging commits: r2649 - in store/trunk/cpp: lib/jrnl and 1 other directories.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2008-10-17 13:51:24 -0400 (Fri, 17 Oct 2008)
New Revision: 2649
Modified:
store/trunk/cpp/lib/JournalImpl.cpp
store/trunk/cpp/lib/jrnl/jcntl.cpp
store/trunk/cpp/lib/jrnl/jcntl.hpp
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/lfmgr.cpp
store/trunk/cpp/lib/jrnl/lfmgr.hpp
store/trunk/cpp/lib/jrnl/rcvdat.hpp
store/trunk/cpp/lib/jrnl/rrfc.cpp
store/trunk/cpp/lib/jrnl/wrfc.cpp
store/trunk/cpp/tests/jrnl/_st_helper_fns.hpp
store/trunk/cpp/tests/jrnl/_ut_jdir.cpp
store/trunk/cpp/tests/jrnl/_ut_jinf.cpp
store/trunk/cpp/tests/jrnl/_ut_lfmgr.cpp
Log:
Added auto-expand management functionality to class lfmgr. Added tests for all auto-expand functionality into _ut_lfmgr.
Modified: store/trunk/cpp/lib/JournalImpl.cpp
===================================================================
--- store/trunk/cpp/lib/JournalImpl.cpp 2008-10-17 17:28:47 UTC (rev 2648)
+++ store/trunk/cpp/lib/JournalImpl.cpp 2008-10-17 17:51:24 UTC (rev 2649)
@@ -144,9 +144,9 @@
if (_mgmtObject != 0)
{
- _mgmtObject->set_initialFileCount(_lfmgr.size());
+ _mgmtObject->set_initialFileCount(_lfmgr.num_jfiles());
_mgmtObject->set_dataFileSize(_jfsize_sblks * JRNL_SBLK_SIZE * JRNL_DBLK_SIZE);
- _mgmtObject->set_currentFileCount(_lfmgr.size());
+ _mgmtObject->set_currentFileCount(_lfmgr.num_jfiles());
_mgmtObject->set_writePageSize(wcache_pgsize_sblks * JRNL_SBLK_SIZE * JRNL_DBLK_SIZE);
_mgmtObject->set_writePages(wcache_num_pages);
}
@@ -172,9 +172,9 @@
if (_mgmtObject != 0)
{
- _mgmtObject->set_initialFileCount(_lfmgr.size());
+ _mgmtObject->set_initialFileCount(_lfmgr.num_jfiles());
_mgmtObject->set_dataFileSize(_jfsize_sblks * JRNL_SBLK_SIZE * JRNL_DBLK_SIZE);
- _mgmtObject->set_currentFileCount(_lfmgr.size());
+ _mgmtObject->set_currentFileCount(_lfmgr.num_jfiles());
_mgmtObject->set_writePageSize(wcache_pgsize_sblks * JRNL_SBLK_SIZE * JRNL_DBLK_SIZE);
_mgmtObject->set_writePages(wcache_num_pages);
}
Modified: store/trunk/cpp/lib/jrnl/jcntl.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.cpp 2008-10-17 17:28:47 UTC (rev 2648)
+++ store/trunk/cpp/lib/jrnl/jcntl.cpp 2008-10-17 17:51:24 UTC (rev 2649)
@@ -112,7 +112,7 @@
// Clear any existing journal files
_jdir.clear_dir();
- _lfmgr.initialize(num_jfiles, this, &new_fcntl);
+ _lfmgr.initialize(num_jfiles, false, 0, this, &new_fcntl);
_wrfc.initialize(_jfsize_sblks);
_rrfc.initialize();
@@ -154,7 +154,7 @@
// Verify journal dir and journal files
_jdir.verify_dir();
- _rcvdat.reset(num_jfiles);
+ _rcvdat.reset(num_jfiles, false, 0);
rcvr_janalyze(_rcvdat, prep_txn_list_ptr);
highest_rid = _rcvdat._h_rid;
@@ -180,7 +180,7 @@
{
if (!_readonly_flag)
throw jexception(jerrno::JERR_JCNTL_NOTRECOVERED, "jcntl", "recover_complete");
- for (u_int16_t i=0; i<_lfmgr.size(); i++)
+ for (u_int16_t i=0; i<_lfmgr.num_jfiles(); i++)
_lfmgr.get_fcntlp(i)->reset(&_rcvdat);
_wrfc.initialize(_jfsize_sblks, &_rcvdat);
_rrfc.initialize();
@@ -387,7 +387,7 @@
u_int16_t fid = _wrfc.index();
while ( _emap.get_enq_cnt(ffid) == 0 && _tmap.get_txn_fid_cnt(ffid) == 0 && ffid != fid)
{
- if (++ffid >= _lfmgr.size())
+ if (++ffid >= _lfmgr.num_jfiles())
ffid = 0;
}
if (!_rrfc.is_active())
@@ -435,7 +435,7 @@
}
fcntl*
-jcntl::new_fcntl(jcntl* const jcp, const std::size_t lid, const std::size_t fid, const rcvdat* const rdp)
+jcntl::new_fcntl(jcntl* const jcp, const u_int16_t lid, const u_int16_t fid, const rcvdat* const rdp)
{
if (!jcp) return 0;
std::ostringstream oss;
@@ -475,8 +475,8 @@
oss << FORMAT_SYSERR(errno);
throw jexception(jerrno::JERR__RTCLOCK, oss.str(), "jcntl", "write_infofile");
}
- jinf ji(_jid, _jdir.dirname(), _base_filename, _lfmgr.size(), _jfsize_sblks,
- _wmgr.cache_pgsize_sblks(), _wmgr.cache_num_pages(), ts);
+ jinf ji(_jid, _jdir.dirname(), _base_filename, _lfmgr.num_jfiles(), _lfmgr.is_ae(), _lfmgr.ae_max_jfiles(),
+ _jfsize_sblks, _wmgr.cache_pgsize_sblks(), _wmgr.cache_num_pages(), ts);
ji.write();
}
@@ -550,14 +550,14 @@
// If the number of files does not tie up with the jinf file from the journal being recovered,
// use the jinf data.
- if (rd._num_jfiles != ji.num_jfiles())
+ if (rd._njf != ji.num_jfiles())
{
std::ostringstream oss;
oss << "Recovery found " << ji.num_jfiles() <<
- " files (different from --num-jfiles value of " << rd._num_jfiles << ").";
+ " files (different from --num-jfiles value of " << rd._njf << ").";
this->log(LOG_WARN, oss.str());
- rd._num_jfiles = ji.num_jfiles();
- _rcvdat._enq_cnt_list.resize(rd._num_jfiles);
+ rd._njf = ji.num_jfiles();
+ _rcvdat._enq_cnt_list.resize(rd._njf);
}
if (_jfsize_sblks != ji.jfsize_sblks())
{
@@ -627,7 +627,7 @@
rd._lffull = rd._eo == (1 + _jfsize_sblks) * JRNL_SBLK_SIZE * JRNL_DBLK_SIZE;
// Check for journal full condition
- u_int16_t next_wr_fid = (rd._lfid + 1) % rd._num_jfiles;
+ u_int16_t next_wr_fid = (rd._lfid + 1) % rd._njf;
rd._jfull = rd._ffid == next_wr_fid && rd._enq_cnt_list[next_wr_fid];
}
}
@@ -851,7 +851,7 @@
rd._eo = ifsp->tellg(); // remember file offset before closing
assert(rd._eo != std::numeric_limits<std::size_t>::max()); // Check for error code -1
ifsp->close();
- if (++fid >= rd._num_jfiles)
+ if (++fid >= rd._njf)
{
fid = 0;
lowi = !lowi; // Flip local owi
@@ -896,7 +896,7 @@
{
if (rd._ffid ? h.get_owi() == lowi : h.get_owi() != lowi) // Overwrite indicator changed
{
- u_int16_t expected_fid = rd._ffid ? rd._ffid - 1 : rd._num_jfiles - 1;
+ u_int16_t expected_fid = rd._ffid ? rd._ffid - 1 : rd._njf - 1;
if (fid == expected_fid)
{
check_journal_alignment(fid, file_pos);
Modified: store/trunk/cpp/lib/jrnl/jcntl.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jcntl.hpp 2008-10-17 17:28:47 UTC (rev 2648)
+++ store/trunk/cpp/lib/jrnl/jcntl.hpp 2008-10-17 17:51:24 UTC (rev 2649)
@@ -616,7 +616,7 @@
*/
inline const std::string& base_filename() const { return _base_filename; }
- inline u_int16_t num_jfiles() const { return _lfmgr.size(); }
+ inline u_int16_t num_jfiles() const { return _lfmgr.num_jfiles(); }
inline fcntl* get_fcntlp(const u_int16_t fid) const { return _lfmgr.get_fcntlp(fid); }
@@ -637,8 +637,7 @@
/**
* /brief Static function for creating new fcntl objects for use with obj_arr.
*/
- static fcntl* new_fcntl(jcntl* const jcp, const std::size_t lid, const std::size_t fid,
- const rcvdat* const rdp);
+ static fcntl* new_fcntl(jcntl* const jcp, const u_int16_t lid, const u_int16_t fid, const rcvdat* const rdp);
protected:
/**
Modified: store/trunk/cpp/lib/jrnl/jerrno.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jerrno.cpp 2008-10-17 17:28:47 UTC (rev 2648)
+++ store/trunk/cpp/lib/jrnl/jerrno.cpp 2008-10-17 17:51:24 UTC (rev 2649)
@@ -82,12 +82,17 @@
const u_int32_t jerrno::JERR_FCNTL_CMPLOFFSOVFL = 0x0404;
const u_int32_t jerrno::JERR_FCNTL_RDOFFSOVFL = 0x0405;
+// class lfmgr
+const u_int32_t jerrno::JERR_LFMGR_BADAEFNUMLIM = 0x0500;
+const u_int32_t jerrno::JERR_LFMGR_AEFNUMLIMIT = 0x0501;
+const u_int32_t jerrno::JERR_LFMGR_AEDISABLED = 0x0502;
+
// class rrfc
-const u_int32_t jerrno::JERR_RRFC_OPENRD = 0x0500;
+const u_int32_t jerrno::JERR_RRFC_OPENRD = 0x0600;
// class jrec, enq_rec, deq_rec, txn_rec
-const u_int32_t jerrno::JERR_JREC_BADRECHDR = 0x0600;
-const u_int32_t jerrno::JERR_JREC_BADRECTAIL = 0x0601;
+const u_int32_t jerrno::JERR_JREC_BADRECHDR = 0x0700;
+const u_int32_t jerrno::JERR_JREC_BADRECTAIL = 0x0701;
// class wmgr
const u_int32_t jerrno::JERR_WMGR_BADPGSTATE = 0x0801;
@@ -136,17 +141,12 @@
// class jcntl
_err_map[JERR_JCNTL_STOPPED] = "JERR_JCNTL_STOPPED: Operation on stopped journal.";
- _err_map[JERR_JCNTL_READONLY] = "JERR_JCNTL_READONLY: "
- "Write operation on read-only journal (during recovery).";
- _err_map[JERR_JCNTL_AIOCMPLWAIT] = "JERR_JCNTL_AIOCMPLWAIT: "
- "Timeout waiting for AIOs to complete.";
+ _err_map[JERR_JCNTL_READONLY] = "JERR_JCNTL_READONLY: Write operation on read-only journal (during recovery).";
+ _err_map[JERR_JCNTL_AIOCMPLWAIT] = "JERR_JCNTL_AIOCMPLWAIT: Timeout waiting for AIOs to complete.";
_err_map[JERR_JCNTL_UNKNOWNMAGIC] = "JERR_JCNTL_UNKNOWNMAGIC: Found record with unknown magic.";
- _err_map[JERR_JCNTL_NOTRECOVERED] = "JERR_JCNTL_NOTRECOVERED: "
- "Operation requires recover() to be run first.";
- _err_map[JERR_JCNTL_RECOVERJFULL] = "JERR_JCNTL_RECOVERJFULL: "
- "Journal data files full, cannot write.";
- _err_map[JERR_JCNTL_OWIMISMATCH] = "JERR_JCNTL_OWIMISMATCH: "
- "Overwrite Indecator (OWI) change found in unexpected location.";
+ _err_map[JERR_JCNTL_NOTRECOVERED] = "JERR_JCNTL_NOTRECOVERED: Operation requires recover() to be run first.";
+ _err_map[JERR_JCNTL_RECOVERJFULL] = "JERR_JCNTL_RECOVERJFULL: Journal data files full, cannot write.";
+ _err_map[JERR_JCNTL_OWIMISMATCH] = "JERR_JCNTL_OWIMISMATCH: Overwrite Indecator (OWI) change found in unexpected location.";
// class jdir
_err_map[JERR_JDIR_NOTDIR] = "JERR_JDIR_NOTDIR: Directory name exists but is not a directory.";
@@ -165,13 +165,14 @@
_err_map[JERR_FCNTL_OPENWR] = "JERR_FCNTL_OPENWR: Unable to open file for write.";
_err_map[JERR_FCNTL_WRITE] = "JERR_FCNTL_WRITE: Unable to write to file.";
_err_map[JERR_FCNTL_CLOSE] = "JERR_FCNTL_CLOSE: File close failed.";
- _err_map[JERR_FCNTL_FILEOFFSOVFL] = "JERR_FCNTL_FILEOFFSOVFL: "
- "Attempted increase file offset past file size.";
- _err_map[JERR_FCNTL_CMPLOFFSOVFL] = "JERR_FCNTL_CMPLOFFSOVFL: "
- "Attempted increase completed file offset past submitted offset.";
- _err_map[JERR_FCNTL_RDOFFSOVFL] = "JERR_FCNTL_RDOFFSOVFL: "
- "Attempted increase read offset past write offset.";
+ _err_map[JERR_FCNTL_FILEOFFSOVFL] = "JERR_FCNTL_FILEOFFSOVFL: Attempted increase file offset past file size.";
+ _err_map[JERR_FCNTL_CMPLOFFSOVFL] = "JERR_FCNTL_CMPLOFFSOVFL: Attempted increase completed file offset past submitted offset.";
+ _err_map[JERR_FCNTL_RDOFFSOVFL] = "JERR_FCNTL_RDOFFSOVFL: Attempted increase read offset past write offset.";
+ // class lfmgr
+ _err_map[JERR_LFMGR_BADAEFNUMLIM] = "JERR_LFMGR_BADAEFNUMLIM: Bad auto-expand file number limit.";
+ _err_map[JERR_LFMGR_AEFNUMLIMIT] = "JERR_LFMGR_AEFNUMLIMIT: Exceeded auto-expand file number limit.";
+ _err_map[JERR_LFMGR_AEDISABLED] = "JERR_LFMGR_AEDISABLED: Attempted to expand with auto-expand disabled.";
// class rrfc
_err_map[JERR_RRFC_OPENRD] = "JERR_RRFC_OPENRD: Unable to open file for read.";
@@ -181,43 +182,32 @@
_err_map[JERR_JREC_BADRECTAIL] = "JERR_JREC_BADRECTAIL: Invalid data record tail.";
// class wmgr
- _err_map[JERR_WMGR_BADPGSTATE] = "JERR_WMGR_BADPGSTATE: "
- "Page buffer in illegal state for operation.";
- _err_map[JERR_WMGR_BADDTOKSTATE] = "JERR_WMGR_BADDTOKSTATE: "
- "Data token in illegal state for operation.";
- _err_map[JERR_WMGR_ENQDISCONT] = "JERR_WMGR_ENQDISCONT: "
- "Enqueued new dtok when previous enqueue returned partly completed (state ENQ_PART).";
- _err_map[JERR_WMGR_DEQDISCONT] = "JERR_WMGR_DEQDISCONT: "
- "Dequeued new dtok when previous dequeue returned partly completed (state DEQ_PART).";
+ _err_map[JERR_WMGR_BADPGSTATE] = "JERR_WMGR_BADPGSTATE: Page buffer in illegal state for operation.";
+ _err_map[JERR_WMGR_BADDTOKSTATE] = "JERR_WMGR_BADDTOKSTATE: Data token in illegal state for operation.";
+ _err_map[JERR_WMGR_ENQDISCONT] = "JERR_WMGR_ENQDISCONT: Enqueued new dtok when previous enqueue returned partly completed (state ENQ_PART).";
+ _err_map[JERR_WMGR_DEQDISCONT] = "JERR_WMGR_DEQDISCONT: Dequeued new dtok when previous dequeue returned partly completed (state DEQ_PART).";
_err_map[JERR_WMGR_DEQRIDNOTENQ] = "JERR_WMGR_DEQRIDNOTENQ: Dequeue rid is not enqueued.";
// class rmgr
_err_map[JERR_RMGR_UNKNOWNMAGIC] = "JERR_RMGR_UNKNOWNMAGIC: Found record with unknown magic.";
- _err_map[JERR_RMGR_RIDMISMATCH] = "JERR_RMGR_RIDMISMATCH: "
- "RID mismatch between current record and dtok RID";
+ _err_map[JERR_RMGR_RIDMISMATCH] = "JERR_RMGR_RIDMISMATCH: RID mismatch between current record and dtok RID";
//_err_map[JERR_RMGR_FIDMISMATCH] = "JERR_RMGR_FIDMISMATCH: FID mismatch between emap and rrfc";
- _err_map[JERR_RMGR_ENQSTATE] = "JERR_RMGR_ENQSTATE: "
- "Attempted read when data token wstate was not ENQ";
- _err_map[JERR_RMGR_BADRECTYPE] = "JERR_RMGR_BADRECTYPE: "
- "Attempted operation on inappropriate record type";
+ _err_map[JERR_RMGR_ENQSTATE] = "JERR_RMGR_ENQSTATE: Attempted read when data token wstate was not ENQ";
+ _err_map[JERR_RMGR_BADRECTYPE] = "JERR_RMGR_BADRECTYPE: Attempted operation on inappropriate record type";
// class data_tok
- _err_map[JERR_DTOK_ILLEGALSTATE] = "JERR_MTOK_ILLEGALSTATE: "
- "Attempted to change to illegal state.";
+ _err_map[JERR_DTOK_ILLEGALSTATE] = "JERR_MTOK_ILLEGALSTATE: Attempted to change to illegal state.";
//_err_map[JERR_DTOK_RIDNOTSET] = "JERR_DTOK_RIDNOTSET: Record ID not set.";
// class enq_map, txn_map
- _err_map[JERR_MAP_DUPLICATE] = "JERR_MAP_DUPLICATE: "
- "Attempted to insert record into map using duplicate key.";
+ _err_map[JERR_MAP_DUPLICATE] = "JERR_MAP_DUPLICATE: Attempted to insert record into map using duplicate key.";
_err_map[JERR_MAP_NOTFOUND] = "JERR_MAP_NOTFOUND: Key not found in map.";
_err_map[JERR_MAP_LOCKED] = "JERR_MAP_LOCKED: Record ID locked by a pending transaction.";
// class jinf
- _err_map[JERR_JINF_CVALIDFAIL] = "JERR_JINF_CVALIDFAIL: "
- "Journal compatibility validation failure.";
+ _err_map[JERR_JINF_CVALIDFAIL] = "JERR_JINF_CVALIDFAIL: Journal compatibility validation failure.";
_err_map[JERR_JINF_NOVALUESTR] = "JERR_JINF_NOVALUESTR: No value attribute found in jinf file.";
- _err_map[JERR_JINF_BADVALUESTR] = "JERR_JINF_BADVALUESTR: "
- "Bad format for value attribute in jinf file";
+ _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.";
Modified: store/trunk/cpp/lib/jrnl/jerrno.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jerrno.hpp 2008-10-17 17:28:47 UTC (rev 2648)
+++ store/trunk/cpp/lib/jrnl/jerrno.hpp 2008-10-17 17:51:24 UTC (rev 2649)
@@ -100,6 +100,11 @@
static const u_int32_t JERR_FCNTL_CMPLOFFSOVFL; ///< Increased cmpl offs past subm offs
static const u_int32_t JERR_FCNTL_RDOFFSOVFL; ///< Increased read offs past write offs
+ // class lfmgr
+ static const u_int32_t JERR_LFMGR_BADAEFNUMLIM; ///< Bad auto-expand file number limit
+ static const u_int32_t JERR_LFMGR_AEFNUMLIMIT; ///< Exceeded auto-expand file number limit
+ static const u_int32_t JERR_LFMGR_AEDISABLED; ///< Attempted to expand with auto-expand disabled
+
// class rrfc
static const u_int32_t JERR_RRFC_OPENRD; ///< Unable to open file for read
Modified: store/trunk/cpp/lib/jrnl/jinf.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jinf.cpp 2008-10-17 17:28:47 UTC (rev 2648)
+++ store/trunk/cpp/lib/jrnl/jinf.cpp 2008-10-17 17:51:24 UTC (rev 2649)
@@ -49,6 +49,8 @@
jinf::jinf(const std::string& jinf_filename, bool validate_flag):
_jver(0),
_num_jfiles(0),
+ _ae(false),
+ _ae_max_jfiles(0),
_jfsize_sblks(0),
_sblk_size_dblks(0),
_dblk_size(0),
@@ -67,8 +69,8 @@
validate();
}
-jinf::jinf(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,
+jinf::jinf(const std::string& jid, const std::string& jdir, const std::string& base_filename, 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_int32_t wcache_pgsize_sblks, const u_int16_t wcache_num_pages, const timespec& ts):
_jver(RHM_JDAT_VERSION),
_jid(jid),
@@ -76,6 +78,8 @@
_base_filename(base_filename),
_ts(ts),
_num_jfiles(num_jfiles),
+ _ae(auto_expand),
+ _ae_max_jfiles(ae_max_jfiles),
_jfsize_sblks(jfsize_sblks),
_sblk_size_dblks(JRNL_SBLK_SIZE),
_dblk_size(JRNL_DBLK_SIZE),
@@ -115,6 +119,21 @@
oss << "; maximum=" << JRNL_MAX_NUM_FILES << std::endl;
err = true;
}
+ if (_ae)
+ {
+ if (_ae_max_jfiles > _num_jfiles)
+ {
+ oss << "Number of journal files exceeds auto-expansion limit: found=" << _num_jfiles;
+ oss << "; maximum=" << _ae_max_jfiles;
+ err = true;
+ }
+ if (_ae_max_jfiles > JRNL_MAX_NUM_FILES)
+ {
+ oss << "Auto-expansion file limit too large: found=" << _ae_max_jfiles;
+ oss << "; maximum=" << JRNL_MAX_NUM_FILES;
+ err = true;
+ }
+ }
if (_jfsize_sblks < JRNL_MIN_FILE_SIZE)
{
oss << "Journal file size too small: found=" << _jfsize_sblks;
@@ -271,7 +290,7 @@
return _frot;
}
-const std::string
+std::string
jinf::to_string() const
{
std::ostringstream oss;
@@ -284,6 +303,8 @@
oss << " Journal base filename: \"" << _base_filename << "\"" << std::endl;
oss << " Journal version: " << (unsigned)_jver << std::endl;
oss << " Number of journal files: " << _num_jfiles << std::endl;
+ oss << " Auto-expand mode: " << (_ae ? "enabled" : "disabled") << std::endl;
+ if (_ae) oss << " Max. number of journal files (in auto-expand mode): " << _ae_max_jfiles << std::endl;
oss << " Journal file size: " << _jfsize_sblks << " sblks" << std::endl;
oss << " Softblock size (JRNL_SBLK_SIZE): " << _sblk_size_dblks << " dblks" << std::endl;
oss << " Datablock size (JRNL_DBLK_SIZE): " << _dblk_size << " bytes" << std::endl;
@@ -294,7 +315,7 @@
return oss.str();
}
-const std::string
+std::string
jinf::xml_str() const
{
// TODO: This is *not* an XML writer, rather for simplicity, it uses literals. I'm sure a more elegant way can be
@@ -321,6 +342,8 @@
oss << " </creation_time>" << std::endl;
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;
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;
@@ -339,7 +362,8 @@
jinf::read(const std::string& jinf_filename)
{
// TODO: This is *not* an XML reader, rather for simplicity, it is a brute-force line reader which relies on string
- // recognition. Can it be replaced cheaply by the real thing?
+ // recognition. It relies on the format of xml_str() above; it will not handle a XML restructuring.
+ // *** Can it be replaced cheaply by a real XML reader? Should it be, or is this sufficient? ***
char buff[1024]; // limit of line input length
std::ifstream jinfs(jinf_filename.c_str());
@@ -358,6 +382,10 @@
string_value(_base_filename, buff);
else if(std::strstr(buff, "number_jrnl_files"))
_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"))
+ _ae_max_jfiles = u_int16_value(buff);
else if(std::strstr(buff, "jrnl_file_size_sblks"))
_jfsize_sblks = u_int32_value(buff);
else if(std::strstr(buff, "JRNL_SBLK_SIZE"))
@@ -383,6 +411,12 @@
jinfs.close();
}
+bool
+jinf::bool_value(char* line) const
+{
+ return std::strcmp(find_value(line), "true") == 0;
+}
+
u_int16_t
jinf::u_int16_value(char* line) const
{
@@ -395,14 +429,14 @@
return std::atol(find_value(line));
}
-const std::string&
+std::string&
jinf::string_value(std::string& str, char* line) const
{
str.assign(find_value(line));
return str;
}
-const char*
+char*
jinf::find_value(char* line) const
{
const char* target1_str = "value=\"";
Modified: store/trunk/cpp/lib/jrnl/jinf.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/jinf.hpp 2008-10-17 17:28:47 UTC (rev 2648)
+++ store/trunk/cpp/lib/jrnl/jinf.hpp 2008-10-17 17:51:24 UTC (rev 2649)
@@ -58,6 +58,8 @@
std::string _base_filename;
timespec _ts;
u_int16_t _num_jfiles;
+ bool _ae;
+ u_int32_t _ae_max_jfiles;
u_int32_t _jfsize_sblks;
u_int16_t _sblk_size_dblks;
u_int32_t _dblk_size;
@@ -77,8 +79,8 @@
jinf(const std::string& jinf_filename, bool validate_flag);
// constructor for writing jinf file
jinf(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_int32_t wcache_pgsize_sblks, const u_int16_t wcache_num_pages,
+ 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_int32_t wcache_pgsize_sblks, const u_int16_t wcache_num_pages,
const timespec& ts);
virtual ~jinf();
@@ -94,6 +96,8 @@
inline const timespec& ts() const { return _ts; }
inline u_int16_t num_jfiles() const { return _num_jfiles; }
u_int16_t incr_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 sblk_size_dblks() const { return _sblk_size_dblks; }
inline u_int32_t dblk_size() const { return _dblk_size; }
@@ -108,15 +112,16 @@
bool get_initial_owi();
bool get_frot();
- const std::string to_string() const;
- const std::string xml_str() const;
+ std::string to_string() const;
+ std::string xml_str() const;
private:
void read(const std::string& jinf_filename);
+ bool bool_value(char* line) const;
u_int16_t u_int16_value(char* line) const;
u_int32_t u_int32_value(char* line) const;
- const std::string& string_value(std::string& str, char* line) const;
- const char* find_value(char* line) const;
+ std::string& string_value(std::string& str, char* line) const;
+ char* find_value(char* line) const;
};
} // namespace journal
Modified: store/trunk/cpp/lib/jrnl/lfmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/lfmgr.cpp 2008-10-17 17:28:47 UTC (rev 2648)
+++ store/trunk/cpp/lib/jrnl/lfmgr.cpp 2008-10-17 17:51:24 UTC (rev 2649)
@@ -32,13 +32,15 @@
#include "jrnl/lfmgr.hpp"
#include <cassert>
+#include <jrnl/jerrno.hpp>
+#include <jrnl/jexception.hpp>
namespace mrg
{
namespace journal
{
-lfmgr::lfmgr()
+lfmgr::lfmgr() : _ae(false), _ae_max_jfiles(0)
{}
lfmgr::~lfmgr()
@@ -47,85 +49,140 @@
}
void
-lfmgr::initialize(const std::size_t num_jfiles,
+lfmgr::initialize(const u_int16_t num_jfiles,
+ const bool ae,
+ const u_int16_t ae_max_jfiles,
jcntl* const jcp,
- fcntl* (new_obj_fn)(jcntl* const jcp,
- const std::size_t lid,
- const std::size_t fid,
- const rcvdat* const rdp))
+ new_obj_fn_ptr fp)
{
+ assert(jcp != 0);
finalize();
- if (num_jfiles > 0)
+
+ // Validate params
+ if (ae && ae_max_jfiles > 0 && ae_max_jfiles <= num_jfiles)
{
- _fcntl_arr.reserve(2 * num_jfiles); // reserve some extra for possible add_obj() operations
- append(jcp, new_obj_fn, num_jfiles);
+ std::ostringstream oss;
+ oss << "_ae_max_jfiles=" << _ae_max_jfiles << "; num_jfiles=" << num_jfiles;
+ throw jexception(jerrno::JERR_LFMGR_BADAEFNUMLIM, oss.str(), "lfmgr", "initialize");
}
+ _ae = ae;
+ _ae_max_jfiles = ae_max_jfiles;
+
+ const std::size_t num_res_files = ae
+ ? (ae_max_jfiles ? ae_max_jfiles : JRNL_MAX_NUM_FILES)
+ : num_jfiles;
+ _fcntl_arr.reserve(num_res_files);
+ append(jcp, fp, num_jfiles);
}
void
lfmgr::recover(const rcvdat& rd,
jcntl* const jcp,
- fcntl* (new_obj_fn)(jcntl* const jcp,
- const std::size_t lid,
- const std::size_t fid,
- const rcvdat* const rdp))
+ new_obj_fn_ptr fp)
{
+ assert(jcp != 0);
finalize();
- _fcntl_arr.reserve(2 * rd._num_jfiles); // reserve some extra for possible add_obj() operations
- _fcntl_arr.assign(rd._num_jfiles, 0);
+
+ // Validate rd params
+ if (rd._aemjf > 0 && rd._aemjf <= rd._njf)
+ {
+ std::ostringstream oss;
+ oss << "_ae_max_jfiles=" << rd._aemjf << "; num_jfiles=" <<rd._njf ;
+ throw jexception(jerrno::JERR_LFMGR_BADAEFNUMLIM, oss.str(), "lfmgr", "recover");
+ }
+ _ae = rd._ae;
+ _ae_max_jfiles = rd._aemjf;
+
+ const std::size_t num_res_files = rd._ae
+ ? (rd._aemjf ? rd._aemjf : JRNL_MAX_NUM_FILES)
+ : rd._njf;
+ _fcntl_arr.reserve(num_res_files);
+ _fcntl_arr.assign(rd._njf, 0);
std::vector<u_int16_t> lid_list(rd._fid_list.size(), 0);
for (std::size_t lid = 0; lid < rd._fid_list.size(); lid++)
lid_list[rd._fid_list[lid]] = lid;
- // NOTE: rd._fid_list may be smaller than rd._num_jfiles (journal may be empty or not yet file-cycled)
- for (std::size_t fid = 0; fid < rd._num_jfiles; fid++)
+ // NOTE: rd._fid_list may be smaller than rd._njf (journal may be empty or not yet file-cycled)
+ for (std::size_t fid = 0; fid < rd._njf; fid++)
if (fid < rd._fid_list.size())
- _fcntl_arr[lid_list[fid]] = new_obj_fn(jcp, lid_list[fid], fid, &rd);
+ _fcntl_arr[lid_list[fid]] = fp(jcp, lid_list[fid], fid, &rd);
else
- _fcntl_arr[fid] = new_obj_fn(jcp, fid, fid, &rd);
+ _fcntl_arr[fid] = fp(jcp, fid, fid, &rd);
}
void
-lfmgr::append(jcntl* const jcp,
- fcntl* (new_obj_fn)(jcntl* const jcp,
- const std::size_t lid,
- const std::size_t fid,
- const rcvdat* const rdp),
- const std::size_t num_jfiles)
-{
- std::size_t s = _fcntl_arr.size();
- for (std::size_t i = s; i < s + num_jfiles; i++)
- _fcntl_arr.push_back(new_obj_fn(jcp, i, i, 0));
-}
-
-void
-lfmgr::insert(const std::size_t after_index,
+lfmgr::insert(const u_int16_t after_index,
jcntl* const jcp,
- fcntl* (new_obj_fn)(jcntl* const jcp,
- const std::size_t lid,
- const std::size_t fid,
- const rcvdat* const rdp),
- const std::size_t num_jfiles)
+ new_obj_fn_ptr fp,
+ const u_int16_t num_jfiles)
{
+ assert(jcp != 0);
assert(after_index < _fcntl_arr.size());
+ if (!_ae) throw jexception(jerrno::JERR_LFMGR_AEDISABLED, "lfmgr", "insert");
+ if (num_jfiles == 0) return;
std::size_t fid = _fcntl_arr.size();
+ const u_int16_t eff_ae_max_jfiles = _ae_max_jfiles ? _ae_max_jfiles : JRNL_MAX_NUM_FILES;
+ if (fid + num_jfiles > eff_ae_max_jfiles)
+ {
+ std::ostringstream oss;
+ oss << "num_files=" << fid << " incr=" << num_jfiles << " limit=" << _ae_max_jfiles;
+ throw jexception(jerrno::JERR_LFMGR_AEFNUMLIMIT, oss.str(), "lfmgr", "insert");
+ }
for (std::size_t lid = after_index + 1; lid <= after_index + num_jfiles; lid++, fid++)
- _fcntl_arr.insert(_fcntl_arr.begin() + lid, new_obj_fn(jcp, lid, fid, 0));
+ _fcntl_arr.insert(_fcntl_arr.begin() + lid, fp(jcp, lid, fid, 0));
for (std::size_t lid = after_index + num_jfiles + 1; lid < _fcntl_arr.size(); lid++)
{
- fcntl* fp = _fcntl_arr[lid];
- assert(fp != 0);
- fp->set_lid(fp->lid() + num_jfiles);
+ fcntl* p = _fcntl_arr[lid];
+ assert(p != 0);
+ p->set_lid(p->lid() + num_jfiles);
}
}
void
lfmgr::finalize()
{
- for (u_int32_t i=0; i<_fcntl_arr.size(); i++)
+ for (u_int32_t i = 0; i < _fcntl_arr.size(); i++)
delete _fcntl_arr[i];
_fcntl_arr.clear();
+ _ae = false;
+ _ae_max_jfiles = 0;
}
+void
+lfmgr::set_ae(const bool ae)
+{
+ if (ae && _ae_max_jfiles > 0 && _ae_max_jfiles <= _fcntl_arr.size())
+ {
+ std::ostringstream oss;
+ oss << "_ae_max_jfiles=" << _ae_max_jfiles << "; _fcntl_arr.size()=" << _fcntl_arr.size();
+ throw jexception(jerrno::JERR_LFMGR_BADAEFNUMLIM, oss.str(), "lfmgr", "set_ae");
+ }
+ if (ae && _fcntl_arr.max_size() < _ae_max_jfiles)
+ _fcntl_arr.reserve(_ae_max_jfiles ? _ae_max_jfiles : JRNL_MAX_NUM_FILES);
+ _ae = ae;
+}
+
+void
+lfmgr::set_ae_max_jfiles(const u_int16_t ae_max_jfiles)
+{
+ if (_ae && ae_max_jfiles > 0 && ae_max_jfiles <= _fcntl_arr.size())
+ {
+ std::ostringstream oss;
+ oss << "_ae_max_jfiles=" << _ae_max_jfiles << "; _fcntl_arr.size()=" << _fcntl_arr.size();
+ throw jexception(jerrno::JERR_LFMGR_BADAEFNUMLIM, oss.str(), "lfmgr", "set_ae_max_jfiles");
+ }
+ if (_ae && _fcntl_arr.max_size() < ae_max_jfiles)
+ _fcntl_arr.reserve(ae_max_jfiles ? ae_max_jfiles : JRNL_MAX_NUM_FILES);
+ _ae_max_jfiles = ae_max_jfiles;
+}
+
+u_int16_t
+lfmgr::ae_jfiles_rem() const
+{
+ if (_ae_max_jfiles > _fcntl_arr.size()) return _ae_max_jfiles - _fcntl_arr.size();
+ if (_ae_max_jfiles == 0) return JRNL_MAX_NUM_FILES - _fcntl_arr.size();
+ return 0;
+}
+
// Testing functions
void
@@ -145,5 +202,23 @@
lid_list[_fcntl_arr[i]->fid()] = i;
}
+// === protected fns ===
+
+void
+lfmgr::append(jcntl* const jcp,
+ new_obj_fn_ptr fp,
+ const u_int16_t num_jfiles)
+{
+ std::size_t s = _fcntl_arr.size();
+ if (_ae_max_jfiles && s + num_jfiles > _ae_max_jfiles)
+ {
+ std::ostringstream oss;
+ oss << "num_files=" << s << " incr=" << num_jfiles << " limit=" << _ae_max_jfiles;
+ throw jexception(jerrno::JERR_LFMGR_AEFNUMLIMIT, oss.str(), "lfmgr", "append");
+ }
+ for (std::size_t i = s; i < s + num_jfiles; i++)
+ _fcntl_arr.push_back(fp(jcp, i, i, 0));
+}
+
} // namespace journal
} // namespace mrg
Modified: store/trunk/cpp/lib/jrnl/lfmgr.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/lfmgr.hpp 2008-10-17 17:28:47 UTC (rev 2648)
+++ store/trunk/cpp/lib/jrnl/lfmgr.hpp 2008-10-17 17:51:24 UTC (rev 2649)
@@ -113,16 +113,35 @@
* +---+---+---+---+---+---+---+---+ +---+---+---+---+---+---+---+---+
* </pre>
*
- * There are two independent tests that may be made to resolve duplicat lids during recovery in such cases:
+ * There are two independent tests that may be made to resolve duplicate lids during recovery in such cases:
* <ol>
* <li>The correct lid has owi flag that matches that of fid/lid 0</li>
* <li>The most recently inserted (hence correct) lid has fids that are higher than the duplicat that was not
* overwritten</li>
* </ol>
+ *
+ * NOTE: NOT THREAD SAFE. Provide external thread protection if used in multi-threaded environments.
*/
class lfmgr
{
- protected:
+ public:
+ /**
+ * \brief Function pointer to function that will create a new fcntl object and return its pointer.
+ *
+ * \param jcp Pointer to jcntl instance from which journal file details will be obtained.
+ * \param lid Logical ID for new fcntl instance.
+ * \param fid Physical file ID for file associated with new fcntl instance.
+ * \param rdp Pointer to rcvdat instance which conatins recovery information for new fcntl instance when
+ * recovering an existing file, or null if a new file is to be created.
+ */
+ typedef fcntl* (new_obj_fn_ptr)(jcntl* const jcp,
+ const u_int16_t lid,
+ const u_int16_t fid,
+ const rcvdat* const rdp);
+
+ private:
+ bool _ae; ///< Auto-expand mode
+ u_int16_t _ae_max_jfiles; ///< Max file count for auto-expansion; 0 = no limit
std::vector<fcntl*> _fcntl_arr; ///< Array of pointers to objects
public:
@@ -135,17 +154,20 @@
*
* \param num_jfiles Number of files to be created, and consequently the number of fcntl objects in array
* _fcntl_arr.
+ * \param ae If true, allows auto-expansion; if false, disables auto-expansion.
+ * \param ae_max_jfiles The maximum number of files allowed for auto-expansion. Cannot be lower than the current
+ * number of files. However, a zero value disables the limit checks, and allows unlimited
+ * expansion.
* \param jcp Pointer to jcntl instance. This is used to find the file path and base filename so that
* new files may be created.
- * \param new_obj_fn Pointer to function which creates and returns a pointer to a new fcntl object (and hence
+ * \param fp Pointer to function which creates and returns a pointer to a new fcntl object (and hence
* causes a new %journal file to be created).
*/
- void initialize(const std::size_t num_jfiles,
+ void initialize(const u_int16_t num_jfiles,
+ const bool ae,
+ const u_int16_t ae_max_jfiles,
jcntl* const jcp,
- fcntl* (new_obj_fn)(jcntl* const jcp,
- const std::size_t lid,
- const std::size_t fid,
- const rcvdat* const rdp));
+ new_obj_fn_ptr fp);
/**
* \brief Initialize from a known lid-fid map fid_list, which is usually obtained from a recover. The index of
@@ -154,34 +176,14 @@
* \param rd Ref to rcvdat struct which contains recovery data.
* \param jcp Pointer to jcntl instance. This is used to find the file path and base filename so that
* new files may be created.
- * \param new_obj_fn Pointer to function which creates and returns a pointer to a new fcntl object (and hence
+ * \param fp Pointer to function which creates and returns a pointer to a new fcntl object (and hence
* causes a new %journal file to be created).
*/
void recover(const rcvdat& rd,
jcntl* const jcp,
- fcntl* (new_obj_fn)(jcntl* const jcp,
- const std::size_t lid,
- const std::size_t fid,
- const rcvdat* const rdp));
+ new_obj_fn_ptr fp);
/**
- * \brief Append num_jfiles files to the end of the logical and file id sequence. This is similar to extending
- * the from-scratch initialization.
- *
- * \param jcp Pointer to jcntl instance. This is used to find the file path and base filename so that
- * new files may be created.
- * \param new_obj_fn Pointer to function which creates and returns a pointer to a new fcntl object (and hence
- * causes a new %journal file to be created).
- * \param num_jfiles The number of files by which to increase.
- */
- void append(jcntl* const jcp,
- fcntl* (new_obj_fn)(jcntl* const jcp,
- const std::size_t lid,
- const std::size_t fid,
- const rcvdat* const rdp),
- const std::size_t num_jfiles = 1);
-
- /**
* \brief Insert num_jfiles files after lid index after_index. This causes all lids after after_index to be
* increased by num_jfiles.
*
@@ -191,17 +193,14 @@
* \param after_index Lid index after which to insert file(s).
* \param jcp Pointer to jcntl instance. This is used to find the file path and base filename so that
* new files may be created.
- * \param new_obj_fn Pointer to function which creates and returns a pointer to a new fcntl object (and hence
+ * \param fp Pointer to function which creates and returns a pointer to a new fcntl object (and hence
* causes a new %journal file to be created).
* \param num_jfiles The number of files by which to increase.
*/
- void insert(const std::size_t after_index,
+ void insert(const u_int16_t after_index,
jcntl* const jcp,
- fcntl* (new_obj_fn)(jcntl* const jcp,
- const std::size_t lid,
- const std::size_t fid,
- const rcvdat* const rdp),
- const std::size_t num_jfiles = 1);
+ new_obj_fn_ptr fp,
+ const u_int16_t num_jfiles = 1);
/**
* \brief Clears _fcntl_arr and deletes all fcntl instances.
@@ -213,23 +212,62 @@
* either initialize() is called; thereafter true until finalize() is called, whereupon it will
* return false again.
*
- * \return True if initialized; False otherwise.
+ * \return True if initialized; false otherwise.
*/
inline bool is_init() const { return _fcntl_arr.size() > 0; }
/**
+ * \brief Returns true if auto-expand mode is enabled; false if not.
+ *
+ * \return True if auto-expand mode is enabled; false if not.
+ */
+ inline bool is_ae() const { return _ae; }
+
+ /**
+ * \brief Sets the auto-expand mode to enabled if ae is true, to disabled otherwise. The value of _ae_max_jfiles
+ * must be valid to succeed (i.e. _ae_max_jfiles must be greater than the current number of files or be zero).
+ *
+ * \param ae If true will enable auto-expand mode; if false will disable it.
+ */
+ void set_ae(const bool ae);
+
+ /**
* \brief Returns the number of %journal files, including any that were appended or inserted since
* initialization.
*
* \return Number of %journal files if initialized; 0 otherwise.
*/
- inline std::size_t size() const { return _fcntl_arr.size(); }
+ inline u_int16_t num_jfiles() const { return static_cast<u_int16_t>(_fcntl_arr.size()); }
/**
+ * \brief Returns the maximum number of files allowed for auto-expansion.
+ *
+ * \return Maximum number of files allowed for auto-expansion. A zero value represents a disabled limit
+ * - i.e. unlimited expansion.
+ */
+ inline u_int16_t ae_max_jfiles() const { return _ae_max_jfiles; }
+
+ /**
+ * \brief Sets the maximum number of files allowed for auto-expansion. A zero value disables the limit.
+ *
+ * \param ae_max_jfiles The maximum number of files allowed for auto-expansion. Cannot be lower than the current
+ * number of files. However, a zero value disables the limit checks, and allows unlimited
+ * expansion.
+ */
+ void set_ae_max_jfiles(const u_int16_t ae_max_jfiles);
+
+ /**
+ * \brief Calculates the number of future files available for auto-expansion.
+ *
+ * \return The number of future files available for auto-expansion.
+ */
+ u_int16_t ae_jfiles_rem() const;
+
+ /**
* \brief Get a pointer to fcntl instance for a given lid.
*
- * \return Pointer to fcntl object corresponding to logical id lid, or 0 if lid is out of range (greater than
- * number of files in use).
+ * \return Pointer to fcntl object corresponding to logical id lid, or 0 if lid is out of range
+ * (greater than number of files in use).
*/
inline fcntl* get_fcntlp(const u_int16_t lid) const
{ if (lid >= _fcntl_arr.size()) return 0; return _fcntl_arr[lid]; }
@@ -237,6 +275,23 @@
// Testing functions
void get_fid_list(std::vector<u_int16_t>& fid_list) const;
void get_lid_list(std::vector<u_int16_t>& lid_list) const;
+
+ private:
+
+ /**
+ * \brief Append num_jfiles files to the end of the logical and file id sequence. This is similar to extending
+ * the from-scratch initialization.
+ *
+ * \param jcp Pointer to jcntl instance. This is used to find the file path and base filename so that
+ * new files may be created.
+ * \param fp Pointer to function which creates and returns a pointer to a new fcntl object (and hence
+ * causes a new %journal file to be created).
+ * \param num_jfiles The number of files by which to increase.
+ */
+ void append(jcntl* const jcp,
+ new_obj_fn_ptr fp,
+ const u_int16_t num_jfiles = 1);
+
};
} // namespace journal
Modified: store/trunk/cpp/lib/jrnl/rcvdat.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rcvdat.hpp 2008-10-17 17:28:47 UTC (rev 2648)
+++ store/trunk/cpp/lib/jrnl/rcvdat.hpp 2008-10-17 17:51:24 UTC (rev 2649)
@@ -47,22 +47,26 @@
struct rcvdat
{
- u_int16_t _num_jfiles; ///< Number of journal files
- bool _owi; ///< Overwrite indicator
- bool _frot; ///< First rotation flag
- bool _jempty; ///< Journal data files empty
- u_int16_t _ffid; ///< First file id
- std::size_t _fro; ///< First record offset in ffid
- u_int16_t _lfid; ///< Last file id
- std::size_t _eo; ///< End offset (first byte past last record)
- u_int64_t _h_rid; ///< Highest rid found
- bool _lffull; ///< Last file is full
- bool _jfull; ///< Journal is full
+ u_int16_t _njf; ///< Number of journal files
+ bool _ae; ///< Auto-expand mode
+ u_int16_t _aemjf; ///< Auto-expand mode max journal files
+ bool _owi; ///< Overwrite indicator
+ bool _frot; ///< First rotation flag
+ bool _jempty; ///< Journal data files empty
+ u_int16_t _ffid; ///< First file id
+ std::size_t _fro; ///< First record offset in ffid
+ u_int16_t _lfid; ///< Last file id
+ std::size_t _eo; ///< End offset (first byte past last record)
+ u_int64_t _h_rid; ///< Highest rid found
+ bool _lffull; ///< Last file is full
+ bool _jfull; ///< Journal is full
std::vector<u_int16_t> _fid_list; ///< Fid-lid mapping - list of fids in order of lid
std::vector<u_int32_t> _enq_cnt_list; ///< Number enqueued records found for each file
rcvdat():
- _num_jfiles(0),
+ _njf(0),
+ _ae(false),
+ _aemjf(0),
_owi(false),
_frot(false),
_jempty(true),
@@ -77,9 +81,11 @@
_enq_cnt_list()
{}
- void reset(u_int16_t num_jfiles)
+ void reset(const u_int16_t num_jfiles, const bool auto_expand, const u_int16_t ae_max_jfiles)
{
- _num_jfiles = num_jfiles;
+ _njf = num_jfiles;
+ _ae = auto_expand;
+ _aemjf = ae_max_jfiles;
_owi=false;
_frot = false;
_jempty=true;
@@ -101,17 +107,19 @@
u_int16_t index = _ffid;
while (index != _lfid && _enq_cnt_list[index] == 0)
{
- if (++index >= _num_jfiles)
+ if (++index >= _njf)
index = 0;
}
return index;
}
- std::string to_string(std::string& jid)
+ std::string to_string(const std::string& jid)
{
std::ostringstream oss;
oss << "Recover file analysis (jid=\"" << jid << "\"):" << std::endl;
- oss << " Number of journal files (_num_jfiles) = " << _num_jfiles << std::endl;
+ oss << " Number of journal files (_njf) = " << _njf << std::endl;
+ oss << " Auto-expand mode (_ae) = " << (_ae ? "TRUE" : "FALSE") << std::endl;
+ if (_ae) oss << " Auto-expand mode max journal files (_aemjf) = " << _aemjf << std::endl;
oss << " Overwrite indicator (_owi) = " << (_owi ? "TRUE" : "FALSE") << std::endl;
oss << " First rotation (_frot) = " << (_frot ? "TRUE" : "FALSE") << std::endl;
oss << " Journal empty (_jempty) = " << (_jempty ? "TRUE" : "FALSE") << std::endl;
@@ -138,12 +146,14 @@
return oss.str();
}
- std::string to_log(std::string& jid)
+ std::string to_log(const std::string& jid)
{
std::ostringstream oss;
oss << "Recover file analysis (jid=\"" << jid << "\"):";
- oss << " njf=" << _num_jfiles;
- oss << " owi=" << (_owi ? "T" : "F");
+ oss << " njf=" << _njf;
+ oss << " ae=" << (_owi ? "T" : "F");
+ oss << " aemjf=" << _aemjf;
+ oss << " owi=" << (_ae ? "T" : "F");
oss << " frot=" << (_frot ? "T" : "F");
oss << " jempty=" << (_jempty ? "T" : "F");
oss << " ffid=" << _ffid;
Modified: store/trunk/cpp/lib/jrnl/rrfc.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rrfc.cpp 2008-10-17 17:28:47 UTC (rev 2648)
+++ store/trunk/cpp/lib/jrnl/rrfc.cpp 2008-10-17 17:51:24 UTC (rev 2649)
@@ -74,10 +74,10 @@
iores
rrfc::rotate()
{
- if (!_lfmp->size())
+ if (!_lfmp->num_jfiles())
throw jexception(jerrno::JERR__NINIT, "rrfc", "rotate");
u_int16_t next_fc_index = _fc_index + 1;
- if (next_fc_index == _lfmp->size())
+ if (next_fc_index == _lfmp->num_jfiles())
next_fc_index = 0;
fcntl* next_fc = _lfmp->get_fcntlp(next_fc_index);
_fc_index = next_fc_index;
Modified: store/trunk/cpp/lib/jrnl/wrfc.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wrfc.cpp 2008-10-17 17:28:47 UTC (rev 2648)
+++ store/trunk/cpp/lib/jrnl/wrfc.cpp 2008-10-17 17:51:24 UTC (rev 2649)
@@ -77,7 +77,7 @@
}
_fsize_sblks = fsize_sblks;
_fsize_dblks = fsize_sblks * JRNL_SBLK_SIZE;
- _enq_cap_offs_dblks = (u_int32_t)std::ceil(_fsize_dblks * _lfmp->size() * (100.0 - JRNL_ENQ_THRESHOLD) / 100);
+ _enq_cap_offs_dblks = (u_int32_t)std::ceil(_fsize_dblks * _lfmp->num_jfiles() * (100.0 - JRNL_ENQ_THRESHOLD) / 100);
// Check the offset is at least one file; if not, make it so
if (_enq_cap_offs_dblks < _fsize_dblks)
_enq_cap_offs_dblks = _fsize_dblks;
@@ -85,10 +85,10 @@
iores wrfc::rotate()
{
- if (!_lfmp->size())
+ if (!_lfmp->num_jfiles())
throw jexception(jerrno::JERR__NINIT, "wrfc", "rotate");
_fc_index++;
- if (_fc_index == _lfmp->size())
+ if (_fc_index == _lfmp->num_jfiles())
{
_fc_index = 0;
_owi = !_owi;
@@ -107,7 +107,7 @@
if (_frot)
return 0;
u_int16_t next_index = _fc_index + 1;
- if (next_index >= _lfmp->size())
+ if (next_index >= _lfmp->num_jfiles())
next_index = 0;
return next_index;
}
@@ -129,7 +129,7 @@
fwd_dblks -= fwd_dblks > _fsize_dblks ? _fsize_dblks : fwd_dblks;
if (fwd_dblks)
{
- if (++findex == _lfmp->size())
+ if (++findex == _lfmp->num_jfiles())
findex = 0;
fcp = _lfmp->get_fcntlp(findex);
}
Modified: store/trunk/cpp/tests/jrnl/_st_helper_fns.hpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_st_helper_fns.hpp 2008-10-17 17:28:47 UTC (rev 2648)
+++ store/trunk/cpp/tests/jrnl/_st_helper_fns.hpp 2008-10-17 17:51:24 UTC (rev 2649)
@@ -68,8 +68,10 @@
jcntl(jid, jdir, base_filename) {}
virtual ~test_jrnl() {}
void initialize(const u_int16_t num_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, 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,
@@ -226,6 +228,7 @@
const u_int16_t num_files = 1, // Number of files to insert
const bool adjust_lids = true) // Adjust lids following inserted files
{
+ if (num_files == 0) return;
_num_used_files += num_files;
const u_int16_t num_jfiles_before_append = _map.size();
lfmap_citr i = _map.find(after_lid);
@@ -375,9 +378,9 @@
* header (512 bytes each) and a single jinf file which contains the journal metadata required for recovery
* analysis.
*/
- void write_journal()
+ void write_journal(const bool ae, const u_int16_t ae_max_jfiles)
{
- create_jinf();
+ create_jinf(ae, ae_max_jfiles);
u_int16_t fid = 0;
for (lfmap_citr itr = _map.begin(); itr != _map.end(); itr++, fid++)
{
@@ -410,11 +413,11 @@
* Method create_new_jinf(): This static call creates a default jinf file only. This is used to test the read
* constructor of a jinf test object which reads a jinf file at instantiation.
*/
- static void create_new_jinf(const string jid, const string base_filename)
+ static void create_new_jinf(const string jid, const string base_filename, const bool ae)
{
if (jdir::exists(test_dir))
jdir::delete_dir(test_dir);
- create_jinf(NUM_JFILES, jid, base_filename);
+ create_jinf(NUM_JFILES, ae, (ae ? 5 * NUM_JFILES : 0), jid, base_filename);
}
/*
@@ -455,20 +458,21 @@
fh._ts_nsec = ts.tv_nsec;
}
- void create_jinf()
+ void create_jinf(const bool ae, const u_int16_t ae_max_jfiles)
{
if (jdir::exists(test_dir))
jdir::delete_dir(test_dir);
- create_jinf(_map.size(), _jid, _base_filename);
+ create_jinf(_map.size(), ae, ae_max_jfiles, _jid, _base_filename);
}
- static void create_jinf(u_int16_t num_files, const string jid, const string base_filename)
+ static void create_jinf(u_int16_t num_files, const bool ae, const u_int16_t ae_max_jfiles, const string jid,
+ const string base_filename)
{
jdir::create_dir(test_dir); // Check test dir exists; create it if not
timespec ts;
::clock_gettime(CLOCK_REALTIME, &ts);
- jinf ji(jid, test_dir, base_filename, num_files, JFSIZE_SBLKS, JRNL_WMGR_DEF_PAGE_SIZE, JRNL_WMGR_DEF_PAGES,
- ts);
+ jinf ji(jid, test_dir, base_filename, num_files, ae, ae_max_jfiles, JFSIZE_SBLKS, JRNL_WMGR_DEF_PAGE_SIZE,
+ JRNL_WMGR_DEF_PAGES, ts);
ji.write();
}
Modified: store/trunk/cpp/tests/jrnl/_ut_jdir.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_ut_jdir.cpp 2008-10-17 17:28:47 UTC (rev 2648)
+++ store/trunk/cpp/tests/jrnl/_ut_jdir.cpp 2008-10-17 17:51:24 UTC (rev 2649)
@@ -93,7 +93,7 @@
{
timespec ts;
::clock_gettime(CLOCK_REALTIME, &ts);
- jinf ji("test journal id", dirname, base_filename, NUM_JFILES, JFSIZE_SBLKS,
+ jinf ji("test journal id", dirname, base_filename, NUM_JFILES, false, 0, JFSIZE_SBLKS,
JRNL_WMGR_DEF_PAGE_SIZE, JRNL_WMGR_DEF_PAGES, ts);
ji.write();
}
Modified: store/trunk/cpp/tests/jrnl/_ut_jinf.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_ut_jinf.cpp 2008-10-17 17:28:47 UTC (rev 2648)
+++ store/trunk/cpp/tests/jrnl/_ut_jinf.cpp 2008-10-17 17:51:24 UTC (rev 2649)
@@ -52,7 +52,7 @@
const string base_filename = test_name + "_bfn";
jdir::create_dir(test_dir); // Check test dir exists; create it if not
::clock_gettime(CLOCK_REALTIME, &ts);
- jinf ji(jid, test_dir, base_filename, NUM_JFILES, JFSIZE_SBLKS, JRNL_WMGR_DEF_PAGE_SIZE, JRNL_WMGR_DEF_PAGES, ts);
+ jinf ji(jid, test_dir, base_filename, NUM_JFILES, false, 0, JFSIZE_SBLKS, JRNL_WMGR_DEF_PAGE_SIZE, JRNL_WMGR_DEF_PAGES, ts);
BOOST_CHECK_EQUAL(ji.jver(), RHM_JDAT_VERSION);
BOOST_CHECK(ji.jid().compare(jid) == 0);
BOOST_CHECK(ji.jdir().compare(test_dir) == 0);
@@ -61,6 +61,8 @@
BOOST_CHECK_EQUAL(this_ts.tv_sec, ts.tv_sec);
BOOST_CHECK_EQUAL(this_ts.tv_nsec, ts.tv_nsec);
BOOST_CHECK_EQUAL(ji.num_jfiles(), u_int16_t(NUM_JFILES));
+ BOOST_CHECK_EQUAL(ji.is_ae(), false);
+ BOOST_CHECK_EQUAL(ji.ae_max_jfiles(), u_int16_t(0));
BOOST_CHECK_EQUAL(ji.jfsize_sblks(), u_int32_t(JFSIZE_SBLKS));
BOOST_CHECK_EQUAL(ji.sblk_size_dblks(), u_int16_t(JRNL_SBLK_SIZE));
BOOST_CHECK_EQUAL(ji.dblk_size(), u_int32_t(JRNL_DBLK_SIZE));
@@ -77,7 +79,7 @@
string test_name = get_test_name(test_filename, "read_constructor");
const string jid = test_name + "_jid";
const string base_filename = test_name + "_bfn";
- lid_fid_map::create_new_jinf(jid, base_filename);
+ lid_fid_map::create_new_jinf(jid, base_filename, false);
stringstream fn;
fn << test_dir << "/" <<base_filename << "." << JRNL_INFO_EXTENSION;
@@ -90,6 +92,8 @@
// BOOST_CHECK_EQUAL(this_ts.tv_sec, ts.tv_sec);
// BOOST_CHECK_EQUAL(this_ts.tv_nsec, ts.tv_nsec);
BOOST_CHECK_EQUAL(ji.num_jfiles(), u_int16_t(NUM_JFILES));
+ BOOST_CHECK_EQUAL(ji.is_ae(), false);
+ BOOST_CHECK_EQUAL(ji.ae_max_jfiles(), u_int16_t(0));
BOOST_CHECK_EQUAL(ji.jfsize_sblks(), u_int32_t(JFSIZE_SBLKS));
BOOST_CHECK_EQUAL(ji.sblk_size_dblks(), u_int16_t(JRNL_SBLK_SIZE));
BOOST_CHECK_EQUAL(ji.dblk_size(), u_int32_t(JRNL_DBLK_SIZE));
@@ -106,7 +110,7 @@
string test_name = get_test_name(test_filename, "set_functions");
const string jid = test_name + "_jid";
const string base_filename = test_name + "_bfn";
- lid_fid_map::create_new_jinf(jid, base_filename);
+ lid_fid_map::create_new_jinf(jid, base_filename, false);
stringstream fn;
fn << test_dir << "/" << base_filename << "." << JRNL_INFO_EXTENSION;
@@ -130,7 +134,7 @@
string test_name = get_test_name(test_filename, "validate");
const string jid = test_name + "_jid";
const string base_filename = test_name + "_bfn";
- lid_fid_map::create_new_jinf(jid, base_filename);
+ lid_fid_map::create_new_jinf(jid, base_filename, false);
stringstream fn;
fn << test_dir << "/" << base_filename << "." << JRNL_INFO_EXTENSION;
@@ -150,7 +154,7 @@
lid_fid_map m(jid, base_filename);
m.journal_create(NUM_JFILES, 0, 0);
- m.write_journal();
+ m.write_journal(false, 0);
stringstream fn;
fn << test_dir << "/" << base_filename << "." << JRNL_INFO_EXTENSION;
@@ -175,7 +179,7 @@
for (u_int16_t num_files = 1; num_files < NUM_JFILES; num_files++)
{
m.journal_create(NUM_JFILES, num_files, 0);
- m.write_journal();
+ m.write_journal(false, 0);
stringstream fn;
fn << test_dir << "/" << base_filename << "." << JRNL_INFO_EXTENSION;
@@ -197,7 +201,7 @@
for (u_int16_t file_num = 0; file_num < NUM_JFILES; file_num++)
{
m.journal_create(NUM_JFILES, NUM_JFILES, file_num);
- m.write_journal();
+ m.write_journal(false, 0);
stringstream fn;
fn << test_dir << "/" << base_filename << "." << JRNL_INFO_EXTENSION;
@@ -222,7 +226,7 @@
{
m.journal_create(NUM_JFILES, NUM_JFILES, oldest_lid);
m.journal_insert(after_lid, num_files);
- m.write_journal();
+ m.write_journal(false, 0);
stringstream fn;
fn << test_dir << "/" << base_filename << "." << JRNL_INFO_EXTENSION;
@@ -253,7 +257,7 @@
const u_int16_t after_lid = u_int16_t(m.size() * ::drand48());
m.journal_insert(after_lid, num_files);
}
- m.write_journal();
+ m.write_journal(false, 0);
stringstream fn;
fn << test_dir << "/" << base_filename << "." << JRNL_INFO_EXTENSION;
@@ -293,7 +297,7 @@
const u_int16_t num_files = u_int16_t(1 + (NUM_JFILES * ::drand48()));
const u_int16_t after_lid = oldest_lid == 0 ? m.size() - 1 : oldest_lid - 1;
m.journal_insert(after_lid, num_files, false);
- m.write_journal();
+ m.write_journal(false, 0);
stringstream fn;
fn << test_dir << "/" << base_filename << "." << JRNL_INFO_EXTENSION;
Modified: store/trunk/cpp/tests/jrnl/_ut_lfmgr.cpp
===================================================================
--- store/trunk/cpp/tests/jrnl/_ut_lfmgr.cpp 2008-10-17 17:28:47 UTC (rev 2648)
+++ store/trunk/cpp/tests/jrnl/_ut_lfmgr.cpp 2008-10-17 17:51:24 UTC (rev 2649)
@@ -82,25 +82,271 @@
linear_vectors_equal(lm, fid_lid_size, res, false);
}
- static void rcvdat_init(rcvdat& rd, const u_int16_t num_jfiles, const u_int16_t fids[])
+ static void rcvdat_init(rcvdat& rd, const u_int16_t num_jfiles, const bool ae, const u_int16_t ae_max_jfiles,
+ const u_int16_t fids[])
{
- rd.reset(num_jfiles);
+ rd.reset(num_jfiles, ae, ae_max_jfiles);
load_vector(fids, num_jfiles, rd._fid_list);
rd._jempty = false;
rd._lfid = fids[num_jfiles - 1];
rd._eo = 100 * JRNL_DBLK_SIZE * JRNL_SBLK_SIZE;
}
- static void rcvdat_init(rcvdat& rd, const flist& fidl)
+ static void rcvdat_init(rcvdat& rd, const flist& fidl, const bool ae, const u_int16_t ae_max_jfiles)
{
const u_int16_t num_jfiles = fidl.size();
- rd.reset(num_jfiles);
+ rd.reset(num_jfiles, ae, ae_max_jfiles);
load_vector(fidl, rd._fid_list);
rd._jempty = false;
rd._lfid = fidl[num_jfiles - 1];
rd._eo = 100 * JRNL_DBLK_SIZE * JRNL_SBLK_SIZE;
}
+ static void initialize(lfmgr& lm, test_jrnl& jc, const u_int16_t num_jfiles, const bool ae,
+ const u_int16_t ae_max_jfiles)
+ {
+ lm.initialize(num_jfiles, ae, ae_max_jfiles, &jc, &jc.new_fcntl);
+ BOOST_CHECK_EQUAL(lm.is_init(), true);
+ BOOST_CHECK_EQUAL(lm.is_ae(), ae);
+ BOOST_CHECK_EQUAL(lm.ae_max_jfiles(), ae_max_jfiles);
+ BOOST_CHECK_EQUAL(lm.num_jfiles(), num_jfiles);
+ if (num_jfiles)
+ check_linear_fids_lids(lm, num_jfiles);
+ else
+ BOOST_CHECK_EQUAL(lm.get_fcntlp(0), (void*)0);
+ }
+
+ // version which sets up the lid_fid_map for later manipulation by insert tests
+ static void initialize(lid_fid_map& lfm, lfmgr& lm, test_jrnl& jc, const u_int16_t num_jfiles, const bool ae,
+ const u_int16_t ae_max_jfiles)
+ {
+ lfm.journal_create(num_jfiles, num_jfiles);
+ initialize(lm, jc, num_jfiles, ae, ae_max_jfiles);
+ }
+
+ static void prepare_recover(lid_fid_map& lfm, const u_int16_t size)
+ {
+ if (size < 4) BOOST_FAIL("prepare_recover(): size parameter (" << size << ") too small.");
+ lfm.journal_create(4, 4); // initial journal of size 4
+ u_int16_t s = 4; // cumulative size
+ while (s < size)
+ {
+ const u_int16_t ins_posn = u_int16_t(s * ::drand48()); // this insert posn
+ if (3.0 * ::drand48() > 1.0 || size - s < 2) // 2:1 chance of single insert when >= 2 still to insert
+ {
+ lfm.journal_insert(ins_posn); // single insert
+ s++;
+ }
+ else
+ {
+ // multiple insert, either 2 - 5
+ const u_int16_t max_ins_size = size - s >5 ? 5 : size - s;
+ const u_int16_t ins_size = 2 + u_int16_t((max_ins_size - 2) * ::drand48()); // this insert size
+ lfm.journal_insert(ins_posn, ins_size);
+ s += ins_size;
+ }
+ }
+ }
+
+ static void recover(lid_fid_map& lfm, lfmgr& lm, test_jrnl& jc, const bool ae, const u_int16_t ae_max_jfiles)
+ {
+ flist fidl;
+ flist lidl;
+ rcvdat rd;
+ const u_int16_t num_jfiles = lfm.size();
+
+ lfm.get_fid_list(fidl);
+ lfm.get_lid_list(lidl);
+ lfm.write_journal(ae, ae_max_jfiles);
+
+ lfmgr_test_helper::rcvdat_init(rd, fidl, ae, ae_max_jfiles);
+ lm.recover(rd, &jc, &jc.new_fcntl);
+ BOOST_CHECK_EQUAL(lm.is_init(), true);
+ BOOST_CHECK_EQUAL(lm.is_ae(), ae);
+ BOOST_CHECK_EQUAL(lm.ae_max_jfiles(), ae_max_jfiles);
+ BOOST_CHECK_EQUAL(lm.num_jfiles(), num_jfiles);
+ if (num_jfiles)
+ check_fids_lids(lm, fidl, lidl);
+ else
+ BOOST_CHECK_EQUAL(lm.get_fcntlp(0), (void*)0);
+ }
+
+ static void finalize(lfmgr& lm)
+ {
+ lm.finalize();
+ BOOST_CHECK_EQUAL(lm.is_init(), false);
+ BOOST_CHECK_EQUAL(lm.is_ae(), false);
+ BOOST_CHECK_EQUAL(lm.ae_max_jfiles(), u_int16_t(0));
+ BOOST_CHECK_EQUAL(lm.num_jfiles(), u_int16_t(0));
+ BOOST_CHECK_EQUAL(lm.get_fcntlp(0), (void*)0);
+ vector<u_int16_t> res;
+ lm.get_fid_list(res);
+ BOOST_CHECK_EQUAL(res.size(), u_int16_t(0));
+ lm.get_lid_list(res);
+ BOOST_CHECK_EQUAL(res.size(), u_int16_t(0));
+ }
+
+ static void insert(lid_fid_map& lfm, lfmgr& lm, test_jrnl& jc, const u_int16_t after_lid, const u_int16_t incr = 1)
+ {
+ flist fidl;
+ flist lidl;
+ const u_int16_t num_jfiles = lm.num_jfiles();
+ lfm.journal_insert(after_lid, incr);
+ lfm.get_fid_list(fidl);
+ lfm.get_lid_list(lidl);
+ lm.insert(after_lid, &jc, &jc.new_fcntl, incr);
+ BOOST_CHECK_EQUAL(lm.num_jfiles(), num_jfiles + incr);
+ lfmgr_test_helper::check_fids_lids(lm, fidl, lidl);
+ }
+
+ static void check_ae_max_jfiles(lfmgr& lm, const u_int16_t num_jfiles, const u_int16_t ae_max_jfiles)
+ {
+ bool legal = ae_max_jfiles > num_jfiles || ae_max_jfiles == 0;
+
+ lm.set_ae(false);
+ BOOST_CHECK(!lm.is_ae());
+ if (legal)
+ {
+ lm.set_ae_max_jfiles(ae_max_jfiles);
+ BOOST_CHECK_EQUAL(lm.ae_max_jfiles(), ae_max_jfiles);
+ lm.set_ae(true);
+ BOOST_CHECK(lm.is_ae());
+ BOOST_CHECK_EQUAL(lm.ae_jfiles_rem(), ae_max_jfiles
+ ? ae_max_jfiles - num_jfiles
+ : JRNL_MAX_NUM_FILES - num_jfiles);
+ }
+ else
+ {
+ lm.set_ae_max_jfiles(ae_max_jfiles);
+ BOOST_CHECK_EQUAL(lm.ae_max_jfiles(), ae_max_jfiles);
+ try
+ {
+ lm.set_ae(true); // should raise exception
+ BOOST_ERROR("Auto-expand enabled with out-of-range ae_max_jfiles");
+ }
+ catch (const jexception& e) { BOOST_CHECK_EQUAL(e.err_code(), jerrno::JERR_LFMGR_BADAEFNUMLIM); }
+ BOOST_CHECK(!lm.is_ae());
+ BOOST_CHECK_EQUAL(lm.ae_jfiles_rem(), 0);
+ }
+ BOOST_CHECK_EQUAL(lm.ae_max_jfiles(), ae_max_jfiles);
+ }
+
+ static void check_multiple_initialization_recover(lid_fid_map& lfm, test_jrnl& jc,
+ const u_int16_t num_jfiles_arr[][2], const bool init_flag_0, const bool finalize_flag,
+ const bool init_flag_1)
+ {
+ unsigned i_njf = 0;
+ while (num_jfiles_arr[i_njf][0] && num_jfiles_arr[i_njf][1])
+ {
+ for (unsigned i1_njf = 0; i1_njf <= 1; i1_njf++)
+ {
+ const u_int16_t num_jfiles_0 = num_jfiles_arr[i_njf][i1_njf == 0];
+ const u_int16_t num_jfiles_1 = num_jfiles_arr[i_njf][i1_njf != 0];
+
+ for (unsigned i_ae = 0; i_ae < 4; i_ae++)
+ {
+ const bool ae_0 = i_ae & 0x1;
+ const bool ae_1 = i_ae & 0x2;
+ for (unsigned i_aemjf = 0; i_aemjf < 4; i_aemjf++)
+ {
+ const u_int16_t ae_max_jfiles_0 = i_aemjf & 0x1 ? 3 * num_jfiles_0 : 0;
+ const u_int16_t ae_max_jfiles_1 = i_aemjf & 0x2 ? 4 * num_jfiles_1 : 0;
+
+ lfmgr lm;
+
+ if (init_flag_0)
+ initialize(lm, jc, num_jfiles_0, ae_0, ae_max_jfiles_0);
+ else
+ {
+ prepare_recover(lfm, num_jfiles_0);
+ recover(lfm, lm, jc, ae_1, ae_max_jfiles_0);
+ lfm.destroy_journal();
+ }
+
+ if (finalize_flag) finalize(lm);
+
+ if (init_flag_1)
+ initialize(lm, jc, num_jfiles_1, ae_1, ae_max_jfiles_1);
+ else
+ {
+ prepare_recover(lfm, num_jfiles_1);
+ recover(lfm, lm, jc, ae_1, ae_max_jfiles_1);
+ lfm.destroy_journal();
+ }
+ }
+ }
+ }
+ i_njf++;
+ }
+ }
+
+ static void check_insert(lid_fid_map& lfm, lfmgr& lm, test_jrnl& jc, const u_int16_t after_lid,
+ const u_int16_t incr = 1)
+ {
+ const u_int16_t num_jfiles = lm.num_jfiles();
+ const u_int16_t ae_max_jfiles = lm.ae_max_jfiles();
+ const u_int16_t effective_ae_max_jfiles = ae_max_jfiles ? ae_max_jfiles : JRNL_MAX_NUM_FILES;
+ BOOST_CHECK_EQUAL(lm.ae_jfiles_rem(), effective_ae_max_jfiles - num_jfiles);
+ bool legal = lm.is_ae() && num_jfiles + incr <= effective_ae_max_jfiles;
+ if (legal)
+ {
+ insert(lfm, lm, jc, after_lid, incr);
+ BOOST_CHECK_EQUAL(lm.num_jfiles(), num_jfiles + incr);
+ BOOST_CHECK_EQUAL(lm.ae_jfiles_rem(), effective_ae_max_jfiles - num_jfiles - incr);
+ }
+ else
+ {
+ try
+ {
+ insert(lfm, lm, jc, after_lid, incr);
+ if (lm.is_ae())
+ BOOST_ERROR("lfmgr::insert() succeeded and exceeded limit");
+ else
+ BOOST_ERROR("lfmgr::insert() succeeded with auto-expand disabled");
+ }
+ catch (const jexception& e)
+ {
+ if (lm.is_ae())
+ BOOST_CHECK_EQUAL(e.err_code(), jerrno::JERR_LFMGR_AEFNUMLIMIT);
+ else
+ BOOST_CHECK_EQUAL(e.err_code(), jerrno::JERR_LFMGR_AEDISABLED);
+ }
+ BOOST_CHECK_EQUAL(lm.num_jfiles(), num_jfiles);
+ BOOST_CHECK_EQUAL(lm.ae_jfiles_rem(), effective_ae_max_jfiles - num_jfiles);
+ }
+ }
+
+ static void check_limit(lid_fid_map& lfm, test_jrnl& jc, const bool ae, const u_int16_t num_jfiles,
+ const u_int16_t ae_max_jfiles)
+ {
+ lfmgr lm;
+
+ for (unsigned i = 0; i < 2; i++)
+ {
+ if (i)
+ initialize(lfm, lm, jc, num_jfiles, ae, ae_max_jfiles);
+ else
+ {
+ prepare_recover(lfm, num_jfiles);
+ recover(lfm, lm, jc, ae, ae_max_jfiles);
+ }
+
+ // use up all available files
+ unsigned j = ae_max_jfiles ? ae_max_jfiles : JRNL_MAX_NUM_FILES;
+ while (ae && j > num_jfiles)
+ {
+ const u_int16_t posn = (lm.num_jfiles() - 1) * ::drand48();
+ const u_int16_t incr = 1 + (lm.ae_jfiles_rem() > 4 ? 3 : lm.ae_jfiles_rem() - 1) * ::drand48();
+ check_insert(lfm, lm, jc, posn, incr);
+ j -= incr;
+ }
+ // these should be over the limit or illegal
+ check_insert(lfm, lm, jc, 0);
+ check_insert(lfm, lm, jc, 2, 2);
+ lfm.destroy_journal();
+ }
+ }
+
private:
static void load_vector(const u_int16_t a[], const size_t n, flist& v)
{
@@ -164,7 +410,9 @@
{
lfmgr lm;
BOOST_CHECK_EQUAL(lm.is_init(), false);
- BOOST_CHECK_EQUAL(lm.size(), size_t(0));
+ BOOST_CHECK_EQUAL(lm.is_ae(), false);
+ BOOST_CHECK_EQUAL(lm.ae_max_jfiles(), u_int16_t(0));
+ BOOST_CHECK_EQUAL(lm.num_jfiles(), u_int16_t(0));
BOOST_CHECK_EQUAL(lm.get_fcntlp(0), (void*)0);
}
catch(const exception& e) { BOOST_FAIL(e.what()); }
@@ -177,15 +425,23 @@
QPID_AUTO_TEST_CASE(initialize)
{
string test_name = get_test_name(test_filename, "initialize");
- u_int16_t num_jfiles = 8;
+ const u_int16_t num_jfiles = 8;
try
{
+ jdir::create_dir(test_dir); // Check test dir exists; create it if not
test_jrnl jc(test_name, test_dir, test_name);
- lfmgr lm;
-
- lm.initialize(num_jfiles, &jc, &jc.new_fcntl);
- BOOST_CHECK_EQUAL(lm.is_init(), true);
- lfmgr_test_helper::check_linear_fids_lids(lm, num_jfiles);
+ {
+ lfmgr lm;
+ lfmgr_test_helper::initialize(lm, jc, num_jfiles, false, 0);
+ }
+ {
+ lfmgr lm;
+ lfmgr_test_helper::initialize(lm, jc, num_jfiles, true, 0);
+ }
+ {
+ lfmgr lm;
+ lfmgr_test_helper::initialize(lm, jc, num_jfiles, true, 5 * num_jfiles);
+ }
}
catch(const exception& e) { BOOST_FAIL(e.what()); }
cout << "done" << endl;
@@ -197,26 +453,30 @@
QPID_AUTO_TEST_CASE(recover)
{
string test_name = get_test_name(test_filename, "recover");
- lid_fid_map lfm(test_name, test_name);
- flist fidl;
- flist lidl;
- rcvdat rd;
+ ::srand48(1); // init random gen for repeatable tests when using lfmgr_test_helper::prepare_recover()
try
{
test_jrnl jc(test_name, test_dir, test_name);
- lfmgr lm;
+ lid_fid_map lfm(test_name, test_name);
- lfm.journal_create(4, 4);
- lfm.journal_insert(0);
- lfm.journal_insert(2, 2);
- lfm.journal_insert(6);
- lfm.get_fid_list(fidl);
- lfm.get_lid_list(lidl);
- lfm.write_journal();
- lfmgr_test_helper::rcvdat_init(rd, fidl);
- lm.recover(rd, &jc, &jc.new_fcntl);
- BOOST_CHECK_EQUAL(lm.is_init(), true);
- lfmgr_test_helper::check_fids_lids(lm, fidl, lidl);
+ {
+ lfmgr lm;
+ lfmgr_test_helper::prepare_recover(lfm, 8);
+ lfmgr_test_helper::recover(lfm, lm, jc, false, 0);
+ lfm.destroy_journal();
+ }
+ {
+ lfmgr lm;
+ lfmgr_test_helper::prepare_recover(lfm, 8);
+ lfmgr_test_helper::recover(lfm, lm, jc, true, 0);
+ lfm.destroy_journal();
+ }
+ {
+ lfmgr lm;
+ lfmgr_test_helper::prepare_recover(lfm, 8);
+ lfmgr_test_helper::recover(lfm, lm, jc, true, 5 * lfm.size());
+ lfm.destroy_journal();
+ }
}
catch(const exception& e) { BOOST_FAIL(e.what()); }
cout << "done" << endl;
@@ -228,24 +488,26 @@
QPID_AUTO_TEST_CASE(initialize_finalize)
{
string test_name = get_test_name(test_filename, "initialize_finalize");
- u_int16_t num_jfiles = 8;
+ const u_int16_t num_jfiles = 8;
try
{
+ jdir::create_dir(test_dir); // Check test dir exists; create it if not
test_jrnl jc(test_name, test_dir, test_name);
- lfmgr lm;
- lm.initialize(num_jfiles, &jc, &jc.new_fcntl);
- BOOST_CHECK_EQUAL(lm.is_init(), true);
- lfmgr_test_helper::check_linear_fids_lids(lm, num_jfiles);
-
- lm.finalize();
- BOOST_CHECK_EQUAL(lm.is_init(), false);
- BOOST_CHECK_EQUAL(lm.size(), size_t(0));
- BOOST_CHECK_EQUAL(lm.get_fcntlp(0), (void*)0);
- vector<u_int16_t> res;
- lm.get_fid_list(res);
- BOOST_CHECK_EQUAL(res.size(), size_t(0));
- lm.get_lid_list(res);
- BOOST_CHECK_EQUAL(res.size(), size_t(0));
+ {
+ lfmgr lm;
+ lfmgr_test_helper::initialize(lm, jc, num_jfiles, false, 0);
+ lfmgr_test_helper::finalize(lm);
+ }
+ {
+ lfmgr lm;
+ lfmgr_test_helper::initialize(lm, jc, num_jfiles, true, 0);
+ lfmgr_test_helper::finalize(lm);
+ }
+ {
+ lfmgr lm;
+ lfmgr_test_helper::initialize(lm, jc, num_jfiles, true, 5 * num_jfiles);
+ lfmgr_test_helper::finalize(lm);
+ }
}
catch(const exception& e) { BOOST_FAIL(e.what()); }
cout << "done" << endl;
@@ -257,517 +519,246 @@
QPID_AUTO_TEST_CASE(recover_finalize)
{
string test_name = get_test_name(test_filename, "recover_finalize");
- lid_fid_map lfm(test_name, test_name);
- flist fidl;
- flist lidl;
- rcvdat rd;
+ const u_int16_t num_jfiles = 8;
+ ::srand48(1); // init random gen for repeatable tests when using lfmgr_test_helper::prepare_recover()
try
{
test_jrnl jc(test_name, test_dir, test_name);
- lfmgr lm;
+ lid_fid_map lfm(test_name, test_name);
- lfm.journal_create(4, 4);
- lfm.journal_insert(0);
- lfm.journal_insert(2, 2);
- lfm.journal_insert(6);
- lfm.get_fid_list(fidl);
- lfm.get_lid_list(lidl);
- lfm.write_journal();
- lfmgr_test_helper::rcvdat_init(rd, fidl);
- lm.recover(rd, &jc, &jc.new_fcntl);
- BOOST_CHECK_EQUAL(lm.is_init(), true);
- lfmgr_test_helper::check_fids_lids(lm, fidl, lidl);
-
- lm.finalize();
- BOOST_CHECK_EQUAL(lm.is_init(), false);
- BOOST_CHECK_EQUAL(lm.size(), size_t(0));
- BOOST_CHECK_EQUAL(lm.get_fcntlp(0), (void*)0);
- vector<u_int16_t> res;
- lm.get_fid_list(res);
- BOOST_CHECK_EQUAL(res.size(), size_t(0));
- lm.get_lid_list(res);
- BOOST_CHECK_EQUAL(res.size(), size_t(0));
+ {
+ lfmgr lm;
+ lfmgr_test_helper::prepare_recover(lfm, num_jfiles);
+ lfmgr_test_helper::recover(lfm, lm, jc, false, 0);
+ lfmgr_test_helper::finalize(lm);
+ lfm.destroy_journal();
+ }
+ {
+ lfmgr lm;
+ lfmgr_test_helper::prepare_recover(lfm, num_jfiles);
+ lfmgr_test_helper::recover(lfm, lm, jc, true, 0);
+ lfmgr_test_helper::finalize(lm);
+ lfm.destroy_journal();
+ }
+ {
+ lfmgr lm;
+ lfmgr_test_helper::prepare_recover(lfm, num_jfiles);
+ lfmgr_test_helper::recover(lfm, lm, jc, true, 5 * lfm.size());
+ lfmgr_test_helper::finalize(lm);
+ lfm.destroy_journal();
+ }
}
catch(const exception& e) { BOOST_FAIL(e.what()); }
cout << "done" << endl;
}
/*
-* Check that initialize() correctly creates an ordered fid array _fcntl_arr after the lfmgr instance has been
-* initialized and finalized.
+* Check that 0 and/or null and other extreme/boundary parameters behave as expected.
*/
-QPID_AUTO_TEST_CASE(initialize_finalize_initialize)
+QPID_AUTO_TEST_CASE(zero_null_params)
{
- string test_name = get_test_name(test_filename, "initialize_finalize_initialize");
- u_int16_t num_jfiles0 = 8;
- u_int16_t num_jfiles1 = 12;
+ string test_name = get_test_name(test_filename, "zero_null_params");
+ const u_int16_t num_jfiles = 8;
try
{
test_jrnl jc(test_name, test_dir, test_name);
+ lid_fid_map lfm(test_name, test_name);
lfmgr lm;
+ lfmgr_test_helper::initialize(lfm, lm, jc, num_jfiles, true, 0);
- lm.initialize(num_jfiles0, &jc, &jc.new_fcntl);
- BOOST_CHECK_EQUAL(lm.is_init(), true);
- lfmgr_test_helper::check_linear_fids_lids(lm, num_jfiles0);
-
- lm.finalize();
- BOOST_CHECK_EQUAL(lm.is_init(), false);
-
- lm.initialize(num_jfiles1, &jc, &jc.new_fcntl);
- BOOST_CHECK_EQUAL(lm.is_init(), true);
- lfmgr_test_helper::check_linear_fids_lids(lm, num_jfiles1);
+ // Check that inserting 0 files works ok
+ lfmgr_test_helper::insert(lfm, lm, jc, 0, 0);
+ lfmgr_test_helper::insert(lfm, lm, jc, 2, 0);
+ lfmgr_test_helper::insert(lfm, lm, jc, num_jfiles - 1, 0);
}
catch(const exception& e) { BOOST_FAIL(e.what()); }
cout << "done" << endl;
}
/*
-* Check that recover() correctly sets up the specified fid list order after the lfmgr instance has been initialized
-* and finalized.
+* Check that initialize()/recover() works correctly after a previous initialize()/recover() with/without an intervening
+* finalize().
*/
-QPID_AUTO_TEST_CASE(initialize_finalize_recover)
+QPID_AUTO_TEST_CASE(multiple_initialization_recover)
{
- string test_name = get_test_name(test_filename, "initialize_finalize_recover");
- u_int16_t num_jfiles = 8;
- lid_fid_map lfm(test_name, test_name);
- flist fidl;
- flist lidl;
- rcvdat rd;
- try
- {
- test_jrnl jc(test_name, test_dir, test_name);
- lfmgr lm;
+ string test_name = get_test_name(test_filename, "multiple_initialization_recover");
+ ::srand48(1); // init random gen for repeatable tests when using lfmgr_test_helper::prepare_recover()
- lm.initialize(num_jfiles, &jc, &jc.new_fcntl);
- BOOST_CHECK_EQUAL(lm.is_init(), true);
- lfmgr_test_helper::check_linear_fids_lids(lm, num_jfiles);
-
- lm.finalize();
- BOOST_CHECK_EQUAL(lm.is_init(), false);
-
- lfm.journal_create(4, 4);
- lfm.journal_insert(0);
- lfm.journal_insert(2, 2);
- lfm.journal_insert(6);
- lfm.journal_insert(7);
- lfm.journal_insert(8, 3);
- lfm.get_fid_list(fidl);
- lfm.get_lid_list(lidl);
- lfm.write_journal();
- lfmgr_test_helper::rcvdat_init(rd, fidl);
- lm.recover(rd, &jc, &jc.new_fcntl);
- BOOST_CHECK_EQUAL(lm.is_init(), true);
- lfmgr_test_helper::check_fids_lids(lm, fidl, lidl);
- }
- catch(const exception& e) { BOOST_FAIL(e.what()); }
- cout << "done" << endl;
-}
-
-/*
-* Check that initialize() correctly creates an ordered fid array _fcntl_arr after the lfmgr instance has been recovered
-* and finalized.
-*/
-QPID_AUTO_TEST_CASE(recover_finalize_initialize)
-{
- string test_name = get_test_name(test_filename, "recover_finalize_initialize");
- lid_fid_map lfm(test_name, test_name);
- flist fidl;
- flist lidl;
- rcvdat rd;
- u_int16_t num_jfiles = 12;
+ // Set combinations of value pairs to be used for number of journal files in first and second init
+ u_int16_t num_jfiles_arr[][2] = {{8, 12}, {4, 7}, {0, 0}}; // end with zeros
try
{
test_jrnl jc(test_name, test_dir, test_name);
- lfmgr lm;
-
- lfm.journal_create(4, 4);
- lfm.journal_insert(0);
- lfm.journal_insert(2, 2);
- lfm.journal_insert(6);
- lfm.get_fid_list(fidl);
- lfm.get_lid_list(lidl);
- lfm.write_journal();
- lfmgr_test_helper::rcvdat_init(rd, fidl);
- lm.recover(rd, &jc, &jc.new_fcntl);
- BOOST_CHECK_EQUAL(lm.is_init(), true);
- lfmgr_test_helper::check_fids_lids(lm, fidl, lidl);
-
- lm.finalize();
- BOOST_CHECK_EQUAL(lm.is_init(), false);
-
- lm.initialize(num_jfiles, &jc, &jc.new_fcntl);
- BOOST_CHECK_EQUAL(lm.is_init(), true);
- lfmgr_test_helper::check_linear_fids_lids(lm, num_jfiles);
+ lid_fid_map lfm(test_name, test_name);
+ for (unsigned p = 0; p < 8; p++)
+ {
+ const bool i_0 = p & 0x01; // first bit
+ const bool i_1 = p & 0x02; // second bit
+ const bool f = p & 0x04; // third bit
+ lfmgr_test_helper::check_multiple_initialization_recover(lfm, jc, num_jfiles_arr, i_0,f, i_1);
+ }
}
catch(const exception& e) { BOOST_FAIL(e.what()); }
cout << "done" << endl;
}
/*
-* Check that recover() correctly sets up the specified fid list order after the lfmgr instance has been recovered and
-* finalized.
+* Check that insert() works correctly after initialize() and shifts the fid sequence beyond the insert point correctly:
+*
+* The following sequence is tested:
+* initialize 4 fids=[0,1,2,3] lids=[0,1,2,3]
+* insert 1 after lid 0 fids=[0,4,1,2,3] lids=[0,2,3,4,1]
+* insert 2 after lid 2 fids=[0,4,1,5,6,2,3] lids=[0,2,5,6,1,3,4]
+* insert 1 after lid 6 fids=[0,4,1,5,6,2,3,7] lids=[0,2,5,6,1,3,4,7]
+* issert 1 after lid 3 fids=[0,4,1,5,8,6,2,3,7] lids=[0,2,6,7,1,3,5,8,4]
*/
-QPID_AUTO_TEST_CASE(recover_finalize_recover)
+QPID_AUTO_TEST_CASE(initialize_insert)
{
- string test_name = get_test_name(test_filename, "recover_finalize_recover");
- lid_fid_map lfm(test_name, test_name);
- flist fidl;
- flist lidl;
- rcvdat rd;
+ string test_name = get_test_name(test_filename, "initialize_insert");
+ const u_int16_t initial_num_jfiles = 8;
try
{
+ jdir::create_dir(test_dir); // Check test dir exists; create it if not
test_jrnl jc(test_name, test_dir, test_name);
+ lid_fid_map lfm(test_name, test_name);
lfmgr lm;
+ lfmgr_test_helper::initialize(lfm, lm, jc, initial_num_jfiles, true, 0);
- lfm.journal_create(4, 4);
- lfm.journal_insert(0);
- lfm.journal_insert(2, 2);
- lfm.journal_insert(6);
- lfm.get_fid_list(fidl);
- lfm.get_lid_list(lidl);
- lfm.write_journal();
- lfmgr_test_helper::rcvdat_init(rd, fidl);
- lm.recover(rd, &jc, &jc.new_fcntl);
- BOOST_CHECK_EQUAL(lm.is_init(), true);
- lfmgr_test_helper::check_fids_lids(lm, fidl, lidl);
-
- lm.finalize();
- BOOST_CHECK_EQUAL(lm.is_init(), false);
-
- lfm.journal_insert(3);
- lfm.journal_insert(8, 3);
- lfm.get_fid_list(fidl);
- lfm.get_lid_list(lidl);
- lfm.write_journal();
- lfmgr_test_helper::rcvdat_init(rd, fidl);
-
- lm.recover(rd, &jc, &jc.new_fcntl);
- BOOST_CHECK_EQUAL(lm.is_init(), true);
- lfmgr_test_helper::check_fids_lids(lm, fidl, lidl);
+ lfmgr_test_helper::insert(lfm, lm, jc, 0);
+ lfmgr_test_helper::insert(lfm, lm, jc, 2, 2);
+ lfmgr_test_helper::insert(lfm, lm, jc, 6);
+ lfmgr_test_helper::insert(lfm, lm, jc, 3);
}
catch(const exception& e) { BOOST_FAIL(e.what()); }
cout << "done" << endl;
}
/*
-* Check that a second call to initialize() without calling finilize() correctly clears the first initialize and
-* correctly creates an ordered fid array of the correct size _fcntl_arr.
+* Check that insert() works correctly after recover() and shifts the fid sequence beyond the insert point correctly:
+*
+* The following sequence is tested:
+* recover 4 fids=[0,2,3,1] lids=[0,3,1,2]
+* insert 1 after lid 0 fids=[0,4,2,3,1] lids=[0,4,2,3,1]
+* insert 2 after lid 2 fids=[0,4,2,5,6,3,1] lids=[0,6,2,5,1,3,4]
+* insert 1 after lid 6 fids=[0,4,2,5,6,3,1,7] lids=[0,6,2,5,1,3,4,7]
+* issert 1 after lid 3 fids=[0,4,2,5,8,6,3,1,7] lids=[0,7,2,6,1,3,5,8,4]
*/
-QPID_AUTO_TEST_CASE(initialize_initialize)
+QPID_AUTO_TEST_CASE(recover_insert)
{
- string test_name = get_test_name(test_filename, "initialize_initialize");
- u_int16_t num_jfiles0 = 8;
- u_int16_t num_jfiles1 = 12;
+ string test_name = get_test_name(test_filename, "recover_insert");
+ const u_int16_t initial_num_jfiles = 4;
+ ::srand48(1); // init random gen for repeatable tests when using lfmgr_test_helper::prepare_recover()
try
{
+ jdir::create_dir(test_dir); // Check test dir exists; create it if not
test_jrnl jc(test_name, test_dir, test_name);
+ lid_fid_map lfm(test_name, test_name);
lfmgr lm;
+ lfmgr_test_helper::prepare_recover(lfm, initial_num_jfiles);
+ lfmgr_test_helper::recover(lfm, lm, jc, true, 0);
- lm.initialize(num_jfiles0, &jc, &jc.new_fcntl);
- BOOST_CHECK_EQUAL(lm.is_init(), true);
- lfmgr_test_helper::check_linear_fids_lids(lm, num_jfiles0);
-
- lm.initialize(num_jfiles1, &jc, &jc.new_fcntl);
- BOOST_CHECK_EQUAL(lm.is_init(), true);
- lfmgr_test_helper::check_linear_fids_lids(lm, num_jfiles1);
+ lfmgr_test_helper::insert(lfm, lm, jc, 0);
+ lfmgr_test_helper::insert(lfm, lm, jc, 2, 2);
+ lfmgr_test_helper::insert(lfm, lm, jc, 6);
+ lfmgr_test_helper::insert(lfm, lm, jc, 3);
}
catch(const exception& e) { BOOST_FAIL(e.what()); }
cout << "done" << endl;
}
/*
-* Check that a call to recover() after initialize() without calling finilize() correctly clears the first initialize and
-* correctly sets up the specified fid list order.
+* Check that illegal ae parameter combinations are caught and result in an exception being thrown.
*/
-QPID_AUTO_TEST_CASE(initialize_recover)
+QPID_AUTO_TEST_CASE(ae_parameters)
{
- string test_name = get_test_name(test_filename, "initialize_recover");
- u_int16_t num_jfiles = 8;
- lid_fid_map lfm(test_name, test_name);
- flist fidl;
- flist lidl;
- rcvdat rd;
+ string test_name = get_test_name(test_filename, "ae_parameters");
+ ::srand48(1); // init random gen for repeatable tests when using lfmgr_test_helper::prepare_recover()
try
{
+ jdir::create_dir(test_dir); // Check test dir exists; create it if not
test_jrnl jc(test_name, test_dir, test_name);
+ lid_fid_map lfm(test_name, test_name);
+ const u_int16_t num_jfiles = 8;
lfmgr lm;
+
+ for (unsigned i = 0; i < 2; i++)
+ {
+ if (i)
+ lfmgr_test_helper::initialize(lfm, lm, jc, num_jfiles, false, 0);
+ else
+ {
+ lfmgr_test_helper::prepare_recover(lfm, num_jfiles);
+ lfmgr_test_helper::recover(lfm, lm, jc, false, 0);
+ }
- lm.initialize(num_jfiles, &jc, &jc.new_fcntl);
- BOOST_CHECK_EQUAL(lm.is_init(), true);
- lfmgr_test_helper::check_linear_fids_lids(lm, num_jfiles);
-
- lfm.journal_create(4, 4);
- lfm.journal_insert(0);
- lfm.journal_insert(2, 2);
- lfm.journal_insert(6);
- lfm.journal_insert(7);
- lfm.journal_insert(8, 3);
- lfm.get_fid_list(fidl);
- lfm.get_lid_list(lidl);
- lfm.write_journal();
- lfmgr_test_helper::rcvdat_init(rd, fidl);
- lm.recover(rd, &jc, &jc.new_fcntl);
- BOOST_CHECK_EQUAL(lm.is_init(), true);
- lfmgr_test_helper::check_fids_lids(lm, fidl, lidl);
+ lfmgr_test_helper::check_ae_max_jfiles(lm, num_jfiles, num_jfiles - 2);
+ lfmgr_test_helper::check_ae_max_jfiles(lm, num_jfiles, 0);
+ lfmgr_test_helper::check_ae_max_jfiles(lm, num_jfiles, 2 * num_jfiles);
+ lfmgr_test_helper::check_ae_max_jfiles(lm, num_jfiles, num_jfiles);
+ lfm.destroy_journal();
+ }
}
catch(const exception& e) { BOOST_FAIL(e.what()); }
cout << "done" << endl;
}
/*
-* Check that a call to initialize() after recover() without calling finilize() correctly clears the first recover and
-* correctly creates an ordered fid array of the correct size _fcntl_arr.
+* Check that initialized or recovered journals with auto-expand disabled will not allow either inserts or appends.
*/
-QPID_AUTO_TEST_CASE(recover_initialize)
+QPID_AUTO_TEST_CASE(ae_disabled)
{
- string test_name = get_test_name(test_filename, "recover_initialize");
- lid_fid_map lfm(test_name, test_name);
- flist fidl;
- flist lidl;
- rcvdat rd;
- u_int16_t num_jfiles = 12;
+ string test_name = get_test_name(test_filename, "ae_disabled");
+ ::srand48(1); // init random gen for repeatable tests when using lfmgr_test_helper::prepare_recover()
try
{
+ jdir::create_dir(test_dir); // Check test dir exists; create it if not
test_jrnl jc(test_name, test_dir, test_name);
- lfmgr lm;
-
- lfm.journal_create(4, 4);
- lfm.journal_insert(0);
- lfm.journal_insert(2, 2);
- lfm.journal_insert(6);
- lfm.get_fid_list(fidl);
- lfm.get_lid_list(lidl);
- lfm.write_journal();
- lfmgr_test_helper::rcvdat_init(rd, fidl);
- lm.recover(rd, &jc, &jc.new_fcntl);
- BOOST_CHECK_EQUAL(lm.is_init(), true);
- lfmgr_test_helper::check_fids_lids(lm, fidl, lidl);
-
- lm.initialize(num_jfiles, &jc, &jc.new_fcntl);
- BOOST_CHECK_EQUAL(lm.is_init(), true);
- lfmgr_test_helper::check_linear_fids_lids(lm, num_jfiles);
+ lid_fid_map lfm(test_name, test_name);
+ lfmgr_test_helper::check_limit(lfm, jc, false, 8, 0);
}
catch(const exception& e) { BOOST_FAIL(e.what()); }
cout << "done" << endl;
}
/*
-* Check that a second call to recover() without calling finilize() correctly clears the first recover and correctly
-* sets up the specified fid list order.
+* Check that initialized or recovered journals with auto-expand enabled and a file limit set will enforce the correct
+* limits on inserts and appends.
*/
-QPID_AUTO_TEST_CASE(recover_recover)
+QPID_AUTO_TEST_CASE(ae_enabled_limit)
{
- string test_name = get_test_name(test_filename, "recover_recover");
- lid_fid_map lfm(test_name, test_name);
- flist fidl;
- flist lidl;
- rcvdat rd;
+ string test_name = get_test_name(test_filename, "ae_enabled_limit");
+ ::srand48(1); // init random gen for repeatable tests when using lfmgr_test_helper::prepare_recover()
try
{
+ jdir::create_dir(test_dir); // Check test dir exists; create it if not
test_jrnl jc(test_name, test_dir, test_name);
- lfmgr lm;
-
- lfm.journal_create(4, 4);
- lfm.journal_insert(0);
- lfm.journal_insert(2, 2);
- lfm.journal_insert(6);
- lfm.get_fid_list(fidl);
- lfm.get_lid_list(lidl);
- lfm.write_journal();
- lfmgr_test_helper::rcvdat_init(rd, fidl);
- lm.recover(rd, &jc, &jc.new_fcntl);
- BOOST_CHECK_EQUAL(lm.is_init(), true);
- lfmgr_test_helper::check_fids_lids(lm, fidl, lidl);
-
- lfm.journal_insert(3);
- lfm.journal_insert(8, 3);
- lfm.get_fid_list(fidl);
- lfm.get_lid_list(lidl);
- lfm.write_journal();
- lfmgr_test_helper::rcvdat_init(rd, fidl);
-
- lm.recover(rd, &jc, &jc.new_fcntl);
- BOOST_CHECK_EQUAL(lm.is_init(), true);
- lfmgr_test_helper::check_fids_lids(lm, fidl, lidl);
+ lid_fid_map lfm(test_name, test_name);
+ lfmgr_test_helper::check_limit(lfm, jc, true, 8, 32);
}
catch(const exception& e) { BOOST_FAIL(e.what()); }
cout << "done" << endl;
}
/*
-* Check that append correctly adds to the end of the array _fcntl_arr after initialize().
+* Check that initialized or recovered journals with auto-expand enabled and no file limit set (0) will allow inserts and
+* appends up to the file limit JRNL_MAX_NUM_FILES.
*/
-QPID_AUTO_TEST_CASE(initialize_append)
+QPID_AUTO_TEST_CASE(ae_enabled_unlimited)
{
- string test_name = get_test_name(test_filename, "initialize_append");
- u_int16_t num_jfiles = 8;
- u_int16_t num_append_jfiles = 3;
+ string test_name = get_test_name(test_filename, "ae_enabled_unlimited");
+ ::srand48(1); // init random gen for repeatable tests when using lfmgr_test_helper::prepare_recover()
try
{
+ jdir::create_dir(test_dir); // Check test dir exists; create it if not
test_jrnl jc(test_name, test_dir, test_name);
- lfmgr lm;
- lm.initialize(num_jfiles, &jc, &jc.new_fcntl);
- lfmgr_test_helper::check_linear_fids_lids(lm, num_jfiles);
-
- // Append single file
- lm.append(&jc, &jc.new_fcntl);
- lfmgr_test_helper::check_linear_fids_lids(lm, num_jfiles + 1);
-
- // Append 3 more files
- lm.append(&jc, &jc.new_fcntl, num_append_jfiles);
- lfmgr_test_helper::check_linear_fids_lids(lm, num_jfiles + 1 + num_append_jfiles);
+ lid_fid_map lfm(test_name, test_name);
+ lfmgr_test_helper::check_limit(lfm, jc, true, 8, 0);
}
catch(const exception& e) { BOOST_FAIL(e.what()); }
cout << "done" << endl;
}
/*
-* Check that append correctly adds to the end of the array _fcntl_arr after recover().
-*/
-QPID_AUTO_TEST_CASE(recover_append)
-{
- string test_name = get_test_name(test_filename, "recover_append");
- lid_fid_map lfm(test_name, test_name);
- flist fidl;
- flist lidl;
- rcvdat rd;
- try
- {
- test_jrnl jc(test_name, test_dir, test_name);
- lfmgr lm;
-
- lfm.journal_create(4, 4);
- lfm.journal_insert(0);
- lfm.journal_insert(2, 2);
- lfm.journal_insert(6);
- lfm.get_fid_list(fidl);
- lfm.get_lid_list(lidl);
- lfm.write_journal();
- lfmgr_test_helper::rcvdat_init(rd, fidl);
- lm.recover(rd, &jc, &jc.new_fcntl);
- lfmgr_test_helper::check_fids_lids(lm, fidl, lidl);
-
- // Append single file
- lfm.journal_insert(7);
- lfm.get_fid_list(fidl);
- lfm.get_lid_list(lidl);
- lm.append(&jc, &jc.new_fcntl);
- lfmgr_test_helper::check_fids_lids(lm, fidl, lidl);
-
- // Append 3 more files
- lfm.journal_insert(8, 3);
- lfm.get_fid_list(fidl);
- lfm.get_lid_list(lidl);
- lm.append(&jc, &jc.new_fcntl, 3);
- lfmgr_test_helper::check_fids_lids(lm, fidl, lidl);
- }
- catch(const exception& e) { BOOST_FAIL(e.what()); }
- cout << "done" << endl;
-}
-
-/*
-* Check that insert() works correctly after initialize() and shifts the fid sequence beyond the insert point correctly:
-*
-* The following sequence is tested:
-* initialize 4 fids=[0,1,2,3] lids=[0,1,2,3]
-* insert 1 after lid 0 fids=[0,4,1,2,3] lids=[0,2,3,4,1]
-* insert 2 after lid 2 fids=[0,4,1,5,6,2,3] lids=[0,2,5,6,1,3,4]
-* insert 1 after lid 6 fids=[0,4,1,5,6,2,3,7] lids=[0,2,5,6,1,3,4,7]
-* issert 1 after lid 3 fids=[0,4,1,5,8,6,2,3,7] lids=[0,2,6,7,1,3,5,8,4]
-*/
-QPID_AUTO_TEST_CASE(initialize_insert)
-{
- string test_name = get_test_name(test_filename, "initialize_insert");
- u_int16_t num_jfiles = 4;
- u_int16_t fids1[] = {0, 4, 1, 2, 3};
- u_int16_t lids1[] = {0, 2, 3, 4, 1};
- u_int16_t fids2[] = {0, 4, 1, 5, 6, 2, 3};
- u_int16_t lids2[] = {0, 2, 5, 6, 1, 3, 4};
- u_int16_t fids3[] = {0, 4, 1, 5, 6, 2, 3, 7};
- u_int16_t lids3[] = {0, 2, 5, 6, 1, 3, 4, 7};
- u_int16_t fids4[] = {0, 4, 1, 5, 8, 6, 2, 3, 7};
- u_int16_t lids4[] = {0, 2, 6, 7, 1, 3, 5, 8, 4};
- try
- {
- test_jrnl jc(test_name, test_dir, test_name);
- lfmgr lm;
- lm.initialize(num_jfiles, &jc, &jc.new_fcntl);
- lfmgr_test_helper::check_linear_fids_lids(lm, num_jfiles);
-
- lm.insert(0, &jc, &jc.new_fcntl);
- lfmgr_test_helper::check_fids_lids(lm, fids1, lids1, num_jfiles + 1);
-
- lm.insert(2, &jc, &jc.new_fcntl, 2);
- lfmgr_test_helper::check_fids_lids(lm, fids2, lids2, num_jfiles + 3);
-
- lm.insert(6, &jc, &jc.new_fcntl);
- lfmgr_test_helper::check_fids_lids(lm, fids3, lids3, num_jfiles + 4);
-
- lm.insert(3, &jc, &jc.new_fcntl);
- lfmgr_test_helper::check_fids_lids(lm, fids4, lids4, num_jfiles + 5);
- }
- catch(const exception& e) { BOOST_FAIL(e.what()); }
- cout << "done" << endl;
-}
-
-/*
-* Check that insert() works correctly after recover() and shifts the fid sequence beyond the insert point correctly:
-*
-* The following sequence is tested:
-* recover 4 fids=[0,2,3,1] lids=[0,3,1,2]
-* insert 1 after lid 0 fids=[0,4,2,3,1] lids=[0,4,2,3,1]
-* insert 2 after lid 2 fids=[0,4,2,5,6,3,1] lids=[0,6,2,5,1,3,4]
-* insert 1 after lid 6 fids=[0,4,2,5,6,3,1,7] lids=[0,6,2,5,1,3,4,7]
-* issert 1 after lid 3 fids=[0,4,2,5,8,6,3,1,7] lids=[0,7,2,6,1,3,5,8,4]
-*/
-QPID_AUTO_TEST_CASE(recover_insert)
-{
- string test_name = get_test_name(test_filename, "recover_insert");
- lid_fid_map lfm(test_name, test_name);
- flist fidl;
- flist lidl;
- rcvdat rd;
- try
- {
- lfm.journal_create(4, 4);
- lfm.get_fid_list(fidl);
- lfm.get_lid_list(lidl);
- lfm.write_journal();
- lfmgr_test_helper::rcvdat_init(rd, fidl);
- test_jrnl jc(test_name, test_dir, test_name);
- lfmgr lm;
- lm.recover(rd, &jc, &jc.new_fcntl);
- lfmgr_test_helper::check_fids_lids(lm, fidl, lidl);
-
- lfm.journal_insert(0);
- lfm.get_fid_list(fidl);
- lfm.get_lid_list(lidl);
- lm.insert(0, &jc, &jc.new_fcntl);
- lfmgr_test_helper::check_fids_lids(lm, fidl, lidl);
-
- lfm.journal_insert(2, 2);
- lfm.get_fid_list(fidl);
- lfm.get_lid_list(lidl);
- lm.insert(2, &jc, &jc.new_fcntl, 2);
- lfmgr_test_helper::check_fids_lids(lm, fidl, lidl);
-
- lfm.journal_insert(6);
- lfm.get_fid_list(fidl);
- lfm.get_lid_list(lidl);
- lm.insert(6, &jc, &jc.new_fcntl);
- lfmgr_test_helper::check_fids_lids(lm, fidl, lidl);
-
- lfm.journal_insert(3);
- lfm.get_fid_list(fidl);
- lfm.get_lid_list(lidl);
- lm.insert(3, &jc, &jc.new_fcntl);
- lfmgr_test_helper::check_fids_lids(lm, fidl, lidl);
- }
- catch(const exception& e) { BOOST_FAIL(e.what()); }
- cout << "done" << endl;
-}
-
-/*
* Tests randomized combinations of initialization/recovery, initial size, number, size and location of inserts.
*
* To reproduce a specific test, comment out the get_seed() statement and uncomment the literal below, adjusting the seed
@@ -777,7 +768,7 @@
{
string test_name = get_test_name(test_filename, "randomized_tests");
const long seed = get_seed();
- // const long seed = 0xd94c29b3;
+ // const long seed = 0x2d9b69d32;
cout << "seed=0x" << hex << seed << dec << " " << flush;
::srand48(seed);
@@ -785,20 +776,24 @@
flist fidl;
flist lidl;
rcvdat rd;
+ u_int16_t curr_ae_max_jfiles = 0;
+ jdir::create_dir(test_dir); // Check test dir exists; create it if not
for (int test_num = 0; test_num < 100; test_num++)
{
test_jrnl jc(test_name, test_dir, test_name);
lfmgr lm;
- // 50% chance of recovery except first run and if >= 800 journal files
- const bool recover_flag = test_num > 0 && lfm.size() < 800 ? 2.0 * ::drand48() < 1.0 : false;
+ // 50% chance of recovery except first run and if there is still ae space left
+ const bool recover_flag = test_num > 0 &&
+ curr_ae_max_jfiles > lfm.size() &&
+ 2.0 * ::drand48() < 1.0;
if (recover_flag)
{
// Recover from previous iteration
lfm.get_fid_list(fidl);
lfm.get_lid_list(lidl);
- lfm.write_journal();
- lfmgr_test_helper::rcvdat_init(rd, fidl);
+ lfm.write_journal(true, curr_ae_max_jfiles);
+ lfmgr_test_helper::rcvdat_init(rd, fidl, true, curr_ae_max_jfiles);
lm.recover(rd, &jc, &jc.new_fcntl);
lfmgr_test_helper::check_fids_lids(lm, fidl, lidl);
}
@@ -806,31 +801,53 @@
{
// Initialize from scratch
const u_int16_t num_jfiles = 4 + u_int16_t(21.0 * ::drand48()); // size: 4 - 25 files
+ curr_ae_max_jfiles = u_int16_t(4 * num_jfiles * ::drand48()); // size: 0 - 100 files
+ if (curr_ae_max_jfiles > JRNL_MAX_NUM_FILES) curr_ae_max_jfiles = JRNL_MAX_NUM_FILES;
+ else if (curr_ae_max_jfiles <= num_jfiles) curr_ae_max_jfiles = 0;
lfm.destroy_journal();
lfm.journal_create(num_jfiles, num_jfiles);
lfm.get_fid_list(fidl);
lfm.get_lid_list(lidl);
- lm.initialize(num_jfiles, &jc, &jc.new_fcntl);
+ lm.initialize(num_jfiles, true, curr_ae_max_jfiles, &jc, &jc.new_fcntl);
lfmgr_test_helper::check_linear_fids_lids(lm, num_jfiles);
}
// Loop to insert fids
- const int num_inserts = 1 + int(lfm.size()/10.0 * ::drand48());
+ const int num_inserts = 1 + int(lfm.size() * ::drand48());
for (int i = 0; i < num_inserts; i++)
{
- const u_int16_t size = lm.size();
+ const u_int16_t size = lm.num_jfiles();
const u_int16_t after_lid = u_int16_t(1.0 * size * ::drand48());
- const u_int16_t num_files = 1 + u_int16_t(4.0 * ::drand48());
- lfm.journal_insert(after_lid, num_files);
- lfm.get_fid_list(fidl);
- lfm.get_lid_list(lidl);
+ const u_int16_t num_jfiles = 1 + u_int16_t(4.0 * ::drand48());
+ const bool legal = lm.ae_max_jfiles()
+ ? size + num_jfiles <= lm.ae_max_jfiles()
+ : size + num_jfiles <= JRNL_MAX_NUM_FILES;
+ if (legal)
+ {
+ lfm.journal_insert(after_lid, num_jfiles);
+ lfm.get_fid_list(fidl);
+ lfm.get_lid_list(lidl);
- lm.insert(after_lid, &jc, &jc.new_fcntl, num_files);
- lfmgr_test_helper::check_fids_lids(lm, fidl, lidl);
+ lm.insert(after_lid, &jc, &jc.new_fcntl, num_jfiles);
+ lfmgr_test_helper::check_fids_lids(lm, fidl, lidl);
+ }
+ else
+ {
+ try
+ {
+ lm.insert(after_lid, &jc, &jc.new_fcntl, num_jfiles);
+ BOOST_FAIL("lfmgr::insert() succeeded and exceeded limit");
+ }
+ catch (const jexception& e)
+ {
+ BOOST_CHECK_EQUAL(e.err_code(), jerrno::JERR_LFMGR_AEFNUMLIMIT);
+ break; // no more inserts...
+ }
+ }
}
lm.finalize();
BOOST_CHECK_EQUAL(lm.is_init(), false);
- BOOST_CHECK_EQUAL(lm.size(), size_t(0));
+ BOOST_CHECK_EQUAL(lm.num_jfiles(), u_int16_t(0));
BOOST_CHECK_EQUAL(lm.get_fcntlp(0), (void*)0);
}
cout << "done" << endl;
16 years, 2 months
rhmessaging commits: r2648 - store/trunk/cpp/tests.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2008-10-17 13:28:47 -0400 (Fri, 17 Oct 2008)
New Revision: 2648
Modified:
store/trunk/cpp/tests/start_broker
Log:
Fixed tests to work with new qpid logging options
Modified: store/trunk/cpp/tests/start_broker
===================================================================
--- store/trunk/cpp/tests/start_broker 2008-10-17 12:54:57 UTC (rev 2647)
+++ store/trunk/cpp/tests/start_broker 2008-10-17 17:28:47 UTC (rev 2648)
@@ -2,4 +2,4 @@
QPIDD=$QPID_DIR/cpp/src/qpidd
rm -f qpidd.vglog* qpidd.log
test -n "$VALGRIND" && VALGRIND="$VALGRIND --log-file=qpidd.vglog --"
-exec libtool --mode=execute $VALGRIND $QPIDD --daemon --port=0 --log-output qpidd.log "$@" > qpidd.port
+exec libtool --mode=execute $VALGRIND $QPIDD --daemon --port=0 --log-to-file qpidd.log "$@" > qpidd.port
16 years, 2 months
rhmessaging commits: r2647 - store/branches/java/broker-queue-refactor/java/bdbstore/bin.
by rhmessaging-commits@lists.jboss.org
Author: ritchiem
Date: 2008-10-17 08:54:57 -0400 (Fri, 17 Oct 2008)
New Revision: 2647
Modified:
store/branches/java/broker-queue-refactor/java/bdbstore/bin/backup.sh
Log:
Update script to set BDB_HOME and QPID_HOME as per storeUpgrade.sh
Modified: store/branches/java/broker-queue-refactor/java/bdbstore/bin/backup.sh
===================================================================
--- store/branches/java/broker-queue-refactor/java/bdbstore/bin/backup.sh 2008-10-17 12:49:30 UTC (rev 2646)
+++ store/branches/java/broker-queue-refactor/java/bdbstore/bin/backup.sh 2008-10-17 12:54:57 UTC (rev 2647)
@@ -9,6 +9,15 @@
fi
done
+if [ -z "$QPID_HOME" ]; then
+ export QPID_HOME=$(dirname $(dirname $(readlink -f $0)))
+ export PATH=${PATH}:${QPID_HOME}/bin
+fi
+
+if [ -z "$BDB_HOME" ]; then
+ export BDB_HOME=$(dirname $(dirname $(readlink -f $0)))
+fi
+
LIBS=$BDB_HOME/lib/qpid-bdbtools-M3.jar:$BDB_HOME/lib/je-3.3.62.jar:$BDB_HOME/lib/qpid-bdbstore-M3.jar:$QPID_HOME/lib/qpid-incubating.jar
echo "Starting Hot Backup Script"
16 years, 2 months
rhmessaging commits: r2646 - store/branches/java/broker-queue-refactor/java/bdbstore/bin.
by rhmessaging-commits@lists.jboss.org
Author: ritchiem
Date: 2008-10-17 08:49:30 -0400 (Fri, 17 Oct 2008)
New Revision: 2646
Modified:
store/branches/java/broker-queue-refactor/java/bdbstore/bin/backup.sh
store/branches/java/broker-queue-refactor/java/bdbstore/bin/storeUpgrade.sh
Log:
Moved classpath to an variable to make it more visible
Modified: store/branches/java/broker-queue-refactor/java/bdbstore/bin/backup.sh
===================================================================
--- store/branches/java/broker-queue-refactor/java/bdbstore/bin/backup.sh 2008-10-16 19:45:18 UTC (rev 2645)
+++ store/branches/java/broker-queue-refactor/java/bdbstore/bin/backup.sh 2008-10-17 12:49:30 UTC (rev 2646)
@@ -9,5 +9,7 @@
fi
done
+LIBS=$BDB_HOME/lib/qpid-bdbtools-M3.jar:$BDB_HOME/lib/je-3.3.62.jar:$BDB_HOME/lib/qpid-bdbstore-M3.jar:$QPID_HOME/lib/qpid-incubating.jar
+
echo "Starting Hot Backup Script"
-java -Dlog4j.configuration=backup-log4j.xml ${JAVA_OPTS} -cp qpid-bdbstore-1.0-incubating-M2-SNAPSHOT-all-test-deps.jar org.apache.qpid.server.store.berkeleydb.BDBBackup ${ARGS}
+java -Dlog4j.configuration=backup-log4j.xml ${JAVA_OPTS} -cp $LIBS org.apache.qpid.server.store.berkeleydb.BDBBackup ${ARGS}
Modified: store/branches/java/broker-queue-refactor/java/bdbstore/bin/storeUpgrade.sh
===================================================================
--- store/branches/java/broker-queue-refactor/java/bdbstore/bin/storeUpgrade.sh 2008-10-16 19:45:18 UTC (rev 2645)
+++ store/branches/java/broker-queue-refactor/java/bdbstore/bin/storeUpgrade.sh 2008-10-17 12:49:30 UTC (rev 2646)
@@ -18,4 +18,6 @@
export BDB_HOME=$(dirname $(dirname $(readlink -f $0)))
fi
-java -Xms256m -Dlog4j.configuration=BDBStoreUpgrade.log4j.xml -Xmx256m -Damqj.logging.level=warn ${JAVA_OPTS} -cp $BDB_HOME/lib/qpid-bdbtools-M3.jar:$BDB_HOME/lib/je-3.3.62.jar:$BDB_HOME/lib/qpid-bdbstore-M3.jar:$QPID_HOME/lib/qpid-incubating.jar org.apache.qpid.server.store.berkeleydb.BDBStoreUpgrade ${ARGS}
+LIBS=$BDB_HOME/lib/qpid-bdbtools-M3.jar:$BDB_HOME/lib/je-3.3.62.jar:$BDB_HOME/lib/qpid-bdbstore-M3.jar:$QPID_HOME/lib/qpid-incubating.jar
+
+java -Xms256m -Dlog4j.configuration=BDBStoreUpgrade.log4j.xml -Xmx256m -Damqj.logging.level=warn ${JAVA_OPTS} -cp $LIBS org.apache.qpid.server.store.berkeleydb.BDBStoreUpgrade ${ARGS}
16 years, 2 months
rhmessaging commits: r2645 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-10-16 15:45:18 -0400 (Thu, 16 Oct 2008)
New Revision: 2645
Modified:
mgmt/trunk/cumin/python/cumin/system.py
Log:
Switching to bound variable for the system/slot linkage
Modified: mgmt/trunk/cumin/python/cumin/system.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/system.py 2008-10-16 18:57:31 UTC (rev 2644)
+++ mgmt/trunk/cumin/python/cumin/system.py 2008-10-16 19:45:18 UTC (rev 2645)
@@ -102,5 +102,8 @@
return "Grid Slots %s" % fmt_count(Slot.select(sql).count())
def render_sql_where(self, session, system):
- sql = "machine = '%s'" % system.nodeName
- return "where %s" % sql
+ return "where s.machine = %(system_name)s"
+
+ def get_sql_values(self, session, system):
+ return {"system_name": system.nodeName}
+
16 years, 2 months
rhmessaging commits: r2644 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-10-16 14:57:31 -0400 (Thu, 16 Oct 2008)
New Revision: 2644
Modified:
mgmt/trunk/cumin/python/cumin/system.py
Log:
Linking slot.name to system.node_name
Modified: mgmt/trunk/cumin/python/cumin/system.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/system.py 2008-10-16 17:57:57 UTC (rev 2643)
+++ mgmt/trunk/cumin/python/cumin/system.py 2008-10-16 18:57:31 UTC (rev 2644)
@@ -94,10 +94,13 @@
from slot import SlotSet
class SystemSlotSet(SlotSet):
- def render_title(self, session, *args):
- sql = "1 = 1" # XXX
+ def get_args(self, session):
+ return self.frame.get_args(session)
+
+ def render_title(self, session, system):
+ sql = "machine = '%s'" % system.nodeName
return "Grid Slots %s" % fmt_count(Slot.select(sql).count())
- def render_sql_where(self, session, *args):
- sql = "1 = 1" # XXX
+ def render_sql_where(self, session, system):
+ sql = "machine = '%s'" % system.nodeName
return "where %s" % sql
16 years, 2 months
rhmessaging commits: r2643 - in mgmt/trunk/mint: python/mint and 1 other directories.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2008-10-16 13:57:57 -0400 (Thu, 16 Oct 2008)
New Revision: 2643
Modified:
mgmt/trunk/mint/Makefile
mgmt/trunk/mint/python/mint/Makefile
mgmt/trunk/mint/sql/Makefile
Log:
Add a top-level clean rule that descends to sub makefiles
Modified: mgmt/trunk/mint/Makefile
===================================================================
--- mgmt/trunk/mint/Makefile 2008-10-15 17:30:04 UTC (rev 2642)
+++ mgmt/trunk/mint/Makefile 2008-10-16 17:57:57 UTC (rev 2643)
@@ -13,9 +13,6 @@
build:
../bin/python-compile python
-clean:
- rm -f python/mint/schema-store.py python/mint/schema.py python/mint/schema.sql
-
install: build
install -d ${lib}
install python/mint/*.py python/mint/*.pyc ${lib}
@@ -30,3 +27,9 @@
$(MAKE) schema -C xml
$(MAKE) schema -C python/mint
$(MAKE) schema -C sql
+
+clean:
+ $(MAKE) clean -C xml
+ $(MAKE) clean -C python/mint
+ $(MAKE) clean -C sql
+
Modified: mgmt/trunk/mint/python/mint/Makefile
===================================================================
--- mgmt/trunk/mint/python/mint/Makefile 2008-10-15 17:30:04 UTC (rev 2642)
+++ mgmt/trunk/mint/python/mint/Makefile 2008-10-16 17:57:57 UTC (rev 2643)
@@ -1,4 +1,4 @@
-.PHONY: schema
+.PHONY: schema clean
dsn := "postgresql://localhost/"
@@ -6,3 +6,5 @@
schema.py: ../../xml/*.xml
python schemaparser.py schema.py ${dsn} $^
+
+clean:
Modified: mgmt/trunk/mint/sql/Makefile
===================================================================
--- mgmt/trunk/mint/sql/Makefile 2008-10-15 17:30:04 UTC (rev 2642)
+++ mgmt/trunk/mint/sql/Makefile 2008-10-16 17:57:57 UTC (rev 2643)
@@ -1,4 +1,4 @@
-.PHONY: schema
+.PHONY: schema clean
dsn := "postgresql://localhost/"
@@ -6,3 +6,5 @@
schema.sql: ../python/mint/*.py
sqlobject-admin sql -m mint -m mint.schema -c ${dsn} | sed -e '1,2d' > schema.sql
+
+clean:
16 years, 2 months