[Groonga-commit] pgroonga/pgroonga at 8575299 [master] Ensure applying changed log path

Back to archive index

Kouhei Sutou null+****@clear*****
Sun Feb 5 21:43:02 JST 2017


Kouhei Sutou	2017-02-05 21:43:02 +0900 (Sun, 05 Feb 2017)

  New Revision: 857529907c3b06c580b8c69bd7866d0de5eb2ced
  https://github.com/pgroonga/pgroonga/commit/857529907c3b06c580b8c69bd7866d0de5eb2ced

  Message:
    Ensure applying changed log path

  Modified files:
    src/pgrn-variables.c
    src/pgroonga.c
    src/pgroonga.h

  Modified: src/pgrn-variables.c (+10 -0)
===================================================================
--- src/pgrn-variables.c    2017-01-26 00:14:31 +0900 (35db411)
+++ src/pgrn-variables.c    2017-02-05 21:43:02 +0900 (88d82b6)
@@ -120,6 +120,11 @@ PGrnLogPathAssignRaw(const char *new_value)
 	{
 		grn_default_logger_set_path(new_value);
 	}
+
+	if (PGrnGroongaInitialized) {
+		grn_ctx *ctx = &PGrnContext;
+		grn_logger_reopen(ctx);
+	}
 }
 
 #ifdef PGRN_IS_GREENPLUM
@@ -161,6 +166,11 @@ PGrnQueryLogPathAssignRaw(const char *new_value)
 	{
 		grn_default_query_logger_set_path(new_value);
 	}
+
+	if (PGrnGroongaInitialized) {
+		grn_ctx *ctx = &PGrnContext;
+		grn_query_logger_reopen(ctx);
+	}
 }
 
 #ifdef PGRN_IS_GREENPLUM

  Modified: src/pgroonga.c (+7 -0)
===================================================================
--- src/pgroonga.c    2017-01-26 00:14:31 +0900 (f513e46)
+++ src/pgroonga.c    2017-02-05 21:43:02 +0900 (65cb319)
@@ -70,6 +70,7 @@
 PG_MODULE_MAGIC;
 
 static bool PGrnInitialized = false;
+bool PGrnGroongaInitialized = false;
 
 typedef struct PGrnBuildStateData
 {
@@ -314,6 +315,9 @@ PGrnOnProcExit(int code, Datum arg)
 	}
 
 	grn_fin();
+
+	PGrnGroongaInitialized = false;
+	PGrnInitialized = false;
 }
 
 static void
@@ -376,6 +380,7 @@ _PG_init(void)
 				 errmsg("pgroonga: already tried to initialize and failed")));
 
 	PGrnInitialized = true;
+	PGrnGroongaInitialized = false;
 
 	PGrnInitializeVariables();
 
@@ -397,6 +402,8 @@ _PG_init(void)
 				(errcode(ERRCODE_SYSTEM_ERROR),
 				 errmsg("pgroonga: failed to initialize Groonga context")));
 
+	PGrnGroongaInitialized = true;
+
 	ctx = &PGrnContext;
 
 	GRN_LOG(ctx, GRN_LOG_NOTICE, "pgroonga: initialize: <%s>", PGRN_VERSION);

  Modified: src/pgroonga.h (+2 -0)
===================================================================
--- src/pgroonga.h    2017-01-26 00:14:31 +0900 (7d7ce00)
+++ src/pgroonga.h    2017-02-05 21:43:02 +0900 (8a0f3ed)
@@ -55,3 +55,5 @@
 #define PGrnJSONValueLexiconNameFormat	"JSONValueLexicon%s%u_%u"
 #define PGrnLexiconNameFormat			"Lexicon%u_%u"
 #define PGrnIndexColumnName				"index"
+
+bool PGrnGroongaInitialized;
-------------- next part --------------
HTML����������������������������...
Download 



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