static int physical_recover (smrLog * handle, recoverState * rs) { int ret; logSeqs *disk_ls = NULL; logSeqs *mem_ls = NULL; disk_ls = &rs->disk_ls; ret = log_recover (handle->disk, disk_ls); if (ret < 0) { ERRNO_POINT (); return -1; } if (handle->mem != NULL) { mem_ls = &rs->mem_ls; ret = log_recover (handle->mem, mem_ls); if (ret < 0) { ERRNO_POINT (); return -1; } } ret = physical_recover_synthesize (handle, rs); if (ret < 0) { ERRNO_POINT (); return -1; } return 0; }
struct jx_database * jx_database_create( const char *logdir ) { if(logdir) { int result = mkdir(logdir,0777); if(result<0 && errno!=EEXIST) return 0; } struct jx_database *db = malloc(sizeof(*db)); db->table = hash_table_create(0,0); db->logyear = 0; db->logday = 0; db->logfile = 0; db->last_log_time = 0; db->logdir = 0; if(logdir) { db->logdir = strdup(logdir); log_recover(db,time(0)); } return db; }