@@ -6864,7 +6864,7 @@ int spider_panic(
6864
6864
int spider_db_init (
6865
6865
void *p
6866
6866
) {
6867
- int error_num, roop_count;
6867
+ int error_num = HA_ERR_OUT_OF_MEM , roop_count;
6868
6868
uint dbton_id = 0 ;
6869
6869
handlerton *spider_hton = (handlerton *)p;
6870
6870
DBUG_ENTER (" spider_db_init" );
@@ -6988,16 +6988,10 @@ int spider_db_init(
6988
6988
6989
6989
#ifndef WITHOUT_SPIDER_BG_SEARCH
6990
6990
if (pthread_attr_init (&spider_pt_attr))
6991
- {
6992
- error_num = HA_ERR_OUT_OF_MEM;
6993
6991
goto error_pt_attr_init;
6994
- }
6995
6992
/*
6996
6993
if (pthread_attr_setdetachstate(&spider_pt_attr, PTHREAD_CREATE_DETACHED))
6997
- {
6998
- error_num = HA_ERR_OUT_OF_MEM;
6999
6994
goto error_pt_attr_setstate;
7000
- }
7001
6995
*/
7002
6996
#endif
7003
6997
@@ -7007,263 +7001,201 @@ int spider_db_init(
7007
7001
if (mysql_mutex_init (spd_key_mutex_tbl,
7008
7002
&spider_tbl_mutex, MY_MUTEX_INIT_FAST))
7009
7003
#endif
7010
- {
7011
- error_num = HA_ERR_OUT_OF_MEM;
7012
7004
goto error_tbl_mutex_init;
7013
- }
7014
7005
#if MYSQL_VERSION_ID < 50500
7015
7006
if (pthread_mutex_init (&spider_thread_id_mutex, MY_MUTEX_INIT_FAST))
7016
7007
#else
7017
7008
if (mysql_mutex_init (spd_key_thread_id,
7018
7009
&spider_thread_id_mutex, MY_MUTEX_INIT_FAST))
7019
7010
#endif
7020
- {
7021
- error_num = HA_ERR_OUT_OF_MEM;
7022
7011
goto error_thread_id_mutex_init;
7023
- }
7024
7012
#if MYSQL_VERSION_ID < 50500
7025
7013
if (pthread_mutex_init (&spider_conn_id_mutex, MY_MUTEX_INIT_FAST))
7026
7014
#else
7027
7015
if (mysql_mutex_init (spd_key_conn_id,
7028
7016
&spider_conn_id_mutex, MY_MUTEX_INIT_FAST))
7029
7017
#endif
7030
- {
7031
- error_num = HA_ERR_OUT_OF_MEM;
7032
7018
goto error_conn_id_mutex_init;
7033
- }
7034
7019
#if MYSQL_VERSION_ID < 50500
7035
7020
if (pthread_mutex_init (&spider_ipport_conn_mutex, MY_MUTEX_INIT_FAST))
7036
7021
#else
7037
7022
if (mysql_mutex_init (spd_key_mutex_ipport_count,
7038
7023
&spider_ipport_conn_mutex, MY_MUTEX_INIT_FAST))
7039
7024
#endif
7040
- {
7041
- error_num = HA_ERR_OUT_OF_MEM;
7042
7025
goto error_ipport_count_mutex_init;
7043
- }
7044
7026
7045
7027
#if MYSQL_VERSION_ID < 50500
7046
7028
if (pthread_mutex_init (&spider_init_error_tbl_mutex, MY_MUTEX_INIT_FAST))
7047
7029
#else
7048
7030
if (mysql_mutex_init (spd_key_mutex_init_error_tbl,
7049
7031
&spider_init_error_tbl_mutex, MY_MUTEX_INIT_FAST))
7050
7032
#endif
7051
- {
7052
- error_num = HA_ERR_OUT_OF_MEM;
7053
7033
goto error_init_error_tbl_mutex_init;
7054
- }
7034
+
7055
7035
#ifdef WITH_PARTITION_STORAGE_ENGINE
7056
7036
#if MYSQL_VERSION_ID < 50500
7057
7037
if (pthread_mutex_init (&spider_pt_share_mutex, MY_MUTEX_INIT_FAST))
7058
7038
#else
7059
7039
if (mysql_mutex_init (spd_key_mutex_pt_share,
7060
7040
&spider_pt_share_mutex, MY_MUTEX_INIT_FAST))
7061
7041
#endif
7062
- {
7063
- error_num = HA_ERR_OUT_OF_MEM;
7064
7042
goto error_pt_share_mutex_init;
7065
- }
7043
+
7066
7044
#endif
7067
7045
#if MYSQL_VERSION_ID < 50500
7068
7046
if (pthread_mutex_init (&spider_lgtm_tblhnd_share_mutex, MY_MUTEX_INIT_FAST))
7069
7047
#else
7070
7048
if (mysql_mutex_init (spd_key_mutex_lgtm_tblhnd_share,
7071
7049
&spider_lgtm_tblhnd_share_mutex, MY_MUTEX_INIT_FAST))
7072
7050
#endif
7073
- {
7074
- error_num = HA_ERR_OUT_OF_MEM;
7075
7051
goto error_lgtm_tblhnd_share_mutex_init;
7076
- }
7052
+
7077
7053
#if MYSQL_VERSION_ID < 50500
7078
7054
if (pthread_mutex_init (&spider_conn_mutex, MY_MUTEX_INIT_FAST))
7079
7055
#else
7080
7056
if (mysql_mutex_init (spd_key_mutex_conn,
7081
7057
&spider_conn_mutex, MY_MUTEX_INIT_FAST))
7082
7058
#endif
7083
- {
7084
- error_num = HA_ERR_OUT_OF_MEM;
7085
7059
goto error_conn_mutex_init;
7086
- }
7060
+
7087
7061
#if MYSQL_VERSION_ID < 50500
7088
7062
if (pthread_mutex_init (&spider_open_conn_mutex, MY_MUTEX_INIT_FAST))
7089
7063
#else
7090
7064
if (mysql_mutex_init (spd_key_mutex_open_conn,
7091
7065
&spider_open_conn_mutex, MY_MUTEX_INIT_FAST))
7092
7066
#endif
7093
- {
7094
- error_num = HA_ERR_OUT_OF_MEM;
7095
7067
goto error_open_conn_mutex_init;
7096
- }
7068
+
7097
7069
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
7098
7070
#if MYSQL_VERSION_ID < 50500
7099
7071
if (pthread_mutex_init (&spider_hs_r_conn_mutex, MY_MUTEX_INIT_FAST))
7100
7072
#else
7101
7073
if (mysql_mutex_init (spd_key_mutex_hs_r_conn,
7102
7074
&spider_hs_r_conn_mutex, MY_MUTEX_INIT_FAST))
7103
7075
#endif
7104
- {
7105
- error_num = HA_ERR_OUT_OF_MEM;
7106
7076
goto error_hs_r_conn_mutex_init;
7107
- }
7077
+
7108
7078
#if MYSQL_VERSION_ID < 50500
7109
7079
if (pthread_mutex_init (&spider_hs_w_conn_mutex, MY_MUTEX_INIT_FAST))
7110
7080
#else
7111
7081
if (mysql_mutex_init (spd_key_mutex_hs_w_conn,
7112
7082
&spider_hs_w_conn_mutex, MY_MUTEX_INIT_FAST))
7113
7083
#endif
7114
- {
7115
- error_num = HA_ERR_OUT_OF_MEM;
7116
7084
goto error_hs_w_conn_mutex_init;
7117
- }
7085
+
7118
7086
#endif
7119
7087
#if MYSQL_VERSION_ID < 50500
7120
7088
if (pthread_mutex_init (&spider_allocated_thds_mutex, MY_MUTEX_INIT_FAST))
7121
7089
#else
7122
7090
if (mysql_mutex_init (spd_key_mutex_allocated_thds,
7123
7091
&spider_allocated_thds_mutex, MY_MUTEX_INIT_FAST))
7124
7092
#endif
7125
- {
7126
- error_num = HA_ERR_OUT_OF_MEM;
7127
7093
goto error_allocated_thds_mutex_init;
7128
- }
7094
+
7129
7095
#if MYSQL_VERSION_ID < 50500
7130
7096
if (pthread_mutex_init (&spider_mon_table_cache_mutex, MY_MUTEX_INIT_FAST))
7131
7097
#else
7132
7098
if (mysql_mutex_init (spd_key_mutex_mon_table_cache,
7133
7099
&spider_mon_table_cache_mutex, MY_MUTEX_INIT_FAST))
7134
7100
#endif
7135
- {
7136
- error_num = HA_ERR_OUT_OF_MEM;
7137
7101
goto error_mon_table_cache_mutex_init;
7138
- }
7139
7102
7140
7103
#if MYSQL_VERSION_ID < 50500
7141
7104
if (pthread_mutex_init (&spider_mem_calc_mutex, MY_MUTEX_INIT_FAST))
7142
7105
#else
7143
7106
if (mysql_mutex_init (spd_key_mutex_mem_calc,
7144
7107
&spider_mem_calc_mutex, MY_MUTEX_INIT_FAST))
7145
7108
#endif
7146
- {
7147
- error_num = HA_ERR_OUT_OF_MEM;
7148
7109
goto error_mem_calc_mutex_init;
7149
- }
7150
7110
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 ))
7156
7113
goto error_open_tables_hash_init;
7157
- }
7114
+
7158
7115
spider_alloc_calc_mem_init (spider_open_tables, 143 );
7159
7116
spider_alloc_calc_mem (NULL ,
7160
7117
spider_open_tables,
7161
7118
spider_open_tables.array .max_element *
7162
7119
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 ))
7168
7122
goto error_init_error_tables_hash_init;
7169
- }
7123
+
7170
7124
spider_alloc_calc_mem_init (spider_init_error_tables, 144 );
7171
7125
spider_alloc_calc_mem (NULL ,
7172
7126
spider_init_error_tables,
7173
7127
spider_init_error_tables.array .max_element *
7174
7128
spider_init_error_tables.array .size_of_element );
7175
7129
#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 ))
7181
7132
goto error_open_pt_share_hash_init;
7182
- }
7133
+
7183
7134
spider_alloc_calc_mem_init (spider_open_pt_share, 145 );
7184
7135
spider_alloc_calc_mem (NULL ,
7185
7136
spider_open_pt_share,
7186
7137
spider_open_pt_share.array .max_element *
7187
7138
spider_open_pt_share.array .size_of_element );
7188
7139
#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 ))
7195
7144
goto error_lgtm_tblhnd_share_hash_init;
7196
- }
7145
+
7197
7146
spider_alloc_calc_mem_init (spider_lgtm_tblhnd_share_hash, 245 );
7198
7147
spider_alloc_calc_mem (NULL ,
7199
7148
spider_lgtm_tblhnd_share_hash,
7200
7149
spider_lgtm_tblhnd_share_hash.array .max_element *
7201
7150
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 ))
7207
7153
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 ))
7214
7158
goto error_ipport_conn__hash_init;
7215
- }
7159
+
7216
7160
spider_alloc_calc_mem_init (spider_open_connections, 146 );
7217
7161
spider_alloc_calc_mem (NULL ,
7218
7162
spider_open_connections,
7219
7163
spider_open_connections.array .max_element *
7220
7164
spider_open_connections.array .size_of_element );
7221
7165
#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 ))
7227
7168
goto error_hs_r_conn_hash_init;
7228
- }
7169
+
7229
7170
spider_alloc_calc_mem_init (spider_hs_r_conn_hash, 147 );
7230
7171
spider_alloc_calc_mem (NULL ,
7231
7172
spider_hs_r_conn_hash,
7232
7173
spider_hs_r_conn_hash.array .max_element *
7233
7174
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 ))
7239
7177
goto error_hs_w_conn_hash_init;
7240
- }
7178
+
7241
7179
spider_alloc_calc_mem_init (spider_hs_w_conn_hash, 148 );
7242
7180
spider_alloc_calc_mem (NULL ,
7243
7181
spider_hs_w_conn_hash,
7244
7182
spider_hs_w_conn_hash.array .max_element *
7245
7183
spider_hs_w_conn_hash.array .size_of_element );
7246
7184
#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 ))
7252
7187
goto error_allocated_thds_hash_init;
7253
- }
7188
+
7254
7189
spider_alloc_calc_mem_init (spider_allocated_thds, 149 );
7255
7190
spider_alloc_calc_mem (NULL ,
7256
7191
spider_allocated_thds,
7257
7192
spider_allocated_thds.array .max_element *
7258
7193
spider_allocated_thds.array .size_of_element );
7259
7194
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)))
7265
7197
goto error_mon_table_cache_array_init;
7266
- }
7198
+
7267
7199
spider_alloc_calc_mem_init (spider_mon_table_cache, 165 );
7268
7200
spider_alloc_calc_mem (NULL ,
7269
7201
spider_mon_table_cache,
@@ -7293,10 +7225,7 @@ int spider_db_init(
7293
7225
if (mysql_mutex_init (spd_key_mutex_udf_table_mon,
7294
7226
&spider_udf_table_mon_mutexes[roop_count], MY_MUTEX_INIT_FAST))
7295
7227
#endif
7296
- {
7297
- error_num = HA_ERR_OUT_OF_MEM;
7298
7228
goto error_init_udf_table_mon_mutex;
7299
- }
7300
7229
}
7301
7230
for (roop_count = 0 ;
7302
7231
roop_count < (int ) spider_param_udf_table_mon_mutex_count ();
@@ -7308,10 +7237,7 @@ int spider_db_init(
7308
7237
if (mysql_cond_init (spd_key_cond_udf_table_mon,
7309
7238
&spider_udf_table_mon_conds[roop_count], NULL ))
7310
7239
#endif
7311
- {
7312
- error_num = HA_ERR_OUT_OF_MEM;
7313
7240
goto error_init_udf_table_mon_cond;
7314
- }
7315
7241
}
7316
7242
for (roop_count = 0 ;
7317
7243
roop_count < (int ) spider_param_udf_table_mon_mutex_count ();
@@ -7320,10 +7246,8 @@ int spider_db_init(
7320
7246
if (my_hash_init (&spider_udf_table_mon_list_hash[roop_count],
7321
7247
spd_charset_utf8_bin, 32 , 0 , 0 ,
7322
7248
(my_hash_get_key) spider_udf_tbl_mon_list_key, 0 , 0 ))
7323
- {
7324
- error_num = HA_ERR_OUT_OF_MEM;
7325
7249
goto error_init_udf_table_mon_list_hash;
7326
- }
7250
+
7327
7251
spider_alloc_calc_mem_init (spider_udf_table_mon_list_hash, 150 );
7328
7252
spider_alloc_calc_mem (NULL ,
7329
7253
spider_udf_table_mon_list_hash,
0 commit comments