Commit ad5233e0 authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul

Log fcreate

git-svn-id: file:///svn/tokudb@683 c7de825b-a66e-492c-adef-691d508d4ae1
parent 20a56541
......@@ -267,6 +267,8 @@ int tokulogger_log_fcreate (TOKUTXN txn, const char *fname, int mode) {
if (txn==0) return 0;
const int fnamelen = strlen(fname);
const int buflen = (+1 // log command
+8 // lsn
+8 // txnid
+4 // length of fname
+fnamelen
+4 // mode
......@@ -276,6 +278,9 @@ int tokulogger_log_fcreate (TOKUTXN txn, const char *fname, int mode) {
struct wbuf wbuf;
wbuf_init (&wbuf, buf, buflen);
wbuf_char (&wbuf, LT_FCREATE);
wbuf_lsn (&wbuf, txn->logger->lsn);
txn->logger->lsn.lsn++;
wbuf_txnid(&wbuf, txn->txnid64);
wbuf_bytes(&wbuf, fname, fnamelen);
wbuf_int (&wbuf, mode);
return tokulogger_finish(txn->logger, &wbuf);
......
......@@ -58,7 +58,6 @@ void transcribe_diskoff (void) {
printf(" diskoff=%lld", value);
}
void transcribe_crc32 (void) {
u_int32_t oldcrc=crc;
u_int32_t l = get_uint32();
......@@ -66,6 +65,11 @@ void transcribe_crc32 (void) {
assert(l==oldcrc);
}
void transcribe_mode (void) {
u_int32_t value = get_uint32();
printf(" mode=0%o", value);
}
void transcribe_len (void) {
u_int32_t l = get_uint32();
printf(" len=%d", l);
......@@ -127,6 +131,17 @@ int main (int argc, char *argv[]) {
printf("\n");
break;
case LT_FCREATE:
printf("FCREATE:");
transcribe_lsn();
transcribe_txnid();
transcribe_key_or_data("fname");
transcribe_mode();
transcribe_crc32();
transcribe_len();
printf("\n");
break;
case LT_COMMIT:
printf("COMMIT:");
transcribe_lsn();
......@@ -137,7 +152,7 @@ int main (int argc, char *argv[]) {
break;
default:
printf("Huh?");
fprintf(stderr, "Huh?, found command %c\n", cmd);
assert(0);
}
}
......
......@@ -20,7 +20,7 @@ static void make_db (void) {
system("rm -rf " DIR);
r=mkdir(DIR, 0777); assert(r==0);
r=db_env_create(&env, 0); assert(r==0);
r=env->open(env, DIR, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE, 0777); CKERR(r);
r=env->open(env, DIR, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, 0777); CKERR(r);
r=db_create(&db, env, 0); CKERR(r);
r=env->txn_begin(env, 0, &tid, 0); assert(r==0);
r=db->open(db, tid, "foo.db", 0, DB_BTREE, DB_CREATE, 0777); CKERR(r);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment