Navigation Menu

Skip to content

Commit

Permalink
Check registered check both on create and open
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Jun 9, 2013
1 parent 4011f34 commit 6ea5245
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 14 deletions.
36 changes: 22 additions & 14 deletions ha_mroonga.cpp
Expand Up @@ -3874,6 +3874,26 @@ void ha_mroonga::ensure_database_directory()
DBUG_VOID_RETURN;
}

int ha_mroonga::ensure_normalizers_register()
{
MRN_DBUG_ENTER_METHOD();

int error = 0;
#ifdef WITH_GROONGA_NORMALIZER_MYSQL
{
grn_obj *mysql_normalizer;
mysql_normalizer = grn_ctx_get(ctx, "NormalizerMySQLGeneralCI", -1);
if (mysql_normalizer) {
grn_obj_unlink(ctx, mysql_normalizer);
} else {
grn_plugin_register(ctx, GROONGA_NORMALIZER_MYSQL_PLUGIN_NAME);
}
}
#endif

DBUG_RETURN(error);
}

int ha_mroonga::ensure_database_create(const char *name)
{
int error;
Expand Down Expand Up @@ -3919,17 +3939,7 @@ int ha_mroonga::ensure_database_create(const char *name)
}
pthread_mutex_unlock(&mrn_db_mutex);
grn_ctx_use(ctx, db);
#ifdef WITH_GROONGA_NORMALIZER_MYSQL
{
grn_obj *mysql_normalizer;
mysql_normalizer = grn_ctx_get(ctx, "NormalizerMySQLGeneralCI", -1);
if (mysql_normalizer) {
grn_obj_unlink(ctx, mysql_normalizer);
} else {
grn_plugin_register(ctx, GROONGA_NORMALIZER_MYSQL_PLUGIN_NAME);
}
}
#endif
error = ensure_normalizers_register();

DBUG_RETURN(error);
}
Expand Down Expand Up @@ -3959,9 +3969,7 @@ int ha_mroonga::ensure_database_open(const char *name)
}
pthread_mutex_unlock(&mrn_db_mutex);
grn_ctx_use(ctx, db);
#ifdef WITH_GROONGA_NORMALIZER_MYSQL
grn_plugin_register(ctx, GROONGA_NORMALIZER_MYSQL_PLUGIN_NAME);
#endif
error = ensure_normalizers_register();

DBUG_RETURN(error);
}
Expand Down
1 change: 1 addition & 0 deletions ha_mroonga.hpp
Expand Up @@ -715,6 +715,7 @@ class ha_mroonga: public handler
grn_obj *grn_table, MRN_SHARE *tmp_share);
int close_databases();
void ensure_database_directory();
int ensure_normalizers_register();
int ensure_database_create(const char *name);
int ensure_database_open(const char *name);
int wrapper_delete_table(const char *name, MRN_SHARE *tmp_share,
Expand Down

0 comments on commit 6ea5245

Please sign in to comment.