Commit 78e288b4 authored by unknown's avatar unknown
Browse files

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

into  mysql.com:/home/mysql_src/mysql-5.1-new-WL3146-handler


sql/ha_berkeley.cc:
  Auto merged
sql/ha_berkeley.h:
  Auto merged
sql/ha_heap.cc:
  Auto merged
sql/ha_innodb.cc:
  Auto merged
sql/ha_innodb.h:
  Auto merged
sql/ha_myisam.cc:
  Auto merged
sql/ha_ndbcluster.cc:
  Auto merged
sql/ha_ndbcluster.h:
  Auto merged
sql/ha_partition.cc:
  Auto merged
sql/handler.cc:
  Auto merged
sql/handler.h:
  Auto merged
sql/log.cc:
  Auto merged
sql/log_event.cc:
  Auto merged
sql/sql_insert.cc:
  Auto merged
sql/sql_load.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
storage/archive/ha_archive.cc:
  Auto merged
storage/archive/ha_archive.h:
  Auto merged
parents 0c68b710 e63f3779
Loading
Loading
Loading
Loading
+15 −2
Original line number Diff line number Diff line
@@ -2232,8 +2232,12 @@ ha_rows ha_berkeley::records_in_range(uint keynr, key_range *start_key,
}


ulonglong ha_berkeley::get_auto_increment()
void ha_berkeley::get_auto_increment(ulonglong offset, ulonglong increment,
                                     ulonglong nb_desired_values,
                                     ulonglong *first_value,
                                     ulonglong *nb_reserved_values)
{
  /* Ideally in case of real error (not "empty table") nr should be ~ULL(0) */
  ulonglong nr=1;				// Default if error or new key
  int error;
  (void) ha_berkeley::extra(HA_EXTRA_KEYREAD);
@@ -2244,9 +2248,18 @@ ulonglong ha_berkeley::get_auto_increment()
  if (!table_share->next_number_key_offset)
  {						// Autoincrement at key-start
    error=ha_berkeley::index_last(table->record[1]);
    /* has taken read lock on page of max key so reserves to infinite  */
    *nb_reserved_values= ULONGLONG_MAX;
  }
  else
  {
    /*
      MySQL needs to call us for next row: assume we are inserting ("a",null)
      here, we return 3, and next this statement will want to insert ("b",null):
      there is no reason why ("b",3+1) would be the good row to insert: maybe it
      already exists, maybe 3+1 is too large...
    */
    *nb_reserved_values= 1;
    DBT row,old_key;
    bzero((char*) &row,sizeof(row));
    KEY *key_info= &table->key_info[active_index];
@@ -2287,7 +2300,7 @@ ulonglong ha_berkeley::get_auto_increment()
      table->next_number_field->val_int_offset(table_share->rec_buff_length)+1;
  ha_berkeley::index_end();
  (void) ha_berkeley::extra(HA_EXTRA_NO_KEYREAD);
  return nr;
  *first_value= nr;
}

void ha_berkeley::print_error(int error, myf errflag)
+4 −1
Original line number Diff line number Diff line
@@ -149,7 +149,10 @@ class ha_berkeley: public handler
    int5store(to,share->auto_ident);
    pthread_mutex_unlock(&share->mutex);
  }
  ulonglong get_auto_increment();
  virtual void get_auto_increment(ulonglong offset, ulonglong increment,
                                  ulonglong nb_desired_values,
                                  ulonglong *first_value,
                                  ulonglong *nb_reserved_values);
  void print_error(int error, myf errflag);
  uint8 table_cache_type() { return HA_CACHE_TBL_TRANSACT; }
  bool primary_key_is_clustered() { return true; }
+7 −2
Original line number Diff line number Diff line
@@ -663,10 +663,15 @@ void ha_heap::update_create_info(HA_CREATE_INFO *create_info)
    create_info->auto_increment_value= auto_increment_value;
}

ulonglong ha_heap::get_auto_increment()
void ha_heap::get_auto_increment(ulonglong offset, ulonglong increment,
                                 ulonglong nb_desired_values,
                                 ulonglong *first_value,
                                 ulonglong *nb_reserved_values)
{
  ha_heap::info(HA_STATUS_AUTO);
  return auto_increment_value;
  *first_value= auto_increment_value;
  /* such table has only table-level locking so reserves up to +inf */
  *nb_reserved_values= ULONGLONG_MAX;
}


+4 −1
Original line number Diff line number Diff line
@@ -71,7 +71,10 @@ class ha_heap: public handler
  int write_row(byte * buf);
  int update_row(const byte * old_data, byte * new_data);
  int delete_row(const byte * buf);
  ulonglong get_auto_increment();
  virtual void get_auto_increment(ulonglong offset, ulonglong increment,
                                  ulonglong nb_desired_values,
                                  ulonglong *first_value,
                                  ulonglong *nb_reserved_values);
  int index_read(byte * buf, const byte * key,
		 uint key_len, enum ha_rkey_function find_flag);
  int index_read_idx(byte * buf, uint idx, const byte * key,
+16 −9
Original line number Diff line number Diff line
@@ -6946,17 +6946,21 @@ ha_innobase::innobase_read_and_init_auto_inc(
	return(error);
}

/***********************************************************************
/*******************************************************************************
This function initializes the auto-inc counter if it has not been
initialized yet. This function does not change the value of the auto-inc
counter if it already has been initialized. Returns the value of the
auto-inc counter. */
auto-inc counter in *first_value, and ULONGLONG_MAX in *nb_reserved_values (as
we have a table-level lock). offset, increment, nb_desired_values are ignored.
*first_value is set to -1 if error (deadlock or lock wait timeout)            */

ulonglong
ha_innobase::get_auto_increment()
/*=============================*/
			 /* out: auto-increment column value, -1 if error
			 (deadlock or lock wait timeout) */
void ha_innobase::get_auto_increment(
/*=================================*/
        ulonglong offset,              /* in */
        ulonglong increment,           /* in */
        ulonglong nb_desired_values,   /* in */
        ulonglong *first_value,        /* out */
        ulonglong *nb_reserved_values) /* out */
{
	longlong	nr;
	int		error;
@@ -6971,10 +6975,13 @@ ha_innobase::get_auto_increment()
		ut_print_timestamp(stderr);
		sql_print_error("Error %lu in ::get_auto_increment()",
				(ulong) error);
		return(~(ulonglong) 0);
                *first_value= (~(ulonglong) 0);
		return;
	}

	return((ulonglong) nr);
        *first_value= (ulonglong) nr;
        /* table-level autoinc lock reserves up to +inf */
        *nb_reserved_values= ULONGLONG_MAX;
}

/* See comment in handler.h */
Loading