Updates for 32-bit x86. There are still real 32-bit bugs being emitted as compiler warnings.
This commit is contained in:
parent
8481e9cdd6
commit
c86688884a
14 changed files with 65 additions and 63 deletions
|
@ -72,6 +72,8 @@ terms specified in this license.
|
|||
# define END_C_DECLS
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define _FILE_OFFSET_BITS 64
|
||||
|
||||
#include <stdint.h> // uint32, et. al.
|
||||
#include <limits.h>
|
||||
|
||||
|
|
|
@ -324,7 +324,7 @@ int receive_message(NetworkSetup *ns, Message *message, char *from) {
|
|||
|
||||
if(message_size != sizeof(Message)) {
|
||||
/* drop packet */
|
||||
fprintf(stderr, "Size mismatch: %ld, %ld\n", message_size, sizeof(Message));
|
||||
fprintf(stderr, "Size mismatch: %lld, %lld\n", (long long)message_size, (long long)sizeof(Message));
|
||||
return 0;
|
||||
} else {
|
||||
/* TODO: Callback to security stuff / crypto here? */
|
||||
|
|
|
@ -46,28 +46,28 @@ static lsn_t debug_end_position(stasis_handle_t *h) {
|
|||
static stasis_write_buffer_t * debug_write_buffer(stasis_handle_t * h,
|
||||
lsn_t off, lsn_t len) {
|
||||
stasis_handle_t * hh = ((debug_impl*)h->impl)->h;
|
||||
printf("tid=%9ld call write_buffer(%lx, %ld, %ld)\n",
|
||||
printf("tid=%9ld call write_buffer(%lx, %lld, %lld)\n",
|
||||
pthread_self(), (unsigned long)hh, off, len); fflush(stdout);
|
||||
stasis_write_buffer_t * ret = hh->write_buffer(hh,off,len);
|
||||
stasis_write_buffer_t * retWrap = malloc(sizeof(stasis_write_buffer_t));
|
||||
*retWrap = *ret;
|
||||
retWrap->h = h;
|
||||
retWrap->impl = ret;
|
||||
printf("tid=%9ld retn write_buffer(%lx, %ld, %ld) = %lx\n",
|
||||
printf("tid=%9ld retn write_buffer(%lx, %lld, %lld) = %lx\n",
|
||||
pthread_self(), (unsigned long)hh, off, len, (unsigned long)retWrap); fflush(stdout);
|
||||
return retWrap;
|
||||
}
|
||||
static stasis_write_buffer_t * debug_append_buffer(stasis_handle_t * h,
|
||||
lsn_t len) {
|
||||
stasis_handle_t * hh = ((debug_impl*)h->impl)->h;
|
||||
printf("tid=%9ld call append_buffer(%lx, %ld)\n",
|
||||
printf("tid=%9ld call append_buffer(%lx, %lld)\n",
|
||||
pthread_self(), (unsigned long)hh, len); fflush(stdout);
|
||||
stasis_write_buffer_t * ret = hh->append_buffer(hh,len);
|
||||
stasis_write_buffer_t * retWrap = malloc(sizeof(stasis_write_buffer_t));
|
||||
*retWrap = *ret;
|
||||
retWrap->h = h;
|
||||
retWrap->impl = ret;
|
||||
printf("tid=%9ld retn append_buffer(%lx, %ld) = %lx (off=%ld)\n",
|
||||
printf("tid=%9ld retn append_buffer(%lx, %lld) = %lx (off=%lld)\n",
|
||||
pthread_self(), (unsigned long)hh, len, (unsigned long)retWrap, ret->off); fflush(stdout);
|
||||
return retWrap;
|
||||
|
||||
|
@ -85,14 +85,14 @@ static int debug_release_write_buffer(stasis_write_buffer_t * w_wrap) {
|
|||
static stasis_read_buffer_t * debug_read_buffer(stasis_handle_t * h,
|
||||
lsn_t off, lsn_t len) {
|
||||
stasis_handle_t * hh = ((debug_impl*)h->impl)->h;
|
||||
printf("tid=%9ld call read_buffer(%lx, %ld, %ld)\n",
|
||||
printf("tid=%9ld call read_buffer(%lx, %lld, %lld)\n",
|
||||
pthread_self(), (unsigned long)hh, off, len); fflush(stdout);
|
||||
stasis_read_buffer_t * ret = hh->read_buffer(hh,off,len);
|
||||
stasis_read_buffer_t * retWrap = malloc(sizeof(stasis_read_buffer_t));
|
||||
*retWrap = *ret;
|
||||
retWrap->h = h;
|
||||
retWrap->impl = ret;
|
||||
printf("tid=%9ld retn read_buffer(%lx, %ld, %ld) = %lx\n",
|
||||
printf("tid=%9ld retn read_buffer(%lx, %lld, %lld) = %lx\n",
|
||||
pthread_self(), (unsigned long)hh, off, len, (unsigned long)retWrap); fflush(stdout);
|
||||
return retWrap;
|
||||
|
||||
|
@ -112,7 +112,7 @@ static int debug_release_read_buffer(stasis_read_buffer_t * r_wrap) {
|
|||
static int debug_write(stasis_handle_t * h, lsn_t off,
|
||||
const byte * dat, lsn_t len) {
|
||||
stasis_handle_t * hh = ((debug_impl*)h->impl)->h;
|
||||
printf("tid=%9ld call write(%lx, %ld, %lx, %ld)\n", pthread_self(), (unsigned long)hh, off, (unsigned long)dat, len); fflush(stdout);
|
||||
printf("tid=%9ld call write(%lx, %lld, %lx, %lld)\n", pthread_self(), (unsigned long)hh, off, (unsigned long)dat, len); fflush(stdout);
|
||||
int ret = hh->write(hh, off, dat, len);
|
||||
printf("tid=%9ld retn write(%lx) = %d\n", pthread_self(), (unsigned long)hh, ret); fflush(stdout);
|
||||
return ret;
|
||||
|
@ -120,27 +120,27 @@ static int debug_write(stasis_handle_t * h, lsn_t off,
|
|||
static int debug_append(stasis_handle_t * h, lsn_t * off,
|
||||
const byte * dat, lsn_t len) {
|
||||
stasis_handle_t * hh = ((debug_impl*)h->impl)->h;
|
||||
printf("tid=%9ld call append(%lx, ??, %lx, %ld)\n", pthread_self(), (unsigned long)hh, (unsigned long)dat, len); fflush(stdout);
|
||||
printf("tid=%9ld call append(%lx, ??, %lx, %lld)\n", pthread_self(), (unsigned long)hh, (unsigned long)dat, len); fflush(stdout);
|
||||
lsn_t tmpOff;
|
||||
if(!off) {
|
||||
off = &tmpOff;
|
||||
}
|
||||
int ret = hh->append(hh, off, dat, len);
|
||||
printf("tid=%9ld retn append(%lx, %ld, %lx, %ld) = %d\n", pthread_self(), (unsigned long)hh, *off, (unsigned long) dat, len, ret); fflush(stdout);
|
||||
printf("tid=%9ld retn append(%lx, %lld, %lx, %lld) = %d\n", pthread_self(), (unsigned long)hh, *off, (unsigned long) dat, len, ret); fflush(stdout);
|
||||
return ret;
|
||||
|
||||
}
|
||||
static int debug_read(stasis_handle_t * h,
|
||||
lsn_t off, byte * buf, lsn_t len) {
|
||||
stasis_handle_t * hh = ((debug_impl*)h->impl)->h;
|
||||
printf("tid=%9ld call read(%lx, %ld, %lx, %ld)\n", pthread_self(), (unsigned long)hh, off, (unsigned long)buf, len); fflush(stdout);
|
||||
printf("tid=%9ld call read(%lx, %lld, %lx, %lld)\n", pthread_self(), (unsigned long)hh, off, (unsigned long)buf, len); fflush(stdout);
|
||||
int ret = hh->read(hh, off, buf, len);
|
||||
printf("tid=%9ld retn read(%lx) = %d\n", pthread_self(), (unsigned long)hh, ret); fflush(stdout);
|
||||
return ret;
|
||||
}
|
||||
static int debug_truncate_start(stasis_handle_t * h, lsn_t new_start) {
|
||||
stasis_handle_t * hh = ((debug_impl*)h->impl)->h;
|
||||
printf("tid=%9ld call truncate_start(%lx, %ld)\n", pthread_self(), (unsigned long)hh, new_start); fflush(stdout);
|
||||
printf("tid=%9ld call truncate_start(%lx, %lld)\n", pthread_self(), (unsigned long)hh, new_start); fflush(stdout);
|
||||
int ret = hh->truncate_start(hh, new_start);
|
||||
printf("tid=%9ld retn truncate_start(%lx) = %d\n", pthread_self(), (unsigned long)hh, ret); fflush(stdout);
|
||||
return ret;
|
||||
|
|
|
@ -262,7 +262,7 @@ int openLogWriter() {
|
|||
nextAvailableLSN = nextEntry_LogWriter(le); //le->LSN + sizeofLogEntry(le) + sizeof(lsn_t);
|
||||
crc = 0;
|
||||
} else {
|
||||
printf("Log corruption: %x != %x (lsn = %ld)\n", (unsigned int) le->prevLSN, crc, le->LSN);
|
||||
printf("Log corruption: %x != %x (lsn = %lld)\n", (unsigned int) le->prevLSN, crc, le->LSN);
|
||||
// The log wasn't successfully forced to this point; discard
|
||||
// everything after the last CRC.
|
||||
FreeLogEntry(le);
|
||||
|
@ -484,7 +484,7 @@ static LogEntry * readLogEntry() {
|
|||
lsn_t size;
|
||||
lsn_t entrySize;
|
||||
|
||||
ssize_t bytesRead = read(roLogFD, &size, sizeof(lsn_t));
|
||||
lsn_t bytesRead = read(roLogFD, &size, sizeof(lsn_t));
|
||||
|
||||
if(bytesRead != sizeof(lsn_t)) {
|
||||
if(bytesRead == 0) {
|
||||
|
@ -503,9 +503,9 @@ static LogEntry * readLogEntry() {
|
|||
abort();
|
||||
return NULL;
|
||||
}
|
||||
fprintf(stderr, "short read from log. Expected %ld bytes, got %ld.\nFIXME: This is 'normal', but currently not handled", sizeof(lsn_t), bytesRead);
|
||||
fprintf(stderr, "short read from log. Expected %lld bytes, got %lld.\nFIXME: This is 'normal', but currently not handled", (long long) sizeof(lsn_t), (long long) bytesRead);
|
||||
fflush(stderr);
|
||||
fprintf(stderr, "\nattempt to read again produced newBytesRead = %ld, newSize was %ld\n", newBytesRead, newSize);
|
||||
fprintf(stderr, "\nattempt to read again produced newBytesRead = %lld, newSize was %lld\n", newBytesRead, newSize);
|
||||
fflush(stderr);
|
||||
|
||||
abort(); // XXX really abort here. This code should attempt to piece together short log reads...
|
||||
|
@ -540,9 +540,9 @@ static LogEntry * readLogEntry() {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
fprintf(stderr, "short read from log w/ lsn %ld. Expected %ld bytes, got %ld.\nFIXME: This is 'normal', but currently not handled", debug_lsn, size, bytesRead);
|
||||
fprintf(stderr, "short read from log w/ lsn %lld. Expected %lld bytes, got %lld.\nFIXME: This is 'normal', but currently not handled", debug_lsn, size, bytesRead);
|
||||
fflush(stderr);
|
||||
fprintf(stderr, "\nattempt to read again produced newBytesRead = %ld, newSize was %ld\n", newBytesRead, newSize);
|
||||
fprintf(stderr, "\nattempt to read again produced newBytesRead = %lld, newSize was %lld\n", newBytesRead, newSize);
|
||||
fflush(stderr);
|
||||
|
||||
abort();
|
||||
|
@ -750,7 +750,7 @@ int truncateLog_LogWriter(lsn_t LSN) {
|
|||
if(logPos == -1) {
|
||||
perror("Truncation couldn't seek");
|
||||
} else {
|
||||
printf("logfile was wrong length after truncation. Expected %ld, found %ld\n", nextAvailableLSN - global_offset, logPos);
|
||||
printf("logfile was wrong length after truncation. Expected %lld, found %lld\n", nextAvailableLSN - global_offset, logPos);
|
||||
fflush(stdout);
|
||||
abort();
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
static int stable = -1;
|
||||
static pthread_mutex_t stable_mutex;
|
||||
|
||||
static long myLseekNoLock(int f, long offset, int whence);
|
||||
static pageid_t myLseekNoLock(int f, pageid_t offset, int whence);
|
||||
|
||||
static int oldOffset = -1;
|
||||
|
||||
|
@ -33,8 +33,8 @@ int pageFile_isDurable = 1;
|
|||
|
||||
void pageRead(Page *ret) {
|
||||
|
||||
long pageoffset;
|
||||
long offset;
|
||||
pageid_t pageoffset;
|
||||
pageid_t offset;
|
||||
|
||||
pageoffset = ret->id * PAGE_SIZE;
|
||||
pthread_mutex_lock(&stable_mutex);
|
||||
|
@ -74,8 +74,8 @@ void pageWrite(Page * ret) {
|
|||
DEBUG(" =^)~ ");
|
||||
return;
|
||||
}
|
||||
long pageoffset = ret->id * PAGE_SIZE;
|
||||
long offset ;
|
||||
pageid_t pageoffset = ret->id * PAGE_SIZE;
|
||||
pageid_t offset ;
|
||||
|
||||
/* assert(ret->pending == 0); */
|
||||
|
||||
|
@ -166,9 +166,9 @@ void closePageFile() {
|
|||
stable = -1;
|
||||
}
|
||||
|
||||
static long myLseekNoLock(int f, long offset, int whence) {
|
||||
static pageid_t myLseekNoLock(int f, pageid_t offset, int whence) {
|
||||
assert(! ( offset % 4096 ));
|
||||
long ret = lseek(f, offset, whence);
|
||||
pageid_t ret = lseek(f, offset, whence);
|
||||
if(ret == -1) {
|
||||
perror("Couldn't seek.");
|
||||
fflush(NULL);
|
||||
|
|
|
@ -251,7 +251,7 @@ static void Undo(int recovery) {
|
|||
records may be passed in by undoTrans.)*/
|
||||
break;
|
||||
default:
|
||||
printf ("Unknown log type to undo (TYPE=%d, XID= %d, LSN=%ld), skipping...\n", e->type, e->xid, e->LSN);
|
||||
printf ("Unknown log type to undo (TYPE=%d, XID= %d, LSN=%lld), skipping...\n", e->type, e->xid, e->LSN);
|
||||
break;
|
||||
}
|
||||
FreeLogEntry(e);
|
||||
|
|
|
@ -158,7 +158,7 @@ int main (int argc, char**argv) {
|
|||
/* int j = (i % 8) + 1;*/
|
||||
int j = i;
|
||||
if(!cHtLookup(xid, dfaSet, &ht, &j, sizeof(int), buf, &buflen)) { printf ("lookup failed!"); }
|
||||
printf(" looked up !! key %d -> %d: %s %ld\n", i, j, buf, buflen);
|
||||
printf(" looked up !! key %d -> %d: %s %lld\n", i, j, buf, (long long)buflen);
|
||||
}
|
||||
|
||||
cHtDelete(xid, dfaSet, &ht);
|
||||
|
|
|
@ -58,7 +58,7 @@ terms specified in this license.
|
|||
long myrandom(long x) {
|
||||
double xx = x;
|
||||
double r = random();
|
||||
double max = ((long)RAND_MAX)+1;
|
||||
double max = ((int64_t)RAND_MAX)+1;
|
||||
max /= xx;
|
||||
return (long)((r/max));
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ int insert(Page* p, recordid rid_caller, int valueIn){
|
|||
|
||||
|
||||
// if DEBUGERROR ==1 this causes a seg fault below!
|
||||
if (DEBUGERROR) {printf("\n***page->id = %ld\n", p->id);}
|
||||
if (DEBUGERROR) {printf("\n***page->id = %lld\n", p->id);}
|
||||
printf("\n***rid.page = %d\n\n", rid.page);
|
||||
|
||||
|
||||
|
@ -164,7 +164,7 @@ int insert(Page* p, recordid rid_caller, int valueIn){
|
|||
rid.slot = insertLocation;
|
||||
|
||||
// fixedWrite(p, rid, valueInBuff); // page/fixed.c:58: checkRid: Assertion `page->id == rid.page' failed.
|
||||
printf("\n***page->id = %ld\n", p->id);
|
||||
printf("\n***page->id = %lld\n", p->id);
|
||||
printf("\n***rid.page = %d\n", rid.page);
|
||||
|
||||
|
||||
|
@ -234,7 +234,7 @@ int SimpleExample(){
|
|||
|
||||
Page * p1 = loadPage(xid, pageid1);
|
||||
|
||||
if(DEBUGP) { printf("\n**** page->id = %ld\n", p1->id);}
|
||||
if(DEBUGP) { printf("\n**** page->id = %lld\n", p1->id);}
|
||||
|
||||
/* check consistency between rid & page's values
|
||||
* for number of slots and record size */
|
||||
|
|
|
@ -132,7 +132,7 @@ START_TEST(indirectAlloc) {
|
|||
|
||||
|
||||
|
||||
printf("{page = %ld, slot = %d, size = %ld}\n", (int64_t)rid.page, rid.slot, (int64_t)rid.size);
|
||||
printf("{page = %lld, slot = %d, size = %lld}\n", (int64_t)rid.page, rid.slot, (int64_t)rid.size);
|
||||
|
||||
releasePage(p);
|
||||
|
||||
|
@ -156,7 +156,7 @@ START_TEST(indirectAlloc) {
|
|||
|
||||
|
||||
|
||||
printf("{page = %ld, slot = %d, size = %ld}\n", (int64_t)rid.page, rid.slot, (int64_t)rid.size);
|
||||
printf("{page = %lld, slot = %d, size = %lld}\n", (int64_t)rid.page, rid.slot, (int64_t)rid.size);
|
||||
|
||||
releasePage(p);
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ terms specified in this license.
|
|||
long myrandom(long x) {
|
||||
double xx = x;
|
||||
double r = random();
|
||||
double max = ((long)RAND_MAX)+1;
|
||||
double max = ((uint64_t)RAND_MAX)+1;
|
||||
max /= xx;
|
||||
return (long)((r/max));
|
||||
}
|
||||
|
@ -428,8 +428,8 @@ Suite * check_suite(void) {
|
|||
tcase_set_timeout(tc, 600); // ten minute timeout
|
||||
|
||||
/* Sub tests are added, one per line, here */
|
||||
// tcase_add_test(tc, io_memoryTest);
|
||||
// tcase_add_test(tc, io_fileTest);
|
||||
tcase_add_test(tc, io_memoryTest);
|
||||
tcase_add_test(tc, io_fileTest);
|
||||
tcase_add_test(tc, io_nonBlockingTest);
|
||||
/* --------------------------------------------- */
|
||||
tcase_add_checked_fixture(tc, setup, teardown);
|
||||
|
|
|
@ -74,8 +74,8 @@ START_TEST(lhtableTest)
|
|||
|
||||
char** keys = malloc(NUM_ENTRIES * sizeof(char*));
|
||||
struct LH_ENTRY(table) * t = LH_ENTRY(create)(100);
|
||||
for(long i = 0; i < NUM_ENTRIES; i++) {
|
||||
int keyLen = asprintf(&(keys[i]), "--> %ld <--\n", i);
|
||||
for(int64_t i = 0; i < NUM_ENTRIES; i++) {
|
||||
int keyLen = asprintf(&(keys[i]), "--> %lld <--\n", i);
|
||||
assert(keyLen == strlen(keys[i]));
|
||||
assert(!LH_ENTRY(find)(t, keys[i], strlen(keys[i])));
|
||||
LH_ENTRY(insert)(t, keys[i], strlen(keys[i]), (void*)i);
|
||||
|
@ -83,9 +83,9 @@ START_TEST(lhtableTest)
|
|||
|
||||
}
|
||||
|
||||
for(long i = 0; i < NUM_ENTRIES; i+=2) {
|
||||
for(int64_t i = 0; i < NUM_ENTRIES; i+=2) {
|
||||
char * key;
|
||||
asprintf(&key, "--> %ld <--\n", i);
|
||||
asprintf(&key, "--> %lld <--\n", i);
|
||||
|
||||
assert((void*)i == LH_ENTRY(find)(t, key, strlen(key)));
|
||||
LH_ENTRY(remove)(t, keys[i], strlen(keys[i]));
|
||||
|
@ -102,12 +102,12 @@ START_TEST(lhtableTest)
|
|||
|
||||
} END_TEST
|
||||
|
||||
long myrandom(long x) {
|
||||
int64_t myrandom(int64_t x) {
|
||||
double xx = x;
|
||||
double r = random();
|
||||
double max = ((long)RAND_MAX)+1;
|
||||
double max = ((int64_t)RAND_MAX)+1;
|
||||
max /= xx;
|
||||
return (long)((r/max));
|
||||
return (int64_t)((r/max));
|
||||
}
|
||||
|
||||
|
||||
|
@ -145,8 +145,8 @@ START_TEST(lhtableRandomized) {
|
|||
int numSets = myrandom(MAXSETS);
|
||||
int* setLength = malloc(numSets * sizeof(int));
|
||||
int** sets = malloc(numSets * sizeof(int*));
|
||||
long nextVal = 1;
|
||||
long eventCount = 0;
|
||||
int64_t nextVal = 1;
|
||||
int64_t eventCount = 0;
|
||||
|
||||
int* setNextAlloc = calloc(numSets, sizeof(int));
|
||||
int* setNextDel = calloc(numSets, sizeof(int));
|
||||
|
@ -163,7 +163,7 @@ START_TEST(lhtableRandomized) {
|
|||
}
|
||||
|
||||
eventCount = myrandom(eventCount * 4);
|
||||
printf("Running %ld events.\n", eventCount);
|
||||
printf("Running %lld events.\n", eventCount);
|
||||
|
||||
for(int iii = 0; iii < eventCount; iii++) {
|
||||
int eventType = myrandom(3); // 0 = insert; 1 = read; 2 = delete.
|
||||
|
@ -174,7 +174,7 @@ START_TEST(lhtableRandomized) {
|
|||
int keyInt = sets[set][setNextAlloc[set]];
|
||||
char * key = itoa(keyInt);
|
||||
assert(!LH_ENTRY(find)(t, key, strlen(key)+1));
|
||||
LH_ENTRY(insert)(t, key, strlen(key)+1, (void*)(long)keyInt);
|
||||
LH_ENTRY(insert)(t, key, strlen(key)+1, (void*)(int64_t)keyInt);
|
||||
// printf("i %d\n", keyInt);
|
||||
assert(LH_ENTRY(find)(t, key, strlen(key)+1));
|
||||
free(key);
|
||||
|
@ -190,12 +190,12 @@ START_TEST(lhtableRandomized) {
|
|||
setNextRead[set] = setNextDel[set];
|
||||
}
|
||||
assert(setNextRead[set] < setNextAlloc[set] && setNextRead[set] >= setNextDel[set]);
|
||||
long keyInt = sets[set][setNextRead[set]];
|
||||
int64_t keyInt = sets[set][setNextRead[set]];
|
||||
char * key = itoa(keyInt);
|
||||
long fret = (long)LH_ENTRY(find)(t, key, strlen(key)+1);
|
||||
int64_t fret = (int64_t)LH_ENTRY(find)(t, key, strlen(key)+1);
|
||||
assert(keyInt == fret);
|
||||
assert(keyInt == (long)LH_ENTRY(insert)(t, key, strlen(key)+1, (void*)(keyInt+1)));
|
||||
assert(keyInt+1 == (long)LH_ENTRY(insert)(t, key, strlen(key)+1, (void*)keyInt));
|
||||
assert(keyInt == (int64_t)LH_ENTRY(insert)(t, key, strlen(key)+1, (void*)(keyInt+1)));
|
||||
assert(keyInt+1 == (int64_t)LH_ENTRY(insert)(t, key, strlen(key)+1, (void*)keyInt));
|
||||
free(key);
|
||||
}
|
||||
break;
|
||||
|
@ -203,9 +203,9 @@ START_TEST(lhtableRandomized) {
|
|||
if(setNextAlloc[set] != setNextDel[set]) {
|
||||
int keyInt = sets[set][setNextDel[set]];
|
||||
char * key = itoa(keyInt);
|
||||
assert((long)keyInt == (long)LH_ENTRY(find) (t, key, strlen(key)+1));
|
||||
assert((long)keyInt == (long)LH_ENTRY(remove)(t, key, strlen(key)+1));
|
||||
assert((long)0 == (long)LH_ENTRY(find)(t, key, strlen(key)+1));
|
||||
assert((int64_t)keyInt == (int64_t)LH_ENTRY(find) (t, key, strlen(key)+1));
|
||||
assert((int64_t)keyInt == (int64_t)LH_ENTRY(remove)(t, key, strlen(key)+1));
|
||||
assert((int64_t)0 == (int64_t)LH_ENTRY(find)(t, key, strlen(key)+1));
|
||||
// printf("d %d\n", keyInt);
|
||||
free(key);
|
||||
setNextDel[set]++;
|
||||
|
|
|
@ -51,7 +51,7 @@ terms specified in this license.
|
|||
long myrandom(long x) {
|
||||
double xx = x;
|
||||
double r = random();
|
||||
double max = ((long)RAND_MAX)+1;
|
||||
double max = ((uint64_t)RAND_MAX)+1;
|
||||
max /= xx;
|
||||
return (long)((r/max));
|
||||
}
|
||||
|
|
|
@ -13,38 +13,38 @@ static char * logEntryToString(const LogEntry * le) {
|
|||
case UPDATELOG:
|
||||
{
|
||||
recordid rid = le->contents.clr.rid;
|
||||
asprintf(&ret, "UPDATE\tlsn=%9ld\tprevlsn=%9ld\txid=%4d\trid={%8d %5d %5lld}\tfuncId=%3d\targSize=%9d\n", le->LSN, le->prevLSN, le->xid,
|
||||
asprintf(&ret, "UPDATE\tlsn=%9lld\tprevlsn=%9lld\txid=%4d\trid={%8d %5d %5lld}\tfuncId=%3d\targSize=%9d\n", le->LSN, le->prevLSN, le->xid,
|
||||
rid.page, rid.slot, (long long int)rid.size, le->contents.update.funcID, le->contents.update.argSize );
|
||||
|
||||
}
|
||||
break;
|
||||
case XBEGIN:
|
||||
{
|
||||
asprintf(&ret, "BEGIN\tlsn=%9ld\tprevlsn=%9ld\txid=%4d\n", le->LSN, le->prevLSN, le->xid);
|
||||
asprintf(&ret, "BEGIN\tlsn=%9lld\tprevlsn=%9lld\txid=%4d\n", le->LSN, le->prevLSN, le->xid);
|
||||
}
|
||||
break;
|
||||
case XCOMMIT:
|
||||
{
|
||||
asprintf(&ret, "COMMIT\tlsn=%9ld\tprevlsn=%9ld\txid=%4d\n", le->LSN, le->prevLSN, le->xid);
|
||||
asprintf(&ret, "COMMIT\tlsn=%9lld\tprevlsn=%9lld\txid=%4d\n", le->LSN, le->prevLSN, le->xid);
|
||||
|
||||
}
|
||||
break;
|
||||
case XABORT:
|
||||
{
|
||||
asprintf(&ret, "ABORT\tlsn=%9ld\tprevlsn=%9ld\txid=%4d\n", le->LSN, le->prevLSN, le->xid);
|
||||
asprintf(&ret, "ABORT\tlsn=%9lld\tprevlsn=%9lld\txid=%4d\n", le->LSN, le->prevLSN, le->xid);
|
||||
|
||||
}
|
||||
break;
|
||||
case XEND:
|
||||
{
|
||||
asprintf(&ret, "END \tlsn=%9ld\tprevlsn=%9ld\txid=%4d\n", le->LSN, le->prevLSN, le->xid);
|
||||
asprintf(&ret, "END \tlsn=%9lld\tprevlsn=%9lld\txid=%4d\n", le->LSN, le->prevLSN, le->xid);
|
||||
}
|
||||
break;
|
||||
case CLRLOG:
|
||||
{
|
||||
recordid rid = le->contents.clr.rid;
|
||||
asprintf(&ret, "CLR \tlsn=%9ld\tprevlsn=%9ld\txid=%4d\trid={%8d %5d %5lld}\tthisUpdateLSN=%9ld\tundoNextLSN=%9ld\n", le->LSN, le->prevLSN, le->xid,
|
||||
rid.page, rid.slot, (long long int) rid.size, (long int)le->contents.clr.thisUpdateLSN, (long int)le->contents.clr.undoNextLSN );
|
||||
asprintf(&ret, "CLR \tlsn=%9lld\tprevlsn=%9lld\txid=%4d\trid={%8d %5d %5lld}\tthisUpdateLSN=%9lld\tundoNextLSN=%9lld\n", le->LSN, le->prevLSN, le->xid,
|
||||
rid.page, rid.slot, (long long int) rid.size, le->contents.clr.thisUpdateLSN, le->contents.clr.undoNextLSN );
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue