Commit a37604ea authored by unknown's avatar unknown
Browse files

Merge tulin@bk-internal.mysql.com:/home/bk/mysql-5.1-new

into  poseidon.ndb.mysql.com:/home/tomas/v7


include/my_base.h:
  Auto merged
mysql-test/t/mysqltest.test:
  Auto merged
sql/handler.cc:
  Auto merged
sql/handler.h:
  Auto merged
mysql-test/t/disabled.def:
  SCCS merged
parents 14ff02d3 0f30b9d7
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1670,3 +1670,5 @@ storage/ndb/test/ndbapi/testPartitioning
storage/ndb/test/ndbapi/testReadPerf
storage/ndb/test/ndbapi/test_event_merge
storage/ndb/test/tools/listen_event
libmysqld/ha_ndbcluster_binlog.cc
libmysqld/rpl_injector.cc
+117 −8
Original line number Diff line number Diff line
@@ -852,10 +852,15 @@ static VAR *var_obtain(const char *name, int len)
  return v;
}

/*
  - if variable starts with a $ it is regarded as a local test varable
  - if not it is treated as a environment variable, and the corresponding
  environment variable will be updated
*/
int var_set(const char *var_name, const char *var_name_end,
            const char *var_val, const char *var_val_end)
{
  int digit;
  int digit, result, env_var= 0;
  VAR* v;
  DBUG_ENTER("var_set");
  DBUG_PRINT("enter", ("var_name: '%.*s' = '%.*s' (length: %d)",
@@ -863,11 +868,11 @@ int var_set(const char *var_name, const char *var_name_end,
                       (int) (var_val_end - var_val), var_val,
                       (int) (var_val_end - var_val)));

  if (*var_name++ != '$')
  {
    var_name--;
    die("Variable name in %s does not start with '$'", var_name);
  }
  if (*var_name != '$')
    env_var= 1;
  else
    var_name++;

  digit = *var_name - '0';
  if (!(digit < 10 && digit >= 0))
  {
@@ -875,7 +880,23 @@ int var_set(const char *var_name, const char *var_name_end,
  }
  else
    v = var_reg + digit;
  DBUG_RETURN(eval_expr(v, var_val, (const char**)&var_val_end));

  result= eval_expr(v, var_val, (const char**) &var_val_end);

  if (env_var)
  {
    char buf[1024];
    memcpy(buf, v->name, v->name_len);
    buf[v->name_len]= 0;
    if (v->int_dirty)
    {
      sprintf(v->str_val, "%d", v->int_val);
      v->int_dirty= 0;
      v->str_val_len= strlen(v->str_val);
    }
    setenv(buf, v->str_val, 1);
  }
  DBUG_RETURN(result);
}


@@ -1483,6 +1504,10 @@ int do_sync_with_master(struct st_query *query)
  return do_sync_with_master2(offset);
}

/*
  when ndb binlog is on, this call will wait until last updated epoch
  (locally in the mysqld) has been received into the binlog
*/
int do_save_master_pos()
{
  MYSQL_RES* res;
@@ -1494,6 +1519,89 @@ int do_save_master_pos()
  rpl_parse = mysql_rpl_parse_enabled(mysql);
  mysql_disable_rpl_parse(mysql);

#ifdef HAVE_NDB_BINLOG
  /*
     Wait for ndb binlog to be up-to-date with all changes
     done on the local mysql server
  */
  {
    ulong have_ndbcluster;
    if (mysql_query(mysql, query= "show variables like 'have_ndbcluster'"))
      die("At line %u: failed in %s: %d: %s", start_lineno, query,
          mysql_errno(mysql), mysql_error(mysql));
    if (!(res= mysql_store_result(mysql)))
      die("line %u: mysql_store_result() retuned NULL for '%s'", start_lineno,
          query);
    if (!(row= mysql_fetch_row(res)))
      die("line %u: empty result in %s", start_lineno, query);

    have_ndbcluster= strcmp("YES", row[1]) == 0;
    mysql_free_result(res);

    if (have_ndbcluster)
    {
      ulonglong epoch, tmp_epoch= 0;
      int count= 0;

      do
      {
        const char binlog[]= "binlog";
        const char latest_trans_epoch[]=
          "latest_trans_epoch=";
        const char latest_applied_binlog_epoch[]=
          "latest_applied_binlog_epoch=";
        if (count)
          sleep(1);
        if (mysql_query(mysql, query= "show engine ndb status"))
          die("At line %u: failed in '%s': %d: %s", start_lineno, query,
              mysql_errno(mysql), mysql_error(mysql));
        if (!(res= mysql_store_result(mysql)))
          die("line %u: mysql_store_result() retuned NULL for '%s'",
              start_lineno, query);
        while ((row= mysql_fetch_row(res)))
        {
          if (strcmp(row[1], binlog) == 0)
          {
            const char *status= row[2];
            /* latest_trans_epoch */
            if (count == 0)
            {
              while (*status && strncmp(status, latest_trans_epoch,
                                        sizeof(latest_trans_epoch)-1))
                status++;
              if (*status)
              {
                status+= sizeof(latest_trans_epoch)-1;
                epoch= strtoull(status, (char**) 0, 10);
              }
              else
                die("line %u: result does not contain '%s' in '%s'",
                    start_lineno, latest_trans_epoch, query);
            }
            /* latest_applied_binlog_epoch */
            while (*status && strncmp(status, latest_applied_binlog_epoch,
                                      sizeof(latest_applied_binlog_epoch)-1))
              status++;
            if (*status)
            {
              status+= sizeof(latest_applied_binlog_epoch)-1;
              tmp_epoch= strtoull(status, (char**) 0, 10);
            }
            else
              die("line %u: result does not contain '%s' in '%s'",
                  start_lineno, latest_applied_binlog_epoch, query);
            break;
          }
        }
        mysql_free_result(res);
        if (!row)
          die("line %u: result does not contain '%s' in '%s'",
              start_lineno, binlog, query);
        count++;
      } while (tmp_epoch < epoch && count <= 3);
    }
  }
#endif
  if (mysql_query(mysql, query= "show master status"))
    die("failed in show master status: %d: %s",
	mysql_errno(mysql), mysql_error(mysql));
@@ -1544,7 +1652,8 @@ int do_let(struct st_query *query)
  while (*p && (*p != '=') && !my_isspace(charset_info,*p))
    p++;
  var_name_end= p;
  if (var_name+1 == var_name_end)
  if (var_name == var_name_end ||
      (var_name+1 == var_name_end && *var_name == '$'))
    die("Missing variable name in let");
  while (my_isspace(charset_info,*p))
    p++;
+25 −0
Original line number Diff line number Diff line
@@ -87,6 +87,11 @@ AC_DEFUN([MYSQL_CHECK_NDB_OPTIONS], [
                           [Extra CFLAGS for ndb compile]),
              [ndb_ccflags=${withval}],
              [ndb_ccflags=""])
  AC_ARG_WITH([ndb-binlog],
              [
  --without-ndb-binlog       Disable ndb binlog],
              [ndb_binlog="$withval"],
              [ndb_binlog="default"])

  case "$ndb_ccflags" in
    "yes")
@@ -185,6 +190,7 @@ AC_DEFUN([MYSQL_SETUP_NDBCLUSTER], [
  ndbcluster_libs="\$(top_builddir)/storage/ndb/src/.libs/libndbclient.a"
  ndbcluster_system_libs=""
  ndb_mgmclient_libs="\$(top_builddir)/storage/ndb/src/mgmclient/libndbmgmclient.la"
  mysql_se_objs="$mysql_se_objs ha_ndbcluster_binlog.o"

  MYSQL_CHECK_NDB_OPTIONS
  NDBCLUSTER_WORKAROUNDS
@@ -219,6 +225,25 @@ AC_DEFUN([MYSQL_SETUP_NDBCLUSTER], [
    ndb_port="1186"
  fi
  
  have_ndb_binlog="no"
  if test X"$ndb_binlog" = Xdefault ||
     test X"$ndb_binlog" = Xyes
  then
    if test X"$have_row_based" = Xyes
    then
      have_ndb_binlog="yes"
    fi
  fi

  if test X"$have_ndb_binlog" = Xyes
  then
    AC_DEFINE([HAVE_NDB_BINLOG], [1],
              [Including Ndb Cluster Binlog])
    AC_MSG_RESULT([Including Ndb Cluster Binlog])
  else
    AC_MSG_RESULT([Not including Ndb Cluster Binlog])
  fi

  ndb_transporter_opt_objs=""
  if test "$ac_cv_func_shmget" = "yes" &&
     test "$ac_cv_func_shmat" = "yes" &&
+8 −1
Original line number Diff line number Diff line
@@ -154,7 +154,14 @@ enum ha_extra_function {
    to overwrite entire row.
  */
  HA_EXTRA_KEYREAD_PRESERVE_FIELDS,
  HA_EXTRA_MMAP
  HA_EXTRA_MMAP,
  /* 
    Ignore if the a tuple is not found, continue processing the
    transaction and ignore that 'row'.  Needed for idempotency
    handling on the slave
  */
  HA_EXTRA_IGNORE_NO_KEY,
  HA_EXTRA_NO_IGNORE_NO_KEY
};

	/* The following is parameter to ha_panic() */
+1 −1
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ enum enum_server_command
  COM_TIME, COM_DELAYED_INSERT, COM_CHANGE_USER, COM_BINLOG_DUMP,
  COM_TABLE_DUMP, COM_CONNECT_OUT, COM_REGISTER_SLAVE,
  COM_STMT_PREPARE, COM_STMT_EXECUTE, COM_STMT_SEND_LONG_DATA, COM_STMT_CLOSE,
  COM_STMT_RESET, COM_SET_OPTION, COM_STMT_FETCH,
  COM_STMT_RESET, COM_SET_OPTION, COM_STMT_FETCH, COM_DAEMON,
  /* don't forget to update const char *command_name[] in sql_parse.cc */

  /* Must be last */
Loading