Пример #1
0
static int run_mysqlcheck_views(void)
{
  const char *upgrade_views="--process-views=YES";
  if (upgrade_from_mysql)
  {
    /*
      this has to ignore opt_systables_only, because upgrade_from_mysql
      is determined by analyzing systables. if we honor opt_systables_only
      here, views won't be fixed by subsequent mysql_upgrade runs
    */
    upgrade_views="--process-views=UPGRADE_FROM_MYSQL";
    verbose("Phase %d/%d: Fixing views from mysql", ++phase, phases_total);
  }
  else if (opt_systables_only)
  {
    verbose("Phase %d/%d: Fixing views... Skipped", ++phase, phases_total);
    return 0;
  }
  else
    verbose("Phase %d/%d: Fixing views", ++phase, phases_total);

  print_conn_args("mysqlcheck");
  return run_tool(mysqlcheck_path,
                  NULL, /* Send output from mysqlcheck directly to screen */
                  "--no-defaults",
                  ds_args.str,
                  "--all-databases", "--repair",
                  upgrade_views,
                  "--skip-process-tables",
                  opt_verbose ? "--verbose": "",
                  opt_silent ? "--silent": "",
                  opt_write_binlog ? "--write-binlog" : "--skip-write-binlog",
                  "2>&1",
                  NULL);
}
Пример #2
0
static int run_mysqlcheck_fixnames(void)
{
  if (opt_systables_only)
  {
    verbose("Phase %d/%d: Fixing table and database names ... Skipped",
            ++phase, phases_total);
    return 0;
  }
  verbose("Phase %d/%d: Fixing table and database names",
          ++phase, phases_total);
  print_conn_args("mysqlcheck");
  return run_tool(mysqlcheck_path,
                  NULL, /* Send output from mysqlcheck directly to screen */
                  "--no-defaults",
                  ds_args.str,
                  "--all-databases",
                  "--fix-db-names",
                  "--fix-table-names",
                  opt_verbose >= 1 ? "--verbose" : "",
                  opt_verbose >= 2 ? "--verbose" : "",
                  opt_verbose >= 3 ? "--verbose" : "",
                  opt_silent ? "--silent": "",
                  opt_write_binlog ? "--write-binlog" : "--skip-write-binlog",
                  "2>&1",
                  NULL);
}
Пример #3
0
static int run_mysqlcheck_upgrade(my_bool mysql_db_only)
{
  const char *what= mysql_db_only ? "mysql database" : "tables";
  const char *arg1= mysql_db_only ? "--databases" : "--all-databases";
  const char *arg2= mysql_db_only ? "mysql" : "--skip-database=mysql";
  int retch;
  if (opt_systables_only && !mysql_db_only)
  {
    verbose("Phase %d/%d: Checking and upgrading %s... Skipped",
            ++phase, phases_total, what);
    return 0;
  }
  verbose("Phase %d/%d: Checking and upgrading %s", ++phase, phases_total, what);
  print_conn_args("mysqlcheck");
  retch= run_tool(mysqlcheck_path,
                  NULL, /* Send output from mysqlcheck directly to screen */
                  "--no-defaults",
                  ds_args.str,
                  "--check-upgrade",
                  "--auto-repair",
                  !opt_silent || opt_verbose >= 1 ? "--verbose" : "",
                  opt_verbose >= 2 ? "--verbose" : "",
                  opt_verbose >= 3 ? "--verbose" : "",
                  opt_silent ? "--silent": "",
                  opt_write_binlog ? "--write-binlog" : "--skip-write-binlog",
                  arg1, arg2,
                  "2>&1",
                  NULL);
  return retch;
}
Пример #4
0
static int run_mysqlcheck_fixnames(void)
{
  print_conn_args("mysqlcheck");
  return run_tool(mysqlcheck_path,
                  NULL, /* Send output from mysqlcheck directly to screen */
                  "--no-defaults",
                  ds_args.str,
                  "--all-databases",
                  "--fix-db-names",
                  "--fix-table-names",
                  opt_write_binlog ? "--write-binlog" : "--skip-write-binlog",
                  NULL);
}
Пример #5
0
static int run_mysqlcheck_upgrade(void)
{
  print_conn_args("mysqlcheck");
  return run_tool(mysqlcheck_path,
                  NULL, /* Send output from mysqlcheck directly to screen */
                  "--no-defaults",
                  ds_args.str,
                  "--check-upgrade",
                  "--all-databases",
                  "--auto-repair",
                  opt_write_binlog ? "--write-binlog" : "--skip-write-binlog",
                  NULL);
}
Пример #6
0
static int run_mysqlcheck_fixnames(void)
{
    verbose("Phase 1/3: Fixing table and database names");
    print_conn_args("mysqlcheck");
    return run_tool(mysqlcheck_path,
                    NULL, /* Send output from mysqlcheck directly to screen */
                    "--no-defaults",
                    ds_args.str,
                    "--all-databases",
                    "--fix-db-names",
                    "--fix-table-names",
                    opt_verbose ? "--verbose": "",
                    opt_silent ? "--silent": "",
                    opt_write_binlog ? "--write-binlog" : "--skip-write-binlog",
                    NULL);
}
Пример #7
0
static int run_mysqlcheck_upgrade(void)
{
    verbose("Phase 2/3: Checking and upgrading tables");
    print_conn_args("mysqlcheck");
    return run_tool(mysqlcheck_path,
                    NULL, /* Send output from mysqlcheck directly to screen */
                    "--no-defaults",
                    ds_args.str,
                    "--check-upgrade",
                    "--all-databases",
                    "--auto-repair",
                    !opt_silent || opt_verbose ? "--verbose": "",
                    opt_silent ? "--silent": "",
                    opt_write_binlog ? "--write-binlog" : "--skip-write-binlog",
                    NULL);
}