dtinfo subdirectory DtMmdb

This commit is contained in:
Ulrich Wilkens
2013-08-28 19:16:37 +02:00
committed by Jon Trulson
parent 0be684281d
commit fbd81ef151
159 changed files with 735 additions and 588 deletions

View File

@@ -52,10 +52,12 @@
abs_storage::abs_storage( char* file_path, char* file_name,
c_code_t c_id, rep_policy* p ) :
policy(p), root(c_id), index_num(-1), v_swap_order(false)
root(c_id), index_num(-1), policy(p), v_swap_order(false)
{
strcpy(path, file_path);
strcpy(name, file_name);
int len = MIN(strlen(file_path), PATHSIZ - 1);
*((char *) memcpy(path, file_path, len) + len) = '\0';
len = MIN(strlen(file_name), PATHSIZ - 1);
*((char *) memcpy(name, file_name, len) + len) = '\0';
}
abs_storage::~abs_storage()

View File

@@ -70,9 +70,9 @@ protected:
int left, int right);
protected:
bset v_index_imp;
abs_storage* v_storage_ptr;
mmdb_pos_t v_initial_loc;
bset v_index_imp;
};

View File

@@ -90,7 +90,6 @@ debug(cerr, inactive_list.count());
replaced = 0;
Boolean ok = true;
switch (x.get_position()) {
case ACTIVE:
@@ -131,8 +130,6 @@ Boolean lru::promote(rep_cell& x)
Boolean lru::derank(rep_cell& x, position_t opt)
{
Boolean ok = true;
switch (x.get_position()) {
case ACTIVE:
//MESSAGE(cerr, "active status to derank");
@@ -158,6 +155,8 @@ Boolean lru::derank(rep_cell& x, position_t opt)
inactive_list.insert_as_tail(&x);
x.set_position(INACTIVE);
break;
default:
break;
}
return true;
@@ -227,6 +226,8 @@ Boolean lru::remove(rep_cell& x)
case NOWHERE:
throw(stringException("lru::last(): bad option"));
}
return false;
}
void lru::remove()

View File

@@ -430,7 +430,7 @@ Boolean page::_alloc_slot( int slot_num, int size, char*& str_ptr )
new_blank_len -= size;
//debug(cerr, new_blank_len);
if ( new_blank_len < 2*SLOT_HEADER_SIZE + 10 )
if ( new_blank_len < (int)(2*SLOT_HEADER_SIZE + 10) )
new_blank_len = 0;
else
new_blank_len -= SLOT_HEADER_SIZE; // space allocated for new

View File

@@ -131,9 +131,9 @@ protected:
void _swap_order(Boolean swap_count_field_first);
protected:
int num_locks; // no. of locks
unsigned int pageid ; // page id
unsigned int pageid ; // page id
Boolean dirty ; // = false: page has not been written;
int num_locks; // no. of locks
int v_memalign_offset; // align offset of the memory
// chunk for this page

View File

