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

Fixed #20

git-svn-id: file:///svn/tokudb@720 c7de825b-a66e-492c-adef-691d508d4ae1
parent c6c1af84
#include <arpa/inet.h>
#include <ctype.h> #include <ctype.h>
#include <unistd.h> #include <unistd.h>
#include <dirent.h> #include <dirent.h>
...@@ -54,6 +55,8 @@ int tokulogger_create_and_open_logger (const char *directory, TOKULOGGER *result ...@@ -54,6 +55,8 @@ int tokulogger_create_and_open_logger (const char *directory, TOKULOGGER *result
return tokulogger_log_bytes(result, 0, ""); return tokulogger_log_bytes(result, 0, "");
} }
int log_format_version=0;
int tokulogger_log_bytes(TOKULOGGER logger, int nbytes, void *bytes) { int tokulogger_log_bytes(TOKULOGGER logger, int nbytes, void *bytes) {
int r; int r;
//fprintf(stderr, "%s:%d logging %d bytes\n", __FILE__, __LINE__, nbytes); //fprintf(stderr, "%s:%d logging %d bytes\n", __FILE__, __LINE__, nbytes);
...@@ -65,6 +68,9 @@ int tokulogger_log_bytes(TOKULOGGER logger, int nbytes, void *bytes) { ...@@ -65,6 +68,9 @@ int tokulogger_log_bytes(TOKULOGGER logger, int nbytes, void *bytes) {
logger->fd = creat(fname, O_EXCL | 0700); logger->fd = creat(fname, O_EXCL | 0700);
if (logger->fd==-1) return errno; if (logger->fd==-1) return errno;
logger->next_log_file_number++; logger->next_log_file_number++;
int version_l = htonl(log_format_version);
r = write(logger->fd, "tokulogg", 8); if (r!=8) return errno;
r = write(logger->fd, &version_l, 4); if (r!=4) return errno;
} }
if (logger->n_in_buf + nbytes > LOGGER_BUF_SIZE) { if (logger->n_in_buf + nbytes > LOGGER_BUF_SIZE) {
struct iovec v[2]; struct iovec v[2];
......
...@@ -29,6 +29,8 @@ struct logtype { ...@@ -29,6 +29,8 @@ struct logtype {
// In the fields, don't mention the command, the LSN, the CRC or the trailing LEN. // In the fields, don't mention the command, the LSN, the CRC or the trailing LEN.
int logformat_version_number = 0;
const struct logtype logtypes[] = { const struct logtype logtypes[] = {
{"commit", 'C', FA{{"TXNID", "txnid"},NULLFIELD}}, {"commit", 'C', FA{{"TXNID", "txnid"},NULLFIELD}},
{"delete", 'D', FA{{"FILENUM", "filenum"}, {"delete", 'D', FA{{"FILENUM", "filenum"},
......
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