Skip to content

Commit 6f09dec

Browse files
committed
feat(plugin): add extra logging to the plugin init
1 parent d9187e6 commit 6f09dec

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

dbcon/mysql/ha_mcs.cpp

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1828,14 +1828,20 @@ static int columnstore_init_func(void* p)
18281828
fprintf(stderr, "Columnstore: Started; Version: %s-%s\n", columnstore_version.c_str(),
18291829
columnstore_release.c_str());
18301830

1831+
plugin_ref plugin_innodb;
18311832
LEX_CSTRING name = {STRING_WITH_LEN("INNODB")};
1832-
auto* plugin_innodb = ha_resolve_by_name(0, &name, 0);
1833-
if (!plugin_innodb || plugin_state(plugin_innodb) != PLUGIN_IS_READY)
18341833

1834+
if (get_innodb_queries_uses_mcs())
18351835
{
1836-
DBUG_RETURN(HA_ERR_RETRY_INIT);
1837-
}
1836+
std::cerr << "Columnstore: innodb_queries_uses_mcs is set, looking for InnoDB plugin." << std::endl;
18381837

1838+
plugin_innodb = ha_resolve_by_name(0, &name, 0);
1839+
if (!plugin_innodb || plugin_state(plugin_innodb) != PLUGIN_IS_READY)
1840+
{
1841+
DBUG_RETURN(HA_ERR_RETRY_INIT);
1842+
}
1843+
}
1844+
18391845
strncpy(cs_version, columnstore_version.c_str(), sizeof(cs_version) - 1);
18401846
cs_version[sizeof(cs_version) - 1] = 0;
18411847

@@ -1844,10 +1850,14 @@ static int columnstore_init_func(void* p)
18441850

18451851
mcs_hton = (handlerton*)p;
18461852

1853+
std::cerr << "Columnstore: init pthread_mutex_init" << std::endl;
18471854
(void)pthread_mutex_init(&mcs_mutex, MY_MUTEX_INIT_FAST);
1855+
std::cerr << "Columnstore: init my_hash_init" << std::endl;
18481856
(void)my_hash_init(PSI_NOT_INSTRUMENTED, &mcs_open_tables, system_charset_info, 32, 0, 0,
18491857
(my_hash_get_key)mcs_get_key, 0, 0);
18501858

1859+
std::cerr << "Columnstore: init mcs_hton attributes" << std::endl;
1860+
18511861
mcs_hton->create = ha_mcs_cache_create_handler;
18521862
mcs_hton->panic = 0;
18531863
mcs_hton->flags = HTON_CAN_RECREATE | HTON_NO_PARTITION;
@@ -1863,22 +1873,27 @@ static int columnstore_init_func(void* p)
18631873

18641874
if (get_innodb_queries_uses_mcs())
18651875
{
1876+
std::cerr << "Columnstore: innodb_queries_uses_mcs is set, redirecting all InnoDB queries to Columnstore." << std::endl;
1877+
18661878
auto* innodb_hton = plugin_hton(plugin_innodb);
18671879
int error = innodb_hton == nullptr; // Engine must exists!
18681880
if (error)
18691881
{
1882+
std::cerr << "Columnstore: innodb_queries_uses_mcs is set, but could not find InnoDB plugin." << std::endl;
18701883
my_error(HA_ERR_INITIALIZATION, MYF(0), "Could not find storage engine %s", name.str);
18711884
}
18721885
innodb_hton->create_select = create_columnstore_select_handler;
18731886
innodb_hton->create_unit = create_columnstore_unit_handler;
18741887
}
18751888

18761889
#ifdef HAVE_PSI_INTERFACE
1890+
std::cerr << "Columnstore: Registering mutex for Columnstore write cache." << std::endl;
18771891
uint count = sizeof(all_mutexes) / sizeof(all_mutexes[0]);
18781892
mysql_mutex_register("ha_mcs_cache", all_mutexes, count);
18791893
#else
18801894
(void)key_LOCK_cache_share;
18811895
#endif
1896+
std::cerr << "Columnstore: Initialising mutex for Columnstore write cache." << std::endl;
18821897
mysql_mutex_init(key_LOCK_cache_share, &LOCK_cache_share, MY_MUTEX_INIT_FAST);
18831898

18841899
DBUG_RETURN(0);

0 commit comments

Comments
 (0)