Fix load plugin bug.

This commit is contained in:
totaj
2022-12-07 10:12:07 +08:00
parent 93107e0d21
commit 8da08b573d

View File

@ -7474,13 +7474,22 @@ void LoadSqlPlugin()
/* recheck and load dolphin within lock */ /* recheck and load dolphin within lock */
pthread_mutex_lock(&g_instance.loadPluginLock[DB_CMPT_B]); pthread_mutex_lock(&g_instance.loadPluginLock[DB_CMPT_B]);
start_xact_command(); PG_TRY();
u_sess->attr.attr_sql.dolphin = CheckIfExtensionExists("dolphin"); {
finish_xact_command(); start_xact_command();
u_sess->attr.attr_sql.dolphin = CheckIfExtensionExists("dolphin");
finish_xact_command();
if (!u_sess->attr.attr_sql.dolphin) { if (!u_sess->attr.attr_sql.dolphin) {
LoadDolphinIfNeeded(); LoadDolphinIfNeeded();
}
} }
PG_CATCH();
{
pthread_mutex_unlock(&g_instance.loadPluginLock[DB_CMPT_B]);
PG_RE_THROW();
}
PG_END_TRY();
pthread_mutex_unlock(&g_instance.loadPluginLock[DB_CMPT_B]); pthread_mutex_unlock(&g_instance.loadPluginLock[DB_CMPT_B]);
} else if (u_sess->attr.attr_sql.dolphin) { } else if (u_sess->attr.attr_sql.dolphin) {
InitBSqlPluginHookIfNeeded(); InitBSqlPluginHookIfNeeded();