Commit 24584808 authored by unknown's avatar unknown
Browse files

Merge bk-internal.mysql.com:/home/bk/mysql-5.1-ndb

into  willster.(none):/home/stewart/Documents/MySQL/5.1/bug19914-mk2-merge

parents c2e8969a 9910031c
Loading
Loading
Loading
Loading
+16 −9
Original line number Diff line number Diff line
@@ -469,11 +469,13 @@ ha_rows ha_ndbcluster::records()
  DBUG_RETURN(retval + info->no_uncommitted_rows_count);
}

void ha_ndbcluster::records_update()
int ha_ndbcluster::records_update()
{
  if (m_ha_not_exact_count)
    return;
    return 0;
  DBUG_ENTER("ha_ndbcluster::records_update");
  int result= 0;

  struct Ndb_local_table_statistics *info= m_table_info;
  DBUG_PRINT("info", ("id=%d, no_uncommitted_rows_count=%d",
                      ((const NDBTAB *)m_table)->getTableId(),
@@ -483,7 +485,7 @@ void ha_ndbcluster::records_update()
    Ndb *ndb= get_ndb();
    struct Ndb_statistics stat;
    ndb->setDatabaseName(m_dbname);
    if (ndb_get_table_statistics(ndb, m_table, &stat) == 0)
    if ((result= ndb_get_table_statistics(ndb, m_table, &stat)) == 0)
    {
      stats.mean_rec_length= stat.row_size;
      stats.data_file_length= stat.fragment_memory;
@@ -496,7 +498,7 @@ void ha_ndbcluster::records_update()
      info->no_uncommitted_rows_count= 0;
  }
  stats.records= info->records+ info->no_uncommitted_rows_count;
  DBUG_VOID_RETURN;
  DBUG_RETURN(result);
}

void ha_ndbcluster::no_uncommitted_rows_execute_failure()
@@ -3635,8 +3637,9 @@ void ha_ndbcluster::position(const byte *record)
}


void ha_ndbcluster::info(uint flag)
int ha_ndbcluster::info(uint flag)
{
  int result= 0;
  DBUG_ENTER("info");
  DBUG_PRINT("enter", ("flag: %d", flag));
  
@@ -3654,18 +3657,18 @@ void ha_ndbcluster::info(uint flag)
      if (m_ha_not_exact_count)
        stats.records= 100;
      else
        records_update();
	result= records_update();
    }
    else
    {
      if ((my_errno= check_ndb_connection()))
        DBUG_VOID_RETURN;
        DBUG_RETURN(my_errno);
      Ndb *ndb= get_ndb();
      ndb->setDatabaseName(m_dbname);
      struct Ndb_statistics stat;
      ndb->setDatabaseName(m_dbname);
      if (current_thd->variables.ndb_use_exact_count &&
          ndb_get_table_statistics(ndb, m_table, &stat) == 0)
          (result= ndb_get_table_statistics(ndb, m_table, &stat)) == 0)
      {
        stats.mean_rec_length= stat.row_size;
        stats.data_file_length= stat.fragment_memory;
@@ -3709,7 +3712,11 @@ void ha_ndbcluster::info(uint flag)
        stats.auto_increment_value= (ulonglong)auto_increment_value64;
    }
  }
  DBUG_VOID_RETURN;

  if(result == -1)
    result= HA_ERR_NO_CONNECTION;

  DBUG_RETURN(result);
}


+2 −2
Original line number Diff line number Diff line
@@ -673,7 +673,7 @@ class ha_ndbcluster: public handler

  bool get_error_message(int error, String *buf);
  ha_rows records();
  void info(uint);
  int info(uint);
  void get_dynamic_partition_info(PARTITION_INFO *stat_info, uint part_id);
  int extra(enum ha_extra_function operation);
  int extra_opt(enum ha_extra_function operation, ulong cache_size);
@@ -878,7 +878,7 @@ static void set_tabname(const char *pathname, char *tabname);
  int check_ndb_connection(THD* thd= current_thd);

  void set_rec_per_key();
  void records_update();
  int records_update();
  void no_uncommitted_rows_execute_failure();
  void no_uncommitted_rows_update(int);
  void no_uncommitted_rows_reset(THD *);
+1 −1
Original line number Diff line number Diff line
@@ -1243,7 +1243,7 @@ class handler :public Sql_alloc
                                   key_range *max_key)
    { return (ha_rows) 10; }
  virtual void position(const byte *record)=0;
  virtual void info(uint)=0; // see my_base.h for full description
  virtual int info(uint)=0; // see my_base.h for full description
  virtual void get_dynamic_partition_info(PARTITION_INFO *stat_info,
                                          uint part_id);
  virtual int extra(enum ha_extra_function operation)
+9 −1
Original line number Diff line number Diff line
@@ -2693,6 +2693,7 @@ bool Item_sum_count_distinct::add()

longlong Item_sum_count_distinct::val_int()
{
  int error;
  DBUG_ASSERT(fixed == 1);
  if (!table)					// Empty query
    return LL(0);
@@ -2706,7 +2707,14 @@ longlong Item_sum_count_distinct::val_int()
    tree->walk(count_distinct_walk, (void*) &count);
    return (longlong) count;
  }
  table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);

  error= table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);

  if(error)
  {
    table->file->print_error(error, MYF(0));
  }

  return table->file->stats.records;
}

+6 −1
Original line number Diff line number Diff line
@@ -167,7 +167,12 @@ int opt_sum_query(TABLE_LIST *tables, List<Item> &all_fields,COND *conds)
    }
    else
    {
      tl->table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
      error= tl->table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
      if(error)
      {
        tl->table->file->print_error(error, MYF(0));
        return error;
      }
      count*= tl->table->file->stats.records;
    }
  }
Loading