[Commits] Rev 3514: Cassandra SE: in file:///data0/psergey/dev2/5.5-cassandra-r01/

Sergey Petrunya psergey at askmonty.org
Sun Sep 16 11:22:22 EEST 2012


At file:///data0/psergey/dev2/5.5-cassandra-r01/

------------------------------------------------------------
revno: 3514
revision-id: psergey at askmonty.org-20120916082221-dmjflcumsduprzac
parent: psergey at askmonty.org-20120914052542-36jdl4nc4bfgqeb9
committer: Sergey Petrunya <psergey at askmonty.org>
branch nick: 5.5-cassandra-r01
timestamp: Sun 2012-09-16 12:22:21 +0400
message:
  Cassandra SE: 
  - added option thrift_port which allows to specify which port to connect to
  - not adding username/password - it turns out, there are no authentication
    schemes in stock cassandra distribution.
=== modified file 'storage/cassandra/cassandra_se.cc'
--- a/storage/cassandra/cassandra_se.cc	2012-09-14 05:03:25 +0000
+++ b/storage/cassandra/cassandra_se.cc	2012-09-16 08:22:21 +0000
@@ -73,7 +73,7 @@
   virtual ~Cassandra_se_impl(){ delete cass; }
   
   /* Connection and DDL checks */
-  bool connect(const char *host, const char *keyspace);
+  bool connect(const char *host, int port, const char *keyspace);
   void set_column_family(const char *cfname) { column_family.assign(cfname); }
 
   bool setup_ddl_checks();
@@ -135,7 +135,7 @@
 }
 
 
-bool Cassandra_se_impl::connect(const char *host, const char *keyspace_arg)
+bool Cassandra_se_impl::connect(const char *host, int port, const char *keyspace_arg)
 {
   bool res= true;
   
@@ -143,7 +143,7 @@
   
   try {
     boost::shared_ptr<TTransport> socket = 
-      boost::shared_ptr<TSocket>(new TSocket(host, 9160));
+      boost::shared_ptr<TSocket>(new TSocket(host, port));
     boost::shared_ptr<TTransport> tr = 
       boost::shared_ptr<TFramedTransport>(new TFramedTransport (socket));
     boost::shared_ptr<TProtocol> p = 
@@ -680,3 +680,4 @@
 }
 
 
+

=== modified file 'storage/cassandra/cassandra_se.h'
--- a/storage/cassandra/cassandra_se.h	2012-08-27 04:44:58 +0000
+++ b/storage/cassandra/cassandra_se.h	2012-09-16 08:22:21 +0000
@@ -17,7 +17,7 @@
   
   virtual ~Cassandra_se_interface(){};
   /* Init */
-  virtual bool connect(const char *host, const char *port)=0;
+  virtual bool connect(const char *host, int port, const char *keyspace)=0;
   virtual void set_column_family(const char *cfname) = 0;
    
   /* Check underlying DDL */
@@ -82,3 +82,4 @@
 
 
 Cassandra_se_interface *get_cassandra_se();
+

=== modified file 'storage/cassandra/ha_cassandra.cc'
--- a/storage/cassandra/ha_cassandra.cc	2012-09-14 05:25:42 +0000
+++ b/storage/cassandra/ha_cassandra.cc	2012-09-16 08:22:21 +0000
@@ -38,7 +38,8 @@
 
 struct ha_table_option_struct
 {
-  const char *host;
+  const char *thrift_host;
+  int         thrift_port;
   const char *keyspace;
   const char *column_family;
 };
@@ -49,7 +50,8 @@
   /*
     one option that takes an arbitrary string
   */
-  HA_TOPTION_STRING("thrift_host", host),
+  HA_TOPTION_STRING("thrift_host", thrift_host),
+  HA_TOPTION_NUMBER("thrift_port", thrift_port, 9160, 1, 65535, 0),
   HA_TOPTION_STRING("keyspace", keyspace),
   HA_TOPTION_STRING("column_family", column_family),
   HA_TOPTION_END
@@ -283,14 +285,14 @@
   
   ha_table_option_struct *options= table->s->option_struct;
   fprintf(stderr, "ha_cass: open thrift_host=%s keyspace=%s column_family=%s\n", 
-          options->host, options->keyspace, options->column_family);
+          options->thrift_host, options->keyspace, options->column_family);
   
   DBUG_ASSERT(!se);
-  if (!options->host || !options->keyspace || !options->column_family)
+  if (!options->thrift_host || !options->keyspace || !options->column_family)
     DBUG_RETURN(HA_WRONG_CREATE_OPTION);
   se= get_cassandra_se();
   se->set_column_family(options->column_family);
-  if (se->connect(options->host, options->keyspace))
+  if (se->connect(options->thrift_host, options->thrift_port, options->keyspace))
   {
     my_error(ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), se->error_str());
     DBUG_RETURN(HA_ERR_NO_CONNECTION);
@@ -389,7 +391,7 @@
 */
 #endif
   DBUG_ASSERT(!se);
-  if (!options->host  || !options->keyspace || !options->column_family)
+  if (!options->thrift_host  || !options->keyspace || !options->column_family)
   {
     my_error(ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), 
              "thrift_host, keyspace, and column_family table options must be specified");
@@ -397,7 +399,7 @@
   }
   se= get_cassandra_se();
   se->set_column_family(options->column_family);
-  if (se->connect(options->host, options->keyspace))
+  if (se->connect(options->thrift_host, options->thrift_port, options->keyspace))
   {
     my_error(ER_CONNECT_TO_FOREIGN_DATA_SOURCE, MYF(0), se->error_str());
     DBUG_RETURN(HA_ERR_NO_CONNECTION);



More information about the commits mailing list