List:Internals« Previous MessageNext Message »
From:Mats Kindahl Date:February 25 2005 11:39am
Subject:bk commit into 5.1 tree (mats:1.1774)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of mats. When mats 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://www.mysql.com/doc/I/n/Installing_source_tree.html

ChangeSet
  1.1774 05/02/25 12:39:13 mats@stripped +5 -0
  WL#2324: Injector interface for NDB
    The changeset contain extra bitkeeper files (sorry). They will not
    be present in the final commit.

  sql/Makefile.am
    1.101 05/02/25 12:39:07 mats@stripped +2 -2
    Added new files.

  sql/injector.cc
    1.1 05/02/25 12:31:38 mats@stripped +84 -0

  sql/injector.h
    1.1 05/02/25 12:31:37 mats@stripped +154 -0

  sql/injector.cc
    1.0 05/02/25 12:31:38 mats@stripped +0 -0
    BitKeeper file /home/bk/w2324-mysql-5.1/sql/injector.cc

  sql/injector.h
    1.0 05/02/25 12:31:37 mats@stripped +0 -0
    BitKeeper file /home/bk/w2324-mysql-5.1/sql/injector.h

  BitKeeper/deleted/.del-injector.h~58c24388e55735a
    1.2 05/02/25 12:31:08 mats@stripped +0 -0
    Delete: sql/injector.h

  BitKeeper/deleted/.del-injector.cc~effd5bfba6e03ef
    1.2 05/02/25 12:31:08 mats@stripped +0 -0
    Delete: sql/injector.cc

  sql/injector.h
    1.1 05/02/25 11:55:58 mats@stripped +127 -0

  sql/injector.cc
    1.1 05/02/25 11:55:58 mats@stripped +78 -0

  sql/injector.h
    1.0 05/02/25 11:55:58 mats@stripped +0 -0
    BitKeeper file /home/bk/w2324-mysql-5.1/sql/injector.h

  sql/injector.cc
    1.0 05/02/25 11:55:58 mats@stripped +0 -0
    BitKeeper file /home/bk/w2324-mysql-5.1/sql/injector.cc

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	mats
# Host:	romeo.kindahl.net
# Root:	/home/bk/w2324-mysql-5.1

--- 1.100/sql/Makefile.am	2004-12-17 03:40:12 +01:00
+++ 1.101/sql/Makefile.am	2005-02-25 12:39:07 +01:00
@@ -49,7 +49,7 @@
 			mysql_priv.h item_geofunc.h sql_bitmap.h \
 			procedure.h sql_class.h sql_lex.h sql_list.h \
 			sql_manager.h sql_map.h sql_string.h unireg.h \
-			field.h handler.h mysqld_suffix.h \
+			field.h handler.h injector.h mysqld_suffix.h \
 			ha_myisammrg.h\
 			ha_heap.h ha_myisam.h ha_berkeley.h ha_innodb.h \
 			ha_ndbcluster.h opt_range.h protocol.h \
@@ -83,7 +83,7 @@
 			log.cc log_event.cc init.cc derror.cc sql_acl.cc \
 			unireg.cc des_key_file.cc \
 			discover.cc time.cc opt_range.cc opt_sum.cc \
-		   	records.cc filesort.cc handler.cc \
+		   	records.cc filesort.cc handler.cc injector.cc \
 		        ha_heap.cc ha_myisam.cc ha_myisammrg.cc \
 	                ha_berkeley.cc ha_innodb.cc \
 			ha_ndbcluster.cc \
--- New file ---
+++ BitKeeper/deleted/.del-injector.cc~effd5bfba6e03ef	05/02/25 11:55:58
// -*- Mode: C++; c-indentation-style: gnu -*-

#include "injector.h"
#include "mysql_priv.h"

////////////////////////////////////////////////////////////////
// injector - member definitions
////////////////////////////////////////////////////////////////

injector::
injector()
{
    
}

injector* injector::
instance()
{
  return new injector();
}



injector::transaction injector::
new_trans()
{
   DBUG_PRINT("info", ("Creating new transaction"));
   return transaction();
}


////////////////////////////////////////////////////////////////
// injector::transaction - member definitions
////////////////////////////////////////////////////////////////

int injector::transaction::
commit()
{
   DBUG_PRINT("info", ("Committing transaction"));
   return 0;
}


