~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/slave.cc

  • Committer: Brian Aker
  • Date: 2008-08-03 22:27:54 UTC
  • mfrom: (236.1.66 codestyle)
  • Revision ID: brian@tangent.org-20080803222754-yhkw8plul06oqvhe
Merge from Monty.

Show diffs side-by-side

added added

removed removed

Lines of Context:
37
37
#include <libdrizzle/sql_common.h>
38
38
#include <libdrizzle/errmsg.h>
39
39
#include <mysys/mysys_err.h>
 
40
#include <drizzled/drizzled_error_messages.h>
40
41
 
41
42
#ifdef HAVE_REPLICATION
42
43
 
87
88
static const char *reconnect_messages[SLAVE_RECON_ACT_MAX][SLAVE_RECON_MSG_MAX]=
88
89
{
89
90
  {
90
 
    "Waiting to reconnect after a failed registration on master",
91
 
    "Slave I/O thread killed while waitnig to reconnect after a failed \
92
 
registration on master",
93
 
    "Reconnecting after a failed registration on master",
94
 
    "failed registering on master, reconnecting to try again, \
95
 
log '%s' at postion %s",
 
91
    gettext_noop("Waiting to reconnect after a failed registration on master"),
 
92
    gettext_noop("Slave I/O thread killed while waitnig to reconnect after a "
 
93
                 "failed registration on master"),
 
94
    gettext_noop("Reconnecting after a failed registration on master"),
 
95
    gettext_noop("failed registering on master, reconnecting to try again, "
 
96
                 "log '%s' at postion %s"),
96
97
    "COM_REGISTER_SLAVE",
97
 
    "Slave I/O thread killed during or after reconnect"
 
98
    gettext_noop("Slave I/O thread killed during or after reconnect")
98
99
  },
99
100
  {
100
 
    "Waiting to reconnect after a failed binlog dump request",
101
 
    "Slave I/O thread killed while retrying master dump",
102
 
    "Reconnecting after a failed binlog dump request",
103
 
    "failed dump request, reconnecting to try again, log '%s' at postion %s",
 
101
    gettext_noop("Waiting to reconnect after a failed binlog dump request"),
 
102
    gettext_noop("Slave I/O thread killed while retrying master dump"),
 
103
    gettext_noop("Reconnecting after a failed binlog dump request"),
 
104
    gettext_noop("failed dump request, reconnecting to try again, "
 
105
                 "log '%s' at postion %s"),
104
106
    "COM_BINLOG_DUMP",
105
 
    "Slave I/O thread killed during or after reconnect"
 
107
    gettext_noop("Slave I/O thread killed during or after reconnect")
106
108
  },
107
109
  {
108
 
    "Waiting to reconnect after a failed master event read",
109
 
    "Slave I/O thread killed while waiting to reconnect after a failed read",
110
 
    "Reconnecting after a failed master event read",
111
 
    "Slave I/O thread: Failed reading log event, reconnecting to retry, \
112
 
log '%s' at postion %s",
 
110
    gettext_noop("Waiting to reconnect after a failed master event read"),
 
111
    gettext_noop("Slave I/O thread killed while waiting to reconnect "
 
112
                 "after a failed read"),
 
113
    gettext_noop("Reconnecting after a failed master event read"),
 
114
    gettext_noop("Slave I/O thread: Failed reading log event, "
 
115
                 "reconnecting to retry, log '%s' at postion %s"),
113
116
    "",
114
 
    "Slave I/O thread killed during or after a reconnect done to recover from \
115
 
failed read"
 
117
    gettext_noop("Slave I/O thread killed during or after a "
 
118
                 "reconnect done to recover from failed read")
116
119
  }
117
120
};
118
121
 
225
228
  */
226
229
  if (!active_mi)
227
230
  {
228
 
    sql_print_error("Failed to allocate memory for the master info structure");
 
231
    sql_print_error(_("Failed to allocate memory for the master info structure"));
229
232
    goto err;
230
233
  }
231
234
 
232
235
  if (init_master_info(active_mi,master_info_file,relay_log_info_file,
233
236
                       1, (SLAVE_IO | SLAVE_SQL)))
234
237
  {
235
 
    sql_print_error("Failed to initialize the master info structure");
 
238
    sql_print_error(_("Failed to initialize the master info structure"));
236
239
    goto err;
237
240
  }
238
241
 
247
250
                            relay_log_info_file,
248
251
                            SLAVE_IO | SLAVE_SQL))
249
252
    {
250
 
      sql_print_error("Failed to create slave threads");
 
253
      sql_print_error(_("Failed to create slave threads"));
251
254
      goto err;
252
255
    }
253
256
  }
444
447
      pthread_cond_broadcast(start_cond);
445
448
    if (start_lock)
446
449
      pthread_mutex_unlock(start_lock);
447
 
    sql_print_error("Server id not set, will not start slave");
 
450
    sql_print_error(_("Server id not set, will not start slave"));
448
451
    return(ER_BAD_SLAVE);
449
452
  }
450
453
 
773
776
 
774
777
  if (!my_isdigit(&my_charset_bin,*drizzle->server_version))
