@@ -6864,7 +6864,7 @@ int spider_panic(
68646864int spider_db_init (
68656865 void *p
68666866) {
6867- int error_num, roop_count;
6867+ int error_num = HA_ERR_OUT_OF_MEM , roop_count;
68686868 uint dbton_id = 0 ;
68696869 handlerton *spider_hton = (handlerton *)p;
68706870 DBUG_ENTER (" spider_db_init" );
@@ -6988,16 +6988,10 @@ int spider_db_init(
69886988
69896989#ifndef WITHOUT_SPIDER_BG_SEARCH
69906990 if (pthread_attr_init (&spider_pt_attr))
6991- {
6992- error_num = HA_ERR_OUT_OF_MEM;
69936991 goto error_pt_attr_init;
6994- }
69956992/*
69966993 if (pthread_attr_setdetachstate(&spider_pt_attr, PTHREAD_CREATE_DETACHED))
6997- {
6998- error_num = HA_ERR_OUT_OF_MEM;
69996994 goto error_pt_attr_setstate;
7000- }
70016995*/
70026996#endif
70036997
@@ -7007,263 +7001,201 @@ int spider_db_init(
70077001 if (mysql_mutex_init (spd_key_mutex_tbl,
70087002 &spider_tbl_mutex, MY_MUTEX_INIT_FAST))
70097003#endif
7010- {
7011- error_num = HA_ERR_OUT_OF_MEM;
70127004 goto error_tbl_mutex_init;
7013- }
70147005#if MYSQL_VERSION_ID < 50500
70157006 if (pthread_mutex_init (&spider_thread_id_mutex, MY_MUTEX_INIT_FAST))
70167007#else
70177008 if (mysql_mutex_init (spd_key_thread_id,
70187009 &spider_thread_id_mutex, MY_MUTEX_INIT_FAST))
70197010#endif
7020- {
7021- error_num = HA_ERR_OUT_OF_MEM;
70227011 goto error_thread_id_mutex_init;
7023- }
70247012#if MYSQL_VERSION_ID < 50500
70257013 if (pthread_mutex_init (&spider_conn_id_mutex, MY_MUTEX_INIT_FAST))
70267014#else
70277015 if (mysql_mutex_init (spd_key_conn_id,
70287016 &spider_conn_id_mutex, MY_MUTEX_INIT_FAST))
70297017#endif
7030- {
7031- error_num = HA_ERR_OUT_OF_MEM;
70327018 goto error_conn_id_mutex_init;
7033- }
70347019#if MYSQL_VERSION_ID < 50500
70357020 if (pthread_mutex_init (&spider_ipport_conn_mutex, MY_MUTEX_INIT_FAST))
70367021#else
70377022 if (mysql_mutex_init (spd_key_mutex_ipport_count,
70387023 &spider_ipport_conn_mutex, MY_MUTEX_INIT_FAST))
70397024#endif
7040- {
7041- error_num = HA_ERR_OUT_OF_MEM;
70427025 goto error_ipport_count_mutex_init;
7043- }
70447026
70457027#if MYSQL_VERSION_ID < 50500
70467028 if (pthread_mutex_init (&spider_init_error_tbl_mutex, MY_MUTEX_INIT_FAST))
70477029#else
70487030 if (mysql_mutex_init (spd_key_mutex_init_error_tbl,
70497031 &spider_init_error_tbl_mutex, MY_MUTEX_INIT_FAST))
70507032#endif
7051- {
7052- error_num = HA_ERR_OUT_OF_MEM;
70537033 goto error_init_error_tbl_mutex_init;
7054- }
7034+
70557035#ifdef WITH_PARTITION_STORAGE_ENGINE
70567036#if MYSQL_VERSION_ID < 50500
70577037 if (pthread_mutex_init (&spider_pt_share_mutex, MY_MUTEX_INIT_FAST))
70587038#else
70597039 if (mysql_mutex_init (spd_key_mutex_pt_share,
70607040 &spider_pt_share_mutex, MY_MUTEX_INIT_FAST))
70617041#endif
7062- {
7063- error_num = HA_ERR_OUT_OF_MEM;
70647042 goto error_pt_share_mutex_init;
7065- }
7043+
70667044#endif
70677045#if MYSQL_VERSION_ID < 50500
70687046 if (pthread_mutex_init (&spider_lgtm_tblhnd_share_mutex, MY_MUTEX_INIT_FAST))
70697047#else
70707048 if (mysql_mutex_init (spd_key_mutex_lgtm_tblhnd_share,
70717049 &spider_lgtm_tblhnd_share_mutex, MY_MUTEX_INIT_FAST))
70727050#endif
7073- {
7074- error_num = HA_ERR_OUT_OF_MEM;
70757051 goto error_lgtm_tblhnd_share_mutex_init;
7076- }
7052+
70777053#if MYSQL_VERSION_ID < 50500
70787054 if (pthread_mutex_init (&spider_conn_mutex, MY_MUTEX_INIT_FAST))
70797055#else
70807056 if (mysql_mutex_init (spd_key_mutex_conn,
70817057 &spider_conn_mutex, MY_MUTEX_INIT_FAST))
70827058#endif
7083- {
7084- error_num = HA_ERR_OUT_OF_MEM;
70857059 goto error_conn_mutex_init;
7086- }
7060+
70877061#if MYSQL_VERSION_ID < 50500
70887062 if (pthread_mutex_init (&spider_open_conn_mutex, MY_MUTEX_INIT_FAST))
70897063#else
70907064 if (mysql_mutex_init (spd_key_mutex_open_conn,
70917065 &spider_open_conn_mutex, MY_MUTEX_INIT_FAST))
70927066#endif
7093- {
7094- error_num = HA_ERR_OUT_OF_MEM;
70957067 goto error_open_conn_mutex_init;
7096- }
7068+
70977069#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
70987070#if MYSQL_VERSION_ID < 50500
70997071 if (pthread_mutex_init (&spider_hs_r_conn_mutex, MY_MUTEX_INIT_FAST))
71007072#else
71017073 if (mysql_mutex_init (spd_key_mutex_hs_r_conn,
71027074 &spider_hs_r_conn_mutex, MY_MUTEX_INIT_FAST))
71037075#endif
7104- {
7105- error_num = HA_ERR_OUT_OF_MEM;
71067076 goto error_hs_r_conn_mutex_init;
7107- }
7077+
71087078#if MYSQL_VERSION_ID < 50500
71097079 if (pthread_mutex_init (&spider_hs_w_conn_mutex, MY_MUTEX_INIT_FAST))
71107080#else
71117081 if (mysql_mutex_init (spd_key_mutex_hs_w_conn,
71127082 &spider_hs_w_conn_mutex, MY_MUTEX_INIT_FAST))
71137083#endif
7114- {
7115- error_num = HA_ERR_OUT_OF_MEM;
71167084 goto error_hs_w_conn_mutex_init;
7117- }
7085+
71187086#endif
71197087#if MYSQL_VERSION_ID < 50500
71207088 if (pthread_mutex_init (&spider_allocated_thds_mutex, MY_MUTEX_INIT_FAST))
71217089#else
71227090 if (mysql_mutex_init (spd_key_mutex_allocated_thds,
71237091 &spider_allocated_thds_mutex, MY_MUTEX_INIT_FAST))
71247092#endif
7125- {
7126- error_num = HA_ERR_OUT_OF_MEM;
71277093 goto error_allocated_thds_mutex_init;
7128- }
7094+
71297095#if MYSQL_VERSION_ID < 50500
71307096 if (pthread_mutex_init (&spider_mon_table_cache_mutex, MY_MUTEX_INIT_FAST))
71317097#else
71327098 if (mysql_mutex_init (spd_key_mutex_mon_table_cache,
71337099 &spider_mon_table_cache_mutex, MY_MUTEX_INIT_FAST))
71347100#endif
7135- {
7136- error_num = HA_ERR_OUT_OF_MEM;
71377101 goto error_mon_table_cache_mutex_init;
7138- }
71397102
71407103#if MYSQL_VERSION_ID < 50500
71417104 if (pthread_mutex_init (&spider_mem_calc_mutex, MY_MUTEX_INIT_FAST))
71427105#else
71437106 if (mysql_mutex_init (spd_key_mutex_mem_calc,
71447107 &spider_mem_calc_mutex, MY_MUTEX_INIT_FAST))
71457108#endif
7146- {
7147- error_num = HA_ERR_OUT_OF_MEM;
71487109 goto error_mem_calc_mutex_init;
7149- }
71507110
7151- if (
7152- my_hash_init (&spider_open_tables, spd_charset_utf8_bin, 32 , 0 , 0 ,
7153- (my_hash_get_key) spider_tbl_get_key, 0 , 0 )
7154- ) {
7155- error_num = HA_ERR_OUT_OF_MEM;
7111+ if (my_hash_init (&spider_open_tables, spd_charset_utf8_bin, 32 , 0 , 0 ,
7112+ (my_hash_get_key) spider_tbl_get_key, 0 , 0 ))
71567113 goto error_open_tables_hash_init;
7157- }
7114+
71587115 spider_alloc_calc_mem_init (spider_open_tables, 143 );
71597116 spider_alloc_calc_mem (NULL ,
71607117 spider_open_tables,
71617118 spider_open_tables.array .max_element *
71627119 spider_open_tables.array .size_of_element );
7163- if (
7164- my_hash_init (&spider_init_error_tables, spd_charset_utf8_bin, 32 , 0 , 0 ,
7165- (my_hash_get_key) spider_tbl_get_key, 0 , 0 )
7166- ) {
7167- error_num = HA_ERR_OUT_OF_MEM;
7120+ if (my_hash_init (&spider_init_error_tables, spd_charset_utf8_bin, 32 , 0 , 0 ,
7121+ (my_hash_get_key) spider_tbl_get_key, 0 , 0 ))
71687122 goto error_init_error_tables_hash_init;
7169- }
7123+
71707124 spider_alloc_calc_mem_init (spider_init_error_tables, 144 );
71717125 spider_alloc_calc_mem (NULL ,
71727126 spider_init_error_tables,
71737127 spider_init_error_tables.array .max_element *
71747128 spider_init_error_tables.array .size_of_element );
71757129#ifdef WITH_PARTITION_STORAGE_ENGINE
7176- if (
7177- my_hash_init (&spider_open_pt_share, spd_charset_utf8_bin, 32 , 0 , 0 ,
7178- (my_hash_get_key) spider_pt_share_get_key, 0 , 0 )
7179- ) {
7180- error_num = HA_ERR_OUT_OF_MEM;
7130+ if (my_hash_init (&spider_open_pt_share, spd_charset_utf8_bin, 32 , 0 , 0 ,
7131+ (my_hash_get_key) spider_pt_share_get_key, 0 , 0 ))
71817132 goto error_open_pt_share_hash_init;
7182- }
7133+
71837134 spider_alloc_calc_mem_init (spider_open_pt_share, 145 );
71847135 spider_alloc_calc_mem (NULL ,
71857136 spider_open_pt_share,
71867137 spider_open_pt_share.array .max_element *
71877138 spider_open_pt_share.array .size_of_element );
71887139#endif
7189- if (
7190- my_hash_init (&spider_lgtm_tblhnd_share_hash, spd_charset_utf8_bin,
7191- 32 , 0 , 0 ,
7192- (my_hash_get_key) spider_lgtm_tblhnd_share_hash_get_key, 0 , 0 )
7193- ) {
7194- error_num = HA_ERR_OUT_OF_MEM;
7140+ if (my_hash_init (&spider_lgtm_tblhnd_share_hash, spd_charset_utf8_bin,
7141+ 32 , 0 , 0 ,
7142+ (my_hash_get_key) spider_lgtm_tblhnd_share_hash_get_key,
7143+ 0 , 0 ))
71957144 goto error_lgtm_tblhnd_share_hash_init;
7196- }
7145+
71977146 spider_alloc_calc_mem_init (spider_lgtm_tblhnd_share_hash, 245 );
71987147 spider_alloc_calc_mem (NULL ,
71997148 spider_lgtm_tblhnd_share_hash,
72007149 spider_lgtm_tblhnd_share_hash.array .max_element *
72017150 spider_lgtm_tblhnd_share_hash.array .size_of_element );
7202- if (
7203- my_hash_init (&spider_open_connections, spd_charset_utf8_bin, 32 , 0 , 0 ,
7204- (my_hash_get_key) spider_conn_get_key, 0 , 0 )
7205- ) {
7206- error_num = HA_ERR_OUT_OF_MEM;
7151+ if (my_hash_init (&spider_open_connections, spd_charset_utf8_bin, 32 , 0 , 0 ,
7152+ (my_hash_get_key) spider_conn_get_key, 0 , 0 ))
72077153 goto error_open_connections_hash_init;
7208- }
7209- if (
7210- my_hash_init (&spider_ipport_conns, spd_charset_utf8_bin, 32 , 0 , 0 ,
7211- (my_hash_get_key) spider_ipport_conn_get_key, spider_free_ipport_conn, 0 )
7212- ) {
7213- error_num = HA_ERR_OUT_OF_MEM;
7154+
7155+ if (my_hash_init (&spider_ipport_conns, spd_charset_utf8_bin, 32 , 0 , 0 ,
7156+ (my_hash_get_key) spider_ipport_conn_get_key,
7157+ spider_free_ipport_conn, 0 ))
72147158 goto error_ipport_conn__hash_init;
7215- }
7159+
72167160 spider_alloc_calc_mem_init (spider_open_connections, 146 );
72177161 spider_alloc_calc_mem (NULL ,
72187162 spider_open_connections,
72197163 spider_open_connections.array .max_element *
72207164 spider_open_connections.array .size_of_element );
72217165#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
7222- if (
7223- my_hash_init (&spider_hs_r_conn_hash, spd_charset_utf8_bin, 32 , 0 , 0 ,
7224- (my_hash_get_key) spider_conn_get_key, 0 , 0 )
7225- ) {
7226- error_num = HA_ERR_OUT_OF_MEM;
7166+ if (my_hash_init (&spider_hs_r_conn_hash, spd_charset_utf8_bin, 32 , 0 , 0 ,
7167+ (my_hash_get_key) spider_conn_get_key, 0 , 0 ))
72277168 goto error_hs_r_conn_hash_init;
7228- }
7169+
72297170 spider_alloc_calc_mem_init (spider_hs_r_conn_hash, 147 );
72307171 spider_alloc_calc_mem (NULL ,
72317172 spider_hs_r_conn_hash,
72327173 spider_hs_r_conn_hash.array .max_element *
72337174 spider_hs_r_conn_hash.array .size_of_element );
7234- if (
7235- my_hash_init (&spider_hs_w_conn_hash, spd_charset_utf8_bin, 32 , 0 , 0 ,
7236- (my_hash_get_key) spider_conn_get_key, 0 , 0 )
7237- ) {
7238- error_num = HA_ERR_OUT_OF_MEM;
7175+ if (my_hash_init (&spider_hs_w_conn_hash, spd_charset_utf8_bin, 32 , 0 , 0 ,
7176+ (my_hash_get_key) spider_conn_get_key, 0 , 0 ))
72397177 goto error_hs_w_conn_hash_init;
7240- }
7178+
72417179 spider_alloc_calc_mem_init (spider_hs_w_conn_hash, 148 );
72427180 spider_alloc_calc_mem (NULL ,
72437181 spider_hs_w_conn_hash,
72447182 spider_hs_w_conn_hash.array .max_element *
72457183 spider_hs_w_conn_hash.array .size_of_element );
72467184#endif
7247- if (
7248- my_hash_init (&spider_allocated_thds, spd_charset_utf8_bin, 32 , 0 , 0 ,
7249- (my_hash_get_key) spider_allocated_thds_get_key, 0 , 0 )
7250- ) {
7251- error_num = HA_ERR_OUT_OF_MEM;
7185+ if (my_hash_init (&spider_allocated_thds, spd_charset_utf8_bin, 32 , 0 , 0 ,
7186+ (my_hash_get_key) spider_allocated_thds_get_key, 0 , 0 ))
72527187 goto error_allocated_thds_hash_init;
7253- }
7188+
72547189 spider_alloc_calc_mem_init (spider_allocated_thds, 149 );
72557190 spider_alloc_calc_mem (NULL ,
72567191 spider_allocated_thds,
72577192 spider_allocated_thds.array .max_element *
72587193 spider_allocated_thds.array .size_of_element );
72597194
7260- if (
7261- SPD_INIT_DYNAMIC_ARRAY2 (&spider_mon_table_cache, sizeof (SPIDER_MON_KEY),
7262- NULL , 64 , 64 , MYF (MY_WME))
7263- ) {
7264- error_num = HA_ERR_OUT_OF_MEM;
7195+ if (SPD_INIT_DYNAMIC_ARRAY2 (&spider_mon_table_cache, sizeof (SPIDER_MON_KEY),
7196+ NULL , 64 , 64 , MYF (MY_WME)))
72657197 goto error_mon_table_cache_array_init;
7266- }
7198+
72677199 spider_alloc_calc_mem_init (spider_mon_table_cache, 165 );
72687200 spider_alloc_calc_mem (NULL ,
72697201 spider_mon_table_cache,
@@ -7293,10 +7225,7 @@ int spider_db_init(
72937225 if (mysql_mutex_init (spd_key_mutex_udf_table_mon,
72947226 &spider_udf_table_mon_mutexes[roop_count], MY_MUTEX_INIT_FAST))
72957227#endif
7296- {
7297- error_num = HA_ERR_OUT_OF_MEM;
72987228 goto error_init_udf_table_mon_mutex;
7299- }
73007229 }
73017230 for (roop_count = 0 ;
73027231 roop_count < (int ) spider_param_udf_table_mon_mutex_count ();
@@ -7308,10 +7237,7 @@ int spider_db_init(
73087237 if (mysql_cond_init (spd_key_cond_udf_table_mon,
73097238 &spider_udf_table_mon_conds[roop_count], NULL ))
73107239#endif
7311- {
7312- error_num = HA_ERR_OUT_OF_MEM;
73137240 goto error_init_udf_table_mon_cond;
7314- }
73157241 }
73167242 for (roop_count = 0 ;
73177243 roop_count < (int ) spider_param_udf_table_mon_mutex_count ();
@@ -7320,10 +7246,8 @@ int spider_db_init(
73207246 if (my_hash_init (&spider_udf_table_mon_list_hash[roop_count],
73217247 spd_charset_utf8_bin, 32 , 0 , 0 ,
73227248 (my_hash_get_key) spider_udf_tbl_mon_list_key, 0 , 0 ))
7323- {
7324- error_num = HA_ERR_OUT_OF_MEM;
73257249 goto error_init_udf_table_mon_list_hash;
7326- }
7250+
73277251 spider_alloc_calc_mem_init (spider_udf_table_mon_list_hash, 150 );
73287252 spider_alloc_calc_mem (NULL ,
73297253 spider_udf_table_mon_list_hash,
0 commit comments