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) { ...@@ -267,6 +267,8 @@ int tokulogger_log_fcreate (TOKUTXN txn, const char *fname, int mode) {
if (txn==0) return 0; if (txn==0) return 0;
const int fnamelen = strlen(fname); const int fnamelen = strlen(fname);
const int buflen = (+1 // log command const int buflen = (+1 // log command
+8 // lsn
+8 // txnid
+4 // length of fname +4 // length of fname
+fnamelen +fnamelen
+4 // mode +4 // mode
...@@ -276,6 +278,9 @@ int tokulogger_log_fcreate (TOKUTXN txn, const char *fname, int mode) { ...@@ -276,6 +278,9 @@ int tokulogger_log_fcreate (TOKUTXN txn, const char *fname, int mode) {
struct wbuf wbuf; struct wbuf wbuf;
wbuf_init (&wbuf, buf, buflen); wbuf_init (&wbuf, buf, buflen);
wbuf_char (&wbuf, LT_FCREATE); 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_bytes(&wbuf, fname, fnamelen);
wbuf_int (&wbuf, mode); wbuf_int (&wbuf, mode);
return tokulogger_finish(txn->logger, &wbuf); return tokulogger_finish(txn->logger, &wbuf);
......
...@@ -58,7 +58,6 @@ void transcribe_diskoff (void) { ...@@ -58,7 +58,6 @@ void transcribe_diskoff (void) {
printf(" diskoff=%lld", value); printf(" diskoff=%lld", value);
} }
void transcribe_crc32 (void) { void transcribe_crc32 (void) {
u_int32_t oldcrc=crc; u_int32_t oldcrc=crc;
u_int32_t l = get_uint32(); u_int32_t l = get_uint32();
...@@ -66,6 +65,11 @@ void transcribe_crc32 (void) { ...@@ -66,6 +65,11 @@ void transcribe_crc32 (void) {
assert(l==oldcrc); assert(l==oldcrc);
} }
void transcribe_mode (void) {
u_int32_t value = get_uint32();
printf(" mode=0%o", value);
}
void transcribe_len (void) { void transcribe_len (void) {
u_int32_t l = get_uint32(); u_int32_t l = get_uint32();
printf(" len=%d", l); printf(" len=%d", l);
...@@ -127,6 +131,17 @@ int main (int argc, char *argv[]) { ...@@ -127,6 +131,17 @@ int main (int argc, char *argv[]) {
printf("\n"); printf("\n");
break; 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: case LT_COMMIT:
printf("COMMIT:"); printf("COMMIT:");
transcribe_lsn(); transcribe_lsn();
...@@ -137,7 +152,7 @@ int main (int argc, char *argv[]) { ...@@ -137,7 +152,7 @@ int main (int argc, char *argv[]) {
break; break;
default: default:
printf("Huh?"); fprintf(stderr, "Huh?, found command %c\n", cmd);
assert(0); assert(0);
} }
} }
......
...@@ -20,7 +20,7 @@ static void make_db (void) { ...@@ -20,7 +20,7 @@ static void make_db (void) {
system("rm -rf " DIR); system("rm -rf " DIR);
r=mkdir(DIR, 0777); assert(r==0); r=mkdir(DIR, 0777); assert(r==0);
r=db_env_create(&env, 0); 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=db_create(&db, env, 0); CKERR(r);
r=env->txn_begin(env, 0, &tid, 0); assert(r==0); 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); 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