int injector::transaction::
write_row (server_id_type sid, record_type record)
{
   DBUG_ENTER("injector::transaction::write_row(...)");
   DBUG_RETURN(0);
}


int injector::transaction::
delete_row(server_id_type sid, record_type record)
{
   DBUG_ENTER("injector::transaction::delete_row(...)");
   DBUG_RETURN(0);
}


int injector::transaction::
update_row(server_id_type sid, 
	   record_type before, 
	   record_type after)
{
   DBUG_ENTER("injector::transaction::update_row(...)");
   DBUG_RETURN(0);
}


injector::transaction::binlog_pos injector::transaction::
start_pos() const
{
   binlog_pos pos = { "dobedobedo", 0 };
   return pos;			
}




--- New file ---
+++ sql/injector.cc	05/02/25 12:31:38
// -*- Mode: C++; c-indentation-style: gnu -*-

#include "injector.h"
#include "mysql_priv.h"

////////////////////////////////////////////////////////////////
// injector::transaction - member definitions
////////////////////////////////////////////////////////////////

inline injector::transaction::	// inline since it's called below
transaction()
{
  // !!! Nothing yet !!!
}

int injector::transaction::
commit()
{
   DBUG_PRINT("info", ("Committing transaction"));
   return 0;
}


int injector::transaction::
write_row (server_id_type sid, table tbl, 
	   record_type record)
{
   DBUG_ENTER("injector::transaction::write_row(...)");
   DBUG_RETURN(0);
}


int injector::transaction::
delete_row(server_id_type sid, table tbl,
	   record_type record)
{
   DBUG_ENTER("injector::transaction::delete_row(...)");
   DBUG_RETURN(0);
}


int injector::transaction::
update_row(server_id_type sid, table tbl, 
	   record_type before, record_type after)
{
   DBUG_ENTER("injector::transaction::update_row(...)");
   DBUG_RETURN(0);
}


injector::transaction::binlog_pos injector::transaction::
start_pos() const
{
   binlog_pos pos = { "dobedobedo", 0 };
   return pos;			
}


////////////////////////////////////////////////////////////////
// injector - member definitions
////////////////////////////////////////////////////////////////

inline injector::		// inline since it's called below
injector()
{
    
}

injector* injector::
instance()
{
  return new injector();
}



injector::transaction injector::
new_trans()
{
   DBUG_PRINT("info", ("Creating new transaction"));
   return transaction();
}



--- New file ---
+++ BitKeeper/deleted/.del-injector.h~58c24388e55735a	05/02/25 11:55:58
/* -*- Mode: C++; c-indentation-style: gnu -*- */

/*
   Copyright (C) 2005 MySQL AB & MySQL Finland AB & TCX DataKonsult AB

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */

#ifndef INJECTOR_H
#define INJECTOR_H

#include "my_global.h"		// Pull in 'byte', 'my_off_t', and 'uint32'

// Forward declarations
class handler;

/*
  The injector class is used to notify the MySQL server of new rows that have
  appeared outside of MySQL control. 

  The original purpose of this is to allow clusters---which handle replication
  inside the cluster through other means---to insert new rows into binary log.
  Note, however, that the injector should be used whenever rows are altered in
  any manner that is outside of MySQL server visibility and which therefore
  are not seen by the MySQL server.
 */
class injector 
{
public:

  /*
    Return the instance of the injector.
    The injector is a Singleton, so this static function return the instance
    of the injector.
  */
  static injector* instance();

    /*
      A transaction where rows can be added.

      The transaction class satisfy the CopyConstructible and Assignable
      requirements.  Note that the transaction is *not* default
      constructible. 
     */
    class transaction {
      friend class injector;
    public:
      // Convenience definitions
      typedef byte*    record_type;
      typedef uint32   server_id_type;

      // Binlog position as a structure
      struct binlog_pos {
	char const* file;
	my_off_t pos;
      };

      transaction(transaction const&);
      ~transaction();
      transaction& operator=(transaction const&);
      
      /*
	Add a 'write row' entry to the transaction.
      */
      int write_row (server_id_type sid, record_type record);

      /*
	Add a 'delete row' entry to the transaction.
      */
      int delete_row(server_id_type sid, record_type record);

      /*
	Add an 'update row' entry to the transaction.
      */
      int update_row(server_id_type sid, record_type before, 
		                         record_type after);

