[Groonga-mysql-commit] mroonga/mroonga [fix-for-visual-studio] upgrade mrn_flush_logs. now require grn_ctx as parameter.

Back to archive index

Tetsuro IKEDA null+****@clear*****
Thu Oct 4 10:19:06 JST 2012


Tetsuro IKEDA	2009-06-24 16:51:27 +0900 (Wed, 24 Jun 2009)

  New Revision: 9e567113f4fb764b29cf772fbc36df9020ec8c86
  https://github.com/mroonga/mroonga/commit/9e567113f4fb764b29cf772fbc36df9020ec8c86

  Log:
    upgrade mrn_flush_logs. now require grn_ctx as parameter.

  Modified files:
    src/driver.c
    src/driver.h
    src/ha_groonga.cc

  Modified: src/driver.c (+8 -8)
===================================================================
--- src/driver.c    2009-06-24 15:49:50 +0900 (47f8cf2)
+++ src/driver.c    2009-06-24 16:51:27 +0900 (05eec47)
@@ -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;
 }

  Modified: src/driver.h (+1 -1)
===================================================================
--- src/driver.h    2009-06-24 15:49:50 +0900 (731f135)
+++ src/driver.h    2009-06-24 16:51:27 +0900 (ad2c734)
@@ -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);

  Modified: src/ha_groonga.cc (+5 -1)
===================================================================
--- src/ha_groonga.cc    2009-06-24 15:49:50 +0900 (adc58fc)
+++ src/ha_groonga.cc    2009-06-24 16:51:27 +0900 (585f373)
@@ -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)
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-mysql-commit mailing list
Back to archive index