List:Commits« Previous MessageNext Message »
From:Chuck Bell Date:April 7 2008 12:44pm
Subject:RE: bk commit into 6.0 tree (cbell:1.2606) WL#4342
View as plain text  
Rafal,

With the changes to the falcon code most of the IS access methods will need
to be replaced. I will incorporate as many of your comments in the new code
as changes permit.

Chuck 

> -----Original Message-----
> From: Rafal Somla [mailto:rsomla@stripped] 
> Sent: Monday, April 07, 2008 2:34 AM
> To: cbell@stripped
> Cc: commits@stripped
> Subject: Re: bk commit into 6.0 tree (cbell:1.2606) WL#4342
> 
> Hi Chuck,
> 
> See my comments inlined below.
> 
> cbell@stripped wrote:
> > Below is the list of changes that have just been committed into a 
> > local 6.0 repository of cbell.  When cbell does a push 
> these changes 
> > will be propagated to the main repository and, within 24 
> hours after 
> > the push, to the public repository.
> > For information on how to access the public repository see 
> > http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
> > 
> > ChangeSet@stripped, 2008-04-04 15:42:06-04:00, 
> cbell@mysql_cab_desk. +4 -0
> >   WL#4342 : ST: extend server service interface to include 
> tablespace 
> > objects
> >   
> >   Patch contains modifications to support backup and 
> restore of Falcon
> >   tables with tablespaces.
> >   
> >   Note: Patch may change pending work ongoing by Falcon team.
> > 
> >   mysql-test/t/backup_tablespace.test@stripped, 2008-04-04 
> 15:42:00-04:00, cbell@mysql_cab_desk. +84 -0
> >     WL#4342 : ST: extend server service interface to include 
> > tablespace objects
> >     
> >     New test for tablespace backup and restore (incomplete 
> pending changes
> >     from Falcon team).
> > 
> >   mysql-test/t/backup_tablespace.test@stripped, 2008-04-04 
> 15:42:00-04:00, 
> > cbell@mysql_cab_desk. +0 -0
> > 
> >   sql/si_objects.cc@stripped, 2008-04-04 15:41:58-04:00, 
> cbell@mysql_cab_desk. +416 -3
> >     WL#4342 : ST: extend server service interface to include 
> > tablespace objects
> >     
> >     This patch adds a new object class to the service 
> interface. This class
> >     encapsulates working with tablespaces. Additional 
> helper methods were
> >     added to allow the backup kernel code access to macro 
> operations.
> >     
> >     Note: This is currently limited to Falcon tablespaces.
> > 
> >   sql/si_objects.h@stripped, 2008-04-04 15:41:59-04:00, 
> cbell@mysql_cab_desk. +36 -0
> >     WL#4342 : ST: extend server service interface to include 
> > tablespace objects
> >     
> >     This patch adds a new object class to the service 
> interface. This class
> >     encapsulates working with tablespaces. Additional 
> helper methods were
> >     added to allow the backup kernel code access to macro 
> operations.
> >     
> >     Note: This is currently limited to Falcon tablespaces.
> > 
> >   sql/table.h@stripped, 2008-04-04 15:41:59-04:00, 
> cbell@mysql_cab_desk. +2 -1
> >     WL#4342 : ST: extend server service interface to include 
> > tablespace objects
> >     
> >     Added Falcon tablespaces to enum.
> > 
> > diff -Nrup a/mysql-test/t/backup_tablespace.test 
> b/mysql-test/t/backup_tablespace.test
> > --- /dev/null	Wed Dec 31 16:00:00 196900
> > +++ b/mysql-test/t/backup_tablespace.test	2008-04-04 
> 15:42:00 -04:00
> > @@ -0,0 +1,84 @@
> > +#
> > +# This test includes tests for backup and restore of 
> tables that use 
> > +# tablespaces.
> > +#
> > +# Note: This test is limited to the falcon storage engine only.
> > +#
> > +
> > +--source include/have_falcon.inc
> > +--source include/not_embedded.inc
> > +
> > +--disable_warnings
> > +DROP DATABASE IF EXISTS backup_ts;
> > +--error 0,1
> > +--remove_file $MYSQLTEST_VARDIR/master-data/backup_ts.bak;
> > +--enable_warnings
> > +
> > +CREATE DATABASE backup_ts;
> > +
> > +#
> > +# Test 1 - Test backup of database with a table that uses a 
> > +tablespace # --echo Test 1:
> > +--echo Create a tablespace.
> > +CREATE TABLESPACE bup_ts ADD DATAFILE 'bup_ts.dat' ENGINE=FALCON;
> > +
> > +--echo Create tables and add data.
> > +CREATE TABLE backup_ts.not_ts (id int, comment char(40)) 
> > +ENGINE=FALCON; CREATE TABLE backup_ts.has_ts (id int, 
> comment char(40))
> > +                               TABLESPACE bup_ts ENGINE=FALCON;
> > +
> > +# Create some data.
> > +INSERT INTO backup_ts.not_ts VALUES (1, "no tablespace 1"); INSERT 
> > +INTO backup_ts.not_ts VALUES (2, "no tablespace 2"); INSERT INTO 
> > +backup_ts.not_ts VALUES (3, "no tablespace 3"); INSERT INTO 
> > +backup_ts.not_ts VALUES (4, "no tablespace 4"); INSERT INTO 
> > +backup_ts.not_ts VALUES (5, "no tablespace 5");
> > +
> > +INSERT INTO backup_ts.has_ts VALUES (51, "Table has a tablespace 
> > +51"); INSERT INTO backup_ts.has_ts VALUES (52, "Table has a 
> > +tablespace 52"); INSERT INTO backup_ts.has_ts VALUES (53, 
> "Table has 
> > +a tablespace 53"); INSERT INTO backup_ts.has_ts VALUES (54, "Table 
> > +has a tablespace 54"); INSERT INTO backup_ts.has_ts VALUES (55, 
> > +"Table has a tablespace 55");
> > +
> > +# Backup the database with tablespace.
> > +--replace_column 1 #
> > +BACKUP DATABASE backup_ts TO 'backup_ts.bak';
> > +
> > +# Drop the database
> > +--echo Drop the database.
> > +DROP DATABASE backup_ts;
> > +
> > +# Restore the database and ensure there are no errors.
> > +--echo Now restore the database.
> > +--replace_column 1 #
> > +RESTORE FROM 'backup_ts.bak';
> > +
> > +--echo Show data
> > +SELECT * FROM backup_ts.not_ts;
> > +SELECT * FROM backup_ts.has_ts;
> > +
> > +DROP DATABASE backup_ts;
> > +
> > +#
> > +# Test 2 - Test restore of database throws error when tablespace
> > +#          has been altered.
> > +#
> > +--echo Test 2:
> > +--echo Alter the tablespace.
> > +DROP TABLESPACE bup_ts;
> > +CREATE TABLESPACE bup_ts ADD DATABASE 'different.dat' 
> ENGINE= FALCON;
> > +
> > +# Restore the database and ensure there is an error.
> > +--echo Now restore the database.
> > +--error 1200
> > +--replace_column 1 #
> > +RESTORE FROM 'backup_ts.bak';
> > +
> > +--echo Cleanup
> > +DROP TABLESPACE bup_ts ENGINE=FALCON; DROP DATABASE backup_ts;
> > +
> > +--error 0,1
> > +--remove_file $MYSQLTEST_VARDIR/master-data/backup_ts.bak
> > +
> 
> > diff -Nrup a/sql/si_objects.cc b/sql/si_objects.cc
> > --- a/sql/si_objects.cc	2008-03-23 09:59:06 -04:00
> > +++ b/sql/si_objects.cc	2008-04-04 15:41:58 -04:00
> > @@ -273,6 +273,9 @@ bool drop_object(THD *thd, const char *o
> >  
> >    @param[in] thd  Thread context
> >    @param[in] st   Schema table enum
> > +  @param[in] db_list List of databases for select condition
> > +
> > +  @note: To ignore the selection condition, pass db_list = NULL.
> 
> This is not directly related to this WL, but to understand 
> the db_list parameter, a better description of the function 
> would be needed. Right know, we guess from the documentation 
> that this function opens a table in INFORMATION_SCHEMA. If 
> so, what a select condition does here (I know what but the 
> point is that it is not described in the documentation)? 
> Also, does that function makes any assumptions about the 
> table being opened - for example that it has a database 
> column (of given name)? Otherwise, how can we select using 
> database list? Or perhaps it is not always a list of 
> databases, but sometimes a list of e.g., tablespaces...
> 
> >  
> >    @retval TABLE* The schema table
> >  */
> > @@ -308,7 +311,13 @@ TABLE* open_schema_table(THD *thd, ST_SC
> >  
> >    old_map= tmp_use_all_columns(t, t->read_set);
> >  
> > -  st->fill_table(thd, &arg, 
> obs::create_db_select_condition(thd, t, 
> > db_list));
> > +  /*
> > +    Create a selection condition only if db_list is defined.
> > +  */
> > +  if (db_list)
> > +    st->fill_table(thd, &arg, 
> obs::create_db_select_condition(thd, t, 
> > + db_list));  else
> > +    st->fill_table(thd, &arg, NULL);
> >  
> >    tmp_restore_column_map(t->read_set, old_map);
> >  
> > @@ -698,6 +707,53 @@ private:
> >    String m_create_stmt;
> >  };
> >  
> > +/**
> > +   @class TablespaceObj
> > +
> > +   This class provides an abstraction to a user object for 
> creation and
> > +   capture of the creation data.
> > +*/
> > +class TablespaceObj : public Obj
> > +{
> > +public:
> > +  TablespaceObj(const String *ts_name,
> > +                const String *datafile);
> > +  
> > +public:
> > +  virtual bool serialize(THD *thd, String *serialization);
> > +
> > +  virtual bool materialize(uint serialization_version,
> > +                           const String *serialization);
> > +
> > +  virtual bool execute(THD *thd);
> > +
> > +  const String *describe();
> > +
> > +  /*
> > +    We reuse the get_db_name primitive to retrieve the name
> > +    of the datafile. This makes it possible to call from a
> > +    definition of Obj * pointer.
> > +  */
> > +  const String *get_db_name()
> > +  { return &m_datafile; }
> > +
> 
> Suggestion: make a dedicated method like get_datafile() and 
> use it to implement 
> get_db_name(). This is so that TablespaceObj has interface 
> appropriate for 
> tablespaces and then it is translated into the general 
> interface of Obj class as 
>   needed.
> 
> > +  const String* get_name()
> > +  { return &m_ts_name; }
> > +
> > +private:
> > +  // These attributes are to be used only for serialization.
> > +  String m_ts_name;
> > +  String m_datafile;
> > +
> > +  // Drop is not supported by this object.
> > +  bool drop(THD *thd)
> > +  { return 0; }
> > +
> > +private:
> > +  // These attributes are to be used only for materialization.
> > +  String m_create_stmt;
> > +};
> > +
> >  
> //////////////////////////////////////////////////////////////
> /////////////
> >  
> >  //
> > @@ -906,6 +962,7 @@ private:
> >    String m_db_name;
> >  };
> >  
> > +
> >  
> //////////////////////////////////////////////////////////////
> /////////////
> >  
> >  class ViewBaseObjectsIterator : public ObjIterator
> > @@ -962,8 +1019,21 @@ bool InformationSchemaIterator::prepare_
> >    enum_schema_tables is_table_idx,
> >    List<LEX_STRING> db_list)
> >  {
> > -  *is_table= open_schema_table(thd, 
> get_schema_table(is_table_idx), &db_list);
> > -
> > +  ST_SCHEMA_TABLE *st;
> > +  /*
> > +    The falcon schema table does not conform to the older SHOW 
> > +    style fill methods nor does it use a wildcard condition.
> > +  */
> > +  if (is_table_idx == SCH_FALCON_TABLESPACES)
> > +  {
> > +    st= find_schema_table(thd, "FALCON_TABLESPACES");
> > +    *is_table= open_schema_table(thd, st, NULL);
> > +  }
> > +  else
> > +  {
> > +    st= get_schema_table(is_table_idx);
> > +    *is_table= open_schema_table(thd, st, &db_list);
> > +  }
> >    if (!*is_table)
> >      return TRUE;
> >  
> > @@ -2324,6 +2394,123 @@ bool EventObj::drop(THD *thd)
> >  
> >  
> //////////////////////////////////////////////////////////////
> /////////////
> >  
> > +//
> > +// Implementation: TablespaceObj class.
> > +//
> > +
> > 
> +/////////////////////////////////////////////////////////////
> ////////////////
> > +
> > +TablespaceObj::TablespaceObj(const String *ts_name,
> > +                             const String *datafile)
> > +{
> > +  // copy strings to newly allocated memory
> > +  m_ts_name.copy(*ts_name);
> > +  m_datafile.copy(*datafile);
> > +}
> > +
> > +/**
> > +  Serialize the object.
> > +
> > +  This method produces the data necessary for 
> materializing the object
> > +  on restore (creates object).
> > +
> > +  @param[in]  thd            Thread context.
> > +  @param[out] serialization  The data needed to recreate 
> this object.
> > +
> > +  @returns Error status.
> > +    @retval FALSE on success
> > +    @retval TRUE on error
> > +*/
> > +bool TablespaceObj::serialize(THD *thd, String *serialization)
> > +{
> > +  DBUG_ENTER("TablespaceObj::serialize()");
> > +  if (m_datafile.length() == 0)
> > +    DBUG_RETURN(TRUE);   //cannot serialize an invalid tablespace!
> > +
> > +  m_create_stmt.append(m_datafile);
> 
> I don't see why you need to set m_create_stmt here?
> 
> > +  serialization->copy(m_create_stmt);
> > +  DBUG_RETURN(FALSE);
> > +}
> > +
> > +/**
> > +  Materialize the serialization string.
> > +
> > +  This method saves serialization string into a member variable.
> > +
> > +  @param[in]  serialization_version   version number of 
> this interface
> > +  @param[in]  serialization           the string from serialize()
> > +
> > +  @todo take serialization_version into account
> > +
> > +  @returns Error status.
> > +    @retval FALSE on success
> > +    @retval TRUE on error
> > +*/
> > +bool TablespaceObj::materialize(uint serialization_version,
> > +                                const String *serialization)
> > +{
> > +  DBUG_ENTER("TablespaceObj::materialize()");
> > +  /*
> > +    The serialization string contains only the datafile attribute.
> > +  */
> > +  m_datafile.copy(*serialization);
> > +  DBUG_RETURN(0);
> > +}
> > +
> > +/**
> > +  Get a description of the tablespace object.
> > +
> > +  This constructs the serialization string for identification
> > +  use in describing tablespace to the user and for creating the
> > +  tablespace.
> > +
> > +  @param[in]  serialization_version   version number of 
> this interface
> > +  @param[in]  serialization           the string from serialize()
> > +
> > +  @todo take serialization_version into account
> > +
> > +  @returns Serialization string.
> > +*/
> > +const String *TablespaceObj::describe()
> > +{
> > +  DBUG_ENTER("DatabaseObj::execute()");
> > +  /*
> > +    Construct the CREATE TABLESPACE command from the variables.
> > +  */
> > +  m_create_stmt.length(0);
> > +  m_create_stmt.append("CREATE TABLESPACE ");
> > +  if (m_ts_name.length() > 0)
> > +  {
> > +    THD *thd= current_thd;
> > +    append_identifier(thd, &m_create_stmt, 
> > +      m_ts_name.c_ptr(), m_ts_name.length());  
> > +  }
> > +  m_create_stmt.append(" ADD DATAFILE '");
> > +  m_create_stmt.append(m_datafile);
> > +  m_create_stmt.append("' ENGINE=FALCON");
> > +  DBUG_RETURN(&m_create_stmt);
> > +}
> > +
> > +/**
> > +  Create the object.
> > +
> > +  This method uses serialization string in a query and executes it.
> > +
> > +  @param[in]  thd  Thread context.
> > +
> > +  @returns Error status.
> > +    @retval FALSE on success
> > +    @retval TRUE on error
> > +*/
> > +bool TablespaceObj::execute(THD *thd)
> > +{
> > +  DBUG_ENTER("DatabaseObj::execute()");
> > +  describe(); // Build the CREATE command.
> > +  DBUG_RETURN(silent_exec(thd, &m_create_stmt));
> > +}
> 
> This implementation of execute() will fail when someone 
> decides to use a 
> different way of describing a tablespace (different than with 
> CREATE statement). 
> Therefore I'd add a dedicated method for constructing the 
> CREATE statement. This 
> new method would be called inside execute() and describe().
> 
> > +
> > 
> +/////////////////////////////////////////////////////////////
> //////////////
> > +
> >  Obj *get_database(const String *db_name)
> >  {
> >    return new DatabaseObj(db_name);
> > @@ -2443,6 +2630,16 @@ Obj *materialize_event(const String *db_
> >    return obj;
> >  }
> >  
> > +Obj *materialize_tablespace(const String *ts_name,
> > +                            uint serialization_version,
> > +                            const String *serialialization)
> > +{
> > +  Obj *obj= new TablespaceObj(ts_name, serialialization);
> > +  obj->materialize(serialization_version, serialialization);
> > +
> > +  return obj;
> > +}
> > +
> >  
> //////////////////////////////////////////////////////////////
> /////////////
> >  
> >  bool is_internal_db_name(const String *db_name)
> > @@ -2464,6 +2661,222 @@ bool is_internal_db_name(const String *d
> >  bool check_db_existence(const String *db_name)
> >  {
> >    return check_db_dir_existence(((String *) 
> db_name)->c_ptr_safe());
> > +}
> > +
> > +/**
> > +  get_tablespace_from_schema
> > +
> > +  This method builds a @c TablespaceObj object if the tablespace
> > +  exists on the server.
> > +
> > +  @param[in]     thd           Thread context.
> > +  @param[in,out] TablespaceObj A pointer to a tablespace object
> 
> Strictly speaking, this is a pointer to the place where 
> pointer to newly created 
> TablespaceObj object will be stored.
> 
> > +  @param[in]     ts_name       The name of the tablespace to find
> > +  
> > +  @retval FALSE if tablespace exists and no errors
> > +  @retval TRUE if tablespace does not exist or errors
> > +*/
> > +bool get_tablespace_from_schema(THD *thd,
> > +                                TablespaceObj **ts, 
> > +                                const String *ts_name)
> > +{
> > +  TABLE *is_table;
> > +  handler *ha;
> > +  my_bitmap_map *orig_columns;
> > +  LEX_STRING lex_ts_name;
> > +  String found_ts_name;
> > +  String datafile;
> > +  List<LEX_STRING> ts_list;
> > +  DBUG_ENTER("obs::get_tablespace_from_schema()");
> > +
> > +  /*
> > +    First, open the IS table.
> > +  */
> > +  thd->make_lex_string(&lex_ts_name, ts_name->ptr(),
> > +                       ts_name->length(), FALSE);
> > +  ts_list.push_back(&lex_ts_name);
> > +
> > +  if (InformationSchemaIterator::prepare_is_table(
> > +      thd, &is_table, &ha, &orig_columns, 
> > +      SCH_FALCON_TABLESPACES, ts_list))
> > +    DBUG_RETURN(TRUE);
> > +
> > +  /*
> > +    Now read from the IS table.
> > +  */
> > +  *ts= NULL;
> > +  if (ha->rnd_next(is_table->record[0]))
> > +    DBUG_RETURN(TRUE);
> > +
> > +  /*
> > +    Loop until either the row is found or the EOF occurs.
> > +  */
> > +  int ret= 0;
> > +  is_table->field[0]->val_str(&found_ts_name);
> 
> > +  while (!ret && found_ts_name.length() &&
> > +    (my_strcasecmp(system_charset_info, 
> found_ts_name.ptr(), ts_name->ptr()) != 0))
> > +  {
> > +    ret= ha->rnd_next(is_table->record[0]);
> > +    found_ts_name.length(0); // reset the length of the string
> > +    if (!ret)
> > +      is_table->field[0]->val_str(&found_ts_name);
> > +  }
> 
> > +  if (ret)
> > +    DBUG_RETURN(TRUE);
> 
> Don't we need to close is_table and/or 'ha' before we return?
> 
> > +
> 
> What if the above loop quits with empty found_ts_name 
> (found_ts_name().length() 
> == 0).
> 
> > +  /* 
> > +    TS name is in col 0
> > +    TS datafile is in col 2
> > +  */
> > +
> 
> I suggest a DBUG_ASSERT() checking that found_ts_name is the 
> same as ts_name, as 
> we assume that below.
> 
> > +  is_table->field[2]->val_str(&datafile);
> > +
> > +  DBUG_PRINT("get_tablespace_from_schema", (" Found 
> tablespace %s %s", 
> > +    found_ts_name.ptr(), datafile.ptr()));
> > +
> > +  *ts= new TablespaceObj(&found_ts_name, &datafile);
> > +
> > +  /*
> > +    Cleanup
> > +  */
> > +  ha->ha_rnd_end();
> > +
> > +  dbug_tmp_restore_column_map(is_table->read_set, orig_columns);
> > +  free_tmp_table(thd, is_table);
> > +  DBUG_RETURN(0);
> > +}
> > +
> > +/**
> > +  get_tablespace_for_table
> 
> The first line in the documentation should not be the 
> function name but a short 
> description of what it does.
> 
> > +
> > +  This method returns a @c TablespaceObj object if the 
> table has a tablespace.
> > +
> > +  @param[in]  thd       Thread context.
> > +  @param[in]  db_name   The database name for the table.
> > +  @param[in]  tbl_name  The table name.
> > +  
> > +  @retval Tablespace object if table uses a tablespace 
> > +  @retval NULL if table does not use a tablespace
> 
> Add note that caller of this function becomes the owner of 
> the created object 
> and should delete it.
> 
> > +*/
> > +Obj *get_tablespace_for_table(THD *thd, 
> > +                              const char *db_name, 
> > +                              const char *tbl_name)
> > +{
> > +  bool retval= 0;
> > +  TablespaceObj *ts;
> > +  LEX_STRING tname, dbname;
> > +  String ts_name;
> > +  DBUG_ENTER("obs::get_tablespace_for_table()");
> > +  DBUG_PRINT("obs::get_tablespace_for_table", ("name: %s.%s", 
> > +             db_name, tbl_name));
> > +
> > +  tname.str= (char *)tbl_name;
> > +  tname.length= strlen(tbl_name);
> > +  dbname.str= (char *)db_name;
> > +  dbname.length= strlen(db_name);
> > +  Table_ident *name_id= new Table_ident(tname);
> 
> Why dynamic object? Why not "Table_indent name_id(tname)"?
> 
> > +  name_id->db= dbname;
> > +
> > +  /*
> > +    Add the view to the table list and set the thd to look 
> at views only.
> > +    Note: derived from sql_yacc.yy.
> > +  */
> 
> I don't understand why you need this here?
> 
> > +  thd->lex->select_lex.add_table_to_list(thd, name_id, NULL, 0);
> > +  TABLE_LIST *table_list= 
> (TABLE_LIST*)thd->lex->select_lex.table_list.first;
> > +  thd->lex->sql_command = SQLCOM_SHOW_CREATE;
> > +
> > +  /*
> > +    Open the table
> > +  */
> > +  if (open_normal_and_derived_tables(thd, table_list, 0))
> > +    DBUG_RETURN(FALSE);
> > +
> > +  /*
> > +    Get the tablespace name and close up shop.
> > +  */
> 
> What you need for this is an opened TABLE to have the ->file 
> pointer. In 
> get_storage_engine() function in backup_info.cc I use 
> open_temporary_table() 
> function which seems to be much more light-weight. Maybe you 
> can use this 
> function here.
> 
> > +  TABLE *table= table_list->table;
> > +  ts_name.length(0);
> > +  if (table->s->db_type()->db_type == DB_TYPE_FALCON)
> > +    ts_name.append(table_list->table->file->get_tablespace_name());
> > +  else
> > +    retval= 1;
> > +  close_thread_tables(thd);
> > +  ts_name.set_charset(system_charset_info);
> > +  thd->lex->select_lex.table_list.empty();
> > +  ts= NULL;
> > +  if (retval)
> > +    goto end;
> > +
> > +  /*
> > +    Now open the information_schema table and get the 
> tablespace information.
> > +  */
> > +  get_tablespace_from_schema(thd, &ts, &ts_name);
> > +
> > +end:
> > +  DBUG_RETURN(ts);
> > +}
> > +
> > +/**
> > +  tablespace_exists
> > +
> > +  This method determines if a materialized tablespace exists on the
> > +  system. This compares the name and all saved attributes of the 
> > +  tablespace. A FALSE return would mean either the tablespace does
> > +  not exist or the tablespace attributes are different.
> > +
> > +  @param[in]  Obj  The TablspaceObj pointer to compare.
> > +  
> > +  @retval TRUE if it exists
> > +  @retval FALSE if it does not exist
> > +*/
> > +bool tablespace_exists(THD *thd,
> > +                       Obj *ts)
> > +{
> > +  TablespaceObj *other_ts= NULL;
> > +  DBUG_ENTER("obs::tablespace_exists()");
> > +  get_tablespace_from_schema(thd, &other_ts, ts->get_name());
> > +  DBUG_RETURN((my_strcasecmp(system_charset_info, 
> > +               other_ts->get_name()->ptr(), 
> > +               ts->get_name()->ptr()) == 0) &&
> > +              (my_strcasecmp(system_charset_info, 
> > +               other_ts->get_db_name()->ptr(), 
> > +               ts->get_db_name()->ptr()) == 0));
> 
> You need to delete other_ts.
> 
> > +}
> > +
> > +/**
> > +  is_tablespace
> > +
> > +  This method determines if the tablespace referenced by 
> name exists on the
> > +  system.
> > +
> > +  @param[in]  ts_name  The Tablspace name to compare.
> > +  
> > +  @retval TRUE if it exists
> > +  @retval FALSE if it does not exist
> > +*/
> > +bool is_tablespace(THD *thd,
> > +                   const String *ts_name)
> > +{
> > +  TablespaceObj *otherTS= NULL;
> > +  DBUG_ENTER("obs::is_tablespace()");
> > +  get_tablespace_from_schema(thd, &otherTS, ts_name);
> > +  DBUG_RETURN(otherTS != NULL);
> 
> You need to delete otherTS.
> 
> Rafal
> 
> > +}
> > +
> > +/**
> > +  describe_tablespace
> > +
> > +  This method returns a description of the tablespace 
> useful for communicating
> > +  with the user.
> > +
> > +  @param[in]  ts  The Tablspace to describe.
> > +  
> > +  @returns tablespace description
> > +*/
> > +const char *describe_tablespace(Obj *ts)
> > +{
> > +  DBUG_ENTER("obs::describe_tablespace()");
> > +  DBUG_RETURN(((TablespaceObj *)ts)->describe()->ptr());
> >  }
> >  
> >  
> //////////////////////////////////////////////////////////////
> /////////////
> 
> 
> > diff -Nrup a/sql/si_objects.h b/sql/si_objects.h
> > --- a/sql/si_objects.h	2008-01-31 10:15:25 -05:00
> > +++ b/sql/si_objects.h	2008-04-04 15:41:59 -04:00
> > @@ -133,6 +133,9 @@ private:
> >                                  uint,
> >                                  const String *);
> >  
> > +  friend Obj *materialize_tablespace(const String *,
> > +                                     uint,
> > +                                     const String *);
> >  };
> >  
> >  
> //////////////////////////////////////////////////////////////
> /////////////
> > @@ -445,6 +448,10 @@ Obj *materialize_event(const String *db_
> >                         uint serialization_version,
> >                         const String *serialialization);
> >  
> > +Obj *materialize_tablespace(const String *ts_name,
> > +                            uint serialization_version,
> > +                            const String *serialialization);
> > +
> >  
> //////////////////////////////////////////////////////////////
> /////////////
> >  
> >  bool is_internal_db_name(const String *db_name);
> > @@ -459,6 +466,35 @@ bool is_internal_db_name(const String *d
> >      @retval TRUE on error (the database either not exists, 
> or not accessible).
> >  */
> >  bool check_db_existence(const String *db_name);
> > +
> > +/*
> > +  This method returns a @c TablespaceObj object if the 
> table has a tablespace.
> > +*/
> > +Obj *get_tablespace_for_table(THD *thd, 
> > +                              const char *db_name, 
> > +                              const char *tbl_name);
> > +
> > +/*
> > +  This method determines if a materialized tablespace exists on the
> > +  system. This compares the name and all saved attributes of the 
> > +  tablespace. A FALSE return would mean either the tablespace does
> > +  not exist or the tablespace attributes are different.
> > +*/
> > +bool tablespace_exists(THD *thd,
> > +                       Obj *ts);
> > +
> > +/*
> > +  This method determines if the tablespace referenced by 
> name exists on the
> > +  system.
> > +*/
> > +bool is_tablespace(THD *thd,
> > +                   const String *ts_name);
> > +
> > +/*
> > +  This method returns a description of the tablespace 
> useful for communicating
> > +  with the user.
> > +*/
> > +const char *describe_tablespace(Obj *ts);
> >  
> >  
> //////////////////////////////////////////////////////////////
> /////////////
> >  
> 
> 
> > diff -Nrup a/sql/table.h b/sql/table.h
> > --- a/sql/table.h	2008-03-14 18:20:08 -04:00
> > +++ b/sql/table.h	2008-04-04 15:41:59 -04:00
> > @@ -748,7 +748,8 @@ enum enum_schema_tables
> >    SCH_TRIGGERS,
> >    SCH_USER_PRIVILEGES,
> >    SCH_VARIABLES,
> > -  SCH_VIEWS
> > +  SCH_VIEWS,
> > +  SCH_FALCON_TABLESPACES
> >  };
> >  
> >  
> > 
> > 

Thread
bk commit into 6.0 tree (cbell:1.2606) WL#4342cbell4 Apr
  • Re: bk commit into 6.0 tree (cbell:1.2606) WL#4342Rafal Somla7 Apr
    • RE: bk commit into 6.0 tree (cbell:1.2606) WL#4342Chuck Bell7 Apr