      /*
	Commit a transaction.

	This member function will clean up after a sequence of *_row calls by,
	for example, releasing resource and unlocking files.
      */
      int commit();

      /*
	Get the position for the start of the transaction.

	Returns the position in the binary log of the first event in this
	transaction. If now event is yet written, the position where the event
	*will* be written is returned. This position is known, since a
	new_transaction() will lock the binary log and prevent any other
	writes to the binary log.
      */
      binlog_pos start_pos() const;

    private:
      transaction();
    };

    /* 
       Create a new transaction. 
       This member function will prepare for a sequence of *_row calls by,
       for example, reserving resources and locking files. 
     */
    transaction new_trans();

private:
    explicit injector();
    ~injector() { }		// Nothing needs to be done
    injector(injector const&);	// You're now allowed to copy injector
				// instances. 
};


#endif // INJECTOR_H

--- New file ---
+++ sql/injector.h	05/02/25 12:31:37
/* -*- Mode: C++; c-indentation-style: gnu -*- */

/*
   Copyright (C) 2005 MySQL AB & MySQL Finland AB & TCX DataKonsult AB

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */

#ifndef INJECTOR_H
#define INJECTOR_H

#include "my_global.h"		// Pull in 'byte', 'my_off_t', and 'uint32'

// Forward declarations
class handler;

/*
  The injector class is used to notify the MySQL server of new rows that have
  appeared outside of MySQL control. 

  The original purpose of this is to allow clusters---which handle replication
  inside the cluster through other means---to insert new rows into binary log.
  Note, however, that the injector should be used whenever rows are altered in
  any manner that is outside of MySQL server visibility and which therefore
  are not seen by the MySQL server.
 */
class injector 
{
public:

  /*
    Return the instance of the injector.
    The injector is a Singleton, so this static function return the instance
    of the injector.
  */
  static injector* instance();

    /*
      A transaction where rows can be added.

      The transaction class satisfy the CopyConstructible and Assignable
      requirements.  Note that the transaction is *not* default
      constructible. 
     */
    class transaction {
      friend class injector;
    public:
      // Convenience definitions
      typedef byte*    record_type;
      typedef uint32   server_id_type;

      /*
	Table reference.

        The class contains constructors to handle several forms of references
        to tables.  The constructors can implicitly be used to construct
        references from, e.g., strings containing table names.
      */
      class table {
      public:
	table(char const* name) : m_name(name) { }
	table(const table& t) : m_name(t.m_name) { }
      private:
	char const* m_name;
      };

      /*
	Binlog position as a structure
      */
      struct binlog_pos {
	char const* file;
	my_off_t pos;
      };

      transaction(transaction const&);
      ~transaction();

      transaction& operator=(transaction t) {
	swap(t);
	return *this;
      }
      
      /*
	Add a 'write row' entry to the transaction.
      */
      int write_row (server_id_type sid, table tbl, 
		     record_type record);

      /*
	Add a 'delete row' entry to the transaction.
      */
      int delete_row(server_id_type sid, table tbl,
		     record_type record);

      /*
	Add an 'update row' entry to the transaction.
      */
      int update_row(server_id_type sid, table tbl,
		     record_type before, record_type after);

      /*
	Commit a transaction.

	This member function will clean up after a sequence of *_row calls by,
	for example, releasing resource and unlocking files.
      */
      int commit();

      /*
	Get the position for the start of the transaction.

	Returns the position in the binary log of the first event in this
	transaction. If now event is yet written, the position where the event
	*will* be written is returned. This position is known, since a
	new_transaction() will lock the binary log and prevent any other
	writes to the binary log.
      */
      binlog_pos start_pos() const;

    private:
      transaction();

      void swap(transaction& o) {
	// Nothing to do yet: the class has no members !!!
      }
    };

    /* 
       Create a new transaction. 
       This member function will prepare for a sequence of *_row calls by,
       for example, reserving resources and locking files. 
     */
    transaction new_trans();

private:
    explicit injector();
    ~injector() { }		// Nothing needs to be done
    injector(injector const&);	// You're now allowed to copy injector
				// instances. 
};


#endif // INJECTOR_H

Thread
bk commit into 5.1 tree (mats:1.1774)Mats Kindahl25 Feb