775
778
  {
776
 
    errmsg = "Master reported unrecognized DRIZZLE version";
 
779
    errmsg = _("Master reported unrecognized DRIZZLE version");
777
780
    err_code= ER_SLAVE_FATAL_ERROR;
778
781
    sprintf(err_buff, ER(err_code), errmsg);
779
782
    err_msg.append(err_buff);
788
791
    case '0':
789
792
    case '1':
790
793
    case '2':
791
 
      errmsg = "Master reported unrecognized DRIZZLE version";
 
794
      errmsg = _("Master reported unrecognized DRIZZLE version");
792
795
      err_code= ER_SLAVE_FATAL_ERROR;
793
796
      sprintf(err_buff, ER(err_code), errmsg);
794
797
      err_msg.append(err_buff);
829
832
  /* as we are here, we tried to allocate the event */
830
833
  if (!mi->rli.relay_log.description_event_for_queue)
831
834
  {
832
 
    errmsg= "default Format_description_log_event";
 
835
    errmsg= _("default Format_description_log_event");
833
836
    err_code= ER_SLAVE_CREATE_EVENT_FAILURE;
834
837
    sprintf(err_buff, ER(err_code), errmsg);
835
838
    err_msg.append(err_buff);
851
854
  else if (!check_io_slave_killed(mi->io_thd, mi, NULL))
852
855
  {
853
856
    mi->clock_diff_with_master= 0; /* The "most sensible" value */
854
 
    sql_print_warning("\"SELECT UNIX_TIMESTAMP()\" failed on master, "
855
 
                      "do not trust column Seconds_Behind_Master of SHOW "
856
 
                      "SLAVE STATUS. Error: %s (%d)",
 
857
    sql_print_warning(_("\"SELECT UNIX_TIMESTAMP()\" failed on master, "
 
858
                        "do not trust column Seconds_Behind_Master of SHOW "
 
859
                        "SLAVE STATUS. Error: %s (%d)"),
857
860
                      drizzle_error(drizzle), drizzle_errno(drizzle));
858
861
  }
859
862
  if (master_res)
878
881
        !mi->rli.replicate_same_server_id)
879
882
    {
880
883
      errmsg=
881
 
        "The slave I/O thread stops because master and slave have equal"
882
 
        " DRIZZLE server ids; these ids must be different for replication to work (or"
883
 
        " the --replicate-same-server-id option must be used on slave but this does"
884
 
        " not always make sense; please check the manual before using it).";
 
884
        _("The slave I/O thread stops because master and slave have equal "
 
885
          "DRIZZLE server ids; these ids must be different "
 
886
          "for replication to work (or "
 
887
          "the --replicate-same-server-id option must be used "
 
888
          "on slave but this does"
 
889
          "not always make sense; please check the manual before using it).");
885
890
      err_code= ER_SLAVE_FATAL_ERROR;
886
891
      sprintf(err_buff, ER(err_code), errmsg);
887
892
      err_msg.append(err_buff);
921
926
        strcmp(master_row[0], global_system_variables.collation_server->name))
922
927
    {
923
928
      errmsg=
924
 
        "The slave I/O thread stops because master and slave have"
925
 
        " different values for the COLLATION_SERVER global variable."
926
 
        " The values must be equal for replication to work";
 
929
        _("The slave I/O thread stops because master and slave have"
 
930
          " different values for the COLLATION_SERVER global variable."
 
931
          " The values must be equal for replication to work");
927
932
      err_code= ER_SLAVE_FATAL_ERROR;
928
933
      sprintf(err_buff, ER(err_code), errmsg);
929
934
      err_msg.append(err_buff);
957
962
               global_system_variables.time_zone->get_name()->ptr()))
958
963
    {
959
964
      errmsg=
960
 
        "The slave I/O thread stops because master and slave have"
961
 
        " different values for the TIME_ZONE global variable."
962
 
        " The values must be equal for replication to work";
 
965
        _("The slave I/O thread stops because master and slave have"
 
966
          " different values for the TIME_ZONE global variable."
 
967
          " The values must be equal for replication to work");
963
968
      err_code= ER_SLAVE_FATAL_ERROR;
964
969
      sprintf(err_buff, ER(err_code), errmsg);
965
970
      err_msg.append(err_buff);
1022
1027
  pthread_mutex_lock(&rli->log_space_lock);
1023
1028
  save_proc_info= thd->enter_cond(&rli->log_space_cond,
1024
1029
                                  &rli->log_space_lock,
1025
 
                                  "\
1026
 
Waiting for the slave SQL thread to free enough relay log space");
 
1030
                                  _("Waiting for the slave SQL thread "
 
1031
                                    "to free enough relay log space"));
1027
1032
  while (rli->log_space_limit < rli->log_space_total &&
1028
1033
         !(slave_killed=io_slave_killed(thd,mi)) &&
1029
1034
         !rli->ignore_log_space_limit)
1068
1073
      if (unlikely(rli->relay_log.append(ev)))
1069
1074
        mi->report(ERROR_LEVEL, ER_SLAVE_RELAY_LOG_WRITE_FAILURE,
1070
1075
                   ER(ER_SLAVE_RELAY_LOG_WRITE_FAILURE),
1071
 
                   "failed to write a Rotate event"
1072
 
                   " to the relay log, SHOW SLAVE STATUS may be"
1073
 
                   " inaccurate");
 
1076
                   _("failed to write a Rotate event"
 
1077
                     " to the relay log, SHOW SLAVE STATUS may be"
 
1078
                     " inaccurate"));
1074
1079
      rli->relay_log.harvest_bytes_written(&rli->log_space_total);
1075
1080
      if (flush_master_info(mi, 1))
1076
 
        sql_print_error("Failed to flush master info file");
 
1081
        sql_print_error(_("Failed to flush master info file"));
1077
1082
      delete ev;
1078
1083
    }
