List:Commits« Previous MessageNext Message »
From:Luís Soares Date:October 27 2010 11:09am
Subject:Re: bzr commit into mysql-next-mr.crash-safe branch (alfranio.correia:3045)
WL#2775
View as plain text  
Hi,

   Just missing the fix for:

     DBUG_ENTER("Rpl_info_table_access::find_info_for_server_id");

   which is here: http://lists.mysql.com/commits/122059


   I guess this settle it from my side. Thanks for this great work.

   Worklog implementation approved.

Kind Regards,
Luís

On 10/27/2010 10:04 AM, Alfranio Correia wrote:
> #At
> file:///home/acorreia/workspace.sun/repository.mysql.new/bzrwork/wl-2775/mysql-next-mr-rpl-merge.crash-safe.2775/
> based on revid:alfranio.correia@stripped
>
>   3045 Alfranio Correia	2010-10-27
>        Addressed review comments in the WL#2775.
>       @ sql/rpl_info_table.cc
>          Simplified the expression
>            error= ((res == FOUND_ID || res == NOT_FOUND_ID) ? 0 : 1);
>       @ sql/rpl_info_table_access.cc
>          Replaced c_ptr() by c_ptr_safe().
>       @ sql/rpl_info_values.cc
>          Created an array of Strings.
>       @ sql/rpl_info_values.h
>          Created an array of Strings.
>
>      modified:
>        sql/rpl_info_table.cc
>        sql/rpl_info_table_access.cc
>        sql/rpl_info_values.cc
>        sql/rpl_info_values.h
> === modified file 'sql/rpl_info_table.cc'
> --- a/sql/rpl_info_table.cc	2010-10-25 10:39:01 +0000
> +++ b/sql/rpl_info_table.cc	2010-10-27 09:04:21 +0000
> @@ -254,7 +254,7 @@ int Rpl_info_table::do_remove_info()
>         goto end;
>       }
>     }
> -  error= ((res == FOUND_ID || res == NOT_FOUND_ID) ? 0 : 1);
> +  error= (res == ERROR_ID);
>   end:
>     /*
>       Unlocks and closes the rpl_info table.
> @@ -335,31 +335,31 @@ int Rpl_info_table::do_prepare_info_for_
>
>   bool Rpl_info_table::do_set_info(const int pos, const char *value)
>   {
> -  return (field_values->value[pos].str->copy(value, strlen(value),
> -&my_charset_bin));
> +  return (field_values->value[pos].copy(value, strlen(value),
> +&my_charset_bin));
>   }
>
>   bool Rpl_info_table::do_set_info(const int pos, const ulong value)
>   {
> -  return (field_values->value[pos].str->set_int(value, TRUE,
> -&my_charset_bin));
> +  return (field_values->value[pos].set_int(value, TRUE,
> +&my_charset_bin));
>   }
>
>   bool Rpl_info_table::do_set_info(const int pos, const int value)
>   {
> -  return (field_values->value[pos].str->set_int(value, FALSE,
> -&my_charset_bin));
> +  return (field_values->value[pos].set_int(value, FALSE,
> +&my_charset_bin));
>   }
>
>   bool Rpl_info_table::do_set_info(const int pos, const float value)
>   {
> -  return (field_values->value[pos].str->set_real(value, NOT_FIXED_DEC,
> -&my_charset_bin));
> +  return (field_values->value[pos].set_real(value, NOT_FIXED_DEC,
> +&my_charset_bin));
>   }
>
>   bool Rpl_info_table::do_set_info(const int pos, const Server_ids *value)
>   {
> -  if (const_cast<Server_ids
> *>(value)->pack_server_ids(field_values->value[pos].str))
> +  if (const_cast<Server_ids
> *>(value)->pack_server_ids(&field_values->value[pos]))
>       return TRUE;
>
>     return FALSE;
> @@ -368,9 +368,9 @@ bool Rpl_info_table::do_set_info(const i
>   bool Rpl_info_table::do_get_info(const int pos, char *value, const size_t size,
>                                    const char *default_value)
>   {
> -  if (field_values->value[pos].str->length())
> -    strmake(value, field_values->value[pos].str->c_ptr(),
> -            field_values->value[pos].str->length());
> +  if (field_values->value[pos].length())
> +    strmake(value, field_values->value[pos].c_ptr_safe(),
> +            field_values->value[pos].length());
>     else if (default_value)
>       strmake(value, default_value, strlen(default_value));
>     else
> @@ -382,9 +382,9 @@ bool Rpl_info_table::do_get_info(const i
>   bool Rpl_info_table::do_get_info(const int pos, ulong *value,
>                                    const ulong default_value)
>   {
> -  if (field_values->value[pos].str->length())
> +  if (field_values->value[pos].length())
>     {
> -    *value= strtoul(field_values->value[pos].str->c_ptr(), 0, 10);
> +    *value= strtoul(field_values->value[pos].c_ptr_safe(), 0, 10);
>       return FALSE;
>     }
>     else if (default_value)
> @@ -399,9 +399,9 @@ bool Rpl_info_table::do_get_info(const i
>   bool Rpl_info_table::do_get_info(const int pos, int *value,
>                                    const int default_value)
>   {
> -  if (field_values->value[pos].str->length())
> +  if (field_values->value[pos].length())
>     {
> -    *value=  atoi(field_values->value[pos].str->c_ptr());
> +    *value=  atoi(field_values->value[pos].c_ptr_safe());
>       return FALSE;
>     }
>     else if (default_value)
> @@ -416,9 +416,9 @@ bool Rpl_info_table::do_get_info(const i
>   bool Rpl_info_table::do_get_info(const int pos, float *value,
>                                    const float default_value)
>   {
> -  if (field_values->value[pos].str->length())
> +  if (field_values->value[pos].length())
>     {
> -    if (sscanf(field_values->value[pos].str->c_ptr(), "%f", value) != 1)
> +    if (sscanf(field_values->value[pos].c_ptr_safe(), "%f", value) != 1)
>         return TRUE;
>       return FALSE;
>     }
> @@ -434,7 +434,7 @@ bool Rpl_info_table::do_get_info(const i
>   bool Rpl_info_table::do_get_info(const int pos, Server_ids *value,
>                                    const Server_ids *default_value
> __attribute__((unused)))
>   {
> -  if (value->unpack_server_ids(field_values->value[pos].str->c_ptr()))
> +  if (value->unpack_server_ids(field_values->value[pos].c_ptr_safe()))
>       return TRUE;
>
>     return FALSE;
>
> === modified file 'sql/rpl_info_table_access.cc'
> --- a/sql/rpl_info_table_access.cc	2010-10-25 10:39:01 +0000
> +++ b/sql/rpl_info_table_access.cc	2010-10-27 09:04:21 +0000
> @@ -178,13 +178,13 @@ enum enum_return_id Rpl_info_table_acces
>     uchar key[MAX_KEY_LENGTH];
>     DBUG_ENTER("Rpl_info_table_access::find_info_id");
>
> -  field_values->value[idx].str->set_int(server_id, TRUE,&my_charset_bin);
> +  field_values->value[idx].set_int(server_id, TRUE,&my_charset_bin);
>
> -  if (field_values->value[idx].str->length()> 
> table->field[idx]->field_length)
> +  if (field_values->value[idx].length()> 
> table->field[idx]->field_length)
>       DBUG_RETURN(ERROR_ID);
>
> -  table->field[idx]->store(field_values->value[idx].str->c_ptr(),
> -                           field_values->value[idx].str->length(),
> +  table->field[idx]->store(field_values->value[idx].c_ptr_safe(),
> +                           field_values->value[idx].length(),
>                              &my_charset_bin);
>
>     if (!(table->field[idx]->flags&  PRI_KEY_FLAG)&&
> @@ -226,7 +226,7 @@ bool Rpl_info_table_access::load_info_va
>     while (field_idx<  max_num_field)
>     {
>       fields[field_idx]->val_str(&str);
> -    field_values->value[field_idx].str->copy(str.c_ptr(), str.length(),
> +    field_values->value[field_idx].copy(str.c_ptr_safe(), str.length(),
>                                                &my_charset_bin);
>       field_idx++;
>     }
> @@ -256,8 +256,8 @@ bool Rpl_info_table_access::store_info_v
>     while (field_idx<  max_num_field)
>     {
>       fields[field_idx]->set_notnull();
> -    if
> (fields[field_idx]->store(field_values->value[field_idx].str->c_ptr(),
> -                                
> field_values->value[field_idx].str->length(),
> +    if (fields[field_idx]->store(field_values->value[field_idx].c_ptr_safe(),
> +                                 field_values->value[field_idx].length(),
>                                    &my_charset_bin))
>       {
>         my_error(ER_RPL_INFO_DATA_TOO_LONG, MYF(0),
>
> === modified file 'sql/rpl_info_values.cc'
> --- a/sql/rpl_info_values.cc	2010-10-25 10:39:01 +0000
> +++ b/sql/rpl_info_values.cc	2010-10-27 09:04:21 +0000
> @@ -16,10 +16,7 @@
>   #include "rpl_info_values.h"
>
>   Rpl_info_values::Rpl_info_values(int param_ninfo): value(0),
> -    ninfo(param_ninfo)
> -{
> -  init_alloc_root(&mem_root, 256, 512);
> -}
> +    ninfo(param_ninfo) { }
>
>   /**
>     Initializes a sequence of values to be read from or stored into a repository.
> @@ -34,18 +31,16 @@ bool Rpl_info_values::init()
>   {
>     DBUG_ENTER("Rpl_info_values::init");
>
> -  if (!value&&  !(value= new struct_value[ninfo]))
> +  if (!value&&  !(value= new String[ninfo]))
>         DBUG_RETURN(TRUE);
>
> -  for (int field_idx= 0; field_idx<  ninfo; field_idx++)
> -    value[field_idx].str= new (&mem_root) String;
> -
>     DBUG_RETURN(FALSE);
>   }
>
>   Rpl_info_values::~Rpl_info_values()
>   {
> -  free_root(&mem_root, MYF(0));
> -  if (value)
> -    delete [] value;
> +  for (int pos= 0; pos<  ninfo; pos++)
> +    value[pos].~String();
> +
> +  delete [] value;
>   }
>
> === modified file 'sql/rpl_info_values.h'
> --- a/sql/rpl_info_values.h	2010-10-25 10:39:01 +0000
> +++ b/sql/rpl_info_values.h	2010-10-27 09:04:21 +0000
> @@ -21,11 +21,6 @@
>   #include<my_sys.h>
>   #include<sql_string.h>
>
> -typedef struct struct_value
> -{
> -  String *str;
> -} struct_value;
> -
>   class Rpl_info_values
>   {
>   public:
> @@ -33,12 +28,9 @@ public:
>     virtual ~Rpl_info_values();
>
>     bool init();
> -  bool resize(int needed_size, int pos);
>
>     /* Sequence of values to be read from or stored into a repository. */
> -  struct_value *value;
> -
> -  MEM_ROOT mem_root;
> +  String *value;
>
>   private:
>     /* This property represents the number of fields. */
>
>
>
>
>

Thread
bzr commit into mysql-next-mr.crash-safe branch (alfranio.correia:3045)WL#2775Alfranio Correia27 Oct
  • Re: bzr commit into mysql-next-mr.crash-safe branch (alfranio.correia:3045)WL#2775Luís Soares27 Oct