@@ -222,7 +222,7 @@ page_cache_global_part::load_new_page(
{
lru_pagePtr p = 0;
if ( f_replace_policy.active_elmts() < f_total_allowed_pages ) {
if ( f_replace_policy.active_elmts() < (int) f_total_allowed_pages ) {
/*
debug(cerr, page_cache -> active_elmts());

View File

@@ -391,8 +391,6 @@ debug(cerr, len);
debug(cerr, str_offset);
*/
Boolean ok = false;
buffer in_cache(0);
in_cache.set_chunk(base, len);
@@ -595,8 +593,8 @@ debug(cerr, name);
debug(cerr, loc);
*/
int page_num ;
int slot_num ;
int page_num =0;
int slot_num =0;
int offset = 0;
page* y = 0;
spointer_t *x = 0;
@@ -761,9 +759,9 @@ debug(cerr, int(string_ptr));
#endif
int u1 = PAGE_ID( loc, page_sz );
int u2 = PAGE_IDX( loc, page_sz );
//cerr << "Allocated ID=" << u1 << "." << u2 << " " << len << "\n";
// int u1 = PAGE_ID( loc, page_sz );
// int u2 = PAGE_IDX( loc, page_sz );
// cerr << "Allocated ID=" << u1 << "." << u2 << " " << len << "\n";
return 0;
}
@@ -779,8 +777,8 @@ cerr << "append:" << u1 << "." << u2 << " " << len << "\n";
int page_num ;
int slot_num ;
int page_num = 0;
int slot_num = 0;
page* y;
spointer_t *x;
@@ -910,8 +908,10 @@ io_status page_storage::asciiOut(ostream& out)
{
int ind = first();
while ( ind != 0 ) {
#ifdef DEBUG
page* p = (*this)(ind, READ);
debug(out, *p);
#endif
next(ind);
}
return done;
@@ -1187,7 +1187,7 @@ void page_storage::roll_back()
// verify the log is in good shape
//////////////////////////////////
int m;
int log_bytes = trans_info.log_store -> bytes();
unsigned int log_bytes = trans_info.log_store -> bytes();
if ( trans_info.log_store &&
(*trans_info.log_store) &&

View File

@@ -89,14 +89,14 @@ class store_trans
protected:
enum trans_t { ENABLED, DISABLED };
int page_sz;
int max_pages;
char* path;
char* name;
trans_t status;
unixf_storage* log_store;
imp_die* log_index;
char* path;
char* name;
int max_pages;
int page_sz;
public:
store_trans(char* path, char*name, int page_sz);
@@ -125,7 +125,7 @@ class page_storage : public abs_storage
{
protected:
buffer* v_buf; // aux. buf.
store_trans trans_info;
int page_sz ; // page size
@@ -142,15 +142,15 @@ protected:
int total_pages;
int pagings ;
int total_page_access;
store_trans trans_info;
// byte order
int v_server_order;
int v_db_order;
buffer* v_buf; // aux. buf.
int pagings ;
int total_page_access;
protected:
Boolean seek_loc_negative(mmdb_pos_t& loc, int smd);

View File

@@ -90,7 +90,7 @@ public:
header.int_view |= (HEADER_MASK & m);
set_mode(UPDATED, true);
};
Boolean test_mode(int m) {
Boolean test_mode(unsigned int m) {
return ( (header.int_view & HEADER_MASK & m) == m ) ? true : false;
};

View File

@@ -35,7 +35,7 @@ void real_page_cache_test_1(pm_random& rand_gen, page_storage** st, unsigned int
unsigned int j, k;
page_storage::access_t l;
for ( int i=0; i< no_access; i++)
for ( unsigned int i=0; i< no_access; i++)
{
j = rand_gen.rand() % ct; // pick the store
@@ -66,7 +66,7 @@ prepare_store(char* path, lru& open_file_policy,
page_storage** x = new page_storagePtr[ct];
unixf_storage* unix_file = 0;
for ( int i=0; i<ct; i++) {
for ( unsigned int i=0; i<ct; i++) {
int pages = rand_gen.rand() % (high-low) + low;
/*
@@ -76,7 +76,7 @@ if ( i == 1 )
pages = 17;
*/
sprintf(name, "test.%d", i);
snprintf(name, sizeof(name), "test.%d", i);
if ( exist_file(name) == true )
del_file(name);
@@ -90,7 +90,7 @@ if ( i == 1 )
void quit_store(page_storage** st, unsigned int ct)
{
for ( int i=0; i<ct; i++) {
for ( unsigned int i=0; i<ct; i++) {
delete st[i];
}
delete st;

View File

@@ -62,7 +62,7 @@ unixf_storage( char* file_path, char* file_name,
rep_policy* rep_p, int m
) :
abs_storage( file_path, file_name, UNIX_STORAGE_CODE, rep_p ),
mode(m), fstream(),
fstream(), mode(m),
total_bytes(-1), v_file_exist(exist_file(file_name, file_path))
{
}
@@ -137,7 +137,7 @@ int unixf_storage::_open(int new_mode)
}
if ( v_file_exist == false ) {
SET_BIT(new_mode, ios::out | ios::app);
SET_BIT(new_mode, ios::out | ios::trunc);
v_file_exist = true;
}
@@ -272,7 +272,7 @@ fprintf(stderr, "flush option=%d\n", flush_opt);
#ifndef C_API
{
char fname[64];
sprintf(fname, "%s.%ld-%d", name, loc+string_ofst, len);
snprintf(fname, sizeof(fname), "%s.%ld-%d", name, loc+string_ofst, len);
ofstream output(fname);
output.write(base, len);
output.flush();
@@ -310,16 +310,16 @@ int unixf_storage::bytes()
{
if ( total_bytes == -1 ) {
char* info_lib_file = form("%s/%s", path, name);
#ifdef C_API
_open(ios::in);
if ( !good() )
clear();
#ifdef C_API
total_bytes = ::bytes(rdbuf() -> fd());
#else
char* info_lib_file = form("%s/%s", path, name);
total_bytes = ::bytes(info_lib_file);
#endif
}