1079
1084
    else
1080
1085
      mi->report(ERROR_LEVEL, ER_SLAVE_CREATE_EVENT_FAILURE,
1081
1086
                 ER(ER_SLAVE_CREATE_EVENT_FAILURE),
1082
 
                 "Rotate_event (out of memory?),"
1083
 
                 " SHOW SLAVE STATUS may be inaccurate");
 
1087
                 _("Rotate_event (out of memory?),"
 
1088
                   " SHOW SLAVE STATUS may be inaccurate"));
1084
1089
  }
1085
1090
  else
1086
1091
    pthread_mutex_unlock(log_lock);
1470
1475
    if (drizzle_errno(drizzle) == ER_NET_READ_INTERRUPTED)
1471
1476
      *suppress_warnings= true;                 // Suppress reconnect warning
1472
1477
    else
1473
 
      sql_print_error("Error on COM_BINLOG_DUMP: %d  %s, will retry in %d secs",
 
1478
      sql_print_error(_("Error on COM_BINLOG_DUMP: %d  %s, will retry in %d secs"),
1474
1479
                      drizzle_errno(drizzle), drizzle_error(drizzle),
1475
1480
                      mi->connect_retry);
1476
1481
    return(1);
1523
1528
      *suppress_warnings= true;
1524
1529
    }
1525
1530
    else
1526
 
      sql_print_error("Error reading packet from server: %s ( server_errno=%d)",
 
1531
      sql_print_error(_("Error reading packet from server: %s ( server_errno=%d)"),
1527
1532
                      drizzle_error(drizzle), drizzle_errno(drizzle));
1528
1533
    return(packet_error);
1529
1534
  }
1531
1536
  /* Check if eof packet */
1532
1537
  if (len < 8 && drizzle->net.read_pos[0] == 254)
1533
1538
  {
1534
 
    sql_print_information("Slave: received end packet from server, apparent "
1535
 
                          "master shutdown: %s",
 
1539
    sql_print_information(_("Slave: received end packet from server, apparent "
 
1540
                            "master shutdown: %s"),
1536
1541
                     drizzle_error(drizzle));
1537
1542
     return(packet_error);
1538
1543
  }
1760
1765
                                ev->log_pos - ev->data_written))
1761
1766
    {
1762
1767
      char buf[22];
1763
 
      sql_print_information("Slave SQL thread stopped because it reached its"
1764
 
                            " UNTIL position %s", llstr(rli->until_pos(), buf));
 
1768
      sql_print_information(_("Slave SQL thread stopped because it reached its"
 
1769
                              " UNTIL position %s"),
 
1770
                            llstr(rli->until_pos(), buf));
1765
1771
      /*
1766
1772
        Setting abort_slave flag because we do not want additional message about
1767
1773
        error in query execution to be printed.
1813
1819
        if (rli->trans_retries < slave_trans_retries)
1814
1820
        {
1815
1821
          if (init_master_info(rli->mi, 0, 0, 0, SLAVE_SQL))
1816
 
            sql_print_error("Failed to initialize the master info structure");
 
1822
            sql_print_error(_("Failed to initialize the master info structure"));
1817
1823
          else if (init_relay_log_pos(rli,
1818
1824
                                      rli->group_relay_log_name,
1819
1825
                                      rli->group_relay_log_pos,
1820
1826
                                      1, &errmsg, 1))
1821
 
            sql_print_error("Error initializing relay log position: %s",
 
1827
            sql_print_error(_("Error initializing relay log position: %s"),
1822
1828
                            errmsg);
1823
1829
          else
1824
1830
          {
1834
1840
          }
1835
1841
        }
1836
1842
        else
1837
 
          sql_print_error("Slave SQL thread retried transaction %lu time(s) "
1838
 
                          "in vain, giving up. Consider raising the value of "
1839
 
                          "the slave_transaction_retries variable.",
 
1843
          sql_print_error(_("Slave SQL thread retried transaction %lu time(s) "
 
1844
                            "in vain, giving up. Consider raising the value of "
 
1845
                            "the slave_transaction_retries variable."),
1840
1846
                          slave_trans_retries);
1841
1847
      }
1842
1848
      else if ((exec_res && !temp_err) ||
1900
1906
                            const char *messages[SLAVE_RECON_MSG_MAX])
1901
1907
{
1902
1908
  mi->slave_running= MYSQL_SLAVE_RUN_NOT_CONNECT;
1903
 
  thd->proc_info= messages[SLAVE_RECON_MSG_WAIT];
1904
 
#ifdef SIGNAL_WITH_VIO_CLOSE  
 
1909
  thd->proc_info= _(messages[SLAVE_RECON_MSG_WAIT]);
 
1910
#ifdef SIGNAL_WITH_VIO_CLOSE
1905
1911
  thd->clear_active_vio();
1906
1912
#endif
1907
1913
  end_server(drizzle);
1912
1918
    safe_sleep(thd, mi->connect_retry, (CHECK_KILLED_FUNC) io_slave_killed,
1913
1919
               (void *) mi);
1914
1920
  }
1915
 
  if (check_io_slave_killed(thd, mi, messages[SLAVE_RECON_MSG_KILLED_WAITING]))
 
1921
  if (check_io_slave_killed(thd, mi,
 
1922
                            _(messages[SLAVE_RECON_MSG_KILLED_WAITING])))
1916
1923
    return 1;
1917
 
  thd->proc_info = messages[SLAVE_RECON_MSG_AFTER];
1918
 
  if (!suppress_warnings) 
 
1924
  thd->proc_info = _(messages[SLAVE_RECON_MSG_AFTER]);
 
1925
  if (!suppress_warnings)
1919
1926
  {
1920
1927
    char buf[256], llbuff[22];
1921
 
    snprintf(buf, sizeof(buf), messages[SLAVE_RECON_MSG_FAILED], 
 
1928
    snprintf(buf, sizeof(buf), _(messages[SLAVE_RECON_MSG_FAILED]),
1922
1929
             IO_RPL_LOG_NAME, llstr(mi->master_log_pos, llbuff));
1923
 
    /* 
 
1930
    /*
1924
1931
      Raise a warining during registering on master/requesting dump.
1925
1932
      Log a message reading event.
1926
1933
    */
1927
 
    if (messages[SLAVE_RECON_MSG_COMMAND][0])
 
1934
    if (_(messages[SLAVE_RECON_MSG_COMMAND])[0])
1928
1935
    {
1929
1936
      mi->report(WARNING_LEVEL, ER_SLAVE_MASTER_COM_FAILURE,
1930
 
                 ER(ER_SLAVE_MASTER_COM_FAILURE), 
1931
 
                 messages[SLAVE_RECON_MSG_COMMAND], buf);
 
1937
                 ER(ER_SLAVE_MASTER_COM_FAILURE),
 
1938
                 _(messages[SLAVE_RECON_MSG_COMMAND]), buf);
1932
1939
    }
