MCPcopy Create free account
hub / github.com/MariaDB/server / bootstrap

Function bootstrap

sql/sql_parse.cc:989–1118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

987
988
989int bootstrap(MYSQL_FILE *file)
990{
991 int bootstrap_error= 0;
992 DBUG_ENTER("handle_bootstrap");
993
994 THD *thd= new THD(next_thread_id());
995 char *buffer= new char[MAX_BOOTSTRAP_QUERY_SIZE];
996#ifdef WITH_WSREP
997 thd->variables.wsrep_on= 0;
998#endif
999 thd->bootstrap=1;
1000 my_net_init(&thd->net,(st_vio*) 0, thd, MYF(0));
1001 thd->max_client_packet_length= thd->net.max_packet;
1002 thd->security_ctx->master_access= ALL_KNOWN_ACL;
1003
1004#ifndef EMBEDDED_LIBRARY
1005 mysql_thread_set_psi_id(thd->thread_id);
1006#else
1007 thd->mysql= 0;
1008#endif
1009
1010 /* The following must be called before DBUG_ENTER */
1011 thd->store_globals();
1012
1013 thd->security_ctx->user= (char*) my_strdup(key_memory_MPVIO_EXT_auth_info,
1014 "boot", MYF(MY_WME));
1015 thd->security_ctx->priv_user[0]= thd->security_ctx->priv_host[0]=
1016 thd->security_ctx->priv_role[0]= 0;
1017 /*
1018 Make the "client" handle multiple results. This is necessary
1019 to enable stored procedures with SELECTs and Dynamic SQL
1020 in init-file.
1021 */
1022 thd->client_capabilities|= CLIENT_MULTI_RESULTS;
1023
1024 thd->init_for_queries();
1025
1026 for ( ; ; )
1027 {
1028 buffer[0]= 0;
1029 int rc, length;
1030 char *query;
1031 int error= 0;
1032
1033 rc= read_bootstrap_query(buffer, &length, file, fgets_fn, 0, &error);
1034
1035 if (rc == READ_BOOTSTRAP_EOF)
1036 break;
1037 /*
1038 Check for bootstrap file errors. SQL syntax errors will be
1039 caught below.
1040 */
1041 if (rc != READ_BOOTSTRAP_SUCCESS)
1042 {
1043 /*
1044 mysql_parse() may have set a successful error status for the previous
1045 query. We must clear the error status to report the bootstrap error.
1046 */

Callers 2

mysqld_mainFunction · 0.85
read_init_fileFunction · 0.85

Calls 15

next_thread_idFunction · 0.85
my_net_initFunction · 0.85
my_strdupFunction · 0.85
read_bootstrap_queryFunction · 0.85
my_printf_errorFunction · 0.85
next_query_idFunction · 0.85
int2storeFunction · 0.85
mysql_parseFunction · 0.85
delete_explain_queryFunction · 0.85
free_rootFunction · 0.85
init_for_queriesMethod · 0.80

Tested by

no test coverage detected