Fixed up some return values; tests now pass with assert disabled.
This commit is contained in:
parent
eec80a0e38
commit
258dd5f4c4
5 changed files with 96 additions and 71 deletions
|
@ -41,7 +41,8 @@ int main(int argc, char** argv) {
|
||||||
|
|
||||||
for(i = 0; i < count ; i++) {
|
for(i = 0; i < count ; i++) {
|
||||||
int j;
|
int j;
|
||||||
assert(TlogicalHashLookup(xid, hash, &i, sizeof(int), &j, sizeof(int)));
|
int exists = TlogicalHashLookup(xid, hash, &i, sizeof(int), &j, sizeof(int));
|
||||||
|
assert(exists);
|
||||||
assert(i == j);
|
assert(i == j);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,12 +66,16 @@ terms specified in this license.
|
||||||
|
|
||||||
/* @define error codes
|
/* @define error codes
|
||||||
*/
|
*/
|
||||||
#define OUT_OF_MEM 1
|
#define LLADD_DEADLOCK -1
|
||||||
#define FILE_OPRN_ERROR 2
|
#define LLADD_NO_MEM -2
|
||||||
#define FILE_READ_ERROR 3
|
#define LLADD_IO_ERROR -3
|
||||||
#define FILE_WRITE_ERROR 4
|
#define LLADD_INTERNAL_ERROR -4
|
||||||
#define FILE_WRITE_OPEN_ERROR 5
|
|
||||||
#define MEM_WRITE_ERROR 6
|
//#define FILE_OPRN_ERROR 2
|
||||||
|
//#define FILE_READ_ERROR 3
|
||||||
|
//#define FILE_WRITE_ERROR 4
|
||||||
|
//#define FILE_WRITE_OPEN_ERROR 5
|
||||||
|
//#define MEM_WRITE_ERROR 6
|
||||||
|
|
||||||
#define PAGE_SIZE 4096
|
#define PAGE_SIZE 4096
|
||||||
|
|
||||||
|
|
|
@ -146,6 +146,7 @@ int openLogWriter() {
|
||||||
assert(!ret); */
|
assert(!ret); */
|
||||||
char * buffer = malloc(BUFSIZE);
|
char * buffer = malloc(BUFSIZE);
|
||||||
|
|
||||||
|
if(!buffer) { return LLADD_NO_MEM; }
|
||||||
|
|
||||||
int logFD = open (LOG_FILE, O_CREAT | O_RDWR | O_APPEND /*| O_SYNC*/, S_IRWXU | S_IRWXG | S_IRWXO);
|
int logFD = open (LOG_FILE, O_CREAT | O_RDWR | O_APPEND /*| O_SYNC*/, S_IRWXU | S_IRWXG | S_IRWXO);
|
||||||
if(logFD == -1) {
|
if(logFD == -1) {
|
||||||
|
@ -157,9 +158,9 @@ int openLogWriter() {
|
||||||
|
|
||||||
if (log==NULL) {
|
if (log==NULL) {
|
||||||
perror("Couldn't open log file");
|
perror("Couldn't open log file");
|
||||||
abort();
|
// abort();
|
||||||
/*there was an error opening this file */
|
/*there was an error opening this file */
|
||||||
return FILE_WRITE_OPEN_ERROR;
|
return LLADD_IO_ERROR; //FILE_WRITE_OPEN_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
setbuffer(log, buffer, BUFSIZE);
|
setbuffer(log, buffer, BUFSIZE);
|
||||||
|
@ -200,8 +201,8 @@ int openLogWriter() {
|
||||||
int nmemb = fwrite(&zero, sizeof(lsn_t), 1, log);
|
int nmemb = fwrite(&zero, sizeof(lsn_t), 1, log);
|
||||||
if(nmemb != 1) {
|
if(nmemb != 1) {
|
||||||
perror("Couldn't start new log file!");
|
perror("Couldn't start new log file!");
|
||||||
assert(0);
|
// assert(0);
|
||||||
return FILE_WRITE_OPEN_ERROR;
|
return LLADD_IO_ERROR; //FILE_WRITE_OPEN_ERROR;
|
||||||
}
|
}
|
||||||
global_offset = 0;
|
global_offset = 0;
|
||||||
} else {
|
} else {
|
||||||
|
@ -330,7 +331,7 @@ static int flushLog() {
|
||||||
if(nmemb != 1) {
|
if(nmemb != 1) {
|
||||||
perror("writeLog couldn't write next log entry!");
|
perror("writeLog couldn't write next log entry!");
|
||||||
assert(0);
|
assert(0);
|
||||||
return FILE_WRITE_ERROR;
|
return LLADD_IO_ERROR; // FILE_WRITE_ERROR;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -408,9 +409,8 @@ static LogEntry * readLogEntry() {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if(ferror(log)) {
|
if(ferror(log)) {
|
||||||
perror("Error reading log!");
|
perror("Error reading log");
|
||||||
assert(0);
|
return (LogEntry*)LLADD_IO_ERROR;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -428,23 +428,24 @@ static LogEntry * readLogEntry() {
|
||||||
if(ferror(log)) {
|
if(ferror(log)) {
|
||||||
perror("Error reading log!");
|
perror("Error reading log!");
|
||||||
free(ret);
|
free(ret);
|
||||||
assert(0);
|
return (LogEntry*)LLADD_IO_ERROR;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
assert(0);
|
perror("Unknown error in readLogEntry");
|
||||||
free(ret);
|
return (LogEntry*)LLADD_IO_ERROR;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
entrySize = sizeofLogEntry(ret);
|
entrySize = sizeofLogEntry(ret);
|
||||||
|
|
||||||
|
// This sanity check makes no sense -- sizeOfLogEntry() has nothing
|
||||||
|
// to do with the number of bytes read. */
|
||||||
|
|
||||||
/** Sanity check -- Did we get the whole entry? */
|
/** Sanity check -- Did we get the whole entry? */
|
||||||
if(size < entrySize) {
|
// if(size < entrySize) {
|
||||||
return 0;
|
/* Read partial entry. */
|
||||||
}
|
// free(ret);
|
||||||
|
// return 0;
|
||||||
|
// }
|
||||||
|
|
||||||
assert(size == entrySize);
|
assert(size == entrySize);
|
||||||
|
|
||||||
|
@ -454,15 +455,6 @@ static LogEntry * readLogEntry() {
|
||||||
LogEntry * readLSNEntry(lsn_t LSN) {
|
LogEntry * readLSNEntry(lsn_t LSN) {
|
||||||
LogEntry * ret;
|
LogEntry * ret;
|
||||||
|
|
||||||
/* We would need a lock to support this operation, and that's not worth it.
|
|
||||||
if(!writeLogEntryIsReady) {
|
|
||||||
if(LSN > maxLSNEncountered) {
|
|
||||||
maxLSNEncountered = LSN;
|
|
||||||
}
|
|
||||||
} */
|
|
||||||
|
|
||||||
/* readlock(log_read_lock); */
|
|
||||||
|
|
||||||
/* Irritating overhead; two mutex acquires to do a read. */
|
/* Irritating overhead; two mutex acquires to do a read. */
|
||||||
readlock(log_read_lock, 200);
|
readlock(log_read_lock, 200);
|
||||||
|
|
||||||
|
@ -478,7 +470,6 @@ LogEntry * readLSNEntry(lsn_t LSN) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int truncateLog(lsn_t LSN) {
|
int truncateLog(lsn_t LSN) {
|
||||||
FILE *tmpLog;
|
FILE *tmpLog;
|
||||||
|
|
||||||
|
@ -502,10 +493,10 @@ int truncateLog(lsn_t LSN) {
|
||||||
tmpLog = fopen(LOG_FILE_SCRATCH, "w+"); /* w+ = truncate, and open for writing. */
|
tmpLog = fopen(LOG_FILE_SCRATCH, "w+"); /* w+ = truncate, and open for writing. */
|
||||||
|
|
||||||
if (tmpLog==NULL) {
|
if (tmpLog==NULL) {
|
||||||
assert(0);
|
|
||||||
/*there was an error opening this file */
|
/*there was an error opening this file */
|
||||||
|
pthread_mutex_unlock(&truncateLog_mutex);
|
||||||
perror("logTruncate() couldn't create scratch log file!");
|
perror("logTruncate() couldn't create scratch log file!");
|
||||||
return FILE_WRITE_OPEN_ERROR;
|
return LLADD_IO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Need to write LSN - sizeof(lsn_t) to make room for the offset in
|
/* Need to write LSN - sizeof(lsn_t) to make room for the offset in
|
||||||
|
@ -553,26 +544,30 @@ int truncateLog(lsn_t LSN) {
|
||||||
fclose(tmpLog);
|
fclose(tmpLog);
|
||||||
|
|
||||||
if(rename(LOG_FILE_SCRATCH, LOG_FILE)) {
|
if(rename(LOG_FILE_SCRATCH, LOG_FILE)) {
|
||||||
perror("Log truncation failed!");
|
writeunlock(log_read_lock);
|
||||||
abort();
|
pthread_mutex_unlock(&log_write_mutex);
|
||||||
|
pthread_mutex_unlock(&truncateLog_mutex);
|
||||||
|
|
||||||
|
perror("Error replacing old log file with new log file");
|
||||||
|
return LLADD_IO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
log = fopen(LOG_FILE, "a+");
|
log = fopen(LOG_FILE, "a+");
|
||||||
if (log==NULL) {
|
if (log==NULL) {
|
||||||
abort();
|
|
||||||
/*there was an error opening this file */
|
writeunlock(log_read_lock);
|
||||||
return FILE_WRITE_OPEN_ERROR;
|
pthread_mutex_unlock(&log_write_mutex);
|
||||||
|
pthread_mutex_unlock(&truncateLog_mutex);
|
||||||
|
|
||||||
|
perror("Couldn't reopen log after truncate");
|
||||||
|
return LLADD_IO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* myFseek(log, 0, SEEK_SET); */
|
global_offset = LSN - sizeof(lsn_t);
|
||||||
global_offset = LSN - sizeof(lsn_t); /*= fread(&global_offset, sizeof(lsn_t), 1, log);*/
|
|
||||||
/*assert(count == 1); */
|
|
||||||
|
|
||||||
/* funlockfile(log); */
|
|
||||||
writeunlock(log_read_lock);
|
writeunlock(log_read_lock);
|
||||||
pthread_mutex_unlock(&log_write_mutex);
|
pthread_mutex_unlock(&log_write_mutex);
|
||||||
|
|
||||||
pthread_mutex_unlock(&truncateLog_mutex);
|
pthread_mutex_unlock(&truncateLog_mutex);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -71,9 +71,11 @@ START_TEST(linearHashNTAtest)
|
||||||
val.page = i * NUM_ENTRIES;
|
val.page = i * NUM_ENTRIES;
|
||||||
val.slot = val.page * NUM_ENTRIES;
|
val.slot = val.page * NUM_ENTRIES;
|
||||||
val.size = val.slot * NUM_ENTRIES;
|
val.size = val.slot * NUM_ENTRIES;
|
||||||
assert(-1 == ThashLookup(xid, hashHeader, (byte*)&i, sizeof(int), (byte**)&val2));
|
int found = ThashLookup(xid, hashHeader, (byte*)&i, sizeof(int), (byte**)&val2);
|
||||||
|
assert(-1 == found);
|
||||||
ThashInsert(xid, hashHeader, (byte*)&i, sizeof(int), (byte*)&val, sizeof(recordid));
|
ThashInsert(xid, hashHeader, (byte*)&i, sizeof(int), (byte*)&val, sizeof(recordid));
|
||||||
assert(sizeof(recordid) == ThashLookup(xid, hashHeader, (byte*)&i, sizeof(int), (byte**)&val2));
|
found = ThashLookup(xid, hashHeader, (byte*)&i, sizeof(int), (byte**)&val2);
|
||||||
|
assert(sizeof(recordid) == found);
|
||||||
assert(val2->page == i * NUM_ENTRIES);
|
assert(val2->page == i * NUM_ENTRIES);
|
||||||
assert(val2->slot == val2->page * NUM_ENTRIES);
|
assert(val2->slot == val2->page * NUM_ENTRIES);
|
||||||
assert(val2->size == val2->slot * NUM_ENTRIES);
|
assert(val2->size == val2->slot * NUM_ENTRIES);
|
||||||
|
@ -88,11 +90,15 @@ START_TEST(linearHashNTAtest)
|
||||||
if(!(i % (NUM_ENTRIES/10))) {
|
if(!(i % (NUM_ENTRIES/10))) {
|
||||||
printf("-"); fflush(stdout);
|
printf("-"); fflush(stdout);
|
||||||
}
|
}
|
||||||
assert(sizeof(recordid) == ThashLookup(xid, hashHeader, (byte*)&i, sizeof(int), (byte**)&val2));
|
int found = ThashLookup(xid, hashHeader, (byte*)&i, sizeof(int), (byte**)&val2);
|
||||||
|
assert(sizeof(recordid) == found);
|
||||||
free(val2);
|
free(val2);
|
||||||
assert(ThashRemove(xid, hashHeader, (byte*)&i, sizeof(int)));
|
found = ThashRemove(xid, hashHeader, (byte*)&i, sizeof(int));
|
||||||
assert(-1==ThashLookup(xid, hashHeader, (byte*)&i, sizeof(int), (byte**)&val2));
|
assert(found);
|
||||||
assert(!ThashRemove(xid, hashHeader, (byte*)&i, sizeof(int)));
|
found = ThashLookup(xid, hashHeader, (byte*)&i, sizeof(int), (byte**)&val2);
|
||||||
|
assert(-1==found);
|
||||||
|
found = ThashRemove(xid, hashHeader, (byte*)&i, sizeof(int));
|
||||||
|
assert(!found);
|
||||||
}
|
}
|
||||||
printf("\nabort()\n"); fflush(stdout);
|
printf("\nabort()\n"); fflush(stdout);
|
||||||
Tabort(xid);
|
Tabort(xid);
|
||||||
|
@ -101,7 +107,8 @@ START_TEST(linearHashNTAtest)
|
||||||
if(!(i % (NUM_ENTRIES/10))) {
|
if(!(i % (NUM_ENTRIES/10))) {
|
||||||
printf("+"); fflush(stdout);
|
printf("+"); fflush(stdout);
|
||||||
}
|
}
|
||||||
assert(sizeof(recordid) == ThashLookup(xid, hashHeader, (byte*)&i, sizeof(int), (byte**)&val2));
|
int found = ThashLookup(xid, hashHeader, (byte*)&i, sizeof(int), (byte**)&val2);
|
||||||
|
assert(sizeof(recordid) == found);
|
||||||
assert(val2->page == i * NUM_ENTRIES);
|
assert(val2->page == i * NUM_ENTRIES);
|
||||||
assert(val2->slot == val2->page * NUM_ENTRIES);
|
assert(val2->slot == val2->page * NUM_ENTRIES);
|
||||||
assert(val2->size == val2->slot * NUM_ENTRIES);
|
assert(val2->size == val2->slot * NUM_ENTRIES);
|
||||||
|
@ -131,7 +138,8 @@ START_TEST(linearHashNTAVariableSizetest)
|
||||||
val.slot = val.page * NUM_ENTRIES;
|
val.slot = val.page * NUM_ENTRIES;
|
||||||
val.size = val.slot * NUM_ENTRIES;
|
val.size = val.slot * NUM_ENTRIES;
|
||||||
val2 = 0;
|
val2 = 0;
|
||||||
assert(-1 == ThashLookup(xid, hashHeader, (byte*)&i, sizeof(int), (byte**)&val2));
|
int found = ThashLookup(xid, hashHeader, (byte*)&i, sizeof(int), (byte**)&val2);
|
||||||
|
assert(-1 == found);
|
||||||
ThashInsert(xid, hashHeader, (byte*)&i, sizeof(int), (byte*)&val, sizeof(recordid));
|
ThashInsert(xid, hashHeader, (byte*)&i, sizeof(int), (byte*)&val, sizeof(recordid));
|
||||||
val2 =0;
|
val2 =0;
|
||||||
int ret = ThashLookup(xid, hashHeader, (byte*)&i, sizeof(int), (byte**)&val2);
|
int ret = ThashLookup(xid, hashHeader, (byte*)&i, sizeof(int), (byte**)&val2);
|
||||||
|
@ -150,11 +158,15 @@ START_TEST(linearHashNTAVariableSizetest)
|
||||||
if(!(i % (NUM_ENTRIES/10))) {
|
if(!(i % (NUM_ENTRIES/10))) {
|
||||||
printf("-"); fflush(stdout);
|
printf("-"); fflush(stdout);
|
||||||
}
|
}
|
||||||
assert(sizeof(recordid) == ThashLookup(xid, hashHeader, (byte*)&i, sizeof(int), (byte**)&val2));
|
int found = ThashLookup(xid, hashHeader, (byte*)&i, sizeof(int), (byte**)&val2);
|
||||||
|
assert(sizeof(recordid) == found);
|
||||||
free(val2);
|
free(val2);
|
||||||
assert(ThashRemove(xid, hashHeader, (byte*)&i, sizeof(int)));
|
found = ThashRemove(xid, hashHeader, (byte*)&i, sizeof(int));
|
||||||
assert(-1==ThashLookup(xid, hashHeader, (byte*)&i, sizeof(int), (byte**)&val2));
|
assert(found);
|
||||||
assert(!ThashRemove(xid, hashHeader, (byte*)&i, sizeof(int)));
|
found = ThashLookup(xid, hashHeader, (byte*)&i, sizeof(int), (byte**)&val2);
|
||||||
|
assert(-1==found);
|
||||||
|
found = ThashRemove(xid, hashHeader, (byte*)&i, sizeof(int));
|
||||||
|
assert(!found);
|
||||||
}
|
}
|
||||||
printf("\nabort()\n"); fflush(stdout);
|
printf("\nabort()\n"); fflush(stdout);
|
||||||
Tabort(xid);
|
Tabort(xid);
|
||||||
|
@ -210,9 +222,12 @@ void * worker(void* arg) {
|
||||||
for(i = 0; i < NUM_T_ENTRIES; i+=10) {
|
for(i = 0; i < NUM_T_ENTRIES; i+=10) {
|
||||||
int * value;
|
int * value;
|
||||||
recordid key = makekey(thread,i);
|
recordid key = makekey(thread,i);
|
||||||
assert(ThashRemove(xid, hash, (byte*)&key, sizeof(recordid)));
|
int found = ThashRemove(xid, hash, (byte*)&key, sizeof(recordid));
|
||||||
assert(-1==ThashLookup(xid, hash, (byte*)&key, sizeof(recordid), (byte**)&value));
|
assert(found);
|
||||||
assert(!ThashRemove(xid, hash, (byte*)&key, sizeof(recordid)));
|
found = ThashLookup(xid, hash, (byte*)&key, sizeof(recordid), (byte**)&value);
|
||||||
|
assert(-1==found);
|
||||||
|
found = ThashRemove(xid, hash, (byte*)&key, sizeof(recordid));
|
||||||
|
assert(!found);
|
||||||
}
|
}
|
||||||
|
|
||||||
Tabort(xid);
|
Tabort(xid);
|
||||||
|
@ -221,7 +236,8 @@ void * worker(void* arg) {
|
||||||
for(i = 0; i < NUM_T_ENTRIES; i+=10) {
|
for(i = 0; i < NUM_T_ENTRIES; i+=10) {
|
||||||
recordid key = makekey(thread,i);
|
recordid key = makekey(thread,i);
|
||||||
int * value;
|
int * value;
|
||||||
assert(sizeof(int) == ThashLookup(xid, hash, (byte*)&key, sizeof(recordid), (byte**)&value));
|
int found = ThashLookup(xid, hash, (byte*)&key, sizeof(recordid), (byte**)&value);
|
||||||
|
assert(sizeof(int) == found);
|
||||||
assert(*value == i + thread * NUM_T_ENTRIES);
|
assert(*value == i + thread * NUM_T_ENTRIES);
|
||||||
free (value);
|
free (value);
|
||||||
}
|
}
|
||||||
|
@ -258,7 +274,8 @@ START_TEST(linearHashNTAIteratortest) {
|
||||||
|
|
||||||
for(i = 0; i < NUM_ENTRIES; i++) {
|
for(i = 0; i < NUM_ENTRIES; i++) {
|
||||||
recordid value = makekey(0, i);
|
recordid value = makekey(0, i);
|
||||||
assert(!ThashInsert(xid, hash, (byte*)&i, sizeof(int), (byte*)&value, sizeof(recordid)));
|
int found = ThashInsert(xid, hash, (byte*)&i, sizeof(int), (byte*)&value, sizeof(recordid));
|
||||||
|
assert(!found);
|
||||||
}
|
}
|
||||||
|
|
||||||
int seen[NUM_ENTRIES];
|
int seen[NUM_ENTRIES];
|
||||||
|
|
|
@ -67,9 +67,11 @@ START_TEST(linkedListNTAtest)
|
||||||
val.page = i * 1000;
|
val.page = i * 1000;
|
||||||
val.slot = val.page * 1000;
|
val.slot = val.page * 1000;
|
||||||
val.size = val.slot * 1000;
|
val.size = val.slot * 1000;
|
||||||
assert(-1==TlinkedListFind(xid, linkedList, (byte*)(&i), sizeof(int), (byte**)&val2));
|
int found = TlinkedListFind(xid, linkedList, (byte*)(&i), sizeof(int), (byte**)&val2);
|
||||||
|
assert(-1==found);
|
||||||
TlinkedListInsert(xid, linkedList, (byte*)&i, sizeof(int), (byte*)&val, sizeof(recordid));
|
TlinkedListInsert(xid, linkedList, (byte*)&i, sizeof(int), (byte*)&val, sizeof(recordid));
|
||||||
assert(sizeof(recordid)==TlinkedListFind(xid, linkedList, (byte*)(&i), sizeof(int), (byte**)&val2));
|
found = TlinkedListFind(xid, linkedList, (byte*)(&i), sizeof(int), (byte**)&val2);
|
||||||
|
assert(sizeof(recordid)==found);
|
||||||
assert(!memcmp(&val, val2, sizeof(recordid)));
|
assert(!memcmp(&val, val2, sizeof(recordid)));
|
||||||
free(val2);
|
free(val2);
|
||||||
}
|
}
|
||||||
|
@ -79,20 +81,26 @@ START_TEST(linkedListNTAtest)
|
||||||
xid = Tbegin();
|
xid = Tbegin();
|
||||||
for(i = 0; i < 1000; i+=10) {
|
for(i = 0; i < 1000; i+=10) {
|
||||||
recordid * val2 = NULL;
|
recordid * val2 = NULL;
|
||||||
assert(sizeof(recordid)==TlinkedListFind(xid, linkedList, (byte*)(&i), sizeof(int), (byte**)&val2));
|
int found = TlinkedListFind(xid, linkedList, (byte*)(&i), sizeof(int), (byte**)&val2);
|
||||||
|
assert(sizeof(recordid)==found);
|
||||||
assert(val2->page == i * 1000);
|
assert(val2->page == i * 1000);
|
||||||
assert(val2->slot == i * 1000 * 1000);
|
assert(val2->slot == i * 1000 * 1000);
|
||||||
assert(val2->size == i * 1000 * 1000 * 1000);
|
assert(val2->size == i * 1000 * 1000 * 1000);
|
||||||
free(val2);
|
free(val2);
|
||||||
assert(TlinkedListRemove(xid, linkedList, (byte*)&i, sizeof(int)));
|
|
||||||
assert(-1==TlinkedListFind(xid, linkedList, (byte*)(&i), sizeof(int), (byte**)&val2));
|
found = TlinkedListRemove(xid, linkedList, (byte*)&i, sizeof(int));
|
||||||
assert(!TlinkedListRemove(xid, linkedList, (byte*)&i, sizeof(int)));
|
assert(found);
|
||||||
|
found = TlinkedListFind(xid, linkedList, (byte*)(&i), sizeof(int), (byte**)&val2);
|
||||||
|
assert(-1==found);
|
||||||
|
found = TlinkedListRemove(xid, linkedList, (byte*)&i, sizeof(int));
|
||||||
|
assert(!found);
|
||||||
}
|
}
|
||||||
Tabort(xid);
|
Tabort(xid);
|
||||||
xid = Tbegin();
|
xid = Tbegin();
|
||||||
for(i = 0; i < 1000; i++) {
|
for(i = 0; i < 1000; i++) {
|
||||||
recordid * val2;
|
recordid * val2;
|
||||||
assert(sizeof(recordid)==TlinkedListFind(xid, linkedList, (byte*)(&i), sizeof(int), (byte**)&val2));
|
int found = TlinkedListFind(xid, linkedList, (byte*)(&i), sizeof(int), (byte**)&val2);
|
||||||
|
assert(sizeof(recordid)==found);
|
||||||
assert(val2->page == i * 1000);
|
assert(val2->page == i * 1000);
|
||||||
assert(val2->slot == i * 1000 * 1000);
|
assert(val2->slot == i * 1000 * 1000);
|
||||||
assert(val2->size == i * 1000 * 1000 * 1000);
|
assert(val2->size == i * 1000 * 1000 * 1000);
|
||||||
|
|
Loading…
Reference in a new issue