1933
1940
    else
1934
1941
    {
1938
1945
  if (safe_reconnect(thd, drizzle, mi, 1) || io_slave_killed(thd, mi))
1939
1946
  {
1940
1947
    if (global_system_variables.log_warnings)
1941
 
      sql_print_information(messages[SLAVE_RECON_MSG_KILLED_AFTER]);
 
1948
      sql_print_information(_(messages[SLAVE_RECON_MSG_KILLED_AFTER]));
1942
1949
    return 1;
1943
1950
  }
1944
1951
  return 0;
1979
1986
  {
1980
1987
    pthread_cond_broadcast(&mi->start_cond);
1981
1988
    pthread_mutex_unlock(&mi->run_lock);
1982
 
    sql_print_error("Failed during slave I/O thread initialization");
 
1989
    sql_print_error(_("Failed during slave I/O thread initialization"));
1983
1990
    goto err;
1984
1991
  }
1985
1992
  pthread_mutex_lock(&LOCK_thread_count);
2001
2008
  // we can get killed during safe_connect
2002
2009
  if (!safe_connect(thd, drizzle, mi))
2003
2010
  {
2004
 
    sql_print_information("Slave I/O thread: connected to master '%s@%s:%d',"
2005
 
                          "replication started in log '%s' at position %s",
 
2011
    sql_print_information(_("Slave I/O thread: connected to master '%s@%s:%d',"
 
2012
                            "replication started in log '%s' at position %s"),
2006
2013
                          mi->user, mi->host, mi->port,
2007
2014
                          IO_RPL_LOG_NAME,
2008
2015
                          llstr(mi->master_log_pos,llbuff));
2015
2022
  }
2016
2023
  else
2017
2024
  {
2018
 
    sql_print_information("Slave I/O thread killed while connecting to master");
 
2025
    sql_print_information(_("Slave I/O thread killed while connecting to master"));
2019
2026
    goto err;
2020
2027
  }
2021
2028
 
2027
2034
  thd_proc_info(thd, "Checking master version");
2028
2035
  if (get_master_version_and_clock(drizzle, mi))
2029
2036
    goto err;
2030
 
 
 
2037
  
2031
2038
  if (mi->rli.relay_log.description_event_for_queue->binlog_version > 1)
2032
2039
  {
2033
2040
    /*
2037
2044
    if (register_slave_on_master(drizzle, mi, &suppress_warnings))
2038
2045
    {
2039
2046
      if (!check_io_slave_killed(thd, mi, "Slave I/O thread killed "
2040
 
                                "while registering slave on master"))
 
2047
                                 "while registering slave on master"))
2041
2048
      {
2042
 
        sql_print_error("Slave I/O thread couldn't register on master");
 
2049
        sql_print_error(_("Slave I/O thread couldn't register on master"));
2043
2050
        if (try_to_reconnect(thd, drizzle, mi, &retry_count, suppress_warnings,
2044
2051
                             reconnect_messages[SLAVE_RECON_ACT_REG]))
2045
2052
          goto err;
2051
2058
    if (!retry_count_reg)
2052
2059
    {
2053
2060
      retry_count_reg++;
2054
 
      sql_print_information("Forcing to reconnect slave I/O thread");
 
2061
      sql_print_information(_("Forcing to reconnect slave I/O thread"));
2055
2062
      if (try_to_reconnect(thd, drizzle, mi, &retry_count, suppress_warnings,
2056
 
                         reconnect_messages[SLAVE_RECON_ACT_REG]))
 
2063
                           reconnect_messages[SLAVE_RECON_ACT_REG]))
2057
2064
        goto err;
2058
2065
      goto connected;
2059
2066
    }
2064
2071
    thd_proc_info(thd, "Requesting binlog dump");
2065
2072
    if (request_dump(drizzle, mi, &suppress_warnings))
2066
2073
    {
2067
 
      sql_print_error("Failed on request_dump()");
2068
 
      if (check_io_slave_killed(thd, mi, "Slave I/O thread killed while \
2069
 
requesting master dump") ||
 
2074
      sql_print_error(_("Failed on request_dump()"));
 
2075
      if (check_io_slave_killed(thd, mi, _("Slave I/O thread killed while \
 
2076
requesting master dump")) ||
2070
2077
          try_to_reconnect(thd, drizzle, mi, &retry_count, suppress_warnings,
2071
2078
                           reconnect_messages[SLAVE_RECON_ACT_DUMP]))
2072
2079
        goto err;
2075
2082
    if (!retry_count_dump)
2076
2083
    {
2077
2084
      retry_count_dump++;
2078
 
      sql_print_information("Forcing to reconnect slave I/O thread");
 
2085
      sql_print_information(_("Forcing to reconnect slave I/O thread"));
2079
2086
      if (try_to_reconnect(thd, drizzle, mi, &retry_count, suppress_warnings,
2080
2087
                           reconnect_messages[SLAVE_RECON_ACT_DUMP]))
2081
2088
        goto err;
2086
2093
    {
2087
2094
      uint32_t event_len;
2088
2095
      /*
2089
 
         We say "waiting" because read_event() will wait if there's nothing to
2090
 
         read. But if there's something to read, it will not wait. The
2091
 
         important thing is to not confuse users by saying "reading" whereas
2092
 
         we're in fact receiving nothing.
 
2096
        We say "waiting" because read_event() will wait if there's nothing to
 
2097
        read. But if there's something to read, it will not wait. The
 
2098
        important thing is to not confuse users by saying "reading" whereas
 
2099
        we're in fact receiving nothing.
2093
2100
      */
2094
 
      thd_proc_info(thd, "Waiting for master to send event");
 
2101
      thd_proc_info(thd, _("Waiting for master to send event"));
2095
2102
      event_len= read_event(drizzle, mi, &suppress_warnings);
2096
 
      if (check_io_slave_killed(thd, mi, "Slave I/O thread killed while \
2097
 
reading event"))
 
2103
      if (check_io_slave_killed(thd, mi, _("Slave I/O thread killed while "
 
2104
                                           "reading event")))
2098
2105
        goto err;
2099
2106
      if (!retry_count_event)
2100
2107
      {
2101
2108
        retry_count_event++;
2102
 
        sql_print_information("Forcing to reconnect slave I/O thread");
 
2109
        sql_print_information(_("Forcing to reconnect slave I/O thread"));
2103
2110
        if (try_to_reconnect(thd, drizzle, mi, &retry_count, suppress_warnings,
2104
2111
                             reconnect_messages[SLAVE_RECON_ACT_EVENT]))
2105
2112
          goto err;
2111
2118
        uint32_t drizzle_error_number= drizzle_errno(drizzle);
2112
2119
        switch (drizzle_error_number) {
2113
2120
        case CR_NET_PACKET_TOO_LARGE:
2114
 
          sql_print_error("\
2115
 
Log entry on master is longer than max_allowed_packet (%ld) on \
2116
 
slave. If the entry is correct, restart the server with a higher value of \
2117
 
max_allowed_packet",
 
2121
          sql_print_error(_("Log entry on master is longer than "
 
2122
                            "max_allowed_packet (%ld) on "
 
2123
                            "slave. If the entry is correct, restart the "
 
2124
                            "server with a higher value of "
 
2125
                            "max_allowed_packet"),
2118
2126
                          thd->variables.max_allowed_packet);
2119
2127
          goto err;
2120
2128
        case ER_MASTER_FATAL_ERROR_READING_BINLOG:
2123
2131
          goto err;
2124
2132
        case EE_OUTOFMEMORY:
2125
2133
        case ER_OUTOFMEMORY:
2126
 
          sql_print_error("\
2127
 
Stopping slave I/O thread due to out-of-memory error from master");
 
2134
          sql_print_error(
 
2135
       _("Stopping slave I/O thread due to out-of-memory error from master"));
2128
2136
          goto err;
2129
2137
        }
2130
2138
        if (try_to_reconnect(thd, drizzle, mi, &retry_count, suppress_warnings,
2134
2142
      } // if (event_len == packet_error)
2135
2143
 
2136
2144
      retry_count=0;                    // ok event, reset retry counter
2137
 
      thd_proc_info(thd, "Queueing master event to the relay log");
 
2145
      thd_proc_info(thd, _("Queueing master event to the relay log"));
2138
2146
      if (queue_event(mi,(const char*)drizzle->net.read_pos + 1, event_len))
2139
2147
      {
2140
2148
        goto err;
2141
2149
      }
2142
2150
      if (flush_master_info(mi, 1))
2143
2151
      {
2144
 
        sql_print_error("Failed to flush master info file");
 
2152
        sql_print_error(_("Failed to flush master info file"));
2145
2153
        goto err;
2146
2154
      }
2147
2155
      /*
2161
2169
          !rli->ignore_log_space_limit)
2162
2170
        if (wait_for_relay_log_space(rli))
2163
2171
        {
2164
 
          sql_print_error("Slave I/O thread aborted while waiting for relay \
2165
 
log space");
 
2172
          sql_print_error(_("Slave I/O thread aborted while waiting for "
 
2173
                            "relay log space"));
2166
2174
          goto err;
2167
2175
        }
2168
2176
    }
2169
2177
  }
2170
2178
 
2171
 
  // error = 0;
 
2179
// error = 0;
2172
2180
err:
2173
 
  // print the current replication position
2174
 
  sql_print_information("Slave I/O thread exiting, read up to log '%s', position %s",
2175
 
                  IO_RPL_LOG_NAME, llstr(mi->master_log_pos,llbuff));
 
2181
// print the current replication position
 
2182
  sql_print_information(_("Slave I/O thread exiting, read up to log '%s', "
 
2183
                          "position %s"),
 
2184
                        IO_RPL_LOG_NAME, llstr(mi->master_log_pos,llbuff));
2176
2185
  VOID(pthread_mutex_lock(&LOCK_thread_count));
2177
2186
  thd->query = thd->db = 0; // extra safety
2178
2187
  thd->query_length= thd->db_length= 0;
2194
2203
    mi->drizzle=0;
2195
2204
  }
2196
2205
  write_ignored_events_info_to_relay_log(thd, mi);
2197
 
  thd_proc_info(thd, "Waiting for slave mutex on exit");
 
2206
  thd_proc_info(thd, _("Waiting for slave mutex on exit"));
2198
2207
  pthread_mutex_lock(&mi->run_lock);
2199
2208
 
2200
2209
  /* Forget the relay log's format */
2260
2269
    */
2261
2270
    pthread_cond_broadcast(&rli->start_cond);
2262
2271
    pthread_mutex_unlock(&rli->run_lock);
2263
 
    sql_print_error("Failed during slave thread initialization");
 
2272
    sql_print_error(_("Failed during slave thread initialization"));
2264
2273
    goto err;
2265
2274
  }
2266
2275
  thd->init_for_queries();
2304
2313
                         1 /*need data lock*/, &errmsg,
2305
2314
                         1 /*look for a description_event*/))
2306
2315
  {
2307
 
    sql_print_error("Error initializing relay log position: %s",
 
2316
    sql_print_error(_("Error initializing relay log position: %s"),
2308
2317
                    errmsg);
2309
2318
    goto err;
2310
2319
  }
2326
2335
  assert(rli->sql_thd == thd);
2327
2336
 
2328
2337
  if (global_system_variables.log_warnings)
2329
 
    sql_print_information("Slave SQL thread initialized, starting replication in \
2330
 
log '%s' at position %s, relay log '%s' position: %s", RPL_LOG_NAME,
2331
 
                    llstr(rli->group_master_log_pos,llbuff),rli->group_relay_log_name,
2332
 
                    llstr(rli->group_relay_log_pos,llbuff1));
 
2338
    sql_print_information(_("Slave SQL thread initialized, "
 
2339
                            "starting replication in log '%s' at "
 
2340
                            "position %s, relay log '%s' position: %s"),
 
2341
                            RPL_LOG_NAME,
 
2342
                          llstr(rli->group_master_log_pos,llbuff),
 
2343
                          rli->group_relay_log_name,
 
2344
                          llstr(rli->group_relay_log_pos,llbuff1));
2333
2345
 
2334
2346
  /* execute init_slave variable */
2335
2347
  if (sys_init_slave.value_length)
2337
2349
    execute_init_command(thd, &sys_init_slave, &LOCK_sys_init_slave);
2338
2350
    if (thd->is_slave_error)
2339
2351
    {
2340
 
      sql_print_error("\
2341
 
Slave SQL thread aborted. Can't execute init_slave query");
 
2352
      sql_print_error(_("Slave SQL thread aborted. "
 
2353
                        "Can't execute init_slave query"));
2342
2354
      goto err;
2343
2355
    }
2344
2356
  }
2352
2364
      rli->is_until_satisfied(rli->group_master_log_pos))
2353
2365
  {
2354
2366
    char buf[22];
2355
 
    sql_print_information("Slave SQL thread stopped because it reached its"
2356
 
                          " UNTIL position %s", llstr(rli->until_pos(), buf));
 
2367
    sql_print_information(_("Slave SQL thread stopped because it reached its"
 
2368
                            " UNTIL position %s"), llstr(rli->until_pos(), buf));
2357
2369
    pthread_mutex_unlock(&rli->data_lock);
2358
2370
    goto err;
2359
2371
  }
2363
2375
 
2364
2376
  while (!sql_slave_killed(thd,rli))
2365
2377
  {
2366
 
    thd_proc_info(thd, "Reading event from the relay log");
 
2378
    thd_proc_info(thd, _("Reading event from the relay log"));
2367
2379
    assert(rli->sql_thd == thd);
2368
2380
    THD_CHECK_SENTRY(thd);
2369
2381
    if (exec_relay_log_event(thd,rli))
2388
2400
          }
2389
2401
          else if (last_errno != thd->main_da.sql_errno())
2390
2402
          {
2391
 
            sql_print_error("Slave (additional info): %s Error_code: %d",
 
2403
            sql_print_error(_("Slave (additional info): %s Error_code: %d"),
2392
2404
                            errmsg, thd->main_da.sql_errno());
2393
2405
          }
2394
2406
        }
2405
2417
        {
2406
2418
          if (err->code == ER_CANT_OPEN_LIBRARY)
2407
2419
            udf_error = true;
2408
 
          sql_print_warning("Slave: %s Error_code: %d",err->msg, err->code);
 
2420
          sql_print_warning(_("Slave: %s Error_code: %d"),err->msg, err->code);
2409
2421
        }
2410
2422
        if (udf_error)
2411
 
          sql_print_error("Error loading user-defined library, slave SQL "
2412
 
            "thread aborted. Install the missing library, and restart the "
2413
 
            "slave SQL thread with \"SLAVE START\". We stopped at log '%s' "
2414
 
            "position %s", RPL_LOG_NAME, llstr(rli->group_master_log_pos, 
 
2423
          sql_print_error(_("Error loading user-defined library, slave SQL "
 
2424
                            "thread aborted. Install the missing library, "
 
2425
                            "and restart the slave SQL thread with "
 
2426
                            "\"SLAVE START\". We stopped at log '%s' "
 
2427
                            "position %s"),
 
2428
                          RPL_LOG_NAME, llstr(rli->group_master_log_pos,
2415
2429
            llbuff));
2416
2430
        else
2417
 
        sql_print_error("\
2418
 
Error running query, slave SQL thread aborted. Fix the problem, and restart \
2419
 
the slave SQL thread with \"SLAVE START\". We stopped at log \
2420
 
'%s' position %s", RPL_LOG_NAME, llstr(rli->group_master_log_pos, llbuff));
 
2431
          sql_print_error(_("Error running query, slave SQL thread aborted. "
 
2432
                            "Fix the problem, and restart "
 
2433
                            "the slave SQL thread with \"SLAVE START\". "
 
2434
                            "We stopped at log '%s' position %s"),
 
2435
                          RPL_LOG_NAME,
 
2436
                          llstr(rli->group_master_log_pos, llbuff));
2421
2437
      }
2422
2438
      goto err;
2423
2439
    }
2424
2440
  }
2425
2441
 
2426
2442
  /* Thread stopped. Print the current replication position to the log */
2427
 
  sql_print_information("Slave SQL thread exiting, replication stopped in log "
2428
 
                        "'%s' at position %s",
2429
 
                        RPL_LOG_NAME, llstr(rli->group_master_log_pos,llbuff));
 
2443
  sql_print_information(_("Slave SQL thread exiting, replication stopped in "
 
2444
                          "log '%s' at position %s"),
 
2445
                        RPL_LOG_NAME,
 
2446
                        llstr(rli->group_master_log_pos,llbuff));
2430
2447
 
2431
2448
 err:
2432
2449
 
2519
2536
 
2520
2537
  if (unlikely(net_request_file(net,cev->fname)))
2521
2538
  {
2522
 
    sql_print_error("Slave I/O: failed requesting download of '%s'",
 
2539
    sql_print_error(_("Slave I/O: failed requesting download of '%s'"),
2523
2540
                    cev->fname);
2524
2541
    goto err;
2525
2542
  }
2536
2553
    {
2537
2554
      if (unlikely((num_bytes=my_net_read(net)) == packet_error))
2538
2555
      {
2539
 
        sql_print_error("Network read error downloading '%s' from master",
 
2556
        sql_print_error(_("Network read error downloading '%s' from master"),
2540
2557
                        cev->fname);
2541
2558
        goto err;
2542
2559
      }
2708
2725
                                            mi->rli.relay_log.description_event_for_queue);
2709
2726
  if (unlikely(!ev))
2710
2727
  {
2711
 
    sql_print_error("Read invalid event from master: '%s',\
2712
 
 master could be corrupt but a more likely cause of this is a bug",
 
2728
    sql_print_error(_("Read invalid event from master: '%s', "
 
2729
                      "master could be corrupt but a more likely cause "
 
2730
                      "of this is a bug"),
2713
2731
                    errmsg);
2714
2732
    my_free((char*) tmp_buf, MYF(MY_ALLOW_ZERO_PTR));
2715
2733
    return(1);
2793
2811
                                            mi->rli.relay_log.description_event_for_queue);
2794
2812
  if (unlikely(!ev))
2795
2813
  {
2796
 
    sql_print_error("Read invalid event from master: '%s',\
2797
 
 master could be corrupt but a more likely cause of this is a bug",
 
2814
    sql_print_error(_("Read invalid event from master: '%s', "
 
2815
                      "master could be corrupt but a more likely cause of "
 
2816
                      "this is a bug"),
2798
2817
                    errmsg);
2799
2818
    my_free((char*) tmp_buf, MYF(MY_ALLOW_ZERO_PTR));
2800
2819
    return(1);
3187
3206
    if (reconnect)
3188
3207
    {
3189
3208
      if (!suppress_warnings && global_system_variables.log_warnings)
3190
 
        sql_print_information("Slave: connected to master '%s@%s:%d',\
3191
 
replication resumed in log '%s' at position %s", mi->user,
3192
 
                        mi->host, mi->port,
3193
 
                        IO_RPL_LOG_NAME,
3194
 
                        llstr(mi->master_log_pos,llbuff));
 
3209
        sql_print_information(_("Slave: connected to master '%s@%s:%d', "
 
3210
                                "replication resumed in log '%s' at "
 
3211
                                "position %s"), mi->user,
 
3212
                                mi->host, mi->port,
 
3213
                                IO_RPL_LOG_NAME,
 
3214
                                llstr(mi->master_log_pos,llbuff));
3195
3215
    }
3196
3216
    else
3197
3217
    {
3576
3596
      {
3577
3597
#ifdef EXTRA_DEBUG
3578
3598
        if (global_system_variables.log_warnings)
3579
 
          sql_print_information("next log '%s' is currently active",
 
3599
          sql_print_information(_("next log '%s' is currently active"),
3580
3600
                                rli->linfo.log_file_name);
3581
3601
#endif
3582
3602
        rli->cur_log= cur_log= rli->relay_log.get_log_file();
3606
3626
      */
3607
3627
#ifdef EXTRA_DEBUG
3608
3628
      if (global_system_variables.log_warnings)
3609
 
        sql_print_information("next log '%s' is not active",
 
3629
        sql_print_information(_("next log '%s' is not active"),
3610
3630
                              rli->linfo.log_file_name);
3611
3631
#endif
3612
3632
      // open_binlog() will check the magic header
3622
3642
      */
3623
3643
      if (hot_log)
3624
3644
        pthread_mutex_unlock(log_lock);
3625
 
      sql_print_error("Slave SQL thread: I/O error reading \
3626
 
event(errno: %d  cur_log->error: %d)",
 
3645
      sql_print_error(_("Slave SQL thread: I/O error reading "
 
3646
                        "event(errno: %d  cur_log->error: %d)"),
3627
3647
                      my_errno,cur_log->error);
3628
3648
      // set read position to the beginning of the event
3629
3649
      my_b_seek(cur_log,rli->event_relay_log_pos);
3630
3650
      /* otherwise, we have had a partial read */
3631
 
      errmsg = "Aborting slave SQL thread because of partial event read";
 
3651
      errmsg = _("Aborting slave SQL thread because of partial event read");
3632
3652
      break;                                    // To end of function
3633
3653
    }
3634
3654
  }
3635
3655
  if (!errmsg && global_system_variables.log_warnings)
3636
3656
  {
3637
 
    sql_print_information("Error reading relay log event: %s",
3638
 
                          "slave SQL thread was killed");
 
3657
    sql_print_information(_("Error reading relay log event: %s"),
 
3658
                          _("slave SQL thread was killed"));
3639
3659
    return(0);
3640
3660
  }
3641
3661
 
3642
3662
err:
3643
3663
  if (errmsg)
3644
 
    sql_print_error("Error reading relay log event: %s", errmsg);
 
3664
    sql_print_error(_("Error reading relay log event: %s"), errmsg);
3645
3665
  return(0);
3646
3666
}
3647
3667
 
3729
3749
        (memcmp(fixed_in,      master_ver, 3) >  0))
3730
3750
    {
3731
3751
      if (!report)
3732
 
        return true;
3733
 
      
 
3752
        return true;
 
3753
 
3734
3754
      // a short message for SHOW SLAVE STATUS (message length constraints)
3735
 
      my_printf_error(ER_UNKNOWN_ERROR, "master may suffer from"
3736
 
                      " http://bugs.mysql.com/bug.php?id=%u"
3737
 
                      " so slave stops; check error log on slave"
3738
 
                      " for more info", MYF(0), bug_id);
 
3755
      my_printf_error(ER_UNKNOWN_ERROR,
 
3756
                      _("master may suffer from"
 
3757
                        " http://bugs.mysql.com/bug.php?id=%u"
 
3758
                        " so slave stops; check error log on slave"
 
3759
                        " for more info"), MYF(0), bug_id);
3739
3760
      // a verbose message for the error log
3740
3761
      rli->report(ERROR_LEVEL, ER_UNKNOWN_ERROR,
3741
 
                  "According to the master's version ('%s'),"
3742
 
                  " it is probable that master suffers from this bug:"
3743
 
                      " http://bugs.mysql.com/bug.php?id=%u"
3744
 
                      " and thus replicating the current binary log event"
3745
 
                      " may make the slave's data become different from the"
3746
 
                      " master's data."
3747
 
                      " To take no risk, slave refuses to replicate"
3748
 
                      " this event and stops."
3749
 
                      " We recommend that all updates be stopped on the"
3750
 
                      " master and slave, that the data of both be"
3751
 
                      " manually synchronized,"
3752
 
                      " that master's binary logs be deleted,"
3753
 
                      " that master be upgraded to a version at least"
3754
 
                      " equal to '%d.%d.%d'. Then replication can be"
3755
 
                      " restarted.",
3756
 
                      rli->relay_log.description_event_for_exec->server_version,
3757
 
                      bug_id,
3758
 
                      fixed_in[0], fixed_in[1], fixed_in[2]);
 
3762
                  _("According to the master's version ('%s'),"
 
3763
                    " it is probable that master suffers from this bug:"
 
3764
                    " http://bugs.mysql.com/bug.php?id=%u"
 
3765
                    " and thus replicating the current binary log event"
 
3766
                    " may make the slave's data become different from the"
 
3767
                    " master's data."
 
3768
                    " To take no risk, slave refuses to replicate"
 
3769
                    " this event and stops."
 
3770
                    " We recommend that all updates be stopped on the"
 
3771
                    " master and slave, that the data of both be"
 
3772
                    " manually synchronized,"
 
3773
                    " that master's binary logs be deleted,"
 
3774
                    " that master be upgraded to a version at least"
 
3775
                    " equal to '%d.%d.%d'. Then replication can be"
 
3776
                    " restarted."),
 
3777
                  rli->relay_log.description_event_for_exec->server_version,
 
3778
                  bug_id,
 
3779
                  fixed_in[0], fixed_in[1], fixed_in[2]);
3759
3780
      return true;
3760
3781
    }
3761
3782
  }