Navigation Menu

Skip to content

Commit

Permalink
upgrade mrn_flush_logs. now require grn_ctx as parameter.
Browse files Browse the repository at this point in the history
  • Loading branch information
ikdttr committed Jun 24, 2009
1 parent 7cd6fc5 commit 9e56711
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
16 changes: 8 additions & 8 deletions src/driver.c
Expand Up @@ -27,16 +27,16 @@ grn_logger_info mrn_logger_info = {
};

/* additional functions */
int mrn_flush_logs()
int mrn_flush_logs(grn_ctx *ctx)
{
MRN_TRACE;
pthread_mutex_lock(mrn_lock);
MRN_LOG(GRN_LOG_NOTICE, "logfile closed by FLUSH LOGS");
fflush(mrn_logfile);
fclose(mrn_logfile); /* reopen logfile for rotation */
mrn_logfile = fopen(mrn_logfile_name, "a");
MRN_LOG(GRN_LOG_NOTICE, "-------------------------------");
MRN_LOG(GRN_LOG_NOTICE, "logfile re-opened by FLUSH LOGS");
GRN_LOG(ctx, GRN_LOG_NOTICE, "flush logfile");
if (fflush(mrn_logfile) || fclose(mrn_logfile)
|| (mrn_logfile = fopen(mrn_logfile_name, "a")) == NULL)
{
GRN_LOG(ctx, GRN_LOG_ERROR, "cannot flush logfile");
return -1;
}
pthread_mutex_unlock(mrn_lock);
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/driver.h
Expand Up @@ -62,7 +62,7 @@ int mrn_init();
int mrn_deinit();
void mrn_logger_func(int level, const char *time, const char *title,
const char *msg, const char *location, void *func_arg);
int mrn_flush_logs();
int mrn_flush_logs(grn_ctx *ctx);
void mrn_ctx_init();
grn_obj *mrn_db_open_or_create();
mrn_table *mrn_share_get(const char *name);
Expand Down
6 changes: 5 additions & 1 deletion src/ha_groonga.cc
Expand Up @@ -80,7 +80,11 @@ handler *mrn_handler_create(handlerton *hton,

bool mrn_plugin_flush_logs(handlerton *hton)
{
return (bool) mrn_flush_logs();
grn_ctx ctx;
grn_ctx_init(&ctx,0);
mrn_flush_logs(&ctx);
grn_ctx_fin(&ctx);
return 0;
}

int mrn_plugin_init(void *p)
Expand Down

0 comments on commit 9e56711

Please sign in to comment.