3311 Ole John Aske 2010-10-11 [merge]
Merge from mainline
removed:
storage/ndb/swig/
storage/ndb/swig/Makefile.am
storage/ndb/swig/globals.i
storage/ndb/swig/mgmapi/
storage/ndb/swig/mgmapi/ClusterState.i
storage/ndb/swig/mgmapi/NdbLogEvent.i
storage/ndb/swig/mgmapi/NdbLogEventManager.i
storage/ndb/swig/mgmapi/NdbMgm.i
storage/ndb/swig/mgmapi/NdbMgmFactory.i
storage/ndb/swig/mgmapi/NdbMgmReply.i
storage/ndb/swig/mgmapi/NodeState.i
storage/ndb/swig/mgmapi/events.i
storage/ndb/swig/mgmapi/listeners.i
storage/ndb/swig/mgmapi/mgmglobals.i
storage/ndb/swig/ndbapi/
storage/ndb/swig/ndbapi/Ndb.i
storage/ndb/swig/ndbapi/NdbBlob.i
storage/ndb/swig/ndbapi/NdbClusterConnection.i
storage/ndb/swig/ndbapi/NdbDictionary.i
storage/ndb/swig/ndbapi/NdbError.i
storage/ndb/swig/ndbapi/NdbEventOperation.i
storage/ndb/swig/ndbapi/NdbFactory.i
storage/ndb/swig/ndbapi/NdbIndexOperation.i
storage/ndb/swig/ndbapi/NdbIndexScanOperation.i
storage/ndb/swig/ndbapi/NdbOperation.i
storage/ndb/swig/ndbapi/NdbRecAttr.i
storage/ndb/swig/ndbapi/NdbScanFilter.i
storage/ndb/swig/ndbapi/NdbScanOperation.i
storage/ndb/swig/ndbapi/NdbTransaction.i
storage/ndb/swig/ndbapi/ndbglobals.i
added:
storage/ndb/src/ndbapi/trp_client.cpp
modified:
include/my_global.h
mysql-test/suite/ndb/r/ndb_basic.result
mysql-test/suite/ndb/r/ndb_bulk_delete.result
mysql-test/suite/ndb/t/ndb_bulk_delete.test
sql/ha_ndbcluster.cc
sql/ha_ndbcluster.h
sql/handler.cc
sql/handler.h
sql/sql_delete.cc
storage/ndb/Makefile.am
storage/ndb/config/common.mk.am
storage/ndb/include/kernel/signaldata/QueryTree.hpp
storage/ndb/include/ndbapi/Ndb.hpp
storage/ndb/include/transporter/TransporterRegistry.hpp
storage/ndb/src/common/transporter/TCP_Transporter.cpp
storage/ndb/src/common/transporter/TCP_Transporter.hpp
storage/ndb/src/common/transporter/TransporterRegistry.cpp
storage/ndb/src/common/util/NdbSqlUtil.cpp
storage/ndb/src/common/util/SocketServer.cpp
storage/ndb/src/kernel/blocks/LocalProxy.cpp
storage/ndb/src/kernel/blocks/LocalProxy.hpp
storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp
storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp
storage/ndb/src/kernel/vm/WatchDog.cpp
storage/ndb/src/mgmsrv/MgmtSrvr.cpp
storage/ndb/src/ndbapi/CMakeLists.txt
storage/ndb/src/ndbapi/ClusterMgr.cpp
storage/ndb/src/ndbapi/Makefile.am
storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp
storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp
storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp
storage/ndb/src/ndbapi/NdbIndexStat.cpp
storage/ndb/src/ndbapi/NdbQueryBuilderImpl.hpp
storage/ndb/src/ndbapi/NdbQueryOperation.cpp
storage/ndb/src/ndbapi/NdbScanOperation.cpp
storage/ndb/src/ndbapi/NdbTransactionScan.cpp
storage/ndb/src/ndbapi/NdbWaiter.hpp
storage/ndb/src/ndbapi/Ndbif.cpp
storage/ndb/src/ndbapi/Ndbinit.cpp
storage/ndb/src/ndbapi/SignalSender.cpp
storage/ndb/src/ndbapi/SignalSender.hpp
storage/ndb/src/ndbapi/TransporterFacade.cpp
storage/ndb/src/ndbapi/TransporterFacade.hpp
storage/ndb/src/ndbapi/ndb_cluster_connection.cpp
storage/ndb/src/ndbapi/trp_client.hpp
storage/ndb/test/ndbapi/testIndexStat.cpp
storage/ndb/test/ndbapi/testNdbApi.cpp
storage/ndb/test/ndbapi/test_event_merge.cpp
storage/ndb/test/run-test/daily-basic-tests.txt
storage/ndb/tools/ndb_test_platform.cpp
3310 Ole John Aske 2010-10-11
spj-svs: Enhanced RQG test to partition test tables on only some of the column in the primary key.
Also:
- create a mix of unique / non-unique indexes in order instead of only unique indexes.
- Added indexes on (var)char columns for some of the tables to improve testcoverage.
modified:
storage/ndb/test/rqg/runall.sh
storage/ndb/test/rqg/spj_test.yy
=== modified file 'include/my_global.h'
--- a/include/my_global.h 2010-06-16 20:49:05 +0000
+++ b/include/my_global.h 2010-10-01 11:19:52 +0000
@@ -1098,7 +1098,6 @@ typedef off_t os_off_t;
#define SOCKET_ETIMEDOUT SOCKET_EINTR
#define SOCKET_EWOULDBLOCK EWOULDBLOCK
#define SOCKET_EADDRINUSE EADDRINUSE
-#define SOCKET_ECONNREFUSED ECONNREFUSED
#define SOCKET_ENFILE ENFILE
#define SOCKET_EMFILE EMFILE
#endif
=== modified file 'mysql-test/suite/ndb/r/ndb_basic.result'
--- a/mysql-test/suite/ndb/r/ndb_basic.result 2010-06-22 05:24:36 +0000
+++ b/mysql-test/suite/ndb/r/ndb_basic.result 2010-10-11 13:18:51 +0000
@@ -1012,6 +1012,8 @@ create table t1
primary key (a,b,c,d))
engine=ndb
max_rows=800000000;
+Warnings:
+Warning 1105 Ndb might have problems storing the max amount of rows specified
insert into t1 values
(1,2,3,4),(2,3,4,5),(3,4,5,6),
(3,2,3,4),(1,3,4,5),(2,4,5,6),
=== modified file 'mysql-test/suite/ndb/r/ndb_bulk_delete.result'
--- a/mysql-test/suite/ndb/r/ndb_bulk_delete.result 2008-09-24 14:44:11 +0000
+++ b/mysql-test/suite/ndb/r/ndb_bulk_delete.result 2010-10-01 13:20:38 +0000
@@ -1,4 +1,3 @@
-DROP TABLE IF EXISTS t1;
create table t1 (a int key) engine ndb;
insert into t1 values (1);
insert into t1 select a+1 from t1;
@@ -9,6 +8,9 @@ insert into t1 select a+16 from t1;
insert into t1 select a+32 from t1;
insert into t1 select a+64 from t1;
insert into t1 select a+128 from t1;
+select count(*) from t1;
+count(*)
+256
# test: simple delete of multiple pk's
# expected result 1 roundtrips
@@ -46,5 +48,26 @@ affected rows: 0
@ndb_execute_count:=VARIABLE_VALUE-@ndb_init_execute_count
1
affected rows: 1
+select count(*) as "0(was deleted)" from t1 where a in (1,7, 90, 100, 130);
+0(was deleted)
+0
+select count(*) as "0(never existed)" from t1 where a=1000;
+0(never existed)
+0
+select count(*) as "0(never existed)" from t1
+where a in (1000, 1001, 1002, 1003, 1004);
+0(never existed)
+0
+select count(*) as "251(remaining)" from t1;
+251(remaining)
+251
+select count(*) as "5(not deleted)" from t1 where a in (2, 3, 4, 5, 6);
+5(not deleted)
+5
drop table t1;
-affected rows: 0
+create table t2 (a int primary key, b varchar(256)) engine ndb;
+Has loaded 2000 rows
+2000
+Should be 1500 rows left now
+1500
+drop table t2, t3;
=== modified file 'mysql-test/suite/ndb/t/ndb_bulk_delete.test'
--- a/mysql-test/suite/ndb/t/ndb_bulk_delete.test 2010-09-22 11:36:01 +0000
+++ b/mysql-test/suite/ndb/t/ndb_bulk_delete.test 2010-10-01 13:34:24 +0000
@@ -1,13 +1,9 @@
#
-# Basic test of bulk update interface. Test counts number of execute
-# as measurement of numbre of round trips to kernel.
+# Basic test of bulk delete interface. Test counts number of execute
+# as measurement of number of round trips to kernel.
#
-- source include/have_ndb.inc
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
create table t1 (a int key) engine ndb;
insert into t1 values (1);
insert into t1 select a+1 from t1;
@@ -18,6 +14,7 @@ insert into t1 select a+16 from t1;
insert into t1 select a+32 from t1;
insert into t1 select a+64 from t1;
insert into t1 select a+128 from t1;
+select count(*) from t1; # 256 rows
--enable_info
@@ -57,6 +54,83 @@ delete from t1 where a=1000;
delete from t1 where a in (1000, 1001, 1002, 1003, 1004);
--source suite/ndb/include/ndb_execute_count.inc
+--disable_info
+
+# Check that the expected rows remains
+select count(*) as "0(was deleted)" from t1 where a in (1,7, 90, 100, 130);
+select count(*) as "0(never existed)" from t1 where a=1000;
+select count(*) as "0(never existed)" from t1
+ where a in (1000, 1001, 1002, 1003, 1004);
+select count(*) as "251(remaining)" from t1;
+select count(*) as "5(not deleted)" from t1 where a in (2, 3, 4, 5, 6);
# cleanup
drop table t1;
+
+
+# Build table t2 with 2000 rows
+create table t2 (a int primary key, b varchar(256)) engine ndb;
+--disable_result_log
+--disable_query_log
+let $i = 200;
+while($i)
+{
+ eval insert into t2 values
+ ($i*10,"building a table"),
+ ($i*10+1, "one row"), ($i*10+2, "another row"),
+ ($i*10+3, "the third row"), ($i*10+4, ""),
+ ($i*10+5, "fifth"), ($i*10+6, "a longer string at line six"),
+ ($i*10+7, "in the sevent it will get even longer"),
+ ($i*10+8, "another row 8"), ($i*10+9, "another row 9");
+ dec $i;
+}
+--enable_result_log
+select count(*) as "Has loaded 2000 rows" from t2;
+--enable_query_log
+
+# Build table t3 and delete from it with increasing
+# number of values in the IN clause, don't do too many
+# as mysqld will switch to full table scan
+--disable_query_log
+--disable_result_log
+create table t3 like t2;
+let $i = 50;
+let $in = $i;
+while($i)
+{
+ # Repopulate t3 with all rows
+ replace into t3 select * from t2;
+
+ # Extend the IN clause with another 10 values
+ let $in =$in,$i*10,$i*10+1,$i*10+2,$i*10+3,$i*10+4,$i*10+5,
+ $i*10+6,$i*10+7,$i*10+8,$i*10+9;
+
+ # Get the execute count before DELETE
+ let $before= `select VARIABLE_VALUE from information_schema.session_status
+ where variable_name like 'NDB_EXECUTE_COUNT'`;
+
+ # Run the query
+ eval delete from t3 where a in ($in);
+
+ # Check that execute count after DELETE is not greater than 3
+ let $after= `select VARIABLE_VALUE from information_schema.session_status
+ where variable_name like 'NDB_EXECUTE_COUNT'`;
+ if (!`select $after-$before <= 3`)
+ {
+ echo before: $before;
+ echo after: $after;
+ enable_result_log;
+ show session status like 'ndb%';
+ die Got unexpected ndb_execute_count value;
+ }
+
+ dec $i;
+}
+--enable_result_log
+select count(*) as "Should be 1500 rows left now" from t3;
+--enable_query_log
+
+# Cleanup
+drop table t2, t3;
+
+
=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc 2010-09-30 14:20:12 +0000
+++ b/sql/ha_ndbcluster.cc 2010-10-11 13:18:51 +0000
@@ -6633,18 +6633,14 @@ int ha_ndbcluster::delete_row(const ucha
bool ha_ndbcluster::start_bulk_delete()
{
DBUG_ENTER("start_bulk_delete");
- DBUG_RETURN(FALSE);
-}
-
-int ha_ndbcluster::bulk_delete_row(const uchar *record)
-{
- DBUG_ENTER("bulk_delete_row");
- DBUG_RETURN(ndb_delete_row(record, FALSE, TRUE));
+ m_is_bulk_delete = true;
+ DBUG_RETURN(0); // Bulk delete used by handler
}
int ha_ndbcluster::end_bulk_delete()
{
DBUG_ENTER("end_bulk_delete");
+ assert(m_is_bulk_delete); // Don't allow end() without start()
if (m_thd_ndb->m_unsent_bytes &&
!(table->in_use->options & OPTION_ALLOW_BATCH) &&
!m_thd_ndb->m_handler)
@@ -6659,6 +6655,7 @@ int ha_ndbcluster::end_bulk_delete()
}
m_rows_deleted-= ignore_count;
}
+ m_is_bulk_delete = false;
DBUG_RETURN(0);
}
@@ -6668,8 +6665,7 @@ int ha_ndbcluster::end_bulk_delete()
*/
int ha_ndbcluster::ndb_delete_row(const uchar *record,
- bool primary_key_update,
- bool is_bulk_delete)
+ bool primary_key_update)
{
THD *thd= table->in_use;
Thd_ndb *thd_ndb= get_thd_ndb(thd);
@@ -6678,7 +6674,7 @@ int ha_ndbcluster::ndb_delete_row(const
const NdbOperation *op;
uint32 part_id= ~uint32(0);
int error;
- bool allow_batch= is_bulk_delete || (thd->options & OPTION_ALLOW_BATCH);
+ bool allow_batch= m_is_bulk_delete || (thd->options & OPTION_ALLOW_BATCH);
DBUG_ENTER("ndb_delete_row");
DBUG_ASSERT(trans);
@@ -7903,6 +7899,9 @@ int ha_ndbcluster::reset()
m_delete_cannot_batch= FALSE;
m_update_cannot_batch= FALSE;
+ assert(m_is_bulk_delete == false);
+ m_is_bulk_delete = false;
+
DBUG_RETURN(0);
}
@@ -9413,6 +9412,39 @@ err:
DBUG_VOID_RETURN;
}
+/*
+ Create a table in NDB Cluster
+ */
+static uint get_no_fragments(ulonglong max_rows)
+{
+ ulonglong acc_row_size= 25 + /*safety margin*/ 2;
+ ulonglong acc_fragment_size= 512*1024*1024;
+ return uint((max_rows*acc_row_size)/acc_fragment_size)+1;
+}
+
+
+/*
+ Routine to adjust default number of partitions to always be a multiple
+ of number of nodes and never more than 4 times the number of nodes.
+
+*/
+static bool adjusted_frag_count(uint no_fragments,
+ uint no_nodes,
+ uint &reported_frags)
+{
+ uint i= 0;
+
+ // Should really depend on #replicas
+ uint max_per_node = no_nodes == 1 ? 8 : 4;
+
+ reported_frags= no_nodes;
+ while (reported_frags < no_fragments && ++i < max_per_node &&
+ (reported_frags + no_nodes) < MAX_PARTITIONS)
+ reported_frags+= no_nodes;
+ return (reported_frags < no_fragments);
+}
+
+
/**
Create a table in NDB Cluster
*/
@@ -9725,6 +9757,49 @@ int ha_ndbcluster::create(const char *na
if ((my_errno= set_up_partition_info(part_info, form, (void*)&tab)))
goto abort;
+ if (tab.getFragmentType() == NDBTAB::HashMapPartition &&
+ tab.getDefaultNoPartitionsFlag() &&
+ (create_info->max_rows != 0 || create_info->min_rows != 0))
+ {
+ ulonglong rows= create_info->max_rows >= create_info->min_rows ?
+ create_info->max_rows :
+ create_info->min_rows;
+ uint no_fragments= get_no_fragments(rows);
+
+ uint no_nodes= g_ndb_cluster_connection->no_db_nodes();
+ {
+ /**
+ * Use SYSTAB_0 to guess #threads per node
+ */
+ ndb->setDatabaseName("sys");
+ Ndb_table_guard ndbtab_g(dict, "SYSTAB_0");
+ if (ndbtab_g.get_table())
+ {
+ Uint32 frags= ndbtab_g.get_table()->getFragmentCount();
+ if (frags > no_nodes)
+ {
+ /**
+ * And use this as argument adjusted_frag_count...
+ */
+ no_nodes= frags;
+ }
+ }
+ ndb->setDatabaseName(m_dbname);
+ }
+
+ uint reported_frags= no_fragments;
+ if (adjusted_frag_count(no_fragments, no_nodes, reported_frags))
+ {
+ push_warning(current_thd,
+ MYSQL_ERROR::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR,
+ "Ndb might have problems storing the max amount "
+ "of rows specified");
+ }
+ tab.setFragmentCount(reported_frags);
+ tab.setDefaultNoPartitionsFlag(false);
+ tab.setFragmentData(0, 0);
+ }
+
// Check for HashMap
if (tab.getFragmentType() == NDBTAB::HashMapPartition &&
tab.getDefaultNoPartitionsFlag())
@@ -10748,6 +10823,7 @@ ha_ndbcluster::ha_ndbcluster(handlerton
m_update_cannot_batch(FALSE),
m_skip_auto_increment(TRUE),
m_blobs_pending(0),
+ m_is_bulk_delete(false),
m_blobs_row_total_size(0),
m_blobs_buffer(0),
m_blobs_buffer_size(0),
@@ -14748,47 +14824,6 @@ ndbcluster_show_status(handlerton *hton,
}
-/*
- Create a table in NDB Cluster
- */
-static uint get_no_fragments(ulonglong max_rows)
-{
-#if MYSQL_VERSION_ID >= 50000
- uint acc_row_size= 25 + /*safety margin*/ 2;
-#else
- uint acc_row_size= pk_length*4;
- /* add acc overhead */
- if (pk_length <= 8) /* main page will set the limit */
- acc_row_size+= 25 + /*safety margin*/ 2;
- else /* overflow page will set the limit */
- acc_row_size+= 4 + /*safety margin*/ 4;
-#endif
- ulonglong acc_fragment_size= 512*1024*1024;
-#if MYSQL_VERSION_ID >= 50100
- return uint((max_rows*acc_row_size)/acc_fragment_size)+1;
-#else
- return ((max_rows*acc_row_size)/acc_fragment_size+1
- +1/*correct rounding*/)/2;
-#endif
-}
-
-
-/*
- Routine to adjust default number of partitions to always be a multiple
- of number of nodes and never more than 4 times the number of nodes.
-
-*/
-static bool adjusted_frag_count(uint no_fragments, uint no_nodes,
- uint &reported_frags)
-{
- uint i= 0;
- reported_frags= no_nodes;
- while (reported_frags < no_fragments && ++i < 4 &&
- (reported_frags + no_nodes) < MAX_PARTITIONS)
- reported_frags+= no_nodes;
- return (reported_frags < no_fragments);
-}
-
int ha_ndbcluster::get_default_no_partitions(HA_CREATE_INFO *create_info)
{
ha_rows max_rows, min_rows;
=== modified file 'sql/ha_ndbcluster.h'
--- a/sql/ha_ndbcluster.h 2010-09-27 09:14:26 +0000
+++ b/sql/ha_ndbcluster.h 2010-10-11 13:18:51 +0000
@@ -726,10 +726,8 @@ private:
bool batched_update);
bool start_bulk_delete();
- int bulk_delete_row(const uchar *record);
int end_bulk_delete();
- int ndb_delete_row(const uchar *record, bool primary_key_update,
- bool is_bulk_delete= FALSE);
+ int ndb_delete_row(const uchar *record, bool primary_key_update);
int ndb_optimize_table(THD* thd, uint delay);
@@ -922,6 +920,7 @@ private:
bool m_skip_auto_increment;
bool m_blobs_pending;
bool m_slow_path;
+ bool m_is_bulk_delete;
/* State for setActiveHook() callback for reading blob data. */
uint m_blob_counter;
=== modified file 'sql/handler.cc'
--- a/sql/handler.cc 2010-09-23 11:55:42 +0000
+++ b/sql/handler.cc 2010-10-11 13:18:51 +0000
@@ -4977,19 +4977,14 @@ int handler::ha_update_row(const uchar *
return 0;
}
-int handler::ha_delete_row(const uchar *buf, bool will_batch)
+int handler::ha_delete_row(const uchar *buf)
{
int error;
Log_func *log_func= Delete_rows_log_event::binlog_row_logging_function;
mark_trx_read_write();
- if (will_batch)
- {
- if (unlikely((error= bulk_delete_row(buf)) != 0))
- return error;
- }
- else if (unlikely((error= delete_row(buf)) != 0))
+ if (unlikely((error= delete_row(buf)) != 0))
return error;
if (unlikely((error= binlog_log_row(table, buf, 0, log_func)) != 0))
return error;
=== modified file 'sql/handler.h'
--- a/sql/handler.h 2010-09-29 13:14:52 +0000
+++ b/sql/handler.h 2010-10-11 13:18:51 +0000
@@ -296,7 +296,7 @@ typedef Bitmap<HA_MAX_ALTER_FLAGS> HA_AL
#define HA_BLOCK_LOCK 256 /* unlock when reading some records */
#define HA_OPEN_TEMPORARY 512
-/* Some key definitions */
+ /* Some key definitions */
#define HA_KEY_NULL_LENGTH 1
#define HA_KEY_BLOB_LENGTH 2
@@ -1337,7 +1337,7 @@ public:
int ha_external_lock(THD *thd, int lock_type);
int ha_write_row(uchar * buf);
int ha_update_row(const uchar * old_data, uchar * new_data);
- int ha_delete_row(const uchar * buf, bool will_batch= FALSE);
+ int ha_delete_row(const uchar * buf);
void ha_release_auto_increment();
int check_collation_compatibility();
@@ -2141,22 +2141,6 @@ private:
DBUG_ASSERT(FALSE);
return HA_ERR_WRONG_COMMAND;
}
- /*
- This method is similar to delete_row, however the handler doesn't need
- to execute the delete at this point in time. The handler can be certain
- that another call to bulk_delete_row will occur OR a call to
- end_bulk_delete before the set of deletes in this query is concluded.
-
- @param record Record to delete
-
- @retval 0 Success
- @retval !=0 Error code
- */
- virtual int bulk_delete_row(const uchar *record)
- {
- DBUG_ASSERT(FALSE);
- return HA_ERR_WRONG_COMMAND;
- }
/**
This is called to delete all rows in a table
If the handler don't support this, then this function will
@@ -2212,6 +2196,9 @@ private:
{ return HA_ERR_WRONG_COMMAND; }
};
+
+ /* Some extern variables used with handlers */
+
extern const char *ha_row_type[];
extern MYSQL_PLUGIN_IMPORT const char *tx_isolation_names[];
extern MYSQL_PLUGIN_IMPORT const char *binlog_format_names[];
@@ -2219,7 +2206,7 @@ extern TYPELIB tx_isolation_typelib;
extern TYPELIB myisam_stats_method_typelib;
extern ulong total_ha, total_ha_2pc;
-/* Wrapper functions */
+ /* Wrapper functions */
#define ha_commit(thd) (ha_commit_trans((thd), TRUE))
#define ha_rollback(thd) (ha_rollback_trans((thd), TRUE))
=== modified file 'sql/sql_delete.cc'
--- a/sql/sql_delete.cc 2010-06-16 12:04:53 +0000
+++ b/sql/sql_delete.cc 2010-10-01 13:20:38 +0000
@@ -336,7 +336,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *
break;
}
- if (!(error= table->file->ha_delete_row(table->record[0], will_batch)))
+ if (!(error= table->file->ha_delete_row(table->record[0])))
{
deleted++;
if (triggers_applicable &&
=== modified file 'storage/ndb/Makefile.am'
--- a/storage/ndb/Makefile.am 2010-08-06 08:20:51 +0000
+++ b/storage/ndb/Makefile.am 2010-10-08 13:51:37 +0000
@@ -14,8 +14,8 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-SUBDIRS = include src tools . swig @ndb_opt_subdirs@
-DIST_SUBDIRS = src tools include test docs swig
+SUBDIRS = include src tools . @ndb_opt_subdirs@
+DIST_SUBDIRS = src tools include test docs
EXTRA_DIST = config cmake ndbapi-examples plug.in CMakeLists.txt
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
=== modified file 'storage/ndb/config/common.mk.am'
--- a/storage/ndb/config/common.mk.am 2010-01-22 14:20:37 +0000
+++ b/storage/ndb/config/common.mk.am 2010-10-08 12:29:13 +0000
@@ -19,7 +19,6 @@ ndbtoolsdir = "$(bindir)"
ndbtestdir = "$(bindir)"
ndblibdir = "$(pkglibdir)"
ndbjardir = "$(pkgdatadir)/java"
-swigincludedir = "$(datadir)/mysql/swig"
ndbincludedir = "$(pkgincludedir)/storage/ndb"
ndbapiincludedir = "$(pkgincludedir)/storage/ndb/ndbapi"
mgmapiincludedir = "$(pkgincludedir)/storage/ndb/mgmapi"
=== modified file 'storage/ndb/include/kernel/signaldata/QueryTree.hpp'
--- a/storage/ndb/include/kernel/signaldata/QueryTree.hpp 2010-07-06 13:11:29 +0000
+++ b/storage/ndb/include/kernel/signaldata/QueryTree.hpp 2010-10-11 13:18:51 +0000
@@ -235,7 +235,7 @@ struct QN_ScanIndexNode
// Do pattern contain parameters
SI_PRUNE_PARAMS = 0x20000,
- // Is prune pattern dependant on parent key (or only on parameters)
+ // Is prune pattern dependant on parent key (or only on parameters / constants)
SI_PRUNE_LINKED = 0x40000,
// Should it be parallel scan (can also be set as in parameters)
=== modified file 'storage/ndb/include/ndbapi/Ndb.hpp'
--- a/storage/ndb/include/ndbapi/Ndb.hpp 2010-10-04 14:44:27 +0000
+++ b/storage/ndb/include/ndbapi/Ndb.hpp 2010-10-11 13:18:51 +0000
@@ -1072,6 +1072,7 @@ class Ndb
friend class Ndb_cluster_connection_impl;
friend class Ndb_internal;
friend class NdbScanFilterImpl;
+ friend class PollGuard;
friend class NdbQueryImpl;
friend class NdbQueryOperationImpl;
#endif
@@ -1762,11 +1763,8 @@ private:
/*****************************************************************************
* These are service routines used by the other classes in the NDBAPI.
****************************************************************************/
- Uint32 get_cond_wait_index() { return cond_wait_index; }
- void set_cond_wait_index(Uint32 index) { cond_wait_index = index; }
- Uint32 cond_wait_index;
- Ndb *cond_signal_ndb;
- void cond_signal();
+ Uint32 _unused;
+ void *_unused2;
Ndb(const Ndb&); // Not impl.
Ndb&operator=(const Ndb&);
=== modified file 'storage/ndb/include/transporter/TransporterRegistry.hpp'
--- a/storage/ndb/include/transporter/TransporterRegistry.hpp 2010-06-01 12:19:50 +0000
+++ b/storage/ndb/include/transporter/TransporterRegistry.hpp 2010-10-07 09:36:21 +0000
@@ -307,7 +307,10 @@ public:
*/
void external_IO(Uint32 timeOutMillis);
- Uint32 pollReceive(Uint32 timeOutMillis);
+ inline Uint32 pollReceive(Uint32 timeOutMillis) {
+ return pollReceive(timeOutMillis, m_has_data_transporters);
+ }
+ Uint32 pollReceive(Uint32 timeOutMillis, NodeBitmask& mask);
void performReceive();
int performSend(NodeId nodeId);
void performSend();
@@ -352,19 +355,15 @@ private:
int nSCITransporters;
int nSHMTransporters;
-#if defined(HAVE_EPOLL_CREATE)
- typedef Bitmask<MAX_NTRANSPORTERS/32> TransporterMask;
-
- int m_epoll_fd;
- struct epoll_event *m_epoll_events;
- bool change_epoll(TCP_Transporter *t, bool add);
- void get_tcp_data(TCP_Transporter *t);
-
/**
* Bitmask of transporters that has data "carried over" since
* last performReceive
*/
- TransporterMask m_has_data_transporters;
+ NodeBitmask m_has_data_transporters;
+#if defined(HAVE_EPOLL_CREATE)
+ int m_epoll_fd;
+ struct epoll_event *m_epoll_events;
+ bool change_epoll(TCP_Transporter *t, bool add);
#endif
/**
* Arrays holding all transporters in the order they are created
@@ -426,9 +425,9 @@ private:
int tcpReadSelectReply;
ndb_socket_poller m_socket_poller;
- Uint32 poll_TCP(Uint32 timeOutMillis);
- Uint32 poll_SCI(Uint32 timeOutMillis);
- Uint32 poll_SHM(Uint32 timeOutMillis);
+ Uint32 poll_TCP(Uint32 timeOutMillis, NodeBitmask&);
+ Uint32 poll_SCI(Uint32 timeOutMillis, NodeBitmask&);
+ Uint32 poll_SHM(Uint32 timeOutMillis, NodeBitmask&);
int m_shm_own_pid;
int m_transp_count;
=== modified file 'storage/ndb/src/common/transporter/TCP_Transporter.cpp'
--- a/storage/ndb/src/common/transporter/TCP_Transporter.cpp 2010-08-11 10:21:17 +0000
+++ b/storage/ndb/src/common/transporter/TCP_Transporter.cpp 2010-10-07 09:36:21 +0000
@@ -96,8 +96,7 @@ TCP_Transporter::TCP_Transporter(Transpo
0, false,
conf->checksum,
conf->signalId,
- conf->tcp.sendBufferSize),
- m_poll_index(~0)
+ conf->tcp.sendBufferSize)
{
maxReceiveSize = conf->tcp.maxReceiveSize;
=== modified file 'storage/ndb/src/common/transporter/TCP_Transporter.hpp'
--- a/storage/ndb/src/common/transporter/TCP_Transporter.hpp 2010-06-01 12:19:50 +0000
+++ b/storage/ndb/src/common/transporter/TCP_Transporter.hpp 2010-10-07 09:36:21 +0000
@@ -141,10 +141,6 @@ private:
ReceiveBuffer receiveBuffer;
bool send_limit_reached(int bufsize) { return bufsize > TCP_SEND_LIMIT; }
-
- unsigned m_poll_index;
- void set_poll_index(unsigned index) { m_poll_index = index; };
- unsigned get_poll_index(void) const { return m_poll_index; };
};
inline
=== modified file 'storage/ndb/src/common/transporter/TransporterRegistry.cpp'
--- a/storage/ndb/src/common/transporter/TransporterRegistry.cpp 2010-08-20 08:35:41 +0000
+++ b/storage/ndb/src/common/transporter/TransporterRegistry.cpp 2010-10-07 09:36:21 +0000
@@ -17,7 +17,6 @@
*/
#include <ndb_global.h>
-#include <my_pthread.h>
#include <TransporterRegistry.hpp>
#include "TransporterInternalDefinitions.hpp"
@@ -902,18 +901,30 @@ TransporterRegistry::wakeup()
}
Uint32
-TransporterRegistry::pollReceive(Uint32 timeOutMillis){
+TransporterRegistry::pollReceive(Uint32 timeOutMillis,
+ NodeBitmask& mask)
+{
Uint32 retVal = 0;
- if((nSCITransporters) > 0)
+ /**
+ * If any transporters have left-over data that was not fully executed in
+ * last loop, don't wait and return 'data available' even if nothing new
+ */
+ if (!mask.isclear())
+ {
+ timeOutMillis = 0;
+ retVal = 1;
+ }
+
+ if (nSCITransporters > 0)
{
timeOutMillis=0;
}
#ifdef NDB_SHM_TRANSPORTER
- if(nSHMTransporters > 0)
+ if (nSHMTransporters > 0)
{
- Uint32 res = poll_SHM(0);
+ Uint32 res = poll_SHM(0, mask);
if(res)
{
retVal |= res;
@@ -926,17 +937,7 @@ TransporterRegistry::pollReceive(Uint32
#if defined(HAVE_EPOLL_CREATE)
if (likely(m_epoll_fd != -1))
{
- Uint32 num_trps = nTCPTransporters;
- /**
- * If any transporters have left-over data that was not fully executed in
- * last loop, don't wait and return 'data available' even if nothing new
- * from epoll.
- */
- if (!m_has_data_transporters.isclear())
- {
- timeOutMillis = 0;
- retVal = 1;
- }
+ Uint32 num_trps = nTCPTransporters + (m_has_extra_wakeup_socket ? 1 : 0);
if (num_trps)
{
@@ -944,26 +945,39 @@ TransporterRegistry::pollReceive(Uint32
num_trps, timeOutMillis);
retVal |= tcpReadSelectReply;
}
+
+ int num_socket_events = tcpReadSelectReply;
+ if (num_socket_events > 0)
+ {
+ for (int i = 0; i < num_socket_events; i++)
+ {
+ mask.set(m_epoll_events[i].data.u32);
+ }
+ }
+ else if (num_socket_events < 0)
+ {
+ assert(errno == EINTR);
+ }
}
else
#endif
{
- if(nTCPTransporters > 0 || m_has_extra_wakeup_socket || retVal == 0)
+ if (nTCPTransporters > 0 || m_has_extra_wakeup_socket)
{
- retVal |= poll_TCP(timeOutMillis);
+ retVal |= poll_TCP(timeOutMillis, mask);
}
else
tcpReadSelectReply = 0;
}
#endif
#ifdef NDB_SCI_TRANSPORTER
- if(nSCITransporters > 0)
- retVal |= poll_SCI(timeOutMillis);
+ if (nSCITransporters > 0)
+ retVal |= poll_SCI(timeOutMillis, mask);
#endif
#ifdef NDB_SHM_TRANSPORTER
- if(nSHMTransporters > 0 && retVal == 0)
+ if (nSHMTransporters > 0)
{
- int res = poll_SHM(0);
+ int res = poll_SHM(0, mask);
retVal |= res;
}
#endif
@@ -973,17 +987,23 @@ TransporterRegistry::pollReceive(Uint32
#ifdef NDB_SCI_TRANSPORTER
Uint32
-TransporterRegistry::poll_SCI(Uint32 timeOutMillis)
+TransporterRegistry::poll_SCI(Uint32 timeOutMillis, NodeBitmask& mask)
{
- for (int i=0; i<nSCITransporters; i++) {
+ Uint32 retVal = 0;
+ for (int i = 0; i < nSCITransporters; i++)
+ {
SCI_Transporter * t = theSCITransporters[i];
- Uint32 node_id= t->getRemoteNodeId();
- if (t->isConnected() && is_connected(node_id)) {
- if(t->hasDataToRead())
- return 1;
+ Uint32 node_id = t->getRemoteNodeId();
+ if (t->isConnected() && is_connected(node_id))
+ {
+ if (t->hasDataToRead())
+ {
+ mask.set(node_id);
+ retVal = 1;
+ }
}
}
- return 0;
+ return retVal;
}
#endif
@@ -991,21 +1011,27 @@ TransporterRegistry::poll_SCI(Uint32 tim
#ifdef NDB_SHM_TRANSPORTER
static int g_shm_counter = 0;
Uint32
-TransporterRegistry::poll_SHM(Uint32 timeOutMillis)
+TransporterRegistry::poll_SHM(Uint32 timeOutMillis, NodeBitmask& mask)
{
- for(int j=0; j < 100; j++)
+ Uint32 retVal = 0;
+ for (int j = 0; j < 100; j++)
{
- for (int i=0; i<nSHMTransporters; i++) {
+ for (int i = 0; i<nSHMTransporters; i++)
+ {
SHM_Transporter * t = theSHMTransporters[i];
- Uint32 node_id= t->getRemoteNodeId();
- if (t->isConnected() && is_connected(node_id)) {
- if(t->hasDataToRead()) {
- return 1;
+ Uint32 node_id = t->getRemoteNodeId();
+ if (t->isConnected() && is_connected(node_id))
+ {
+ if (t->hasDataToRead())
+ {
+ j = 100;
+ mask.set(node_id);
+ retVal = 1;
}
}
}
}
- return 0;
+ return retVal;
}
#endif
@@ -1019,10 +1045,8 @@ TransporterRegistry::poll_SHM(Uint32 tim
* protected by transporter locks on upper layer).
*/
Uint32
-TransporterRegistry::poll_TCP(Uint32 timeOutMillis)
+TransporterRegistry::poll_TCP(Uint32 timeOutMillis, NodeBitmask& mask)
{
- bool hasdata = false;
-
m_socket_poller.clear();
if (m_has_extra_wakeup_socket)
@@ -1033,28 +1057,46 @@ TransporterRegistry::poll_TCP(Uint32 tim
m_socket_poller.add(socket, true, false, false);
}
+ Uint16 idx[MAX_NODES];
for (int i = 0; i < nTCPTransporters; i++)
{
- unsigned index = ~0;
TCP_Transporter * t = theTCPTransporters[i];
- const Uint32 node_id = t->getRemoteNodeId();
const NDB_SOCKET_TYPE socket = t->getSocket();
+ Uint32 node_id = t->getRemoteNodeId();
- if (is_connected(node_id) && t->isConnected() &&
- my_socket_valid(socket))
+ if (is_connected(node_id) && t->isConnected() && my_socket_valid(socket))
{
- // Poll the connected transporter for read
- index = m_socket_poller.add(socket, true, false, false);
+ idx[i] = m_socket_poller.add(socket, true, false, false);
+ }
+ else
+ {
+ idx[i] = MAX_NODES + 1;
}
- // Remember the index into poll list
- t->set_poll_index(index);
-
- hasdata |= t->hasReceiveData();
}
- tcpReadSelectReply = m_socket_poller.poll_unsafe(hasdata ? 0 : timeOutMillis);
+ tcpReadSelectReply = m_socket_poller.poll_unsafe(timeOutMillis);
- return tcpReadSelectReply || hasdata;
+ if (tcpReadSelectReply > 0)
+ {
+ if (m_extra_wakeup_sockets)
+ {
+ if (m_socket_poller.has_read(0))
+ mask.set((Uint32)0);
+ }
+
+ for (int i = 0; i < nTCPTransporters; i++)
+ {
+ TCP_Transporter * t = theTCPTransporters[i];
+ if (idx[i] != MAX_NODES + 1)
+ {
+ Uint32 node_id = t->getRemoteNodeId();
+ if (m_socket_poller.has_read(idx[i]))
+ mask.set(node_id);
+ }
+ }
+ }
+
+ return tcpReadSelectReply;
}
#endif
@@ -1112,111 +1154,46 @@ ok:
return FALSE;
}
+#endif
+
/**
* In multi-threaded cases, this must be protected by a global receive lock.
*/
void
-TransporterRegistry::get_tcp_data(TCP_Transporter *t)
-{
- const NodeId node_id = t->getRemoteNodeId();
- bool hasdata = false;
- if (is_connected(node_id) && t->isConnected())
- {
- callbackObj->checkJobBuffer();
- t->doReceive();
-
- Uint32 *ptr;
- Uint32 sz = t->getReceiveData(&ptr);
- callbackObj->transporter_recv_from(node_id);
- Uint32 szUsed = unpack(ptr, sz, node_id, ioStates[node_id]);
- t->updateReceiveDataPtr(szUsed);
- hasdata = t->hasReceiveData();
- }
- m_has_data_transporters.set(node_id, hasdata);
-}
-
-#endif
-
-void
TransporterRegistry::performReceive()
{
bool hasReceived = false;
-#ifdef NDB_TCP_TRANSPORTER
-#if defined(HAVE_EPOLL_CREATE)
- if (likely(m_epoll_fd != -1))
- {
- int num_socket_events = tcpReadSelectReply;
- int i;
-
- if (num_socket_events > 0)
- {
- for (i = 0; i < num_socket_events; i++)
- {
- m_has_data_transporters.set(m_epoll_events[i].data.u32);
- }
- }
- else if (num_socket_events < 0)
- {
- assert(errno == EINTR);
- }
- if (m_has_data_transporters.get(0))
- {
- m_has_data_transporters.clear(Uint32(0));
- consume_extra_sockets();
- }
-
- Uint32 id = 0;
- while ((id = m_has_data_transporters.find(id + 1)) != BitmaskImpl::NotFound)
- {
- get_tcp_data((TCP_Transporter*)theTransporters[id]);
- }
+ if (m_has_data_transporters.get(0))
+ {
+ m_has_data_transporters.clear(Uint32(0));
+ consume_extra_sockets();
}
- else
-#endif
+
+#ifdef NDB_TCP_TRANSPORTER
+ Uint32 id = 0;
+ while ((id = m_has_data_transporters.find(id + 1)) != BitmaskImpl::NotFound)
{
- if (m_has_extra_wakeup_socket)
+ bool hasdata = false;
+ TCP_Transporter * t = (TCP_Transporter*)theTransporters[id];
+ if (is_connected(id))
{
- // The wakeupsocket is always added first => use index 0
- if (m_socket_poller.has_read(0))
+ if (t->isConnected())
{
- assert(m_socket_poller.is_socket_equal(0, m_extra_wakeup_sockets[0]));
- consume_extra_sockets();
- }
- }
-
- for (int i=0; i<nTCPTransporters; i++)
- {
- TCP_Transporter *t = theTCPTransporters[i];
- const NodeId nodeId = t->getRemoteNodeId();
-
- if(is_connected(nodeId)){
- if(t->isConnected())
- {
- const unsigned index = t->get_poll_index();
- if (index != (unsigned)~0 &&
- m_socket_poller.has_read(index))
- {
- assert(m_socket_poller.is_socket_equal(index, t->getSocket()));
- t->doReceive();
- }
- // Reset the index into poll list
- t->set_poll_index(~0);
-
- if (t->hasReceiveData())
- {
- if (hasReceived)
- callbackObj->checkJobBuffer();
- hasReceived = true;
- Uint32 * ptr;
- Uint32 sz = t->getReceiveData(&ptr);
- callbackObj->transporter_recv_from(nodeId);
- Uint32 szUsed = unpack(ptr, sz, nodeId, ioStates[nodeId]);
- t->updateReceiveDataPtr(szUsed);
- }
- }
+ t->doReceive();
+ if (hasReceived)
+ callbackObj->checkJobBuffer();
+ hasReceived = true;
+ Uint32 * ptr;
+ Uint32 sz = t->getReceiveData(&ptr);
+ callbackObj->transporter_recv_from(id);
+ Uint32 szUsed = unpack(ptr, sz, id, ioStates[id]);
+ t->updateReceiveDataPtr(szUsed);
+ hasdata = t->hasReceiveData();
}
}
+ // If transporter still have data, make sure that it's remember to next time
+ m_has_data_transporters.set(id, hasdata);
}
#endif
@@ -1503,9 +1480,7 @@ TransporterRegistry::report_disconnect(N
DBUG_ENTER("TransporterRegistry::report_disconnect");
DBUG_PRINT("info",("performStates[%d]=DISCONNECTED",node_id));
performStates[node_id] = DISCONNECTED;
-#ifdef HAVE_EPOLL_CREATE
m_has_data_transporters.clear(node_id);
-#endif
callbackObj->reportDisconnect(node_id, errnum);
DBUG_VOID_RETURN;
}
=== modified file 'storage/ndb/src/common/util/NdbSqlUtil.cpp'
--- a/storage/ndb/src/common/util/NdbSqlUtil.cpp 2010-08-16 10:25:27 +0000
+++ b/storage/ndb/src/common/util/NdbSqlUtil.cpp 2010-10-07 05:39:39 +0000
@@ -17,7 +17,6 @@
*/
#include <NdbSqlUtil.hpp>
-#include <my_sys.h>
#include <ndb_version.h>
/*
=== modified file 'storage/ndb/src/common/util/SocketServer.cpp'
--- a/storage/ndb/src/common/util/SocketServer.cpp 2010-06-01 12:19:50 +0000
+++ b/storage/ndb/src/common/util/SocketServer.cpp 2010-10-07 05:39:39 +0000
@@ -18,7 +18,6 @@
#include <ndb_global.h>
-#include <my_pthread.h>
#include <SocketServer.hpp>
=== modified file 'storage/ndb/src/kernel/blocks/LocalProxy.cpp'
--- a/storage/ndb/src/kernel/blocks/LocalProxy.cpp 2010-05-03 04:49:08 +0000
+++ b/storage/ndb/src/kernel/blocks/LocalProxy.cpp 2010-10-08 08:31:34 +0000
@@ -1050,10 +1050,13 @@ LocalProxy::find_next(Ndbinfo::ScanCurso
ndbrequire(node == getOwnNodeId());
ndbrequire(block == number());
- if (instance++ < c_workers)
+
+ Uint32 worker = (instance > 0) ? workerIndex(instance) + 1 : 0;
+
+ if (worker < c_workers)
{
jam();
- cursor->currRef = switchRef(block, instance, node);
+ cursor->currRef = switchRef(block, workerInstance(worker), node);
return true;
}
=== modified file 'storage/ndb/src/kernel/blocks/LocalProxy.hpp'
--- a/storage/ndb/src/kernel/blocks/LocalProxy.hpp 2010-05-03 04:49:08 +0000
+++ b/storage/ndb/src/kernel/blocks/LocalProxy.hpp 2010-10-08 08:31:34 +0000
@@ -94,7 +94,7 @@ protected:
// convert between worker index and worker instance
- Uint32 workerInstance(Uint32 i) {
+ Uint32 workerInstance(Uint32 i) const {
ndbrequire(i < c_workers);
Uint32 ino;
if (i < c_lqhWorkers)
@@ -104,7 +104,7 @@ protected:
return ino;
}
- Uint32 workerIndex(Uint32 ino) {
+ Uint32 workerIndex(Uint32 ino) const {
ndbrequire(ino != 0);
Uint32 i;
if (ino != 1 + MaxLqhWorkers)
=== modified file 'storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp 2010-08-20 11:10:25 +0000
+++ b/storage/ndb/src/kernel/blocks/dbacc/DbaccMain.cpp 2010-10-07 05:39:39 +0000
@@ -18,7 +18,6 @@
#define DBACC_C
#include "Dbacc.hpp"
-#include <my_sys.h>
#include <AttributeHeader.hpp>
#include <signaldata/AccFrag.hpp>
=== modified file 'storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp 2010-10-07 13:54:04 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp 2010-10-11 13:18:51 +0000
@@ -22,7 +22,6 @@
#include "md5_hash.hpp"
#include <RefConvert.hpp>
#include <ndb_limits.h>
-#include <my_sys.h>
#include <ndb_rand.h>
#include <signaldata/DiGetNodes.hpp>
@@ -11288,7 +11287,8 @@ Dbtc::close_scan_req(Signal* signal, Sca
ndbrequire(curr.p->scanFragState == ScanFragRec::DELIVERED);
delivered.remove(curr);
- if(curr.p->m_ops > 0 && curr.p->m_scan_frag_conf_status == 0){
+ if (curr.p->m_scan_frag_conf_status == 0)
+ {
jam();
running.add(curr);
curr.p->scanFragState = ScanFragRec::LQH_ACTIVE;
@@ -11297,7 +11297,9 @@ Dbtc::close_scan_req(Signal* signal, Sca
sendSignal(curr.p->lqhBlockref, GSN_SCAN_NEXTREQ, signal,
ScanFragNextReq::SignalLength, JBB);
- } else {
+ }
+ else
+ {
jam();
c_scan_frag_pool.release(curr);
curr.p->scanFragState = ScanFragRec::COMPLETED;
@@ -11317,7 +11319,8 @@ Dbtc::close_scan_req(Signal* signal, Sca
queued.remove(curr);
scanP->m_queued_count--;
- if(curr.p->m_ops > 0){
+ if (curr.p->m_scan_frag_conf_status == 0)
+ {
jam();
running.add(curr);
curr.p->scanFragState = ScanFragRec::LQH_ACTIVE;
@@ -11325,7 +11328,9 @@ Dbtc::close_scan_req(Signal* signal, Sca
nextReq->senderData = curr.i;
sendSignal(curr.p->lqhBlockref, GSN_SCAN_NEXTREQ, signal,
ScanFragNextReq::SignalLength, JBB);
- } else {
+ }
+ else
+ {
jam();
c_scan_frag_pool.release(curr);
curr.p->scanFragState = ScanFragRec::COMPLETED;
@@ -11413,15 +11418,34 @@ void Dbtc::sendScanFragReq(Signal* signa
bool longFragReq= ((version >= NDBD_LONG_SCANFRAGREQ) &&
(! ERROR_INSERTED(8070) &&
! ERROR_INSERTED(8088)));
- Uint32 reqKeyLen= 0;
- Uint32 reqAttrLen= 0;
- if (unlikely(! longFragReq))
- {
- reqKeyLen= scanP->scanKeyLen;
- reqAttrLen= scanP->scanAiLength;
- }
cachePtr.i = apiConnectptr.p->cachePtr;
ptrCheckGuard(cachePtr, ccacheFilesize, cacheRecord);
+
+ Uint32 reqKeyLen = scanP->scanKeyLen;
+
+ SectionHandle sections(this);
+ sections.m_ptr[0].i = cachePtr.p->attrInfoSectionI;
+ sections.m_cnt = 1;
+
+ if (reqKeyLen > 0)
+ {
+ jam();
+ ndbassert(cachePtr.p->keyInfoSectionI != RNIL);
+ sections.m_ptr[1].i = cachePtr.p->keyInfoSectionI;
+ sections.m_cnt = 2;
+ }
+
+ if (isLastReq)
+ {
+ /* This send will release these sections, remove our
+ * references to them
+ */
+ cachePtr.p->attrInfoSectionI = RNIL;
+ cachePtr.p->keyInfoSectionI = RNIL;
+ }
+
+ getSections(sections.m_cnt, sections.m_ptr);
+
ScanFragReq * const req = (ScanFragReq *)&signal->theData[0];
Uint32 requestInfo = scanP->scanRequestInfo;
ScanFragReq::setScanPrio(requestInfo, 1);
@@ -11431,7 +11455,7 @@ void Dbtc::sendScanFragReq(Signal* signa
ptrCheckGuard(apiConnectptr, capiConnectFilesize, apiConnectRecord);
req->senderData = scanFragptr.i;
req->requestInfo = requestInfo;
- req->fragmentNoKeyLen = scanFragP->scanFragId | reqKeyLen;
+ req->fragmentNoKeyLen = scanFragP->scanFragId;
req->resultRef = apiConnectptr.p->ndbapiBlockref;
req->savePointId = apiConnectptr.p->currSavePointId;
req->transId1 = apiConnectptr.p->transid[0];
@@ -11444,29 +11468,6 @@ void Dbtc::sendScanFragReq(Signal* signa
{
jam();
/* Send long, possibly fragmented SCAN_FRAGREQ */
- /* Create SectionHandle */
- SectionHandle sections(this);
- sections.m_ptr[0].i= cachePtr.p->attrInfoSectionI;
- sections.m_cnt= 1;
-
- if (scanP->scanKeyLen > 0)
- {
- jam();
- ndbassert(cachePtr.p->keyInfoSectionI != RNIL);
- sections.m_ptr[1].i= cachePtr.p->keyInfoSectionI;
- sections.m_cnt= 2;
- }
-
- if (isLastReq)
- {
- /* This send will release these sections, remove our
- * references to them
- */
- cachePtr.p->attrInfoSectionI= RNIL;
- cachePtr.p->keyInfoSectionI= RNIL;
- }
-
- getSections(sections.m_cnt, sections.m_ptr);
// TODO :
// 1) Consider whether to adjust fragmentation threshold
@@ -11514,10 +11515,12 @@ void Dbtc::sendScanFragReq(Signal* signa
/* Short SCANFRAGREQ with separate KeyInfo and AttrInfo trains
* Sent to older NDBD nodes during upgrade
*/
- ScanFragReq::setAttrLen(requestInfo, reqAttrLen);
+ Uint32 reqAttrLen = sections.m_ptr[0].sz;
+ ScanFragReq::setAttrLen(req->requestInfo, reqAttrLen);
+ req->fragmentNoKeyLen |= reqKeyLen;
sendSignal(scanFragP->lqhBlockref, GSN_SCAN_FRAGREQ, signal,
ScanFragReq::SignalLength, JBB);
- if(scanP->scanKeyLen > 0)
+ if(reqKeyLen > 0)
{
jam();
tcConnectptr.i = scanFragptr.i;
@@ -11526,7 +11529,7 @@ void Dbtc::sendScanFragReq(Signal* signa
scanFragP->lqhBlockref,
scanFragptr.i,
0, // Offset 0
- cachePtr.p->keyInfoSectionI);
+ sections.m_ptr[1].i);
}
if(ERROR_INSERTED(8035))
@@ -11538,19 +11541,20 @@ void Dbtc::sendScanFragReq(Signal* signa
scanFragP->lqhBlockref,
scanFragptr.i,
0, // Offset 0
- cachePtr.p->attrInfoSectionI));
+ sections.m_ptr[0].i));
}
-
+
if(ERROR_INSERTED(8035))
globalTransporterRegistry.performSend();
if (isLastReq)
{
/* Free the sections here */
- releaseSection(cachePtr.p->attrInfoSectionI);
- releaseSection(cachePtr.p->keyInfoSectionI);
- cachePtr.p->attrInfoSectionI= RNIL;
- cachePtr.p->keyInfoSectionI= RNIL;
+ releaseSections(sections);
+ }
+ else
+ {
+ sections.clear();
}
}
=== modified file 'storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp'
--- a/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp 2010-09-20 13:09:18 +0000
+++ b/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp 2010-10-07 05:39:39 +0000
@@ -17,8 +17,6 @@
*/
#include <ndb_global.h>
-#include <my_sys.h>
-#include <my_pthread.h>
#include "AsyncFile.hpp"
#include <ErrorHandlingMacros.hpp>
=== modified file 'storage/ndb/src/kernel/vm/WatchDog.cpp'
--- a/storage/ndb/src/kernel/vm/WatchDog.cpp 2010-04-01 15:22:57 +0000
+++ b/storage/ndb/src/kernel/vm/WatchDog.cpp 2010-10-07 05:39:39 +0000
@@ -18,7 +18,6 @@
#include <ndb_global.h>
-#include <my_pthread.h>
#include "WatchDog.hpp"
#include "GlobalData.hpp"
=== modified file 'storage/ndb/src/mgmsrv/MgmtSrvr.cpp'
--- a/storage/ndb/src/mgmsrv/MgmtSrvr.cpp 2010-10-01 10:08:29 +0000
+++ b/storage/ndb/src/mgmsrv/MgmtSrvr.cpp 2010-10-06 12:35:34 +0000
@@ -408,7 +408,7 @@ MgmtSrvr::start_transporter(const Config
Register ourself at TransporterFacade to be able to receive signals
and to be notified when a database process has died.
*/
- if ((_blockNumber= theFacade->open(this)) == -1)
+ if ((_blockNumber= open(theFacade)) == -1)
{
g_eventLogger->error("Failed to open block in TransporterFacade");
theFacade->stop_instance();
=== modified file 'storage/ndb/src/ndbapi/CMakeLists.txt'
--- a/storage/ndb/src/ndbapi/CMakeLists.txt 2010-10-04 14:44:27 +0000
+++ b/storage/ndb/src/ndbapi/CMakeLists.txt 2010-10-11 13:18:51 +0000
@@ -59,5 +59,6 @@ ADD_LIBRARY(ndbapi STATIC
ObjectMap.cpp
NdbInfo.cpp
NdbInfoScanOperation.cpp
- ndb_internal.cpp)
+ ndb_internal.cpp
+ trp_client.cpp)
=== modified file 'storage/ndb/src/ndbapi/ClusterMgr.cpp'
--- a/storage/ndb/src/ndbapi/ClusterMgr.cpp 2010-10-04 08:31:18 +0000
+++ b/storage/ndb/src/ndbapi/ClusterMgr.cpp 2010-10-06 12:35:34 +0000
@@ -73,7 +73,7 @@ ClusterMgr::ClusterMgr(TransporterFacade
waitForHBCond= NdbCondition_Create();
m_auto_reconnect = -1;
- int ret = theFacade.open(this, API_CLUSTERMGR);
+ int ret = this->open(&theFacade, API_CLUSTERMGR);
if (unlikely(ret < 0))
{
ndbout_c("Failed to register ClusterMgr! ret: %d", ret);
=== modified file 'storage/ndb/src/ndbapi/Makefile.am'
--- a/storage/ndb/src/ndbapi/Makefile.am 2010-10-04 14:44:27 +0000
+++ b/storage/ndb/src/ndbapi/Makefile.am 2010-10-11 13:18:51 +0000
@@ -64,7 +64,8 @@ libndbapi_la_SOURCES = \
NdbInterpretedCode.cpp \
NdbInfo.cpp \
NdbInfoScanOperation.cpp \
- ndb_internal.cpp
+ ndb_internal.cpp \
+ trp_client.cpp
INCLUDES_LOC = -I$(top_srcdir)/storage/ndb/src/mgmapi
=== modified file 'storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp'
--- a/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp 2010-10-01 10:08:29 +0000
+++ b/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp 2010-10-06 12:35:34 +0000
@@ -1985,25 +1985,12 @@ NdbDictionaryImpl::getBlobTable(uint tab
DBUG_RETURN(bt);
}
-#if 0
-bool
-NdbDictionaryImpl::setTransporter(class TransporterFacade * tf)
-{
- if(tf != 0){
- m_globalHash = tf->m_globalDictCache;
- return m_receiver.setTransporter(tf);
- }
-
- return false;
-}
-#endif
-
bool
NdbDictionaryImpl::setTransporter(class Ndb* ndb,
class TransporterFacade * tf)
{
m_globalHash = tf->m_globalDictCache;
- if(m_receiver.setTransporter(ndb, tf)){
+ if(m_receiver.setTransporter(ndb)){
return true;
}
return false;
@@ -2030,46 +2017,19 @@ NdbDictionaryImpl::getIndexTable(NdbInde
return index_table;
}
-#if 0
bool
-NdbDictInterface::setTransporter(class TransporterFacade * tf)
-{
- if(tf == 0)
- return false;
-
- Guard g(tf->theMutexPtr);
-
- m_blockNumber = tf->open(this,
- execSignal,
- execNodeStatus);
-
- if ( m_blockNumber == -1 ) {
- m_error.code= 4105;
- return false; // no more free blocknumbers
- }//if
- Uint32 theNode = tf->ownId();
- m_reference = numberToRef(m_blockNumber, theNode);
- m_transporter = tf;
- m_waiter.m_mutex = tf->theMutexPtr;
-
- return true;
-}
-#endif
-
-bool
-NdbDictInterface::setTransporter(class Ndb* ndb, class TransporterFacade * tf)
+NdbDictInterface::setTransporter(class Ndb* ndb)
{
m_reference = ndb->getReference();
- m_transporter = tf;
- m_waiter.m_mutex = tf->theMutexPtr;
+ m_impl = ndb->theImpl;
return true;
}
TransporterFacade *
-NdbDictInterface::getTransporter()
+NdbDictInterface::getTransporter() const
{
- return m_transporter;
+ return m_impl->m_transporter_facade;
}
NdbDictInterface::~NdbDictInterface()
@@ -2212,7 +2172,7 @@ NdbDictInterface::execNodeStatus(void* d
switch(event){
case NS_NODE_FAILED:
- tmp->m_waiter.nodeFail(aNode);
+ tmp->m_impl->theWaiter.nodeFail(aNode);
break;
default:
break;
@@ -2261,15 +2221,15 @@ NdbDictInterface::dictSignal(NdbApiSigna
in all places where the object is out of context due to a return,
break, continue or simply end of statement block
*/
- PollGuard poll_guard(m_transporter, &m_waiter, refToBlock(m_reference));
+ PollGuard poll_guard(* m_impl);
Uint32 node;
switch(node_specification){
case 0:
- node = (m_transporter->get_node_alive(m_masterNodeId) ? m_masterNodeId :
- (m_masterNodeId = m_transporter->get_an_alive_node()));
+ node = (getTransporter()->get_node_alive(m_masterNodeId) ? m_masterNodeId :
+ (m_masterNodeId = getTransporter()->get_an_alive_node()));
break;
case -1:
- node = m_transporter->get_an_alive_node();
+ node = getTransporter()->get_an_alive_node();
break;
default:
node = node_specification;
@@ -2280,8 +2240,8 @@ NdbDictInterface::dictSignal(NdbApiSigna
DBUG_RETURN(-1);
}
int res = (ptr ?
- m_transporter->sendFragmentedSignal(sig, node, ptr, secs):
- m_transporter->sendSignal(sig, node));
+ getTransporter()->sendFragmentedSignal(sig, node, ptr, secs):
+ getTransporter()->sendSignal(sig, node));
if(res != 0){
DBUG_PRINT("info", ("dictSignal failed to send signal"));
m_error.code = 4007;
@@ -2305,7 +2265,7 @@ NdbDictInterface::dictSignal(NdbApiSigna
m_error.code = 4013;
continue;
}
- if(m_waiter.m_state == WST_WAIT_TIMEOUT)
+ if(m_impl->theWaiter.get_state() == WST_WAIT_TIMEOUT)
{
DBUG_PRINT("info", ("dictSignal caught time-out"));
m_error.code = 4008;
@@ -2497,7 +2457,7 @@ end:
return;
}
- m_waiter.signal(NO_WAIT);
+ m_impl->theWaiter.signal(NO_WAIT);
}
void
@@ -2518,7 +2478,7 @@ NdbDictInterface::execGET_TABINFO_REF(co
m_error.code = (*(signal->getDataPtr() +
GetTabInfoRef::OriginalErrorOffset));
}
- m_waiter.signal(NO_WAIT);
+ m_impl->theWaiter.signal(NO_WAIT);
}
/*****************************************************************
@@ -3676,7 +3636,7 @@ NdbDictInterface::execCREATE_TABLE_CONF(
Uint32* data = (Uint32*)m_buffer.get_data();
data[0] = conf->tableId;
data[1] = conf->tableVersion;
- m_waiter.signal(NO_WAIT);
+ m_impl->theWaiter.signal(NO_WAIT);
}
void
@@ -3686,14 +3646,14 @@ NdbDictInterface::execCREATE_TABLE_REF(c
const CreateTableRef* ref = CAST_CONSTPTR(CreateTableRef, sig->getDataPtr());
m_error.code= ref->errorCode;
m_masterNodeId = ref->masterNodeId;
- m_waiter.signal(NO_WAIT);
+ m_impl->theWaiter.signal(NO_WAIT);
}
void
NdbDictInterface::execALTER_TABLE_CONF(const NdbApiSignal * signal,
const LinearSectionPtr ptr[3])
{
- m_waiter.signal(NO_WAIT);
+ m_impl->theWaiter.signal(NO_WAIT);
}
void
@@ -3703,7 +3663,7 @@ NdbDictInterface::execALTER_TABLE_REF(co
const AlterTableRef * ref = CAST_CONSTPTR(AlterTableRef, sig->getDataPtr());
m_error.code= ref->errorCode;
m_masterNodeId = ref->masterNodeId;
- m_waiter.signal(NO_WAIT);
+ m_impl->theWaiter.signal(NO_WAIT);
}
/*****************************************************************
@@ -3899,7 +3859,7 @@ NdbDictInterface::execDROP_TABLE_CONF(co
DBUG_ENTER("NdbDictInterface::execDROP_TABLE_CONF");
//DropTableConf* const conf = CAST_CONSTPTR(DropTableConf, signal->getDataPtr());
- m_waiter.signal(NO_WAIT);
+ m_impl->theWaiter.signal(NO_WAIT);
DBUG_VOID_RETURN;
}
@@ -3911,7 +3871,7 @@ NdbDictInterface::execDROP_TABLE_REF(con
const DropTableRef* ref = CAST_CONSTPTR(DropTableRef, signal->getDataPtr());
m_error.code= ref->errorCode;
m_masterNodeId = ref->masterNodeId;
- m_waiter.signal(NO_WAIT);
+ m_impl->theWaiter.signal(NO_WAIT);
DBUG_VOID_RETURN;
}
@@ -4157,7 +4117,7 @@ void
NdbDictInterface::execCREATE_INDX_CONF(const NdbApiSignal * signal,
const LinearSectionPtr ptr[3])
{
- m_waiter.signal(NO_WAIT);
+ m_impl->theWaiter.signal(NO_WAIT);
}
void
@@ -4168,7 +4128,7 @@ NdbDictInterface::execCREATE_INDX_REF(co
m_error.code = ref->errorCode;
if (m_error.code == ref->NotMaster)
m_masterNodeId = ref->masterNodeId;
- m_waiter.signal(NO_WAIT);
+ m_impl->theWaiter.signal(NO_WAIT);
}
/*****************************************************************
@@ -4293,7 +4253,7 @@ void
NdbDictInterface::execDROP_INDX_CONF(const NdbApiSignal * signal,
const LinearSectionPtr ptr[3])
{
- m_waiter.signal(NO_WAIT);
+ m_impl->theWaiter.signal(NO_WAIT);
}
void
@@ -4304,7 +4264,7 @@ NdbDictInterface::execDROP_INDX_REF(cons
m_error.code = ref->errorCode;
if (m_error.code == ref->NotMaster)
m_masterNodeId = ref->masterNodeId;
- m_waiter.signal(NO_WAIT);
+ m_impl->theWaiter.signal(NO_WAIT);
}
/*****************************************************************
@@ -4811,7 +4771,7 @@ NdbDictInterface::execCREATE_EVNT_CONF(c
DBUG_PRINT("info",("nodeid=%d,subscriptionId=%d,subscriptionKey=%d",
refToNode(signal->theSendersBlockRef),
subscriptionId,subscriptionKey));
- m_waiter.signal(NO_WAIT);
+ m_impl->theWaiter.signal(NO_WAIT);
DBUG_VOID_RETURN;
}
@@ -4828,7 +4788,7 @@ NdbDictInterface::execCREATE_EVNT_REF(co
ref->getErrorLine(),ref->getErrorNode()));
if (m_error.code == CreateEvntRef::NotMaster)
m_masterNodeId = ref->getMasterNode();
- m_waiter.signal(NO_WAIT);
+ m_impl->theWaiter.signal(NO_WAIT);
DBUG_VOID_RETURN;
}
@@ -4860,7 +4820,7 @@ NdbDictInterface::execSUB_STOP_CONF(cons
data[0] = gci_hi;
data[1] = gci_lo;
- m_waiter.signal(NO_WAIT);
+ m_impl->theWaiter.signal(NO_WAIT);
DBUG_VOID_RETURN;
}
@@ -4884,7 +4844,7 @@ NdbDictInterface::execSUB_STOP_REF(const
{
m_masterNodeId = subStopRef->m_masterNodeId;
}
- m_waiter.signal(NO_WAIT);
+ m_impl->theWaiter.signal(NO_WAIT);
DBUG_VOID_RETURN;
}
@@ -4933,7 +4893,7 @@ NdbDictInterface::execSUB_START_CONF(con
}
DBUG_PRINT("info",("subscriptionId=%d,subscriptionKey=%d,subscriberData=%d",
subscriptionId,subscriptionKey,subscriberData));
- m_waiter.signal(NO_WAIT);
+ m_impl->theWaiter.signal(NO_WAIT);
DBUG_VOID_RETURN;
}
@@ -4947,7 +4907,7 @@ NdbDictInterface::execSUB_START_REF(cons
m_error.code= subStartRef->errorCode;
if (m_error.code == SubStartRef::NotMaster)
m_masterNodeId = subStartRef->m_masterNodeId;
- m_waiter.signal(NO_WAIT);
+ m_impl->theWaiter.signal(NO_WAIT);
DBUG_VOID_RETURN;
}
@@ -5083,7 +5043,7 @@ NdbDictInterface::execDROP_EVNT_CONF(con
const LinearSectionPtr ptr[3])
{
DBUG_ENTER("NdbDictInterface::execDROP_EVNT_CONF");
- m_waiter.signal(NO_WAIT);
+ m_impl->theWaiter.signal(NO_WAIT);
DBUG_VOID_RETURN;
}
@@ -5100,7 +5060,7 @@ NdbDictInterface::execDROP_EVNT_REF(cons
ref->getErrorCode(), ref->getErrorLine(), ref->getErrorNode()));
if (m_error.code == DropEvntRef::NotMaster)
m_masterNodeId = ref->getMasterNode();
- m_waiter.signal(NO_WAIT);
+ m_impl->theWaiter.signal(NO_WAIT);
DBUG_VOID_RETURN;
}
@@ -5633,13 +5593,13 @@ NdbDictInterface::listObjects(NdbApiSign
in all places where the object is out of context due to a return,
break, continue or simply end of statement block
*/
- PollGuard poll_guard(m_transporter, &m_waiter, refToBlock(m_reference));
- Uint16 aNodeId = m_transporter->get_an_alive_node();
+ PollGuard poll_guard(* m_impl);
+ Uint16 aNodeId = getTransporter()->get_an_alive_node();
if (aNodeId == 0) {
m_error.code= 4009;
return -1;
}
- NodeInfo info = m_transporter->theClusterMgr->getNodeInfo(aNodeId).m_info;
+ NodeInfo info = getTransporter()->theClusterMgr->getNodeInfo(aNodeId).m_info;
if (ndbd_LIST_TABLES_CONF_long_signal(info.m_version))
{
/*
@@ -5657,7 +5617,7 @@ NdbDictInterface::listObjects(NdbApiSign
return -1;
}
- if (m_transporter->sendSignal(signal, aNodeId) != 0) {
+ if (getTransporter()->sendSignal(signal, aNodeId) != 0) {
continue;
}
m_error.code= 0;
@@ -5679,7 +5639,7 @@ NdbDictInterface::execLIST_TABLES_CONF(c
const LinearSectionPtr ptr[3])
{
Uint16 nodeId = refToNode(signal->theSendersBlockRef);
- NodeInfo info = m_transporter->theClusterMgr->getNodeInfo(nodeId).m_info;
+ NodeInfo info = getTransporter()->theClusterMgr->getNodeInfo(nodeId).m_info;
if (!ndbd_LIST_TABLES_CONF_long_signal(info.m_version))
{
/*
@@ -5748,7 +5708,7 @@ NdbDictInterface::execLIST_TABLES_CONF(c
return;
}
- m_waiter.signal(NO_WAIT);
+ m_impl->theWaiter.signal(NO_WAIT);
}
@@ -5764,7 +5724,7 @@ NdbDictInterface::execOLD_LIST_TABLES_CO
}
if (signal->getLength() < OldListTablesConf::SignalLength) {
// last signal has less than full length
- m_waiter.signal(NO_WAIT);
+ m_impl->theWaiter.signal(NO_WAIT);
}
}
@@ -5794,24 +5754,27 @@ NdbDictInterface::forceGCPWait(int type)
const Uint32 RETRIES = 100;
for (Uint32 i = 0; i < RETRIES; i++)
{
- m_transporter->lock_mutex();
- Uint16 aNodeId = m_transporter->get_an_alive_node();
+ PollGuard pg(* m_impl);
+ Uint16 aNodeId = getTransporter()->get_an_alive_node();
if (aNodeId == 0) {
m_error.code= 4009;
- m_transporter->unlock_mutex();
return -1;
}
- if (m_transporter->sendSignal(&tSignal, aNodeId) != 0) {
- m_transporter->unlock_mutex();
+ if (getTransporter()->sendSignal(&tSignal, aNodeId) != 0)
+ {
continue;
}
m_error.code= 0;
- m_waiter.m_node = aNodeId;
- m_waiter.m_state = WAIT_LIST_TABLES_CONF;
- m_waiter.wait(DICT_WAITFOR_TIMEOUT);
- m_transporter->unlock_mutex();
- return m_error.code == 0 ? 0 : -1;
+
+ int ret_val= pg.wait_n_unlock(DICT_WAITFOR_TIMEOUT,
+ aNodeId, WAIT_LIST_TABLES_CONF);
+ // end protected
+ if (ret_val == 0 && m_error.code == 0)
+ return 0;
+ if (ret_val == -2) //WAIT_NODE_FAILURE
+ continue;
+ return -1;
}
return -1;
}
@@ -5825,20 +5788,20 @@ NdbDictInterface::forceGCPWait(int type)
const Uint32 RETRIES = 100;
for (Uint32 i = 0; i < RETRIES; i++)
{
- m_transporter->lock_mutex();
- Uint16 aNodeId = m_transporter->get_an_alive_node();
+ getTransporter()->lock_mutex();
+ Uint16 aNodeId = getTransporter()->get_an_alive_node();
if (aNodeId == 0) {
m_error.code= 4009;
- m_transporter->unlock_mutex();
+ getTransporter()->unlock_mutex();
return -1;
}
- if (m_transporter->sendSignal(&tSignal, aNodeId) != 0) {
- m_transporter->unlock_mutex();
+ if (getTransporter()->sendSignal(&tSignal, aNodeId) != 0) {
+ getTransporter()->unlock_mutex();
continue;
}
- m_transporter->forceSend(refToBlock(m_reference));
- m_transporter->unlock_mutex();
+ getTransporter()->forceSend(refToBlock(m_reference));
+ getTransporter()->unlock_mutex();
}
return m_error.code == 0 ? 0 : -1;
}
@@ -5868,7 +5831,7 @@ NdbDictInterface::execWAIT_GCP_CONF(cons
m_data.m_wait_gcp_conf.gci_lo = conf->gci_lo;
m_data.m_wait_gcp_conf.gci_hi = conf->gci_hi;
- m_waiter.signal(NO_WAIT);
+ m_impl->theWaiter.signal(NO_WAIT);
}
void
@@ -5878,7 +5841,7 @@ NdbDictInterface::execWAIT_GCP_REF(const
const WaitGCPRef* ref = CAST_CONSTPTR(WaitGCPRef, signal->getDataPtr());
m_error.code = ref->errorCode;
- m_waiter.signal(NO_WAIT);
+ m_impl->theWaiter.signal(NO_WAIT);
}
NdbFilegroupImpl::NdbFilegroupImpl(NdbDictionary::Object::Type t)
@@ -7276,7 +7239,7 @@ NdbDictInterface::execCREATE_FILE_CONF(c
data[1] = conf->fileVersion;
data[2] = conf->warningFlags;
- m_waiter.signal(NO_WAIT);
+ m_impl->theWaiter.signal(NO_WAIT);
}
void
@@ -7287,7 +7250,7 @@ NdbDictInterface::execCREATE_FILE_REF(co
CAST_CONSTPTR(CreateFileRef, signal->getDataPtr());
m_error.code = ref->errorCode;
m_masterNodeId = ref->masterNodeId;
- m_waiter.signal(NO_WAIT);
+ m_impl->theWaiter.signal(NO_WAIT);
}
int
@@ -7321,7 +7284,7 @@ void
NdbDictInterface::execDROP_FILE_CONF(const NdbApiSignal * signal,
const LinearSectionPtr ptr[3])
{
- m_waiter.signal(NO_WAIT);
+ m_impl->theWaiter.signal(NO_WAIT);
}
void
@@ -7332,7 +7295,7 @@ NdbDictInterface::execDROP_FILE_REF(cons
CAST_CONSTPTR(DropFileRef, signal->getDataPtr());
m_error.code = ref->errorCode;
m_masterNodeId = ref->masterNodeId;
- m_waiter.signal(NO_WAIT);
+ m_impl->theWaiter.signal(NO_WAIT);
}
int
@@ -7444,7 +7407,7 @@ NdbDictInterface::execCREATE_FILEGROUP_C
data[0] = conf->filegroupId;
data[1] = conf->filegroupVersion;
data[2] = conf->warningFlags;
- m_waiter.signal(NO_WAIT);
+ m_impl->theWaiter.signal(NO_WAIT);
}
void
@@ -7455,7 +7418,7 @@ NdbDictInterface::execCREATE_FILEGROUP_R
CAST_CONSTPTR(CreateFilegroupRef, signal->getDataPtr());
m_error.code = ref->errorCode;
m_masterNodeId = ref->masterNodeId;
- m_waiter.signal(NO_WAIT);
+ m_impl->theWaiter.signal(NO_WAIT);
}
int
@@ -7489,7 +7452,7 @@ void
NdbDictInterface::execDROP_FILEGROUP_CONF(const NdbApiSignal * signal,
const LinearSectionPtr ptr[3])
{
- m_waiter.signal(NO_WAIT);
+ m_impl->theWaiter.signal(NO_WAIT);
}
void
@@ -7500,7 +7463,7 @@ NdbDictInterface::execDROP_FILEGROUP_REF
CAST_CONSTPTR(DropFilegroupRef, signal->getDataPtr());
m_error.code = ref->errorCode;
m_masterNodeId = ref->masterNodeId;
- m_waiter.signal(NO_WAIT);
+ m_impl->theWaiter.signal(NO_WAIT);
}
@@ -8024,7 +7987,7 @@ NdbDictInterface::execCREATE_HASH_MAP_RE
CAST_CONSTPTR(CreateHashMapRef, signal->getDataPtr());
m_error.code = ref->errorCode;
m_masterNodeId = ref->masterNodeId;
- m_waiter.signal(NO_WAIT);
+ m_impl->theWaiter.signal(NO_WAIT);
}
@@ -8039,7 +8002,7 @@ NdbDictInterface::execCREATE_HASH_MAP_CO
data[0] = conf->objectId;
data[1] = conf->objectVersion;
- m_waiter.signal(NO_WAIT);
+ m_impl->theWaiter.signal(NO_WAIT);
}
@@ -8153,9 +8116,9 @@ NdbDictInterface::checkAllNodeVersionsMi
{
for (Uint32 nodeId = 1; nodeId < MAX_NODES; nodeId++)
{
- if (m_transporter->getIsDbNode(nodeId) &&
- m_transporter->getIsNodeSendable(nodeId) &&
- (m_transporter->getNodeNdbVersion(nodeId) <
+ if (getTransporter()->getIsDbNode(nodeId) &&
+ getTransporter()->getIsNodeSendable(nodeId) &&
+ (getTransporter()->getNodeNdbVersion(nodeId) <
minNdbVersion))
{
/* At least 1 sendable data node has lower-than-min
@@ -8248,7 +8211,7 @@ NdbDictInterface::execSCHEMA_TRANS_BEGIN
CAST_CONSTPTR(SchemaTransBeginConf, signal->getDataPtr());
assert(m_tx.m_transId == conf->transId);
m_tx.m_transKey = conf->transKey;
- m_waiter.signal(NO_WAIT);
+ m_impl->theWaiter.signal(NO_WAIT);
}
void
@@ -8259,7 +8222,7 @@ NdbDictInterface::execSCHEMA_TRANS_BEGIN
CAST_CONSTPTR(SchemaTransBeginRef, signal->getDataPtr());
m_error.code = ref->errorCode;
m_masterNodeId = ref->masterNodeId;
- m_waiter.signal(NO_WAIT);
+ m_impl->theWaiter.signal(NO_WAIT);
}
void
@@ -8269,7 +8232,7 @@ NdbDictInterface::execSCHEMA_TRANS_END_C
const SchemaTransEndConf* conf=
CAST_CONSTPTR(SchemaTransEndConf, signal->getDataPtr());
assert(m_tx.m_transId == conf->transId);
- m_waiter.signal(NO_WAIT);
+ m_impl->theWaiter.signal(NO_WAIT);
}
void
@@ -8281,7 +8244,7 @@ NdbDictInterface::execSCHEMA_TRANS_END_R
m_error.code = ref->errorCode;
m_tx.m_error.code = ref->errorCode;
m_masterNodeId = ref->masterNodeId;
- m_waiter.signal(NO_WAIT);
+ m_impl->theWaiter.signal(NO_WAIT);
}
void
@@ -8296,7 +8259,7 @@ NdbDictInterface::execSCHEMA_TRANS_END_R
m_tx.m_state = Tx::Aborted;
m_tx.m_error.code = rep->errorCode;
m_masterNodeId = rep->masterNodeId;
- m_waiter.signal(NO_WAIT);
+ m_impl->theWaiter.signal(NO_WAIT);
}
const NdbDictionary::Column * NdbDictionary::Column::FRAGMENT = 0;
=== modified file 'storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp'
--- a/storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp 2010-10-01 10:08:29 +0000
+++ b/storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp 2010-10-04 19:22:21 +0000
@@ -31,9 +31,9 @@
#include <Bitmask.hpp>
#include <AttributeList.hpp>
#include <Ndb.hpp>
-#include "NdbWaiter.hpp"
#include "DictCache.hpp"
#include <signaldata/DictSignal.hpp>
+#include "NdbWaiter.hpp"
class ListTablesReq;
@@ -601,13 +601,12 @@ public:
m_tx(tx), m_error(err), m_warn(warn) {
m_reference = 0;
m_masterNodeId = 0;
- m_transporter= NULL;
+ m_impl = 0;
}
~NdbDictInterface();
- bool setTransporter(class Ndb * ndb, class TransporterFacade * tf);
- bool setTransporter(class TransporterFacade * tf);
- class TransporterFacade *getTransporter();
+ bool setTransporter(class Ndb * ndb);
+ class TransporterFacade *getTransporter() const;
// To abstract the stuff thats made in all create/drop/lists below
int dictSignal(NdbApiSignal* signal, LinearSectionPtr ptr[3], int secs,
@@ -708,9 +707,8 @@ public:
private:
Uint32 m_reference;
Uint32 m_masterNodeId;
-
- NdbWaiter m_waiter;
- class TransporterFacade * m_transporter;
+
+ class NdbImpl * m_impl;
friend class Ndb;
friend class NdbImpl;
=== modified file 'storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp'
--- a/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp 2010-10-04 11:13:48 +0000
+++ b/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp 2010-10-06 12:35:34 +0000
@@ -1107,7 +1107,8 @@ NdbEventBuffer::NdbEventBuffer(Ndb *ndb)
ndbout_c("NdbEventHandle: NdbCondition_Create() failed");
exit(-1);
}
- m_mutex= ndb->theImpl->theWaiter.m_mutex;
+ m_mutex = 0; // Set in Ndb::init()
+
// ToDo set event buffer size
// pre allocate event data array
m_sz= 0;
=== modified file 'storage/ndb/src/ndbapi/NdbIndexStat.cpp'
--- a/storage/ndb/src/ndbapi/NdbIndexStat.cpp 2010-01-18 19:20:01 +0000
+++ b/storage/ndb/src/ndbapi/NdbIndexStat.cpp 2010-10-07 05:39:39 +0000
@@ -24,7 +24,6 @@
#include "NdbDictionaryImpl.hpp"
#include <NdbInterpretedCode.hpp>
#include <NdbRecord.hpp>
-#include <my_sys.h>
NdbIndexStat::NdbIndexStat(const NdbDictionary::Index* index) :
m_index(index->m_impl),
=== modified file 'storage/ndb/src/ndbapi/NdbQueryBuilderImpl.hpp'
--- a/storage/ndb/src/ndbapi/NdbQueryBuilderImpl.hpp 2010-10-07 13:54:04 +0000
+++ b/storage/ndb/src/ndbapi/NdbQueryBuilderImpl.hpp 2010-10-11 13:18:51 +0000
@@ -68,7 +68,7 @@ class NdbConstOperandImpl;
class NdbLinkedOperandImpl;
// For debuggging.
-#define TRACE_SERIALIZATION
+//#define TRACE_SERIALIZATION
/** A buffer for holding serialized data.
*
=== modified file 'storage/ndb/src/ndbapi/NdbQueryOperation.cpp'
--- a/storage/ndb/src/ndbapi/NdbQueryOperation.cpp 2010-10-07 13:54:04 +0000
+++ b/storage/ndb/src/ndbapi/NdbQueryOperation.cpp 2010-10-11 13:18:51 +0000
@@ -1744,19 +1744,19 @@ NdbQueryImpl::awaitMoreResults(bool forc
Ndb* const ndb = m_transaction.getNdb();
Uint32 timeout = ndb->theImpl->get_waitfor_timeout();
- TransporterFacade* const facade = ndb->theImpl->m_transporter_facade;
while (likely(m_error.code==0))
{
{
/* This part needs to be done under mutex due to synchronization with
- * receiver thread. */
- PollGuard poll_guard(facade,
- &ndb->theImpl->theWaiter,
- ndb->theNdbBlockNumber);
+ * receiver thread.
+ */
+ PollGuard poll_guard(*ndb->theImpl);
+
/* m_fullFrags contains any fragments that are complete (for this batch)
* but have not yet been moved (under mutex protection) to
- * m_applFrags.*/
+ * m_applFrags.
+ */
if (m_fullFrags.size()==0) {
if (m_pendingFrags == 0)
{
@@ -2544,10 +2544,9 @@ NdbQueryImpl::sendFetchMore(NdbRootFragm
TransporterFacade* const facade = ndb.theImpl->m_transporter_facade;
/* This part needs to be done under mutex due to synchronization with
- * receiver thread. */
- PollGuard poll_guard(facade,
- &ndb.theImpl->theWaiter,
- ndb.theNdbBlockNumber);
+ * receiver thread.
+ */
+ PollGuard poll_guard(*ndb.theImpl);
const int res =
facade->sendSignal(&tSignal,
getNdbTransaction().getConnectedNodeId(),
@@ -2579,14 +2578,11 @@ NdbQueryImpl::closeTcCursor(bool forceSe
Ndb* const ndb = m_transaction.getNdb();
Uint32 timeout = ndb->theImpl->get_waitfor_timeout();
- TransporterFacade* const facade = ndb->theImpl->m_transporter_facade;
/* This part needs to be done under mutex due to synchronization with
* receiver thread.
*/
- PollGuard poll_guard(facade,
- &ndb->theImpl->theWaiter,
- ndb->theNdbBlockNumber);
+ PollGuard poll_guard(*ndb->theImpl);
/* Wait for outstanding scan results from current batch fetch */
while (m_error.code==0 && !isBatchComplete())
=== modified file 'storage/ndb/src/ndbapi/NdbScanOperation.cpp'
--- a/storage/ndb/src/ndbapi/NdbScanOperation.cpp 2010-10-04 14:44:27 +0000
+++ b/storage/ndb/src/ndbapi/NdbScanOperation.cpp 2010-10-11 13:18:51 +0000
@@ -1837,8 +1837,7 @@ NdbScanOperation::nextResultNdbRecord(co
The rest needs to be done under mutex due to synchronization with receiver
thread.
*/
- PollGuard poll_guard(tp, &theNdb->theImpl->theWaiter,
- theNdb->theNdbBlockNumber);
+ PollGuard poll_guard(* theNdb->theImpl);
const Uint32 seq= theNdbCon->theNodeSequence;
@@ -2037,8 +2036,7 @@ void NdbScanOperation::close(bool forceS
in all places where the object is out of context due to a return,
break, continue or simply end of statement block
*/
- PollGuard poll_guard(tp, &theNdb->theImpl->theWaiter,
- theNdb->theNdbBlockNumber);
+ PollGuard poll_guard(* theNdb->theImpl);
close_impl(tp, forceSend, &poll_guard);
}
@@ -3693,8 +3691,7 @@ NdbIndexScanOperation::ordered_send_scan
Uint32 timeout= theNdb->theImpl->get_waitfor_timeout();
TransporterFacade* tp= theNdb->theImpl->m_transporter_facade;
- PollGuard poll_guard(tp, &theNdb->theImpl->theWaiter,
- theNdb->theNdbBlockNumber);
+ PollGuard poll_guard(* theNdb->theImpl);
if(theError.code)
return -1;
=== modified file 'storage/ndb/src/ndbapi/NdbTransactionScan.cpp'
--- a/storage/ndb/src/ndbapi/NdbTransactionScan.cpp 2010-10-04 17:00:36 +0000
+++ b/storage/ndb/src/ndbapi/NdbTransactionScan.cpp 2010-10-11 13:18:51 +0000
@@ -119,7 +119,7 @@ NdbTransaction::receiveSCAN_TABCONF(cons
if (tOp && tOp->checkMagicNumber())
{
// Check if this is a linked operation.
- if(tOp->getType()==NdbReceiver::NDB_QUERY_OPERATION)
+ if (tOp->getType()==NdbReceiver::NDB_QUERY_OPERATION)
{
NdbQueryOperationImpl* queryOp = tOp->m_query_operation_impl;
assert (&queryOp->getQuery() == m_scanningQuery);
=== modified file 'storage/ndb/src/ndbapi/NdbWaiter.hpp'
--- a/storage/ndb/src/ndbapi/NdbWaiter.hpp 2010-09-30 09:32:28 +0000
+++ b/storage/ndb/src/ndbapi/NdbWaiter.hpp 2010-10-06 12:35:34 +0000
@@ -21,7 +21,6 @@
#include <ndb_global.h>
#include <NdbTick.h>
-#include <NdbCondition.h>
#include <NdbOut.hpp>
enum WaitSignalType {
@@ -34,6 +33,8 @@ enum WaitSignalType {
WAIT_NDB_TAMPER = 5,
WAIT_SCAN = 6,
+ WAIT_TRANS = 7,
+
// DICT stuff
WAIT_GET_TAB_INFO_REQ = 11,
WAIT_CREATE_TAB_REQ = 12,
@@ -47,58 +48,46 @@ enum WaitSignalType {
class NdbWaiter {
public:
- NdbWaiter();
+ NdbWaiter(class trp_client*);
~NdbWaiter();
- void wait(NDB_TICKS waitTime);
- void nodeFail(Uint32 node);
void signal(Uint32 state);
- void cond_signal();
- void set_poll_owner(bool poll_owner) { m_poll_owner= poll_owner; }
- Uint32 get_state() { return m_state; }
+ void nodeFail(Uint32 node);
+
+ void clear_wait_state() { m_state = NO_WAIT; }
+ Uint32 get_wait_state() { return m_state; }
+ void set_wait_state(Uint32 s) { m_state = s;}
+
void set_state(Uint32 state) { m_state= state; }
void set_node(Uint32 node) { m_node= node; }
- Uint32 get_cond_wait_index() { return m_cond_wait_index; }
- void set_cond_wait_index(Uint32 index) { m_cond_wait_index= index; }
+ Uint32 get_state() { return m_state; }
+private:
Uint32 m_node;
Uint32 m_state;
- NdbMutex * m_mutex;
- bool m_poll_owner;
- Uint32 m_cond_wait_index;
- struct NdbCondition * m_condition;
+ class trp_client* m_clnt;
};
-inline
-void
-NdbWaiter::wait(NDB_TICKS waitTime)
-{
- assert(!m_poll_owner);
- NdbCondition_WaitTimeout(m_condition, m_mutex, (int)waitTime);
-}
+
+#include "trp_client.hpp"
inline
void
-NdbWaiter::nodeFail(Uint32 aNodeId){
- if (m_state != NO_WAIT && m_node == aNodeId){
+NdbWaiter::nodeFail(Uint32 aNodeId)
+{
+ if (m_state != NO_WAIT && m_node == aNodeId)
+ {
m_state = WAIT_NODE_FAILURE;
- if (!m_poll_owner)
- NdbCondition_Signal(m_condition);
+ m_clnt->wakeup();
}
}
inline
void
-NdbWaiter::signal(Uint32 state){
+NdbWaiter::signal(Uint32 state)
+{
m_state = state;
- if (!m_poll_owner)
- NdbCondition_Signal(m_condition);
+ m_clnt->wakeup();
}
-inline
-void
-NdbWaiter::cond_signal()
-{
- NdbCondition_Signal(m_condition);
-}
#endif
=== modified file 'storage/ndb/src/ndbapi/Ndbif.cpp'
--- a/storage/ndb/src/ndbapi/Ndbif.cpp 2010-10-04 14:44:27 +0000
+++ b/storage/ndb/src/ndbapi/Ndbif.cpp 2010-10-11 13:18:51 +0000
@@ -71,21 +71,20 @@ Ndb::init(int aMaxNoOfTransactions)
}//if
theInitState = StartingInit;
TransporterFacade * theFacade = theImpl->m_transporter_facade;
- theFacade->lock_mutex();
-
- const int tBlockNo = theFacade->open(theImpl);
+ theEventBuffer->m_mutex = theFacade->theMutexPtr;
+
+ const int tBlockNo = theImpl->open(theFacade);
if ( tBlockNo == -1 ) {
theError.code = 4105;
- theFacade->unlock_mutex();
DBUG_RETURN(-1); // no more free blocknumbers
}//if
theNdbBlockNumber = tBlockNo;
/* Init cached min node version */
+ theFacade->lock_mutex();
theCachedMinDbNodeVersion = theFacade->getMinDbNodeVersion();
-
theFacade->unlock_mutex();
theDictionary->setTransporter(this, theFacade);
@@ -140,7 +139,7 @@ error_handler:
ndbout << "error_handler" << endl;
releaseTransactionArrays();
delete theDictionary;
- theImpl->m_transporter_facade->close(theNdbBlockNumber);
+ theImpl->close();
DBUG_RETURN(-1);
}
@@ -340,12 +339,13 @@ Ndb::handleReceivedSignal(const NdbApiSi
NdbTransaction* tCon;
int tReturnCode = -1;
const Uint32* tDataPtr = aSignal->getDataPtr();
- const Uint32 tWaitState = theImpl->theWaiter.m_state;
+ const Uint32 tWaitState = theImpl->theWaiter.get_state();
const Uint32 tSignalNumber = aSignal->readSignalNumber();
const Uint32 tFirstData = *tDataPtr;
const Uint32 tLen = aSignal->getLength();
+ Uint32 tNewState = tWaitState;
void * tFirstDataPtr;
- NdbWaiter *t_waiter;
+ NdbWaiter *t_waiter = &theImpl->theWaiter;
/* Update cached Min Db node version */
theCachedMinDbNodeVersion = theImpl->m_transporter_facade->getMinDbNodeVersion();
@@ -433,14 +433,14 @@ Ndb::handleReceivedSignal(const NdbApiSi
return;
case NdbReceiver::NDB_SCANRECEIVER:
tCon->theScanningOp->receiver_delivered(tRec);
- theImpl->theWaiter.m_state = (((WaitSignalType) tWaitState) == WAIT_SCAN ?
- (Uint32) NO_WAIT : tWaitState);
+ tNewState = (((WaitSignalType) tWaitState) == WAIT_SCAN ?
+ (Uint32) NO_WAIT : tWaitState);
break;
case NdbReceiver::NDB_QUERY_OPERATION:
// Handled differently whether it is a scan or lookup
if (tRec->m_query_operation_impl->getQueryDef().isScanQuery()) {
- theImpl->theWaiter.m_state = (((WaitSignalType) tWaitState) == WAIT_SCAN ?
- (Uint32) NO_WAIT : tWaitState);
+ tNewState = (((WaitSignalType) tWaitState) == WAIT_SCAN ?
+ (Uint32) NO_WAIT : tWaitState);
break;
} else {
if (tCon->OpCompleteSuccess() != -1) { //More completions pending?
@@ -659,7 +659,7 @@ Ndb::handleReceivedSignal(const NdbApiSi
}//if
tReturnCode = tCon->receiveTCSEIZECONF(aSignal);
if (tReturnCode != -1) {
- theImpl->theWaiter.m_state = NO_WAIT;
+ tNewState = NO_WAIT;
} else {
goto InvalidSignal;
}//if
@@ -679,7 +679,7 @@ Ndb::handleReceivedSignal(const NdbApiSi
}//if
tReturnCode = tCon->receiveTCSEIZEREF(aSignal);
if (tReturnCode != -1) {
- theImpl->theWaiter.m_state = NO_WAIT;
+ tNewState = NO_WAIT;
} else {
return;
}//if
@@ -699,7 +699,7 @@ Ndb::handleReceivedSignal(const NdbApiSi
}//if
tReturnCode = tCon->receiveTCRELEASECONF(aSignal);
if (tReturnCode != -1) {
- theImpl->theWaiter.m_state = NO_WAIT;
+ tNewState = NO_WAIT;
}//if
break;
}
@@ -717,7 +717,7 @@ Ndb::handleReceivedSignal(const NdbApiSi
}//if
tReturnCode = tCon->receiveTCRELEASEREF(aSignal);
if (tReturnCode != -1) {
- theImpl->theWaiter.m_state = NO_WAIT;
+ tNewState = NO_WAIT;
}//if
break;
}
@@ -834,8 +834,8 @@ Ndb::handleReceivedSignal(const NdbApiSi
tDataPtr + ScanTabConf::SignalLength,
tLen - ScanTabConf::SignalLength);
}
- if (tReturnCode > 0 && tWaitState == WAIT_SCAN)
- theImpl->theWaiter.m_state = NO_WAIT;
+ if (tReturnCode != -1 && tWaitState == WAIT_SCAN)
+ tNewState = NO_WAIT;
break;
} else {
goto InvalidSignal;
@@ -854,7 +854,7 @@ Ndb::handleReceivedSignal(const NdbApiSi
if (tCon->checkMagicNumber() == 0){
tReturnCode = tCon->receiveSCAN_TABREF(aSignal);
if (tReturnCode != -1 && tWaitState == WAIT_SCAN){
- theImpl->theWaiter.m_state = NO_WAIT;
+ tNewState = NO_WAIT;
}
break;
}
@@ -879,8 +879,8 @@ Ndb::handleReceivedSignal(const NdbApiSi
switch(com){
case 1:
tCon->theScanningOp->receiver_delivered(tRec);
- theImpl->theWaiter.m_state = (((WaitSignalType) tWaitState) == WAIT_SCAN ?
- (Uint32) NO_WAIT : tWaitState);
+ tNewState = (((WaitSignalType) tWaitState) == WAIT_SCAN ?
+ (Uint32) NO_WAIT : tWaitState);
break;
case 0:
break;
@@ -951,8 +951,7 @@ Ndb::handleReceivedSignal(const NdbApiSi
goto InvalidSignal;
}//swich
- t_waiter= &theImpl->theWaiter;
- if (t_waiter->get_state() == NO_WAIT && tWaitState != NO_WAIT)
+ if (tNewState != tWaitState)
{
/*
If our waiter object is the owner of the "poll rights", then we
@@ -965,20 +964,13 @@ Ndb::handleReceivedSignal(const NdbApiSi
its conditional wait. This will wake up this thread so that it
can continue its work.
*/
- TransporterFacade *tp= theImpl->m_transporter_facade;
- if (tp->get_poll_owner() != t_waiter)
- {
- /*
- Wake up the thread waiting for response and remove it from queue
- of objects waiting for receive completion
- */
- tp->remove_from_cond_wait_queue(t_waiter);
- t_waiter->cond_signal();
- }
- }//if
+ t_waiter->signal(tNewState);
+ }
+
return;
- InvalidSignal:
+
+InvalidSignal:
#ifdef VM_TRACE
ndbout_c("Ndbif: Error Ndb::handleReceivedSignal "
"(tFirstDataPtr=%p, GSN=%d, theImpl->theWaiter.m_state=%d)"
@@ -1030,19 +1022,7 @@ Ndb::completedTransaction(NdbTransaction
if ((theMinNoOfEventsToWakeUp != 0) &&
(theNoOfCompletedTransactions >= theMinNoOfEventsToWakeUp)) {
theMinNoOfEventsToWakeUp = 0;
- TransporterFacade *tp = theImpl->m_transporter_facade;
- NdbWaiter *t_waiter= &theImpl->theWaiter;
- if (tp->get_poll_owner() != t_waiter) {
- /*
- When we come here, this is executed by the thread owning the "poll
- rights". This thread is not where our waiter object belongs.
- Thus we wake up the thread owning this waiter object but first
- we must remove it from the conditional wait queue so that we
- don't assign it as poll owner later on.
- */
- tp->remove_from_cond_wait_queue(t_waiter);
- t_waiter->cond_signal();
- }
+ theImpl->theWaiter.signal(NO_WAIT);
return;
}//if
} else {
@@ -1293,9 +1273,11 @@ Ndb::waitCompletedTransactions(int aMill
int noOfEventsToWaitFor,
PollGuard *poll_guard)
{
- theImpl->theWaiter.m_state = NO_WAIT;
+ theImpl->theWaiter.set_node(0);
+ theImpl->theWaiter.set_state(WAIT_TRANS);
+
/**
- * theImpl->theWaiter.m_state = NO_WAIT;
+ * theImpl->theWaiter.set_node(0)
* To ensure no messup with synchronous node fail handling
* (see ReportFailure)
*/
@@ -1314,10 +1296,6 @@ Ndb::waitCompletedTransactions(int aMill
} while (waitTime > 0);
}//Ndb::waitCompletedTransactions()
-void Ndb::cond_signal()
-{
- NdbCondition_Signal(theImpl->theWaiter.m_condition);
-}
/*****************************************************************************
void sendPreparedTransactions(int forceSend = 0);
@@ -1351,8 +1329,7 @@ Ndb::sendPollNdb(int aMillisecondNumber,
in all places where the object is out of context due to a return,
break, continue or simply end of statement block
*/
- PollGuard pg(theImpl->m_transporter_facade, &theImpl->theWaiter,
- theNdbBlockNumber);
+ PollGuard pg(* theImpl);
sendPrepTrans(forceSend);
return poll_trans(aMillisecondNumber, minNoOfEventsToWakeup, &pg);
}
@@ -1374,6 +1351,7 @@ Ndb::poll_trans(int aMillisecondNumber,
} else {
tNoCompletedTransactions = pollCompleted(tConArray);
}//if
+ theMinNoOfEventsToWakeUp = 0; // no more wakup
pg->unlock_and_signal();
reportCallback(tConArray, tNoCompletedTransactions);
return tNoCompletedTransactions;
@@ -1395,8 +1373,7 @@ Ndb::pollNdb(int aMillisecondNumber, int
in all places where the object is out of context due to a return,
break, continue or simply end of statement block
*/
- PollGuard pg(theImpl->m_transporter_facade, &theImpl->theWaiter,
- theNdbBlockNumber);
+ PollGuard pg(* theImpl);
return poll_trans(aMillisecondNumber, minNoOfEventsToWakeup, &pg);
}
@@ -1428,7 +1405,7 @@ Ndb::sendRecSignal(Uint16 node_id,
in all places where the object is out of context due to a return,
break, continue or simply end of statement block
*/
- PollGuard poll_guard(tp,&theImpl->theWaiter,theNdbBlockNumber);
+ PollGuard poll_guard(* theImpl);
read_conn_seq= tp->getNodeSequence(node_id);
if (ret_conn_seq)
*ret_conn_seq= read_conn_seq;
=== modified file 'storage/ndb/src/ndbapi/Ndbinit.cpp'
--- a/storage/ndb/src/ndbapi/Ndbinit.cpp 2010-09-30 11:52:49 +0000
+++ b/storage/ndb/src/ndbapi/Ndbinit.cpp 2010-10-06 12:35:34 +0000
@@ -72,9 +72,6 @@ void Ndb::setup(Ndb_cluster_connection *
theFirstTransId= 0;
theMyRef= 0;
- cond_wait_index = TransporterFacade::MAX_NO_THREADS;
- cond_signal_ndb = NULL;
-
fullyQualifiedNames = true;
#ifdef POORMANSPURIFY
@@ -100,8 +97,6 @@ void Ndb::setup(Ndb_cluster_connection *
theImpl->m_schemaname.assign(aSchema);
theImpl->update_prefix();
- theImpl->theWaiter.m_mutex = theImpl->m_transporter_facade->theMutexPtr;
-
// Signal that the constructor has finished OK
if (theInitState == NotConstructed)
theInitState = NotInitialised;
@@ -144,9 +139,7 @@ Ndb::~Ndb()
doDisconnect();
/* Disconnect from transporter to stop signals from coming in */
- if (theImpl->m_transporter_facade != NULL && theNdbBlockNumber > 0){
- theImpl->m_transporter_facade->close(theNdbBlockNumber);
- }
+ theImpl->close();
delete theEventBuffer;
@@ -176,17 +169,15 @@ Ndb::~Ndb()
DBUG_VOID_RETURN;
}
-NdbWaiter::NdbWaiter(){
+NdbWaiter::NdbWaiter(trp_client* clnt)
+ : m_clnt(clnt)
+{
m_node = 0;
m_state = NO_WAIT;
- m_mutex = 0;
- m_poll_owner= false;
- m_cond_wait_index= TransporterFacade::MAX_NO_THREADS;
- m_condition = NdbCondition_Create();
}
-NdbWaiter::~NdbWaiter(){
- NdbCondition_Destroy(m_condition);
+NdbWaiter::~NdbWaiter()
+{
}
NdbImpl::NdbImpl(Ndb_cluster_connection *ndb_cluster_connection,
@@ -201,6 +192,7 @@ NdbImpl::NdbImpl(Ndb_cluster_connection
theNdbObjectIdMap(m_transporter_facade->theMutexPtr,
1024,1024),
theNoOfDBnodes(0),
+ theWaiter(this),
m_ev_op(0)
{
int i;
=== modified file 'storage/ndb/src/ndbapi/SignalSender.cpp'
--- a/storage/ndb/src/ndbapi/SignalSender.cpp 2010-10-01 10:08:29 +0000
+++ b/storage/ndb/src/ndbapi/SignalSender.cpp 2010-10-06 12:35:34 +0000
@@ -76,53 +76,41 @@ SimpleSignal::print(FILE * out) const {
}
SignalSender::SignalSender(TransporterFacade *facade, int blockNo)
- : m_lock(0)
{
- m_cond = NdbCondition_Create();
theFacade = facade;
- lock();
- m_blockNo = theFacade->open(this, blockNo);
- unlock();
+ m_blockNo = open(theFacade, blockNo);
assert(m_blockNo > 0);
}
SignalSender::SignalSender(Ndb_cluster_connection* connection)
{
- m_cond = NdbCondition_Create();
theFacade = connection->m_impl.m_transporter_facade;
- lock();
- m_blockNo = theFacade->open(this, -1);
- unlock();
+ m_blockNo = open(theFacade, -1);
assert(m_blockNo > 0);
}
SignalSender::~SignalSender(){
int i;
- if (m_lock)
- unlock();
- theFacade->close(m_blockNo);
+ unlock();
+ close();
+
// free these _after_ closing theFacade to ensure that
// we delete all signals
for (i= m_jobBuffer.size()-1; i>= 0; i--)
delete m_jobBuffer[i];
for (i= m_usedBuffer.size()-1; i>= 0; i--)
delete m_usedBuffer[i];
- NdbCondition_Destroy(m_cond);
}
int SignalSender::lock()
{
- if (NdbMutex_Lock(theFacade->theMutexPtr))
- return -1;
- m_lock= 1;
+ start_poll();
return 0;
}
int SignalSender::unlock()
{
- if (NdbMutex_Unlock(theFacade->theMutexPtr))
- return -1;
- m_lock= 0;
+ complete_poll();
return 0;
}
@@ -213,10 +201,7 @@ SignalSender::waitFor(Uint32 timeOutMill
NDB_TICKS stop = now + timeOutMillis;
Uint32 wait = (timeOutMillis == 0 ? 10 : timeOutMillis);
do {
- NdbCondition_WaitTimeout(m_cond,
- theFacade->theMutexPtr,
- wait);
-
+ do_poll(wait);
SimpleSignal * s = t.check(m_jobBuffer);
if(s != 0){
@@ -269,7 +254,7 @@ SignalSender::trp_deliver_signal(const N
memcpy(s->ptr[i].p, ptr[i].p, 4 * ptr[i].sz);
}
m_jobBuffer.push_back(s);
- NdbCondition_Signal(m_cond);
+ wakeup();
}
void
@@ -318,7 +303,7 @@ ok:
}
m_jobBuffer.push_back(s);
- NdbCondition_Signal(m_cond);
+ wakeup();
}
=== modified file 'storage/ndb/src/ndbapi/SignalSender.hpp'
--- a/storage/ndb/src/ndbapi/SignalSender.hpp 2010-10-01 10:08:29 +0000
+++ b/storage/ndb/src/ndbapi/SignalSender.hpp 2010-10-06 12:35:34 +0000
@@ -129,8 +129,6 @@ public:
virtual void trp_node_status(Uint32 nodeId, Uint32 _event);
- int m_lock;
- struct NdbCondition * m_cond;
Vector<SimpleSignal *> m_jobBuffer;
Vector<SimpleSignal *> m_usedBuffer;
=== modified file 'storage/ndb/src/ndbapi/TransporterFacade.cpp'
--- a/storage/ndb/src/ndbapi/TransporterFacade.cpp 2010-10-04 14:44:27 +0000
+++ b/storage/ndb/src/ndbapi/TransporterFacade.cpp 2010-10-11 13:18:51 +0000
@@ -489,7 +489,7 @@ void TransporterFacade::threadMainReceiv
for(int i = 0; i<10; i++){
NdbSleep_MilliSleep(10);
NdbMutex_Lock(theMutexPtr);
- if (poll_owner == NULL) {
+ if (m_poll_owner == NULL) {
const int res = theTransporterRegistry->pollReceive(0);
if(res > 0)
theTransporterRegistry->performReceive();
@@ -518,112 +518,10 @@ void TransporterFacade::external_poll(Ui
}
}
-/*
- This Ndb object didn't get hold of the poll "right" and will wait on a
- conditional mutex wait instead. It is put into the conditional wait
- queue so that it is accessible to take over the poll "right" if needed.
- The method gets a free entry in the free list and puts it first in the
- doubly linked list. Finally it assigns the ndb object reference to the
- entry.
-*/
-Uint32 TransporterFacade::put_in_cond_wait_queue(NdbWaiter *aWaiter)
-{
- /*
- Get first free entry
- */
- Uint32 index = first_free_cond_wait;
- assert(index < MAX_NO_THREADS);
- first_free_cond_wait = cond_wait_array[index].next_cond_wait;
-
- /*
- Put in doubly linked list
- */
- cond_wait_array[index].next_cond_wait = MAX_NO_THREADS;
- cond_wait_array[index].prev_cond_wait = last_in_cond_wait;
- if (last_in_cond_wait == MAX_NO_THREADS) {
- first_in_cond_wait = index;
- } else
- cond_wait_array[last_in_cond_wait].next_cond_wait = index;
- last_in_cond_wait = index;
-
- cond_wait_array[index].cond_wait_object = aWaiter;
- aWaiter->set_cond_wait_index(index);
- return index;
-}
-
-/*
- Somebody is about to signal the thread to wake it up, it could also
- be that it woke up on a timeout and found himself still in the list.
- Removes the entry from the doubly linked list.
- Inserts the entry into the free list.
- NULLifies the ndb object reference entry and sets the index in the
- Ndb object to NIL (=MAX_NO_THREADS)
-*/
-void TransporterFacade::remove_from_cond_wait_queue(NdbWaiter *aWaiter)
-{
- Uint32 index = aWaiter->get_cond_wait_index();
- assert(index < MAX_NO_THREADS &&
- cond_wait_array[index].cond_wait_object == aWaiter);
- /*
- Remove from doubly linked list
- */
- Uint32 prev_elem, next_elem;
- prev_elem = cond_wait_array[index].prev_cond_wait;
- next_elem = cond_wait_array[index].next_cond_wait;
- if (prev_elem != MAX_NO_THREADS)
- cond_wait_array[prev_elem].next_cond_wait = next_elem;
- else
- first_in_cond_wait = next_elem;
- if (next_elem != MAX_NO_THREADS)
- cond_wait_array[next_elem].prev_cond_wait = prev_elem;
- else
- last_in_cond_wait = prev_elem;
- /*
- Insert into free list
- */
- cond_wait_array[index].next_cond_wait = first_free_cond_wait;
- cond_wait_array[index].prev_cond_wait = MAX_NO_THREADS;
- first_free_cond_wait = index;
-
- cond_wait_array[index].cond_wait_object = NULL;
- aWaiter->set_cond_wait_index(MAX_NO_THREADS);
-}
-
-/*
- Get the latest Ndb object from the conditional wait queue
- and also remove it from the list.
-*/
-NdbWaiter* TransporterFacade::rem_last_from_cond_wait_queue()
-{
- NdbWaiter *tWaiter;
- Uint32 index = last_in_cond_wait;
- if (last_in_cond_wait == MAX_NO_THREADS)
- return NULL;
- tWaiter = cond_wait_array[index].cond_wait_object;
- remove_from_cond_wait_queue(tWaiter);
- return tWaiter;
-}
-
-void TransporterFacade::init_cond_wait_queue()
-{
- Uint32 i;
- /*
- Initialise the doubly linked list as empty
- */
- first_in_cond_wait = MAX_NO_THREADS;
- last_in_cond_wait = MAX_NO_THREADS;
- /*
- Initialise free list
- */
- first_free_cond_wait = 0;
- for (i = 0; i < MAX_NO_THREADS; i++) {
- cond_wait_array[i].cond_wait_object = NULL;
- cond_wait_array[i].next_cond_wait = i+1;
- cond_wait_array[i].prev_cond_wait = MAX_NO_THREADS;
- }
-}
-
TransporterFacade::TransporterFacade(GlobalDictCache *cache) :
+ m_poll_owner(NULL),
+ m_poll_queue_head(NULL),
+ m_poll_queue_tail(NULL),
theTransporterRegistry(0),
theOwnId(0),
theStartNodeId(1),
@@ -637,8 +535,6 @@ TransporterFacade::TransporterFacade(Glo
m_globalDictCache(cache)
{
DBUG_ENTER("TransporterFacade::TransporterFacade");
- init_cond_wait_queue();
- poll_owner = NULL;
theMutexPtr = NdbMutex_Create();
sendPerformedLastInterval = 0;
@@ -814,24 +710,31 @@ TransporterFacade::trp_node_status(NodeI
}
int
-TransporterFacade::close(BlockNumber blockNumber)
+TransporterFacade::close_clnt(trp_client* clnt)
{
- NdbMutex_Lock(theMutexPtr);
- close_local(blockNumber);
- NdbMutex_Unlock(theMutexPtr);
- return 0;
-}
-
-int
-TransporterFacade::close_local(BlockNumber blockNumber){
- m_threads.close(blockNumber);
- return 0;
+ int ret = -1;
+ if (clnt)
+ {
+ NdbMutex_Lock(theMutexPtr);
+ if (m_threads.get(clnt->m_blockNo) == clnt)
+ {
+ m_threads.close(clnt->m_blockNo);
+ ret = 0;
+ }
+ else
+ {
+ assert(0);
+ }
+ NdbMutex_Unlock(theMutexPtr);
+ }
+ return ret;
}
int
-TransporterFacade::open(trp_client * clnt, int blockNo)
+TransporterFacade::open_clnt(trp_client * clnt, int blockNo)
{
DBUG_ENTER("TransporterFacade::open");
+ Guard g(theMutexPtr);
int r= m_threads.open(clnt);
if (r < 0)
{
@@ -862,8 +765,8 @@ TransporterFacade::~TransporterFacade()
{
DBUG_ENTER("TransporterFacade::~TransporterFacade");
- NdbMutex_Lock(theMutexPtr);
delete theClusterMgr;
+ NdbMutex_Lock(theMutexPtr);
delete theTransporterRegistry;
NdbMutex_Unlock(theMutexPtr);
NdbMutex_Destroy(theMutexPtr);
@@ -1639,103 +1542,20 @@ TransporterFacade::get_active_ndb_object
return m_threads.m_use_cnt;
}
-PollGuard::PollGuard(TransporterFacade *tp, NdbWaiter *aWaiter,
- Uint32 block_no)
-{
- m_tp= tp;
- m_waiter= aWaiter;
- m_locked= true;
- m_block_no= block_no;
- tp->lock_mutex();
-}
-
-/*
- This is a common routine for possibly forcing the send of buffered signals
- and receiving response the thread is waiting for. It is designed to be
- useful from:
- 1) PK, UK lookups using the asynchronous interface
- This routine uses the wait_for_input routine instead since it has
- special end conditions due to the asynchronous nature of its usage.
- 2) Scans
- 3) dictSignal
- It uses a NdbWaiter object to wait on the events and this object is
- linked into the conditional wait queue. Thus this object contains
- a reference to its place in the queue.
-
- It replaces the method receiveResponse previously used on the Ndb object
-*/
-int PollGuard::wait_n_unlock(int wait_time, NodeId nodeId, Uint32 state,
- bool forceSend)
-{
- int ret_val;
- m_waiter->set_node(nodeId);
- m_waiter->set_state(state);
- ret_val= wait_for_input_in_loop(wait_time, forceSend);
- unlock_and_signal();
- return ret_val;
-}
-
-int PollGuard::wait_scan(int wait_time, NodeId nodeId, bool forceSend)
-{
- m_waiter->set_node(nodeId);
- m_waiter->set_state(WAIT_SCAN);
- return wait_for_input_in_loop(wait_time, forceSend);
-}
-int PollGuard::wait_for_input_in_loop(int wait_time, bool forceSend)
+void
+TransporterFacade::start_poll(trp_client* clnt)
{
- int ret_val;
- if (forceSend)
- m_tp->forceSend(m_block_no);
- else
- m_tp->checkForceSend(m_block_no);
-
- NDB_TICKS curr_time = NdbTick_CurrentMillisecond();
- NDB_TICKS max_time = curr_time + (NDB_TICKS)wait_time;
- const int maxsleep = (wait_time == -1 || wait_time > 10) ? 10 : wait_time;
- do
- {
- wait_for_input(maxsleep);
- Uint32 state= m_waiter->get_state();
- if (state == NO_WAIT)
- {
- return 0;
- }
- else if (state == WAIT_NODE_FAILURE)
- {
- ret_val= -2;
- break;
- }
- if (wait_time == -1)
- {
-#ifdef NOT_USED
- ndbout << "Waited WAITFOR_RESPONSE_TIMEOUT, continuing wait" << endl;
-#endif
- continue;
- }
- wait_time= int(max_time - NdbTick_CurrentMillisecond());
- if (wait_time <= 0)
- {
-#ifdef VM_TRACE
- ndbout << "Time-out state is " << m_waiter->get_state() << endl;
-#endif
- m_waiter->set_state(WST_WAIT_TIMEOUT);
- ret_val= -1;
- break;
- }
- } while (1);
-#ifdef VM_TRACE
- ndbout << "ERR: receiveResponse - theImpl->theWaiter.m_state = ";
- ndbout << m_waiter->get_state() << endl;
-#endif
- m_waiter->set_state(NO_WAIT);
- return ret_val;
+ lock_mutex();
+ clnt->m_poll.m_locked = true;
}
-void PollGuard::wait_for_input(int wait_time)
+void
+TransporterFacade::do_poll(trp_client* clnt, Uint32 wait_time)
{
- NdbWaiter *t_poll_owner= m_tp->get_poll_owner();
- if (t_poll_owner != NULL && t_poll_owner != m_waiter)
+ assert(clnt->m_poll.m_locked == true);
+ trp_client* owner = m_poll_owner;
+ if (owner != NULL && owner != clnt)
{
/*
We didn't get hold of the poll "right". We will sleep on a
@@ -1746,11 +1566,11 @@ void PollGuard::wait_for_input(int wait_
queue if it hasn't happened already. It is usually already out of the
queue but at time-out it could be that the object is still there.
*/
- (void) m_tp->put_in_cond_wait_queue(m_waiter);
- m_waiter->wait(wait_time);
- if (m_waiter->get_cond_wait_index() != TransporterFacade::MAX_NO_THREADS)
+ add_to_poll_queue(clnt);
+ clnt->cond_wait(wait_time, theMutexPtr); // release/reacquire mutex
+ if (clnt != m_poll_owner)
{
- m_tp->remove_from_cond_wait_queue(m_waiter);
+ remove_from_poll_queue(clnt);
}
}
else
@@ -1768,17 +1588,32 @@ void PollGuard::wait_for_input(int wait_
*/
NdbThread_set_shm_sigmask(FALSE);
#endif
- m_tp->set_poll_owner(m_waiter);
- m_waiter->set_poll_owner(true);
- m_tp->external_poll((Uint32)wait_time);
+ assert(owner == clnt || clnt->m_poll.m_poll_owner == false);
+ m_poll_owner = clnt;
+ clnt->m_poll.m_poll_owner = true;
+ NdbMutex_Unlock(theMutexPtr);
+ const int res = theTransporterRegistry->pollReceive(wait_time);
+#ifdef NDB_SHM_TRANSPORTER
+ NdbThread_set_shm_sigmask(TRUE);
+#endif
+
+ NdbMutex_Lock(theMutexPtr);
+ if (res > 0)
+ {
+ theTransporterRegistry->performReceive();
+ }
}
}
-void PollGuard::unlock_and_signal()
+void
+TransporterFacade::complete_poll(trp_client* clnt)
{
- NdbWaiter *t_signal_cond_waiter= 0;
- if (!m_locked)
+ if (!clnt->m_poll.m_locked)
+ {
+ assert(clnt->m_poll.m_poll_owner == false);
return;
+ }
+
/*
When completing the poll for this thread we must return the poll
ownership if we own it. We will give it to the last thread that
@@ -1791,25 +1626,92 @@ void PollGuard::unlock_and_signal()
API Volume 1 Third Edition on page 703-704 for a discussion on this
subject.
*/
- if (m_tp->get_poll_owner() == m_waiter)
+ trp_client* new_owner = 0;
+ if (m_poll_owner == clnt)
{
-#ifdef NDB_SHM_TRANSPORTER
- /*
- If shared memory transporters are used we need to reset our sigmask
- since we are no longer the thread to receive interrupts.
- */
- NdbThread_set_shm_sigmask(TRUE);
-#endif
- m_waiter->set_poll_owner(false);
- t_signal_cond_waiter= m_tp->rem_last_from_cond_wait_queue();
- m_tp->set_poll_owner(t_signal_cond_waiter);
- if (t_signal_cond_waiter)
- t_signal_cond_waiter->set_poll_owner(true);
- }
- if (t_signal_cond_waiter)
- t_signal_cond_waiter->cond_signal();
- m_tp->unlock_mutex();
- m_locked=false;
+ assert(clnt->m_poll.m_poll_owner == true);
+ m_poll_owner = new_owner = remove_last_from_poll_queue();
+ }
+ if (new_owner)
+ {
+ assert(new_owner->m_poll.m_poll_owner == false);
+ new_owner->cond_signal();
+ new_owner->m_poll.m_poll_owner = true;
+ }
+ clnt->m_poll.m_locked = false;
+ clnt->m_poll.m_poll_owner = false;
+ unlock_mutex();
+}
+
+void
+TransporterFacade::add_to_poll_queue(trp_client* clnt)
+{
+ assert(clnt != 0);
+ assert(clnt->m_poll.m_prev == 0);
+ assert(clnt->m_poll.m_next == 0);
+ assert(clnt->m_poll.m_locked == true);
+ assert(clnt->m_poll.m_poll_owner == false);
+
+ if (m_poll_queue_head == 0)
+ {
+ assert(m_poll_queue_tail == 0);
+ m_poll_queue_head = clnt;
+ m_poll_queue_tail = clnt;
+ }
+ else
+ {
+ assert(m_poll_queue_tail->m_poll.m_next == 0);
+ m_poll_queue_tail->m_poll.m_next = clnt;
+ clnt->m_poll.m_prev = m_poll_queue_tail;
+ m_poll_queue_tail = clnt;
+ }
+}
+
+void
+TransporterFacade::remove_from_poll_queue(trp_client* clnt)
+{
+ assert(clnt != 0);
+ assert(clnt->m_poll.m_locked == true);
+ assert(clnt->m_poll.m_poll_owner == false);
+
+ if (clnt->m_poll.m_prev != 0)
+ {
+ clnt->m_poll.m_prev->m_poll.m_next = clnt->m_poll.m_next;
+ }
+ else
+ {
+ assert(m_poll_queue_head == clnt);
+ m_poll_queue_head = clnt->m_poll.m_next;
+ }
+
+ if (clnt->m_poll.m_next != 0)
+ {
+ clnt->m_poll.m_next->m_poll.m_prev = clnt->m_poll.m_prev;
+ }
+ else
+ {
+ assert(m_poll_queue_tail == clnt);
+ m_poll_queue_tail = clnt->m_poll.m_prev;
+ }
+
+ if (m_poll_queue_head == 0)
+ assert(m_poll_queue_tail == 0);
+ else if (m_poll_queue_tail == 0)
+ assert(m_poll_queue_head == 0);
+
+ clnt->m_poll.m_prev = 0;
+ clnt->m_poll.m_next = 0;
+}
+
+trp_client*
+TransporterFacade::remove_last_from_poll_queue()
+{
+ trp_client * clnt = m_poll_queue_tail;
+ if (clnt == 0)
+ return 0;
+
+ remove_from_poll_queue(clnt);
+ return clnt;
}
template class Vector<trp_client*>;
=== modified file 'storage/ndb/src/ndbapi/TransporterFacade.hpp'
--- a/storage/ndb/src/ndbapi/TransporterFacade.hpp 2010-10-04 14:44:27 +0000
+++ b/storage/ndb/src/ndbapi/TransporterFacade.hpp 2010-10-11 13:18:51 +0000
@@ -75,10 +75,9 @@ public:
* @blockNo block number to use, -1 => any blockNumber
* @return BlockNumber or -1 for failure
*/
- int open(trp_client*, int blockNo = -1);
-
- // Close this block number
- int close(BlockNumber blockNumber);
+ int open_clnt(trp_client*, int blockNo = -1);
+ int close_clnt(trp_client*);
+
Uint32 get_active_ndb_objects() const;
// Only sends to nodes which are alive
@@ -131,9 +130,6 @@ public:
void forceSend(Uint32 block_number);
void checkForceSend(Uint32 block_number);
- // Close this block number
- int close_local(BlockNumber blockNumber);
-
TransporterRegistry* get_registry() { return theTransporterRegistry;};
/*
@@ -152,12 +148,22 @@ public:
as seldom as possible we always pick the last thread which is likely to
be the last to complete its reception.
*/
+ void start_poll(trp_client*);
+ void do_poll(trp_client* clnt, Uint32 wait_time);
+ void complete_poll(trp_client*);
+
void external_poll(Uint32 wait_time);
- NdbWaiter* get_poll_owner(void) const { return poll_owner; }
- void set_poll_owner(NdbWaiter* new_owner) { poll_owner= new_owner; }
- Uint32 put_in_cond_wait_queue(NdbWaiter *aWaiter);
- void remove_from_cond_wait_queue(NdbWaiter *aWaiter);
- NdbWaiter* rem_last_from_cond_wait_queue();
+
+ trp_client* get_poll_owner(bool) const { return m_poll_owner;}
+ trp_client* remove_last_from_poll_queue();
+ void add_to_poll_queue(trp_client* clnt);
+ void remove_from_poll_queue(trp_client* clnt);
+
+ trp_client * m_poll_owner;
+ trp_client * m_poll_queue_head; // First in queue
+ trp_client * m_poll_queue_tail; // Last in queue
+ /* End poll owner stuff */
+
// heart beat received from a node (e.g. a signal came)
void hb_received(NodeId n);
void set_auto_reconnect(int val);
@@ -194,18 +200,7 @@ public:
}
private:
- void init_cond_wait_queue();
- struct CondWaitQueueElement {
- NdbWaiter *cond_wait_object;
- Uint32 next_cond_wait;
- Uint32 prev_cond_wait;
- };
- NdbWaiter *poll_owner;
- CondWaitQueueElement cond_wait_array[MAX_NO_THREADS];
- Uint32 first_in_cond_wait;
- Uint32 first_free_cond_wait;
- Uint32 last_in_cond_wait;
- /* End poll owner stuff */
+
/**
* Send a signal unconditional of node status (used by ClusterMgr)
*/
@@ -294,25 +289,6 @@ public:
GlobalDictCache *m_globalDictCache;
};
-class PollGuard
-{
- public:
- PollGuard(TransporterFacade *tp, NdbWaiter *aWaiter, Uint32 block_no);
- ~PollGuard() { unlock_and_signal(); }
- int wait_n_unlock(int wait_time, NodeId nodeId, Uint32 state,
- bool forceSend= false);
- int wait_for_input_in_loop(int wait_time, bool forceSend);
- void wait_for_input(int wait_time);
- int wait_scan(int wait_time, NodeId nodeId, bool forceSend);
- void unlock_and_signal();
- private:
- TransporterFacade *m_tp;
- NdbWaiter *m_waiter;
- Uint32 m_block_no;
- bool m_locked;
-};
-
-
inline
void
TransporterFacade::lock_mutex()
=== modified file 'storage/ndb/src/ndbapi/ndb_cluster_connection.cpp'
--- a/storage/ndb/src/ndbapi/ndb_cluster_connection.cpp 2010-09-30 11:52:49 +0000
+++ b/storage/ndb/src/ndbapi/ndb_cluster_connection.cpp 2010-10-07 05:39:39 +0000
@@ -17,8 +17,6 @@
*/
#include <ndb_global.h>
-#include <my_pthread.h>
-#include <my_sys.h>
#include "ndb_cluster_connection_impl.hpp"
#include <mgmapi_configuration.hpp>
@@ -103,7 +101,9 @@ const char *Ndb_cluster_connection::get_
return 0;
}
-pthread_handler_t run_ndb_cluster_connection_connect_thread(void *me)
+extern "C"
+void *
+run_ndb_cluster_connection_connect_thread(void *me)
{
Ndb_cluster_connection_impl* connection= (Ndb_cluster_connection_impl*) me;
connection->m_run_connect_thread= 1;
=== added file 'storage/ndb/src/ndbapi/trp_client.cpp'
--- a/storage/ndb/src/ndbapi/trp_client.cpp 1970-01-01 00:00:00 +0000
+++ b/storage/ndb/src/ndbapi/trp_client.cpp 2010-10-06 12:35:34 +0000
@@ -0,0 +1,206 @@
+#include "trp_client.hpp"
+#include "TransporterFacade.hpp"
+
+trp_client::trp_client()
+ : m_blockNo(~Uint32(0)), m_facade(0)
+{
+ m_poll.m_locked = false;
+ m_poll.m_poll_owner = false;
+ m_poll.m_next = 0;
+ m_poll.m_prev = 0;
+ m_poll.m_condition = NdbCondition_Create();
+}
+
+trp_client::~trp_client()
+{
+ /**
+ * require that trp_client user
+ * doesnt destroy object when holding any locks
+ */
+ assert(m_poll.m_locked == 0);
+ assert(m_poll.m_poll_owner == false);
+ assert(m_poll.m_next == 0);
+ assert(m_poll.m_prev == 0);
+
+ close();
+ NdbCondition_Destroy(m_poll.m_condition);
+}
+
+int
+trp_client::open(TransporterFacade* tf, int blockNo)
+{
+ int res = -1;
+ assert(m_facade == 0);
+ if (m_facade == 0)
+ {
+ m_facade = tf;
+ res = tf->open_clnt(this, blockNo);
+ if (res >= 0)
+ {
+ m_blockNo = Uint32(res);
+ }
+ else
+ {
+ m_facade = 0;
+ }
+ }
+ return res;
+}
+
+void
+trp_client::close()
+{
+ if (m_facade)
+ {
+ m_facade->close_clnt(this);
+
+ m_facade = 0;
+ m_blockNo = ~Uint32(0);
+ }
+}
+
+void
+trp_client::start_poll()
+{
+ m_facade->start_poll(this);
+}
+
+void
+trp_client::do_poll(Uint32 to)
+{
+ m_facade->do_poll(this, to);
+}
+
+void
+trp_client::complete_poll()
+{
+ m_facade->complete_poll(this);
+}
+
+void
+trp_client::cond_signal()
+{
+ assert(m_poll.m_locked);
+ assert(m_poll.m_poll_owner == false);
+ NdbCondition_Signal(m_poll.m_condition);
+}
+
+void
+trp_client::cond_wait(Uint32 timeout, NdbMutex* mutexPtr)
+{
+ assert(m_poll.m_locked);
+ assert(m_poll.m_poll_owner == false);
+ NdbCondition_WaitTimeout(m_poll.m_condition, mutexPtr, (int)timeout);
+}
+
+void
+trp_client::forceSend(int val)
+{
+ if (val == 0)
+ {
+ m_facade->checkForceSend(m_blockNo);
+ }
+ else if (val == 1)
+ {
+ m_facade->forceSend(m_blockNo);
+ }
+}
+
+#include "NdbImpl.hpp"
+
+PollGuard::PollGuard(NdbImpl& impl)
+{
+ m_clnt = &impl;
+ m_waiter= &impl.theWaiter;
+ m_clnt->start_poll();
+}
+
+/*
+ This is a common routine for possibly forcing the send of buffered signals
+ and receiving response the thread is waiting for. It is designed to be
+ useful from:
+ 1) PK, UK lookups using the asynchronous interface
+ This routine uses the wait_for_input routine instead since it has
+ special end conditions due to the asynchronous nature of its usage.
+ 2) Scans
+ 3) dictSignal
+ It uses a NdbWaiter object to wait on the events and this object is
+ linked into the conditional wait queue. Thus this object contains
+ a reference to its place in the queue.
+
+ It replaces the method receiveResponse previously used on the Ndb object
+*/
+int PollGuard::wait_n_unlock(int wait_time, Uint32 nodeId, Uint32 state,
+ bool forceSend)
+{
+ int ret_val;
+ m_waiter->set_node(nodeId);
+ m_waiter->set_state(state);
+ ret_val= wait_for_input_in_loop(wait_time, forceSend);
+ unlock_and_signal();
+ return ret_val;
+}
+
+int PollGuard::wait_scan(int wait_time, Uint32 nodeId, bool forceSend)
+{
+ m_waiter->set_node(nodeId);
+ m_waiter->set_state(WAIT_SCAN);
+ return wait_for_input_in_loop(wait_time, forceSend);
+}
+
+int PollGuard::wait_for_input_in_loop(int wait_time, bool forceSend)
+{
+ int ret_val;
+ m_clnt->forceSend(forceSend ? 1 : 0);
+
+ NDB_TICKS curr_time = NdbTick_CurrentMillisecond();
+ NDB_TICKS max_time = curr_time + (NDB_TICKS)wait_time;
+ const int maxsleep = (wait_time == -1 || wait_time > 10) ? 10 : wait_time;
+ do
+ {
+ wait_for_input(maxsleep);
+ Uint32 state= m_waiter->get_state();
+ if (state == NO_WAIT)
+ {
+ return 0;
+ }
+ else if (state == WAIT_NODE_FAILURE)
+ {
+ ret_val= -2;
+ break;
+ }
+ if (wait_time == -1)
+ {
+#ifdef NOT_USED
+ ndbout << "Waited WAITFOR_RESPONSE_TIMEOUT, continuing wait" << endl;
+#endif
+ continue;
+ }
+ wait_time= int(max_time - NdbTick_CurrentMillisecond());
+ if (wait_time <= 0)
+ {
+#ifdef VM_TRACE
+ ndbout << "Time-out state is " << m_waiter->get_state() << endl;
+#endif
+ m_waiter->set_state(WST_WAIT_TIMEOUT);
+ ret_val= -1;
+ break;
+ }
+ } while (1);
+#ifdef VM_TRACE
+ ndbout << "ERR: receiveResponse - theImpl->theWaiter.m_state = ";
+ ndbout << m_waiter->get_state() << endl;
+#endif
+ m_waiter->set_state(NO_WAIT);
+ return ret_val;
+}
+
+void PollGuard::wait_for_input(int wait_time)
+{
+ m_clnt->do_poll(wait_time);
+}
+
+void PollGuard::unlock_and_signal()
+{
+ m_clnt->complete_poll();
+}
=== modified file 'storage/ndb/src/ndbapi/trp_client.hpp'
--- a/storage/ndb/src/ndbapi/trp_client.hpp 2010-10-01 10:08:29 +0000
+++ b/storage/ndb/src/ndbapi/trp_client.hpp 2010-10-06 12:35:34 +0000
@@ -19,18 +19,75 @@
#define trp_client_hpp
#include <ndb_global.h>
+#include <NdbCondition.h>
class NdbApiSignal;
struct LinearSectionPtr;
class trp_client
{
+ friend class TransporterFacade;
public:
- virtual ~trp_client() {}
+ trp_client();
+ virtual ~trp_client();
virtual void trp_deliver_signal(const NdbApiSignal *,
const LinearSectionPtr ptr[3]) = 0;
virtual void trp_node_status(Uint32, Uint32 event) = 0;
+
+ int open(class TransporterFacade*, int blockNo = -1);
+ void close();
+
+ void start_poll();
+ void do_poll(Uint32);
+ void complete_poll();
+ void wakeup();
+
+ void forceSend(int val = 1);
+
+private:
+ Uint32 m_blockNo;
+ TransporterFacade * m_facade;
+
+ /**
+ * This is used for polling
+ */
+ struct PollQueue
+ {
+ bool m_locked;
+ bool m_poll_owner;
+ trp_client *m_prev;
+ trp_client *m_next;
+ NdbCondition * m_condition;
+ } m_poll;
+ void cond_wait(Uint32 timeout, NdbMutex*);
+ void cond_signal();
+};
+
+inline
+void
+trp_client::wakeup()
+{
+ if (m_poll.m_locked == true && m_poll.m_poll_owner == false)
+ cond_signal();
+ else if (m_poll.m_poll_owner)
+ assert(m_poll.m_locked);
+}
+
+class PollGuard
+{
+public:
+ PollGuard(class NdbImpl&);
+ ~PollGuard() { unlock_and_signal(); }
+ int wait_n_unlock(int wait_time, Uint32 nodeId, Uint32 state,
+ bool forceSend= false);
+ int wait_for_input_in_loop(int wait_time, bool forceSend);
+ void wait_for_input(int wait_time);
+ int wait_scan(int wait_time, Uint32 nodeId, bool forceSend);
+ void unlock_and_signal();
+private:
+ class trp_client* m_clnt;
+ class NdbWaiter *m_waiter;
};
#endif
=== removed directory 'storage/ndb/swig'
=== removed file 'storage/ndb/swig/Makefile.am'
--- a/storage/ndb/swig/Makefile.am 2010-08-06 08:19:19 +0000
+++ b/storage/ndb/swig/Makefile.am 1970-01-01 00:00:00 +0000
@@ -1,46 +0,0 @@
-# Copyright (C) 2004-2006 MySQL AB
-# All rights reserved. Use is subject to license terms.
-#
-# 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; version 2 of the License.
-#
-# 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-include $(top_srcdir)/storage/ndb/config/common.mk.am
-
-nobase_swiginclude_HEADERS = \
-mgmapi/mgmglobals.i \
-mgmapi/ClusterState.i \
-mgmapi/events.i \
-mgmapi/listeners.i \
-mgmapi/NdbLogEvent.i \
-mgmapi/NdbLogEventManager.i \
-mgmapi/NdbMgmFactory.i \
-mgmapi/NdbMgm.i \
-mgmapi/NdbMgmReply.i \
-mgmapi/NodeState.i \
-ndbapi/NdbError.i \
-ndbapi/ndbglobals.i \
-ndbapi/NdbIndexScanOperation.i \
-ndbapi/NdbOperation.i \
-ndbapi/NdbScanFilter.i \
-ndbapi/NdbScanOperation.i \
-ndbapi/NdbBlob.i \
-ndbapi/NdbClusterConnection.i \
-ndbapi/NdbDictionary.i \
-ndbapi/NdbEventOperation.i \
-ndbapi/NdbFactory.i \
-ndbapi/Ndb.i \
-ndbapi/NdbIndexOperation.i \
-ndbapi/NdbRecAttr.i \
-ndbapi/NdbTransaction.i \
-globals.i
-
=== removed file 'storage/ndb/swig/globals.i'
--- a/storage/ndb/swig/globals.i 2008-03-11 15:27:35 +0000
+++ b/storage/ndb/swig/globals.i 1970-01-01 00:00:00 +0000
@@ -1,75 +0,0 @@
-/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
- *
- * Copyright (C) 2008 MySQL, Inc.
- *
- * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#if !defined(SWIGLUA)
-%include "typemaps.i"
-#endif
-
-%include "exception.i"
-
- //%include "cstring.i"
-
-%include "ndberror.h"
-%include "ndb_constants.h"
-%include "ndb_init.h"
-
- // Suppress SWIG warning
-#pragma SWIG nowarn=SWIGWARN_PARSE_NESTED_CLASS
-
-%define %ndbexception(EXCEPTION)
-#if defined(SWIGJAVA)
-%javaexception(EXCEPTION)
-#else
-%exception
-#endif
-%enddef
-
-%define %ndbnoexception
-#if defined(SWIGJAVA)
-%nojavaexception;
-#else
-%noexception; // clear exception handler
-#endif
-%enddef
-
-%{
- enum NdbException {
- BaseRuntimeError,
- NdbApiException,
- BlobUndefinedException,
- NdbApiPermanentException,
- NdbApiRuntimeException,
- NdbApiTemporaryException,
- NdbApiTimeStampOutOfBoundsException,
- NdbApiUserErrorPermanentException,
- NdbClusterConnectionPermanentException,
- NdbClusterConnectionTemporaryException,
- NoSuchColumnException,
- NoSuchIndexException,
- NoSuchTableException,
- NdbMgmException,
- InvalidSchemaObjectVersionException,
- };
- %}
-
-typedef unsigned long long Uint64;
-typedef unsigned int Uint32;
-typedef signed long long Int64;
-typedef signed int Int32;
=== removed directory 'storage/ndb/swig/mgmapi'
=== removed file 'storage/ndb/swig/mgmapi/ClusterState.i'
--- a/storage/ndb/swig/mgmapi/ClusterState.i 2008-03-11 15:27:35 +0000
+++ b/storage/ndb/swig/mgmapi/ClusterState.i 1970-01-01 00:00:00 +0000
@@ -1,56 +0,0 @@
-/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
- *
- * Copyright (C) 2008 MySQL, Inc.
- *
- * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-/**
- * State of all nodes in the cluster; returned from
- * ndb_mgm_get_status()
- */
-
-%rename ndb_mgm_cluster_state ClusterState;
-
-struct ndb_mgm_cluster_state {
-private:
- ndb_mgm_cluster_state();
- ~ndb_mgm_cluster_state();
- /** Number of entries in the node_states array */
- int no_of_nodes;
- /** An array with node_states*/
- %immutable;
- struct ndb_mgm_node_state node_states[];
- %mutable;
-};
-
-
-%extend ndb_mgm_cluster_state {
-
-public:
- int getNoOfNodes() {
- return self->no_of_nodes;
- }
-
- ndb_mgm_node_state * getNodeState(int nodeId) {
- if (nodeId < self->no_of_nodes) {
- return &(self->node_states[nodeId]);
- }
- return NULL;
- }
-};
-
=== removed file 'storage/ndb/swig/mgmapi/NdbLogEvent.i'
--- a/storage/ndb/swig/mgmapi/NdbLogEvent.i 2008-03-11 15:27:35 +0000
+++ b/storage/ndb/swig/mgmapi/NdbLogEvent.i 1970-01-01 00:00:00 +0000
@@ -1,86 +0,0 @@
-/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
- *
- * Copyright (C) 2008 MySQL, Inc.
- *
- * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/** Log event specific data for for corresponding NDB_LE_ log event */
-
-/**
- * The NdbLogevent
- */
-%rename ndb_logevent NdbLogEvent;
-
-class ndb_logevent {
-
- /** NdbLogEventHandle (to be used for comparing only)
- * set in ndb_logevent_get_next()
- */
- void *handle;
-
- /** Which event */
- enum Ndb_logevent_type type;
-
- /** Time when log event was registred at the management server */
- unsigned time;
-
- /** Category of log event */
- enum ndb_mgm_event_category category;
-
- /** Severity of log event */
- enum ndb_mgm_event_severity severity;
-
- /** Level (0-15) of log event */
- unsigned level;
-
- /** Node ID of the node that reported the log event */
- unsigned source_nodeid;
-
-};
-
-%extend ndb_logevent {
-
-public:
-
- Ndb_logevent_type getEventType() {
- return $self->type;
- }
-
- ndb_mgm_event_category getEventCategory() {
- return $self->category;
- }
-
- ndb_mgm_event_severity getEventSeverity() {
- return $self->severity;
- }
-
- Uint32 getSourceNodeId() {
- return $self->source_nodeid;
- }
-
- Uint32 getEventTime() {
- return $self->time;
- }
-
- Uint32 getEventLevel() {
- return $self->level;
- }
-
-};
-
-
-
=== removed file 'storage/ndb/swig/mgmapi/NdbLogEventManager.i'
--- a/storage/ndb/swig/mgmapi/NdbLogEventManager.i 2008-03-11 15:27:35 +0000
+++ b/storage/ndb/swig/mgmapi/NdbLogEventManager.i 1970-01-01 00:00:00 +0000
@@ -1,88 +0,0 @@
-/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
- *
- * Copyright (C) 2008 MySQL, Inc.
- *
- * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-%{
-#include "NdbEventListener.hpp"
- %}
-
-
-%feature("director") NdbLogEventTypeListener;
-%feature("director") NdbLogEventCategoryListener;
-
-class NdbLogEventListener {
-public:
- virtual ~NdbLogEventListener();
-// virtual void le_handleEvent(const ndb_logevent & theEvent);
-};
-class NdbLogEventCategoryListener {
-public:
- virtual ~NdbLogEventCategoryListener();
-// virtual void le_handleEvent(const ndb_logevent & theEvent);
- virtual ndb_mgm_event_category getEventCategory();
-};
-class NdbLogEventTypeListener {
-public:
- virtual ~NdbLogEventTypeListener();
-// virtual void le_handleEvent(const ndb_logevent & theEvent);
- virtual Ndb_logevent_type getEventType();
-};
-
-%typemap(newfree) (BaseEventWrapper *) "free($1);";
-%newobject NdbLogEventManager::getLogEvent;
-
-class NdbLogEventManager {
- NdbLogEventManager();
- ndb_logevent_handle * handle;
- NdbLogEventManager(ndb_logevent_handle * theHandle);
-public:
- // Returns -1 on error, 0 otherwise
- ~NdbLogEventManager();
- bool unregisterListener(NdbLogEventTypeListener * listener);
- bool unregisterListener(NdbLogEventCategoryListener * listener);
-
- %ndbexception("NdbMgmException") {
- $action
- if (result < 0) {
- NDB_exception(NdbMgmException,"Must deregister handler before adding a new one");
- }
- }
- int registerListener(NdbLogEventTypeListener * listener);
- int registerListener(NdbLogEventCategoryListener * listener);
-
-
- %ndbexception("NdbMgmException") {
- $action
- if (result->ret < 0) {
- NDB_exception(NdbMgmException,arg1->getMgmError());
- }
- }
- BaseEventWrapper * getLogEvent(unsigned timeout_in_milliseconds);
-
- %ndbexception("NdbMgmException") {
- $action
- if (result < 0) {
- NDB_exception(NdbMgmException,arg1->getMgmError());
- }
- }
- int pollEvents(unsigned timeout_in_milliseconds);
- %ndbnoexception;
-};
-
-
=== removed file 'storage/ndb/swig/mgmapi/NdbMgm.i'
--- a/storage/ndb/swig/mgmapi/NdbMgm.i 2008-03-11 15:27:35 +0000
+++ b/storage/ndb/swig/mgmapi/NdbMgm.i 1970-01-01 00:00:00 +0000
@@ -1,848 +0,0 @@
-/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
- *
- * Copyright (C) 2008 MySQL, Inc.
- *
- * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-%{
-
- struct BackupWrapper {
- unsigned int backupId;
- ndb_mgm_reply* theReply;
- };
-
- %}
-
-
-/**
- * The NdbMgmHandle.
- */
-%rename ndb_mgm_handle NdbMgm;
-%typemap(freearg) (ndb_mgm_reply *) "free($1);";
-
-/*We don't really need this - we're going to free in the typemap
- %typemap(newfree) (BackupWrapper *) "free($1->theReply); free($1);";
- %newobject NdbMgm::startBackup;
-*/
-
-struct ndb_mgm_handle {
-private:
-
- ndb_mgm_handle();
- ~ndb_mgm_handle();
-
-};
-
-typedef ndb_mgm_handle * NdbMgmHandle;
-
-
-
-%extend ndb_mgm_handle {
-
-public:
- /**
- * Destroy a management server handle.
- *
- * @param handle Management handle
- */
- ~ndb_mgm_handle() {
- ndb_mgm_destroy_handle(&$self);
- }
-
-
- /***************************************************************************/
- /**
- * @name Functions: Error Handling
- * @{
- */
-
- /**
- * Get the most recent error
- *
- * @return Latest error code
- */
-
- int getNdbMgmErrorCode() {
- return ndb_mgm_get_latest_error($self);
- }
-
- int getLatestErrorCode() {
- return ndb_mgm_get_latest_error($self);
- }
-
- /**
- * Get the most recent general error message
- *
- * @return Latest error message
- */
- const char * getNdbMgmErrorMsg() {
- return ndb_mgm_get_latest_error_msg($self);
- }
-
- const char * getLatestErrorMsg()
- {
- return ndb_mgm_get_latest_error_msg($self);
- }
-
-
- /**
- * Get the most recent error description
- *
- * The error description gives some additional information regarding
- * the error message.
- *
- * @return Latest error description
- */
- const char * getLatestErrorDesc()
- {
- return ndb_mgm_get_latest_error_desc($self);
- }
-
- /**
- * Set error stream
- *
- void setErrorStream(FILE * errStream)
- {
- ndb_mgm_set_error_stream($self, errStream);
- } */
-
-
- /**
- * Set a name of the handle. Name is reported in cluster log.
- *
- * @param name Name
- */
- void setName(const char *name) {
- ndb_mgm_set_name($self, name);
- }
-
- %ndbexception("NdbMgmException") {
- $action
- if (result == -1) {
- //int errCode = ndb_mgm_get_latest_error(arg1);
- const char * errMsg = ndb_mgm_get_latest_error_msg(arg1);
- NDB_exception(NdbMgmException,errMsg);
- }
- }
- /** @} *********************************************************************/
- /**
- * @name Functions: Connect/Disconnect Management Server
- * @{
- */
-
- /**
- * Sets the connectstring for a management server
- *
- * @param handle Management handle
- * @param connect_string Connect string to the management server,
- *
- * @return -1 on error.
- *
- * @code
- * <connectstring> := [<nodeid-specification>,]<host-specification>[,<host-specification>]
- * <nodeid-specification> := nodeid=<id>
- * <host-specification> := <host>[:<port>]
- * <id> is an integer greater than 0 identifying a node in config.ini
- * <port> is an integer referring to a regular unix port
- * <host> is a string containing a valid network host address
- * @endcode
- */
- int setConnectstring(const char *connect_string) {
- return ndb_mgm_set_connectstring($self,connect_string);
- }
-
- /**
- * Returns the number of management servers in the connect string
- * (as set by ndb_mgm_set_connectstring()). This can be used
- * to help work out how long the maximum amount of time that
- * ndb_mgm_connect can take.
- *
- * @param handle Management handle
- *
- * @return < 0 on error
- */
-
- /**
- * Set local bindaddress
- * @param arg - Srting of form "host[:port]"
- * @note must be called before connect
- * @note Error on binding local address will not be reported until connect
- * @return 0 on success
- */
- int setBindaddress(const char * arg) {
- return ndb_mgm_set_bindaddress($self, arg);
- }
-
- /**
- * Gets the connectstring used for a connection
- *
- * @note This function returns the default connectstring if no call to
- * ndb_mgm_set_connectstring() has been performed. Also, the
- * returned connectstring may be formatted differently.
- *
- * @param handle Management handle
- * @param buf Buffer to hold result
- * @param buf_sz Size of buffer.
- *
- * @return connectstring (same as <var>buf</var>)
- */
-// TODO: Do something sensible with this
-// const char *ndb_mgm_get_connectstring(NdbMgmHandle handle, char *buf, int buf_sz);
-
- /**
- *
- * @param handle NdbMgmHandle
- * @param seconds number of seconds
- * @return non-zero on success
- */
- int setConnectTimeout(Uint32 seconds) {
- return ndb_mgm_set_connect_timeout($self, seconds);
- }
-
- /**
- * Connects to a management server. Connectstring is set by
- * ndb_mgm_set_connectstring().
- *
- * The timeout value is for connect to each management server.
- * Use ndb_mgm_number_of_mgmd_in_connect_string to work out
- * the approximate maximum amount of time that could be spent in this
- * function.
- *
- * @param handle Management handle.
- * @param no_retries Number of retries to connect
- * (0 means connect once).
- * @param retry_delay_in_seconds
- * How long to wait until retry is performed.
- * @param verbose Make printout regarding connect retries.
- *
- * @return -1 on error.
- */
- int connect( const char * connectString,int no_retries, int retry_delay_in_seconds, bool verbose) {
- if (ndb_mgm_set_connectstring($self,connectString)==-1)
- return -1;
- return ndb_mgm_connect($self, no_retries, retry_delay_in_seconds, verbose);
- }
- int connect( int no_retries, int retry_delay_in_seconds, bool verbose) {
- return ndb_mgm_connect($self, no_retries, retry_delay_in_seconds, verbose);
- }
-
-
- /**
- * Disconnects from a management server
- *
- * @param handle Management handle.
- * @return -1 on error.
- */
- int disconnect() {
- return ndb_mgm_disconnect($self);
- }
-
- /**
- * Gets connection node ID
- *
- * @param handle Management handle
- *
- * @return Node ID; 0 indicates that no node ID has been
- * specified
- */
- int getConfigurationNodeid() {
- return ndb_mgm_get_configuration_nodeid($self);
- }
-
- /**
- * Gets connection port
- *
- * @param handle Management handle
- *
- * @return port
- */
- int getConnectedPort() {
- return ndb_mgm_get_connected_port($self);
- }
-
-
- %ndbnoexception;
- /**
- * Return true if connected.
- *
- * @param handle Management handle
- * @return 0 if not connected, non-zero if connected.
- */
- bool isConnected() {
- return ( ndb_mgm_is_connected($self) == 0 ) ? false : true ;
- }
-
- %ndbexception("NdbMgmException") {
- $action
- if (result == NULL) {
- //int errCode = ndb_mgm_get_latest_error(arg1);
- const char * errMsg = ndb_mgm_get_latest_error_msg(arg1);
- NDB_exception(NdbMgmException,errMsg);
- }
- }
-
- /**
- * Gets connection host
- *
- * @param handle Management handle
- *
- * @return hostname
- */
- const char * getConnectedHost() {
- return ndb_mgm_get_connected_host($self);
- }
-
-
-
- /** @} *********************************************************************/
- /**
- * @name Functions: Backup
- * @{
- */
-
- /**
- * Start backup
- *
- * @param wait_completed 0: Don't wait for confirmation<br>
- * 1: Wait for backup to be started<br>
- * 2: Wait for backup to be completed
- * @param backup_id Backup ID is returned from function.
- * @return Reply message. NULL on error.
- * @note backup_id will not be returned if
- * wait_completed == 0
- */
-
- %ndbexception("NdbMgmException") {
- $action
- if (result->theReply == NULL) {
- //int errCode = ndb_mgm_get_latest_error(arg1);
- const char * errMsg = ndb_mgm_get_latest_error_msg(arg1);
- NDB_exception(NdbMgmException,errMsg);
- }
- }
-
- BackupWrapper * startBackup(BackupStartOption wait_completed) {
-
- ndb_mgm_reply * reply = (ndb_mgm_reply *)malloc(sizeof(ndb_mgm_reply));
- unsigned int backup_id=0;
- if (reply == NULL) {
- return NULL;
- }
- int ret = ndb_mgm_start_backup($self, (int)wait_completed,
- &backup_id, reply);
- if (ret == -1) {
- free(reply);
- return NULL;
- }
- BackupWrapper * reply_wrapper = (BackupWrapper *)malloc(sizeof(BackupWrapper));
- if (reply_wrapper == NULL) {
- free(reply);
- return NULL;
- }
- reply_wrapper->theReply=reply;
- reply_wrapper->backupId=backup_id;
- return reply_wrapper;
- }
-
- /**
- * Abort backup
- *
- * @param backup_id Backup ID.
- * @return Reply message. NULL on error.
- */
- %ndbexception("NdbMgmException") {
- $action
- if (result == NULL) {
- //int errCode = ndb_mgm_get_latest_error(arg1);
- const char * errMsg = ndb_mgm_get_latest_error_msg(arg1);
- NDB_exception(NdbMgmException,errMsg);
- }
- }
-
- %newobject abortBackup;
- ndb_mgm_reply* abortBackup(unsigned int backup_id) {
- ndb_mgm_reply * reply = (ndb_mgm_reply *)malloc(sizeof(ndb_mgm_reply));
- if (reply == NULL) {
- return NULL;
- }
- int ret = ndb_mgm_abort_backup($self, backup_id, reply);
- if (ret == -1) {
- free(reply);
- return NULL;
- }
- return reply;
- }
-
- /** @} *********************************************************************/
- /**
- * @name Functions: Cluster status
- * @{
- */
-
- /**
- * Gets status of the nodes in an NDB Cluster
- *
- * @note The caller must free the pointer returned by this function.
- *
- *
- * @return Cluster state (or <var>NULL</var> on error).
- */
- %newobject getStatus;
- ndb_mgm_cluster_state * getStatus() {
- return ndb_mgm_get_status($self);
- }
-
-
- %ndbexception("NdbMgmException") {
- $action
- if (result != NULL && result->return_code < 0) {
- //int errCode = ndb_mgm_get_latest_error(arg1);
- NDB_exception(NdbMgmException,result->message);
- } else if (result == NULL) {
- const char * errMsg = ndb_mgm_get_latest_error_msg(arg1);
- NDB_exception(NdbMgmException,errMsg);
- }
- }
-
- /** @} *********************************************************************/
- /**
- * @name Functions: Single User Mode
- * @{
- */
-
- /**
- * Enter Single user mode
- *
- * @param handle NDB management handle.
- * @param nodeId Node ID of the single user node
- * @param reply Reply message.
- * @return -1 on error.
- */
- %newobject enterSingleUserMode;
- ndb_mgm_reply * enterSingleUserMode(unsigned int nodeId)
- {
- ndb_mgm_reply * reply = (ndb_mgm_reply *)malloc(sizeof(ndb_mgm_reply));
- if (reply == NULL) {
- return NULL;
- }
- memset(reply,0,sizeof(ndb_mgm_reply));
- int ret = ndb_mgm_enter_single_user($self, nodeId, reply);
-
- if (ret == -1) {
- free(reply);
- return NULL;
- }
- return reply;
- }
-
- /**
- * Exit Single user mode
- *
- * @param handle NDB management handle.
- * @param reply Reply message.
- *
- * @return -1 on error.
- */
- %newobject exitSingleUserMode;
- ndb_mgm_reply * exitSingleUserMode()
- {
- ndb_mgm_reply * reply = (ndb_mgm_reply *)malloc(sizeof(ndb_mgm_reply));
- if (reply == NULL) {
- return NULL;
- }
- memset(reply,0,sizeof(ndb_mgm_reply));
- int ret = ndb_mgm_exit_single_user($self,reply);
- if (ret == -1) {
- free(reply);
- return NULL;
- }
- return reply;
- }
-
-
- %ndbexception("NdbMgmException") {
- $action
- if (result == -1) {
- //int errCode = ndb_mgm_get_latest_error(arg1);
- const char * errMsg = ndb_mgm_get_latest_error_msg(arg1);
- NDB_exception(NdbMgmException,errMsg);
- }
- }
-
- /** @} *********************************************************************/
- /**
- * @name Functions: Start/stop nodes
- * @{
- */
-
- /**
- * Stops database nodes
- *
- * @param handle Management handle.
- * @param no_of_nodes Number of database nodes to be stopped<br>
- * 0: All database nodes in cluster<br>
- * n: Stop the <var>n</var> node(s) specified in the
- * array node_list
- * @param node_list List of node IDs for database nodes to be stopped
- *
- * @return Number of nodes stopped (-1 on error)
- *
- * @note This function is equivalent
- * to calling ndb_mgm_stop2(handle, no_of_nodes, node_list, 0)
- */
- %apply int *INOUT { int *node_list };
- int stop(int no_of_nodes, const int * node_list) {
- return ndb_mgm_stop($self,no_of_nodes,node_list);
- }
-
- /**
- * Stops database nodes
- *
- * @param handle Management handle.
- * @param no_of_nodes Number of database nodes to stop<br>
- * 0: All database nodes in cluster<br>
- * n: Stop the <var>n</var> node(s) specified in
- * the array node_list
- * @param node_list List of node IDs of database nodes to be stopped
- * @param abort Don't perform graceful stop,
- * but rather stop immediately
- *
- * @return Number of nodes stopped (-1 on error).
- */
- int stop(int no_of_nodes, const int * node_list, bool abort) {
- return ndb_mgm_stop2($self,no_of_nodes,node_list,abort);
- }
-
- /**
- * Stops cluster nodes
- *
- * @param handle Management handle.
- * @param no_of_nodes Number of database nodes to stop<br>
- * -1: All database and management nodes<br>
- * 0: All database nodes in cluster<br>
- * n: Stop the <var>n</var> node(s) specified in
- * the array node_list
- * @param node_list List of node IDs of database nodes to be stopped
- * @param abort Don't perform graceful stop,
- * but rather stop immediately
- * @param disconnect Returns true if you need to disconnect to apply
- * the stop command (e.g. stopping the mgm server
- * that handle is connected to)
- *
- * @return Number of nodes stopped (-1 on error).
- */
- %apply int *OUTPUT { int *disconnect };
-
- int stop(int no_of_nodes, const int * node_list, bool abort, int *disconnect) {
- return ndb_mgm_stop3($self,no_of_nodes,node_list,abort,disconnect);
- }
-
-
- /**
- * Restart database nodes
- *
- * @param handle Management handle.
- * @param no_of_nodes Number of database nodes to restart<br>
- * 0: All database nodes in cluster<br>
- * n: Restart the <var>n</var> node(s) specified in the
- * array node_list
- * @param node_list List of node IDs of database nodes to be restarted
- *
- * @return Number of nodes restarted (-1 on error).
- *
- * @note This function is equivalent to calling
- * ndb_mgm_restart2(handle, no_of_nodes, node_list, 0, 0, 0);
- */
- int restart(int no_of_nodes, const int * node_list) {
- return ndb_mgm_restart($self,no_of_nodes,node_list);
- }
-
- /**
- * Restart database nodes
- *
- * @param handle Management handle.
- * @param no_of_nodes Number of database nodes to be restarted:<br>
- * 0: Restart all database nodes in the cluster<br>
- * n: Restart the <var>n</var> node(s) specified in the
- * array node_list
- * @param node_list List of node IDs of database nodes to be restarted
- * @param initial Remove filesystem from restarting node(s)
- * @param nostart Don't actually start node(s) but leave them
- * waiting for start command
- * @param abort Don't perform graceful restart,
- * but rather restart immediately
- *
- * @return Number of nodes stopped (-1 on error).
- */
- int restart(int no_of_nodes,const int * node_list, bool initial,
- bool nostart, bool abort) {
- return ndb_mgm_restart2($self, no_of_nodes, node_list, initial, nostart, abort);
- }
-
- /**
- * Restart nodes
- *
- * @param handle Management handle.
- * @param no_of_nodes Number of database nodes to be restarted:<br>
- * 0: Restart all database nodes in the cluster<br>
- * n: Restart the <var>n</var> node(s) specified in the
- * array node_list
- * @param node_list List of node IDs of database nodes to be restarted
- * @param initial Remove filesystem from restarting node(s)
- * @param nostart Don't actually start node(s) but leave them
- * waiting for start command
- * @param abort Don't perform graceful restart,
- * but rather restart immediately
- * @param disconnect Returns true if mgmapi client must disconnect from
- * server to apply the requested operation. (e.g.
- * restart the management server)
- *
- *
- * @return Number of nodes stopped (-1 on error).
- */
- int restart(int no_of_nodes, const int * node_list, int initial,
- int nostart, int abort, int *disconnect) {
-
- return ndb_mgm_restart3($self, no_of_nodes, node_list, initial, nostart,
- abort, disconnect);
- }
-
- /**
- * Start database nodes
- *
- * @param handle Management handle.
- * @param no_of_nodes Number of database nodes to be started<br>
- * 0: Start all database nodes in the cluster<br>
- * n: Start the <var>n</var> node(s) specified in
- * the array node_list
- * @param node_list List of node IDs of database nodes to be started
- *
- * @return Number of nodes actually started (-1 on error).
- *
- * @note The nodes to be started must have been started with nostart(-n)
- * argument.
- * This means that the database node binary is started and
- * waiting for a START management command which will
- * actually enable the database node
- */
- int start(int no_of_nodes,
- const int * node_list) {
- return ndb_mgm_start($self, no_of_nodes, node_list);
- }
-
-
- /** @} *********************************************************************/
- /**
- * @name Functions: Controlling Clusterlog output
- * @{
- */
-
- %ndbexception("NdbMgmException") {
- $action
- if (result == -1) {
- //int errCode = ndb_mgm_get_latest_error(arg1);
- const char * errMsg = ndb_mgm_get_latest_error_msg(arg1);
- NDB_exception(NdbMgmException,errMsg);
- }
- }
-
- /**
- * Filter cluster log severities
- *
- * @param handle NDB management handle.
- * @param severity A cluster log severity to filter.
- * @param enable set 1=enable o 0=disable
- * @param reply Reply message.
- *
- * @return -1 on error.
- */
- int setClusterlogSeverityFilter(ndb_mgm_event_severity severity,
- int enable) {
-
- ndb_mgm_reply * reply = NULL;
- int ret = ndb_mgm_set_clusterlog_severity_filter($self, severity, enable, reply);
- if (reply->return_code != 0) {
- ret = -1;
- }
- free(reply);
- return ret;
- }
-
- /**
- * Set log category and levels for the cluster log
- *
- * @param handle NDB management handle.
- * @param nodeId Node ID.
- * @param category Event category.
- * @param level Log level (0-15).
- * @param reply Reply message.
- * @return -1 on error.
- */
- int getClusterlogLoglevel(int nodeId,
- ndb_mgm_event_category category,
- int level, ndb_mgm_reply * reply) {
-
- return ndb_mgm_set_clusterlog_loglevel(self,
- nodeId, category, level,
- reply);
- }
-
- /**
- * Listen to log events. They are read from the return file descriptor
- * and the format is textual, and the same as in the cluster log.
- *
- * @param handle NDB management handle.
- * @param filter pairs of { level, ndb_mgm_event_category } that will be
- * pushed to fd, level=0 ends list.
- *
- * @return fd filedescriptor to read events from
- */
- // TODO: Returns a filedescriptor - um, gonna have to figure that out
- //int ndb_mgm_listen_event(NdbMgmHandle handle, const int filter[])
-
-
- %ndbexception("NdbMgmException") {
- $action
- if (result == NULL) {
- //int errCode = ndb_mgm_get_latest_error(arg1);
- const char * errMsg = ndb_mgm_get_latest_error_msg(arg1);
- NDB_exception(NdbMgmException,errMsg);
- }
- }
-
- /**
- * Get clusterlog severity filter
- *
- * @param handle NDB management handle
- *
- * @param loglevel A vector of seven (NDB_MGM_EVENT_SEVERITY_ALL)
- * elements of struct ndb_mgm_severity,
- * where each element contains
- * 1 if a severity indicator is enabled and 0 if not.
- * A severity level is stored at position
- * ndb_mgm_clusterlog_level;
- * for example the "error" level is stored in position
- * [NDB_MGM_EVENT_SEVERITY_ERROR].
- * The first element [NDB_MGM_EVENT_SEVERITY_ON] in
- * the vector signals whether the cluster log
- * is disabled or enabled.
- * @param severity_size The size of the vector (NDB_MGM_EVENT_SEVERITY_ALL)
- * @return Number of returned severities or -1 on error
- */
- %newobject getClusterLogSeverityFilter;
- ndb_mgm_severity* getClusterLogSeverityFilter() {
- ndb_mgm_severity * theSeverity = NULL;
- int ret = ndb_mgm_get_clusterlog_severity_filter($self,
- theSeverity,
- NDB_MGM_EVENT_SEVERITY_ALL);
- if (ret == -1) {
- theSeverity = NULL;
- }
- return theSeverity;
- }
-
-
-
- /**
- * get log category and levels
- *
- * @param handle NDB management handle.
- * @param loglevel A vector of twelve (MGM_LOGLEVELS) elements
- * of struct ndb_mgm_loglevel,
- * where each element contains
- * loglevel of corresponding category
- * @param loglevel_size The size of the vector (MGM_LOGLEVELS)
- * @return Number of returned loglevels or -1 on error
- */
- ndb_mgm_loglevel * getClusterlogLoglevel() {
- ndb_mgm_loglevel * theLoglevel = NULL;
- int ret = ndb_mgm_get_clusterlog_loglevel($self, theLoglevel, MGM_LOGLEVELS);
- if (ret == -1) {
- theLoglevel = NULL;
- }
- return theLoglevel;
- }
-
- /**
- * Listen to log events.
- *
- * @param handle NDB management handle.
- * @param filter pairs of { level, ndb_mgm_event_category } that will be
- * pushed to fd, level=0 ends list.
- *
- * @return NdbLogEventHandle
- */
- %newobject createNdbLogEventManager;
- NdbLogEventManager * createNdbLogEventManager(const std::vector<NdbFilterItem> filter) {
-
- int theFilter[filter.size()*2+1];
- for(unsigned x=0;x<filter.size();x++) {
- theFilter[x*2]=filter[x].level;
- theFilter[x*2+1]=(int)(filter[x].category);
- }
- theFilter[filter.size()*2]=0;
- return new NdbLogEventManager(ndb_mgm_create_logevent_handle($self,theFilter));
- }
- %apply int *INOUT { int * filter };
- NdbLogEventManager * createNdbLogEventManager(const int * filter) {
-
- return new NdbLogEventManager(ndb_mgm_create_logevent_handle($self,filter));
- }
-
-
- %newobject dumpState;
- %apply int *INOUT { const int * args };
- ndb_mgm_reply * dumpState(int nodeId,
- const int * args,
- int num_args) {
- ndb_mgm_reply * reply = (ndb_mgm_reply *)malloc(sizeof(ndb_mgm_reply));
- if (reply == NULL) {
- return NULL;
- }
- int ret = ndb_mgm_dump_state($self,nodeId,args,num_args,reply);
- if (ret == -1) {
- free(reply);
- return NULL;
- }
- return reply;
-
- }
-
- %ndbexception("NdbMgmException") {
- $action
- if (result < 0) {
- //int errCode = ndb_mgm_get_latest_error(arg1);
- const char * errMsg = ndb_mgm_get_latest_error_msg(arg1);
- NDB_exception(NdbMgmException,errMsg);
- }
- }
-
- int dumpState(int nodeId, int theState) {
- ndb_mgm_reply * reply = (ndb_mgm_reply *)malloc(sizeof(ndb_mgm_reply));
- if (reply == NULL) {
- return -1;
- }
- int theArgs[1];
- theArgs[0]=theState;
- int ret = ndb_mgm_dump_state($self,nodeId,theArgs,1,reply);
- free(reply);
- return ret;
- }
-
- %ndbnoexception;
-};
-
=== removed file 'storage/ndb/swig/mgmapi/NdbMgmFactory.i'
--- a/storage/ndb/swig/mgmapi/NdbMgmFactory.i 2008-03-11 15:27:35 +0000
+++ b/storage/ndb/swig/mgmapi/NdbMgmFactory.i 1970-01-01 00:00:00 +0000
@@ -1,64 +0,0 @@
-/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
- *
- * Copyright (C) 2008 MySQL, Inc.
- *
- * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-%newobject NdbMgmFactory::createNdbMgm;
-
-%{
-
- class NdbMgmFactory
- {
-
- public:
- static ndb_mgm_handle * createNdbMgm(const char * connectString = 0)
- {
- ndb_mgm_handle * handle = ndb_mgm_create_handle();
- if (handle == NULL) {
- return NULL;
- }
- if (connectString != 0) {
- int ret = ndb_mgm_set_connectstring(handle,connectString);
- if (ret == -1) {
- free(handle);
- return NULL;
- }
- }
- return handle;
- }
- };
-
- %}
-
-
-class NdbMgmFactory
-{
- // We list these here as private so that SWIG doesnt generate them
- NdbMgmFactory();
- ~NdbMgmFactory();
-public:
-
- %ndbexception("NdbMgmException") {
- $action
- if (result==NULL) {
- NDB_exception(NdbMgmException,"Couldn't allocate NdbMgm");
- }
- }
- static ndb_mgm_handle * createNdbMgm(const char * connectString = 0);
-};
-
=== removed file 'storage/ndb/swig/mgmapi/NdbMgmReply.i'
--- a/storage/ndb/swig/mgmapi/NdbMgmReply.i 2008-03-11 15:27:35 +0000
+++ b/storage/ndb/swig/mgmapi/NdbMgmReply.i 1970-01-01 00:00:00 +0000
@@ -1,49 +0,0 @@
-/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
- *
- * Copyright (C) 2008 MySQL, Inc.
- *
- * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * Default reply from the server (reserved for future use)
- */
-%rename ndb_mgm_reply NdbMgmReply;
-
-class ndb_mgm_reply {
-private:
- ndb_mgm_reply();
- ~ndb_mgm_reply();
- /** 0 if successful, otherwise error code. */
- int return_code;
- /** Error or reply message.*/
- char message[256];
-
-};
-
-%extend ndb_mgm_reply {
-
-public:
-
- int getReturnCode() {
- return $self->return_code;
- }
-
- const char * getMessage() {
- return $self->message;
- }
-
-};
=== removed file 'storage/ndb/swig/mgmapi/NodeState.i'
--- a/storage/ndb/swig/mgmapi/NodeState.i 2008-03-11 15:27:35 +0000
+++ b/storage/ndb/swig/mgmapi/NodeState.i 1970-01-01 00:00:00 +0000
@@ -1,133 +0,0 @@
-/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
- *
- * Copyright (C) 2008 MySQL, Inc.
- *
- * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * Status of a node in the cluster.
- *
- * Sub-structure in enum ndb_mgm_cluster_state
- * returned by ndb_mgm_get_status().
- *
- * @note <var>node_status</var>, <var>start_phase</var>,
- * <var>dynamic_id</var>
- * and <var>node_group</var> are relevant only for database nodes,
- * i.e. <var>node_type</var> == @ref NDB_MGM_NODE_TYPE_NDB.
- */
-%rename ndb_mgm_node_state NodeState;
-struct ndb_mgm_node_state {
- /** NDB Cluster node ID*/
-private:
- ndb_mgm_node_state();
- ~ndb_mgm_node_state();
- int node_id;
- /** Type of NDB Cluster node*/
- enum ndb_mgm_node_type node_type;
- /** State of node*/
- enum ndb_mgm_node_status node_status;
- /** Start phase.
- *
- * @note Start phase is only valid if the <var>node_type</var> is
- * NDB_MGM_NODE_TYPE_NDB and the <var>node_status</var> is
- * NDB_MGM_NODE_STATUS_STARTING
- */
- int start_phase;
- /** ID for heartbeats and master take-over (only valid for DB nodes)
- */
- int dynamic_id;
- /** Node group of node (only valid for DB nodes)*/
- int node_group;
- /** Internal version number*/
- int version;
- /** Number of times node has connected or disconnected to the
- * management server
- */
- int connect_count;
- /** IP address of node when it connected to the management server.
- * @note This value will be empty if the management server has restarted
- * since the node last connected.
- */
- %immutable;
- char connect_address[];
- %mutable;
-
-};
-
-%extend ndb_mgm_node_state {
-
-public:
- char * getConnectAddress(void) {
- return $self->connect_address;
- }
-
- int getConnectCount() {
- return $self->connect_count;
- }
-
- int getDynamicID() {
- return $self->dynamic_id;
- }
-
- int getNodeGroup() {
- return $self->node_group;
- }
-
- int getNodeID() {
- return $self->node_id;
- }
-
- ndb_mgm_node_status getNodeStatus() {
- return $self->node_status;
- }
-
- ndb_mgm_node_type getNodeType() {
- return $self->node_type;
- }
-
- int getStartPhase() {
- return $self->start_phase;
- }
-
- int getVersion() {
- return $self->version;
- }
-
- const char * getStartupPhase() {
- const char * startPhaseStr;
-
- switch ($self->start_phase) {
- case 0: startPhaseStr="Startup Phase 0. Clearing the filesystem, --initial was specified as startup option."; break;
- case 1: startPhaseStr="Startup Phase 1. Establishing inter-node connections in cluster."; break;
- case 2: startPhaseStr="Startup Phase 2. The arbitrator node is elected. If this is a system restart, the cluster determines the latest restorable global checkpoint."; break;
- case 3: startPhaseStr="Startup Phase 3. This stage initializes a number of internal cluster variables."; break;
- case 4: startPhaseStr="Startup Phase 4. If initial (re)start: redo log files are created. If system restart: read schemas, LCP, redo logs up to last GCP. Node restart: Find tail of redo log."; break;
- case 5: startPhaseStr="Startup Phase 5. If initial start: creating internal system tables. If node restart or initial restart: include node in transactions, synchronise with node group and master."; break;
- case 6: startPhaseStr="Startup Phase 6. Update Internal variables."; break;
- case 7: startPhaseStr="Startup Phase 7. Update Internal variables."; break;
- case 8: startPhaseStr="Startup Phase 8. If system restart: rebuild all indexes."; break;
- case 9: startPhaseStr="Startup Phase 9. Update Internal variables."; break;
- case 10: startPhaseStr="Startup Phase 10. If node restart or initial node restart: API nodes may connect and send events."; break;
- case 11: startPhaseStr="Startup Phase 11. If node restart or initial node restart: taking responsibility for new transactions. After this pahse, the new node can now act as transaction coordinator."; break;
- default: startPhaseStr="Undefined Startup Phase"; break;
- }
- return startPhaseStr;
- }
-
-
-};
-
=== removed file 'storage/ndb/swig/mgmapi/events.i'
--- a/storage/ndb/swig/mgmapi/events.i 2008-03-11 15:27:35 +0000
+++ b/storage/ndb/swig/mgmapi/events.i 1970-01-01 00:00:00 +0000
@@ -1,49 +0,0 @@
-/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
- *
- * Copyright (C) 2008 MySQL, Inc.
- *
- * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-%import "mgmapi/mgmglobals.i"
-%import "mgmapi/NdbLogEvent.i"
-%import "mgmapi/listeners.i"
-
-
-%{
-
-#include <stdio.h>
-#include <vector>
-
-#undef PACKAGE
-#undef PACKAGE_NAME
-#undef PACKAGE_STRING
-#undef PACKAGE_TARNAME
-#undef PACKAGE_VERSION
-#undef VERSION
-
-#include "config.h"
-#include "ndb_init.h"
-#include "storage/ndb/mgmapi/mgmapi.h"
-#include "mgmapi_debug.h"
-#include "listeners.hpp"
-#include "events.hpp"
-
-%}
-
-%ignore getEventType;
-%ignore le_handleEvent;
-%include "events.hpp"
=== removed file 'storage/ndb/swig/mgmapi/listeners.i'
--- a/storage/ndb/swig/mgmapi/listeners.i 2008-03-11 15:27:35 +0000
+++ b/storage/ndb/swig/mgmapi/listeners.i 1970-01-01 00:00:00 +0000
@@ -1,47 +0,0 @@
-/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
- *
- * Copyright (C) 2008 MySQL, Inc.
- *
- * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-%import "mgmapi/mgmglobals.i"
-%import "mgmapi/NdbLogEvent.i"
-%import "mgmapi/events.i"
-%import "mgmapi/NdbLogEventManager.i"
-
-%{
-
-#include <stdio.h>
-#include <vector>
-
-#undef PACKAGE
-#undef PACKAGE_NAME
-#undef PACKAGE_STRING
-#undef PACKAGE_TARNAME
-#undef PACKAGE_VERSION
-#undef VERSION
-
-#include "config.h"
-#include "ndb_init.h"
-#include "storage/ndb/mgmapi/mgmapi.h"
-#include "mgmapi_debug.h"
-#include "listeners.hpp"
-#include "events.hpp"
-
- %}
-
-%include "listeners.hpp"
=== removed file 'storage/ndb/swig/mgmapi/mgmglobals.i'
--- a/storage/ndb/swig/mgmapi/mgmglobals.i 2008-03-11 15:27:35 +0000
+++ b/storage/ndb/swig/mgmapi/mgmglobals.i 1970-01-01 00:00:00 +0000
@@ -1,455 +0,0 @@
-/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
- *
- * Copyright (C) 2008 MySQL, Inc.
- *
- * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-%include "globals.i"
-%include "std_vector.i"
-
-%{
-#include <stdio.h>
-#include <vector>
-
-#undef PACKAGE
-#undef PACKAGE_NAME
-#undef PACKAGE_STRING
-#undef PACKAGE_TARNAME
-#undef PACKAGE_VERSION
-#undef VERSION
-
-#include "config.h"
-
-#include "ndb_init.h"
-#include "storage/ndb/mgmapi/mgmapi.h"
-#include "mgmapi_debug.h"
-
-
- %}
-
-%inline %{
-
- enum BackupStartOption {
- DontWait = 0,
- WaitUntilBackupStarted = 1,
- WaitUntilBackupCompleted = 2
- };
-
- %}
-
-%include "ndb_constants.h"
- //%include "ndb_logevent.h"
-
-#define MGM_LOGLEVELS CFG_MAX_LOGLEVEL - CFG_MIN_LOGLEVEL + 1
-#define NDB_MGM_MAX_LOGLEVEL 15
-
-
-
- /**
- * NDB Cluster node types
- */
- // API: 1 MGM: 2 NDB: 0
-%rename ndb_mgm_node_type NodeType;
-enum ndb_mgm_node_type {
- NDB_MGM_NODE_TYPE_UNKNOWN = -1 /** Node type not known*/
- ,NDB_MGM_NODE_TYPE_NDB = NODE_TYPE_DB /** A database node */
- ,NDB_MGM_NODE_TYPE_API = NODE_TYPE_API /** An application (NdbApi) node */
- ,NDB_MGM_NODE_TYPE_MGM = NODE_TYPE_MGM /** A management server node */
-};
-
-/**
- * Database node status
- */
-%rename ndb_mgm_node_status NodeStatus;
-enum ndb_mgm_node_status {
- /** Node status not known*/
- NDB_MGM_NODE_STATUS_UNKNOWN = 0,
- /** No contact with node*/
- NDB_MGM_NODE_STATUS_NO_CONTACT = 1,
- /** Has not run starting protocol*/
- NDB_MGM_NODE_STATUS_NOT_STARTED = 2,
- /** Is running starting protocol*/
- NDB_MGM_NODE_STATUS_STARTING = 3,
- /** Running*/
- NDB_MGM_NODE_STATUS_STARTED = 4,
- /** Is shutting down*/
- NDB_MGM_NODE_STATUS_SHUTTING_DOWN = 5,
- /** Is restarting*/
- NDB_MGM_NODE_STATUS_RESTARTING = 6,
- /** Maintenance mode*/
- NDB_MGM_NODE_STATUS_SINGLEUSER = 7,
- /** Resume mode*/
- NDB_MGM_NODE_STATUS_RESUME = 8,
-};
-
-/**
- * Error codes
- */
-%rename ndb_mgm_error NdbMgmError;
-enum ndb_mgm_error {
- /** Not an error */
- NDB_MGM_NO_ERROR = 0,
-
- /* Request for service errors */
- /** Supplied connectstring is illegal */
- NDB_MGM_ILLEGAL_CONNECT_STRING = 1001,
- /** Supplied NdbMgmHandle is illegal */
- NDB_MGM_ILLEGAL_SERVER_HANDLE = 1005,
- /** Illegal reply from server */
- NDB_MGM_ILLEGAL_SERVER_REPLY = 1006,
- /** Illegal number of nodes */
- NDB_MGM_ILLEGAL_NUMBER_OF_NODES = 1007,
- /** Illegal node status */
- NDB_MGM_ILLEGAL_NODE_STATUS = 1008,
- /** Memory allocation error */
- NDB_MGM_OUT_OF_MEMORY = 1009,
- /** Management server not connected */
- NDB_MGM_SERVER_NOT_CONNECTED = 1010,
- /** Could not connect to socker */
- NDB_MGM_COULD_NOT_CONNECT_TO_SOCKET = 1011,
- /** Could not bind local address */
- NDB_MGM_BIND_ADDRESS = 1012,
-
- /* Alloc node id failures */
- /** Generic error, retry may succeed */
- NDB_MGM_ALLOCID_ERROR = 1101,
- /** Non retriable error */
- NDB_MGM_ALLOCID_CONFIG_MISMATCH = 1102,
-
- /* Service errors - Start/Stop Node or System */
- /** Start failed */
- NDB_MGM_START_FAILED = 2001,
- /** Stop failed */
- NDB_MGM_STOP_FAILED = 2002,
- /** Restart failed */
- NDB_MGM_RESTART_FAILED = 2003,
-
- /* Service errors - Backup */
- /** Unable to start backup */
- NDB_MGM_COULD_NOT_START_BACKUP = 3001,
- /** Unable to abort backup */
- NDB_MGM_COULD_NOT_ABORT_BACKUP = 3002,
-
- /* Service errors - Single User Mode */
- /** Unable to enter single user mode */
- NDB_MGM_COULD_NOT_ENTER_SINGLE_USER_MODE = 4001,
- /** Unable to exit single user mode */
- NDB_MGM_COULD_NOT_EXIT_SINGLE_USER_MODE = 4002,
-
- /* Usage errors */
- /** Usage error */
- NDB_MGM_USAGE_ERROR = 5001
-};
-
-%rename ndb_mgm_event_severity NdbLogEventSeverity;
-enum ndb_mgm_event_severity {
- NDB_MGM_ILLEGAL_EVENT_SEVERITY = -1,
- /* Must be a nonnegative integer (used for array indexing) */
- /** Cluster log on */
- NDB_MGM_EVENT_SEVERITY_ON = 0,
- /** Used in NDB Cluster developement */
- NDB_MGM_EVENT_SEVERITY_DEBUG = 1,
- /** Informational messages*/
- NDB_MGM_EVENT_SEVERITY_INFO = 2,
- /** Conditions that are not error condition, but might require handling.
- */
- NDB_MGM_EVENT_SEVERITY_WARNING = 3,
- /** Conditions that, while not fatal, should be corrected. */
- NDB_MGM_EVENT_SEVERITY_ERROR = 4,
- /** Critical conditions, like device errors or out of resources */
- NDB_MGM_EVENT_SEVERITY_CRITICAL = 5,
- /** A condition that should be corrected immediately,
- * such as a corrupted system
- */
- NDB_MGM_EVENT_SEVERITY_ALERT = 6,
- /* must be next number, works as bound in loop */
- /** All severities */
- NDB_MGM_EVENT_SEVERITY_ALL = 7
-};
-
-/**
- * Log event categories, used to set filter level on the log events using
- * ndb_mgm_set_clusterlog_loglevel() and ndb_mgm_listen_event()
- */
-%rename ndb_mgm_event_category NdbLogEventCategory;
-enum ndb_mgm_event_category {
- /**
- * Invalid log event category
- */
- NDB_MGM_ILLEGAL_EVENT_CATEGORY = -1,
- /**
- * Log events during all kinds of startups
- */
- NDB_MGM_EVENT_CATEGORY_STARTUP = CFG_LOGLEVEL_STARTUP,
- /**
- * Log events during shutdown
- */
- NDB_MGM_EVENT_CATEGORY_SHUTDOWN = CFG_LOGLEVEL_SHUTDOWN,
- /**
- * Statistics log events
- */
- NDB_MGM_EVENT_CATEGORY_STATISTIC = CFG_LOGLEVEL_STATISTICS,
- /**
- * Log events related to checkpoints
- */
- NDB_MGM_EVENT_CATEGORY_CHECKPOINT = CFG_LOGLEVEL_CHECKPOINT,
- /**
- * Log events during node restart
- */
- NDB_MGM_EVENT_CATEGORY_NODE_RESTART = CFG_LOGLEVEL_NODERESTART,
- /**
- * Log events related to connections between cluster nodes
- */
- NDB_MGM_EVENT_CATEGORY_CONNECTION = CFG_LOGLEVEL_CONNECTION,
- /**
- * Backup related log events
- */
- NDB_MGM_EVENT_CATEGORY_BACKUP = CFG_LOGLEVEL_BACKUP,
- /**
- * Congestion related log events
- */
- NDB_MGM_EVENT_CATEGORY_CONGESTION = CFG_LOGLEVEL_CONGESTION,
- /**
- * Loglevel debug
- */
- NDB_MGM_EVENT_CATEGORY_DEBUG = CFG_LOGLEVEL_DEBUG,
- /**
- * Uncategorized log events (severity info)
- */
- NDB_MGM_EVENT_CATEGORY_INFO = CFG_LOGLEVEL_INFO,
- /**
- * Uncategorized log events (severity warning or higher)
- */
- NDB_MGM_EVENT_CATEGORY_ERROR = CFG_LOGLEVEL_ERROR,
- NDB_MGM_MIN_EVENT_CATEGORY = CFG_MIN_LOGLEVEL,
- NDB_MGM_MAX_EVENT_CATEGORY = CFG_MAX_LOGLEVEL
-
-
-};
-
-
-%rename ndb_mgm_severity NdbMgmSeverity;
-class ndb_mgm_severity {
-public:
- ndb_mgm_event_severity category;
- unsigned int value;
-};
-
-%rename ndb_mgm_loglevel NdbMgmLoglevel;
-class ndb_mgm_loglevel {
-public:
- enum ndb_mgm_event_category category;
- unsigned int value;
-};
-
-%rename Ndb_logevent_type NdbLogEventType;
-enum Ndb_logevent_type {
-
- NDB_LE_ILLEGAL_TYPE = -1,
-
- /** NDB_MGM_EVENT_CATEGORY_CONNECTION */
- NDB_LE_Connected = 0,
- /** NDB_MGM_EVENT_CATEGORY_CONNECTION */
- NDB_LE_Disconnected = 1,
- /** NDB_MGM_EVENT_CATEGORY_CONNECTION */
- NDB_LE_CommunicationClosed = 2,
- /** NDB_MGM_EVENT_CATEGORY_CONNECTION */
- NDB_LE_CommunicationOpened = 3,
- /** NDB_MGM_EVENT_CATEGORY_CONNECTION */
- NDB_LE_ConnectedApiVersion = 51,
-
- /** NDB_MGM_EVENT_CATEGORY_CHECKPOINT */
- NDB_LE_GlobalCheckpointStarted = 4,
- /** NDB_MGM_EVENT_CATEGORY_CHECKPOINT */
- NDB_LE_GlobalCheckpointCompleted = 5,
- /** NDB_MGM_EVENT_CATEGORY_CHECKPOINT */
- NDB_LE_LocalCheckpointStarted = 6,
- /** NDB_MGM_EVENT_CATEGORY_CHECKPOINT */
- NDB_LE_LocalCheckpointCompleted = 7,
- /** NDB_MGM_EVENT_CATEGORY_CHECKPOINT */
- NDB_LE_LCPStoppedInCalcKeepGci = 8,
- /** NDB_MGM_EVENT_CATEGORY_CHECKPOINT */
- NDB_LE_LCPFragmentCompleted = 9,
-
- /** NDB_MGM_EVENT_CATEGORY_STARTUP */
- NDB_LE_NDBStartStarted = 10,
- /** NDB_MGM_EVENT_CATEGORY_STARTUP */
- NDB_LE_NDBStartCompleted = 11,
- /** NDB_MGM_EVENT_CATEGORY_STARTUP */
- NDB_LE_STTORRYRecieved = 12,
- /** NDB_MGM_EVENT_CATEGORY_STARTUP */
- NDB_LE_StartPhaseCompleted = 13,
- /** NDB_MGM_EVENT_CATEGORY_STARTUP */
- NDB_LE_CM_REGCONF = 14,
- /** NDB_MGM_EVENT_CATEGORY_STARTUP */
- NDB_LE_CM_REGREF = 15,
- /** NDB_MGM_EVENT_CATEGORY_STARTUP */
- NDB_LE_FIND_NEIGHBOURS = 16,
- /** NDB_MGM_EVENT_CATEGORY_STARTUP */
- NDB_LE_NDBStopStarted = 17,
- /** NDB_MGM_EVENT_CATEGORY_STARTUP */
- NDB_LE_NDBStopCompleted = 53,
- /** NDB_MGM_EVENT_CATEGORY_STARTUP */
- NDB_LE_NDBStopForced = 59,
- /** NDB_MGM_EVENT_CATEGORY_STARTUP */
- NDB_LE_NDBStopAborted = 18,
- /** NDB_MGM_EVENT_CATEGORY_STARTUP */
- NDB_LE_StartREDOLog = 19,
- /** NDB_MGM_EVENT_CATEGORY_STARTUP */
- NDB_LE_StartLog = 20,
- /** NDB_MGM_EVENT_CATEGORY_STARTUP */
- NDB_LE_UNDORecordsExecuted = 21,
-
- /** NDB_MGM_EVENT_CATEGORY_NODE_RESTART */
- NDB_LE_NR_CopyDict = 22,
- /** NDB_MGM_EVENT_CATEGORY_NODE_RESTART */
- NDB_LE_NR_CopyDistr = 23,
- /** NDB_MGM_EVENT_CATEGORY_NODE_RESTART */
- NDB_LE_NR_CopyFragsStarted = 24,
- /** NDB_MGM_EVENT_CATEGORY_NODE_RESTART */
- NDB_LE_NR_CopyFragDone = 25,
- /** NDB_MGM_EVENT_CATEGORY_NODE_RESTART */
- NDB_LE_NR_CopyFragsCompleted = 26,
-
- /* NODEFAIL */
- /** NDB_MGM_EVENT_CATEGORY_NODE_RESTART */
- NDB_LE_NodeFailCompleted = 27,
- /** NDB_MGM_EVENT_CATEGORY_NODE_RESTART */
- NDB_LE_NODE_FAILREP = 28,
- /** NDB_MGM_EVENT_CATEGORY_NODE_RESTART */
- NDB_LE_ArbitState = 29,
- /** NDB_MGM_EVENT_CATEGORY_NODE_RESTART */
- NDB_LE_ArbitResult = 30,
- /** NDB_MGM_EVENT_CATEGORY_NODE_RESTART */
- NDB_LE_GCP_TakeoverStarted = 31,
- /** NDB_MGM_EVENT_CATEGORY_NODE_RESTART */
- NDB_LE_GCP_TakeoverCompleted = 32,
- /** NDB_MGM_EVENT_CATEGORY_NODE_RESTART */
- NDB_LE_LCP_TakeoverStarted = 33,
- /** NDB_MGM_EVENT_CATEGORY_NODE_RESTART */
- NDB_LE_LCP_TakeoverCompleted = 34,
-
- /** NDB_MGM_EVENT_CATEGORY_STATISTIC */
- NDB_LE_TransReportCounters = 35,
- /** NDB_MGM_EVENT_CATEGORY_STATISTIC */
- NDB_LE_OperationReportCounters = 36,
- /** NDB_MGM_EVENT_CATEGORY_STATISTIC */
- NDB_LE_TableCreated = 37,
- /** NDB_MGM_EVENT_CATEGORY_STATISTIC */
- NDB_LE_UndoLogBlocked = 38,
- /** NDB_MGM_EVENT_CATEGORY_STATISTIC */
- NDB_LE_JobStatistic = 39,
- /** NDB_MGM_EVENT_CATEGORY_STATISTIC */
- NDB_LE_SendBytesStatistic = 40,
- /** NDB_MGM_EVENT_CATEGORY_STATISTIC */
- NDB_LE_ReceiveBytesStatistic = 41,
- /** NDB_MGM_EVENT_CATEGORY_STATISTIC */
- NDB_LE_MemoryUsage = 50,
- /** NDB_MGM_EVENT_CATEGORY_STATISTIC */
- NDB_LE_ThreadConfigLoop = 68,
-
- /** NDB_MGM_EVENT_CATEGORY_ERROR */
- NDB_LE_TransporterError = 42,
- /** NDB_MGM_EVENT_CATEGORY_ERROR */
- NDB_LE_TransporterWarning = 43,
- /** NDB_MGM_EVENT_CATEGORY_ERROR */
- NDB_LE_MissedHeartbeat = 44,
- /** NDB_MGM_EVENT_CATEGORY_ERROR */
- NDB_LE_DeadDueToHeartbeat = 45,
- /** NDB_MGM_EVENT_CATEGORY_ERROR */
- NDB_LE_WarningEvent = 46,
-
- /** NDB_MGM_EVENT_CATEGORY_INFO */
- NDB_LE_SentHeartbeat = 47,
- /** NDB_MGM_EVENT_CATEGORY_INFO */
- NDB_LE_CreateLogBytes = 48,
- /** NDB_MGM_EVENT_CATEGORY_INFO */
- NDB_LE_InfoEvent = 49,
-
- /* 50 used */
- /* 51 used */
-
- /* SINGLE USER */
- NDB_LE_SingleUser = 52,
- /* 53 used */
-
- /** NDB_MGM_EVENT_CATEGORY_BACKUP */
- NDB_LE_BackupStarted = 54,
- /** NDB_MGM_EVENT_CATEGORY_BACKUP */
- NDB_LE_BackupFailedToStart = 55,
- /** NDB_MGM_EVENT_CATEGORY_BACKUP */
- NDB_LE_BackupStatus = 62,
- /** NDB_MGM_EVENT_CATEGORY_BACKUP */
- NDB_LE_BackupCompleted = 56,
- /** NDB_MGM_EVENT_CATEGORY_BACKUP */
- NDB_LE_BackupAborted = 57,
- /** NDB_MGM_EVENT_CATEGORY_BACKUP */
- NDB_LE_RestoreMetaData = 63,
- /** NDB_MGM_EVENT_CATEGORY_BACKUP */
- NDB_LE_RestoreData = 64,
- /** NDB_MGM_EVENT_CATEGORY_BACKUP */
- NDB_LE_RestoreLog = 65,
- /** NDB_MGM_EVENT_CATEGORY_BACKUP */
- NDB_LE_RestoreStarted = 66,
- /** NDB_MGM_EVENT_CATEGORY_BACKUP */
- NDB_LE_RestoreCompleted = 67,
-
- /** NDB_MGM_EVENT_CATEGORY_INFO */
- NDB_LE_EventBufferStatus = 58,
-
- /* 59 used */
-
- /** NDB_MGM_EVENT_CATEGORY_STARTUP */
- NDB_LE_StartReport = 60
-
- /* 61 (used in upcoming patch) */
- /* 62-68 used */
- /* 69 unused */
-
-};
-
-
-%{
-
- class NdbFilterItem {
-
- public:
- int level;
- ndb_mgm_event_category category;
-
- NdbFilterItem(int level=0,
- ndb_mgm_event_category category=NDB_MGM_ILLEGAL_EVENT_CATEGORY) {
- this->level=level;
- this->category=category;
- }
- };
-
- %}
-
-class NdbFilterItem {
-
-
-public:
- int level;
- ndb_mgm_event_category category;
-
- NdbFilterItem(int level=0,
- ndb_mgm_event_category category=NDB_MGM_ILLEGAL_EVENT_CATEGORY);
-};
-
-%template(NdbFilterList) std::vector<NdbFilterItem>;
=== removed directory 'storage/ndb/swig/ndbapi'
=== removed file 'storage/ndb/swig/ndbapi/Ndb.i'
--- a/storage/ndb/swig/ndbapi/Ndb.i 2008-03-11 15:27:35 +0000
+++ b/storage/ndb/swig/ndbapi/Ndb.i 1970-01-01 00:00:00 +0000
@@ -1,256 +0,0 @@
-/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
- *
- * Copyright (C) 2008 MySQL, Inc.
- *
- * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-%delobject Ndb::close;
-%delobject Ndb::closeTransaction;
-
-class Ndb {
-
-public:
- Ndb(Ndb_cluster_connection *ndb_cluster_connection,
- const char* aCatalogName = "", const char* aSchemaName = "def");
- ~Ndb();
-
- %ndbnoexception;
-
- // These are not expected to fail
- const NdbError & getNdbError() const;
- const NdbError & getNdbError(int errorCode);
-
- const char * getDatabaseName() const;
- void setDatabaseName(const char * aDatabaseName);
- const char * getDatabaseSchemaName() const;
- void setDatabaseSchemaName(const char * aDatabaseSchemaName);
-
- void closeTransaction(NdbTransaction*);
-
- NdbEventOperation *nextEvent();
-
- void sendPreparedTransactions(int forceSend = 0);
-
- %ndbexception("NdbApiException") {
- $action
- if (result==-1) {
- NdbError err = arg1->getNdbError();
- NDB_exception(NdbApiException,err.message);
- }
- }
- int dropEventOperation(NdbEventOperation* eventOp);
- int sendPollNdb(int aMillisecondNumber = WAITFOR_RESPONSE_TIMEOUT,
- int minNoOfEventsToWakeup = 1,
- int forceSend = 0);
- int pollNdb(int aMillisecondNumber = WAITFOR_RESPONSE_TIMEOUT,
- int minNoOfEventsToWakeup = 1);
-
- %ndbexception("NdbApiException") {
- $action
- if (result==NULL) {
- NdbError err = arg1->getNdbError();
- NDB_exception(NdbApiException,err.message);
- }
- }
-
- class NdbDictDictionary* getDictionary();
- NdbEventOperation* createEventOperation(const char* eventName);
-
-};
-
-%extend Ndb {
-public:
-
-
- %ndbexception("NdbApiException") init {
- $action
- if (result) {
- NDB_exception(NdbApiException,"Cluster not ready");
- }
- }
- int init(int maxNoOfTransactions = 4) {
- /* This is becoming a no-op, since we're forcing it */
- return 0;
- }
-
- %ndbexception("NdbApiException") {
- $action
- if (result==(Uint64)-1) {
- NdbError err = arg1->getNdbError();
- NDB_exception_err(NdbApiException,err.message,err);
-// TODO: Really? There isn't a better way to do this?
-#if defined(SWIGPERL)
- SWIG_croak_null();
-#else
-#if defined(SWIGPHP)
- return;
-#else
- return (Uint64)0;
-#endif //defined(SWIGPHP)
-#endif //defined(SWIGPERL)
- }
- }
- Uint64 getAutoIncrementValue(const char* aTableName,
- Uint32 cacheSize) {
-
- Uint64 id = 0;
- int ret = self->getAutoIncrementValue(aTableName,id,cacheSize);
- if (ret == -1) {
- return (Uint64)-1;
- }
- return id;
- };
- Uint64 getAutoIncrementValue(NdbDictTable * myTable,
- Uint32 cacheSize) {
-
- Uint64 id = 0;
- int ret = self->getAutoIncrementValue(myTable,id,cacheSize);
- if (ret == -1) {
- return (Uint64)-1;
- }
- return id;
- };
- %ndbexception("NdbApiException") {
- $action
- if (result < 0) {
- NdbError err = arg1->getNdbError();
- NDB_exception_err(NdbApiException,err.message,err);
- }
- }
- int pollEvents(int aMillisecondNumber, Uint64 latestGCI=0) {
- return self->pollEvents(aMillisecondNumber,&latestGCI);
-
- }
- %ndbexception("NdbApiException") {
- $action
- if (result == NULL) {
- NdbError err = arg1->getNdbError();
- NDB_exception(NdbApiException,err.message);
- }
- }
- const NdbEventOperation*
- getGCIEventOperations(Uint32 iter, Uint32 event_types) {
- return self->getGCIEventOperations(&iter,&event_types);
- }
-
- NdbTransaction* startTransaction(const char* aTableName,
- const char * anInputString, size_t len) {
- const NdbDictDictionary *myDict = self->getDictionary();
- const NdbDictTable *myTable = myDict->getTable(aTableName);
-
- Ndb::Key_part_ptr keys[2];
- keys[0].ptr=(const void*)anInputString;
- keys[0].len=len;
- keys[1].ptr=NULL;
- keys[1].len=0;
- return self->startTransaction(myTable,keys);
- }
- NdbTransaction* startTransaction(const char* aTableName,
- short keyData) {
- const NdbDictDictionary *myDict = self->getDictionary();
- const NdbDictTable *myTable = myDict->getTable(aTableName);
-
- Ndb::Key_part_ptr keys[2];
- keys[0].ptr=(const void*)&keyData;
- keys[0].len=sizeof(short);
- keys[1].ptr=NULL;
- keys[1].len=0;
-
- return self->startTransaction(myTable,keys);
- }
- NdbTransaction* startTransaction(const char* aTableName,
- Int32 keyData) {
- const NdbDictDictionary *myDict = self->getDictionary();
- const NdbDictTable *myTable = myDict->getTable(aTableName);
-
- Ndb::Key_part_ptr keys[2];
- keys[0].ptr=(const void*)&keyData;
- keys[0].len=sizeof(Int32);
- keys[1].ptr=NULL;
- keys[1].len=0;
-
- return self->startTransaction(myTable,keys);
- }
- NdbTransaction* startTransaction(const char* aTableName,
- Uint32 keyData) {
- const NdbDictDictionary *myDict = self->getDictionary();
- const NdbDictTable *myTable = myDict->getTable(aTableName);
-
- Ndb::Key_part_ptr keys[2];
- keys[0].ptr=(const void*)&keyData;
- keys[0].len=sizeof(Uint32);
- keys[1].ptr=NULL;
- keys[1].len=0;
-
- return self->startTransaction(myTable,keys);
- }
- NdbTransaction* startTransaction(const NdbDictTable* table,
- const char * anInputString, size_t len) {
-
- Ndb::Key_part_ptr keys[2];
- keys[0].ptr=(const void*)anInputString;
- keys[0].len=len;
- keys[1].ptr=NULL;
- keys[1].len=0;
- return self->startTransaction(table,keys);
- }
- NdbTransaction* startTransaction(const NdbDictTable* table,
- short keyData) {
-
- Ndb::Key_part_ptr keys[2];
- keys[0].ptr=(const void*)&keyData;
- keys[0].len=sizeof(short);
- keys[1].ptr=NULL;
- keys[1].len=0;
-
- return self->startTransaction(table,keys);
- }
- NdbTransaction* startTransaction(const NdbDictTable* table,
- Int32 keyData) {
-
- Ndb::Key_part_ptr keys[2];
- keys[0].ptr=(const void*)&keyData;
- keys[0].len=sizeof(Int32);
- keys[1].ptr=NULL;
- keys[1].len=0;
-
- return self->startTransaction(table,keys);
- }
- NdbTransaction* startTransaction(const NdbDictTable* table,
- Uint32 keyData) {
-
- Ndb::Key_part_ptr keys[2];
- keys[0].ptr=(const void*)&keyData;
- keys[0].len=sizeof(Uint32);
- keys[1].ptr=NULL;
- keys[1].len=0;
-
- return self->startTransaction(table,keys);
- }
-
- NdbTransaction* startTransaction() {
- return self->startTransaction();
- }
-
- %ndbnoexception;
-
- void close() {
- delete self;
- }
-
-};
-
=== removed file 'storage/ndb/swig/ndbapi/NdbBlob.i'
--- a/storage/ndb/swig/ndbapi/NdbBlob.i 2008-03-11 15:27:35 +0000
+++ b/storage/ndb/swig/ndbapi/NdbBlob.i 1970-01-01 00:00:00 +0000
@@ -1,138 +0,0 @@
-/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
- *
- * Copyright (C) 2008 MySQL, Inc.
- *
- * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-class NdbBlob {
-public:
- enum State {
- Idle = 0,
- Prepared = 1,
- Active = 2,
- Closed = 3,
- Invalid = 9
- };
- State getState();
-/* typedef int ActiveHook(NdbBlob* me, char* arg);*/
-
- %ndbexception("NdbApiException") {
- $action
- if (result==-1) {
- NdbError err = arg1->getNdbError();
- NDB_exception(NdbApiException, err.message);
- }
- }
- int getValue(char* BYTE, Uint32 bytes);
-
-#ifdef SWIGPYTHON
- %rename(setVal) setValue(const char* data, Uint32 bytes);
-#endif
-
- int setValue(const char* BYTE, size_t len);
- /* TODO: build the structure for this callback
- int setActiveHook(ActiveHook* activeHook, char* arg);
- */
- int setNull();
- int truncate(Uint64 length = 0);
- int setPos(Uint64 pos);
- int writeData(const char* data, Uint32 bytes);
-
- %ndbexception("NdbErrorNotAvailable") {
- $action
- if (result==NULL) {
- NDB_exception(NdbApiException,"Problem creating NdbError object");
- }
- }
-
- const NdbError& getNdbError() const;
-
- %ndbexception("NdbApiException") {
- $action
- if (result==0) {
- NdbError err = arg1->getNdbError();
- NDB_exception(NdbApiException, err.message);
- }
- }
-
- const NdbDictColumn* getColumn();
- NdbBlob* blobsFirstBlob();
- NdbBlob* blobsNextBlob();
- %exception;
- static int getBlobTableName(char* btname, Ndb* anNdb, const char* tableName, const char* columnName);
-private:
- NdbBlob();
-};
-
-%extend NdbBlob {
-public:
- // Making this an Int64 instead of a Uint32 so that we can return
- // a -1 on error to wrap this properly in exceptions
-
- %ndbexception("NdbApiException") {
- $action
- if (result==-1) {
- NdbError err = arg1->getNdbError();
- NDB_exception(NdbApiException, err.message);
- }
- }
-
- Int64 readData(char * BYTE, size_t len) {
-
- Uint32 b = len;
- int ret=self->readData((void *)BYTE, b);
- if (ret==-1) {
- return -1;
- }
- return (Int64)b;
- }
-
- %ndbexception("NdbApiException") {
- static int ret = 0;
- $action
- if (ret==-1) {
- NdbError err = arg1->getNdbError();
- NDB_exception(NdbApiException, err.message);
- }
- }
-
- bool getNull() {
- static int ret;
- self->getNull(ret);
-
- return (ret==0);
-
- }
-
- Uint64 getLength() {
-
- Uint64 OUTPUT=0;
- static int ret=0;
- ret = self->getLength(OUTPUT);
- return OUTPUT;
- }
-
- Uint64 getPos() {
- Uint64 OUTPUT=0;
- static int ret=0;
- ret = self->getPos(OUTPUT);
- return OUTPUT;
- }
-
- %ndbnoexception;
-
-};
=== removed file 'storage/ndb/swig/ndbapi/NdbClusterConnection.i'
--- a/storage/ndb/swig/ndbapi/NdbClusterConnection.i 2008-03-11 15:27:35 +0000
+++ b/storage/ndb/swig/ndbapi/NdbClusterConnection.i 1970-01-01 00:00:00 +0000
@@ -1,167 +0,0 @@
-/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
- *
- * Copyright (C) 2008 MySQL, Inc.
- *
- * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-class Ndb_cluster_connection {
-
-public:
-
- // NdbFactory.getNdbClusterConnection should be used instead
- Ndb_cluster_connection(const char * connectstring = 0);
-
-#if !defined(SWIG_RUBY_AUTORENAME)
- %rename set_name setName;
- %rename wait_until_ready waitUntilReady;
- %rename set_timeout setTimeout;
-#endif
-
- %ndbnoexception;
-
- void set_name(const char* name);
-
- %ndbexception("NdbApiException") {
- $action
- if (result > 0) {
- const char * msg = "Setting timeout failed";
- NDB_exception(NdbApiException,msg);
- }
- }
-
- voidint set_timeout(int timeout_ms);
-
-
- %ndbexception("NdbClusterConnectionPermanentException,"
- "NdbClusterConnectionTemporaryException") {
- $action
- if (result > 0) {
- const char * msg = "Connect to management server failed";
- NDB_exception(NdbClusterConnectionPermanentException,msg);
- } else if (result < 0) {
- const char * msg = "Connect to management server failed";
- NDB_exception(NdbClusterConnectionTemporaryException,msg);
- }
- }
- %typemap(check) int retry_delay_in_seconds {
- if ($1 < 0) {
- NDB_exception(NdbClusterConnectionPermanentException,
- "Delay must be greater than or equal to zero.");
- }
- }
- int connect(int no_retries=0, int retry_delay_in_seconds=1,
- bool verbose=false);
-
- %ndbexception("NdbApiException") {
- $action
- if (result) {
- const char * msg = "Cluster was not ready";
- NDB_exception(NdbApiException,msg);
- }
- }
-
- int wait_until_ready(int timeoutFor_firstAlive,
- int timeoutAfterFirstAlive);
-
-};
-
-%newobject Ndb_cluster_connection::createNdb;
-%typemap(newfree) Ndb * "delete $1;";
-%delobject Ndb_cluster_connection::close;
-
-%extend Ndb_cluster_connection {
-
- %ndbnoexception;
-
- bool close() {
- delete self;
- return true;
- }
-
- void deleteAllNdbObjects() {
-
- const Ndb * tmpNdb = NULL;
-
- self->lock_ndb_objects();
-
- tmpNdb = self->get_next_ndb_object(NULL);
- while (tmpNdb != NULL) {
- const Ndb * delNdb = tmpNdb;
- tmpNdb = self->get_next_ndb_object(tmpNdb);
- delete delNdb;
- }
-
- tmpNdb = NULL;
-
- // Leave Ndb objects locked until we delete the mutex
- delete self;
-
- }
-
-public:
- %ndbexception("NdbApiException") createNdb {
- $action
- if (result==NULL) {
- NDB_exception(NdbApiException,"Couldn't allocate an Ndb object");
- }
- }
-
- %contract createNdb(const char* aCatalogName, const char* aSchemaName,
- Int32 initThreads) {
-require:
- initThreads > 0;
- }
- Ndb* createNdb(const char* aCatalogName="", const char* aSchemaName="def",
- Int32 initThreads = 4) {
- Ndb * theNdb = new Ndb(self,aCatalogName,aSchemaName);
- if (theNdb!=NULL) {
- int ret = theNdb->init(initThreads);
- if ( ret ) {
- delete theNdb;
- return NULL;
- }
- }
- return theNdb;
- }
-
- %contract createNdb(const char* aCatalogName, Int32 initThreads) {
-require:
- initThreads > 0;
- }
- Ndb* createNdb(const char* aCatalogName, Int32 initThreads = 4) {
- Ndb * theNdb = new Ndb(self,aCatalogName);
- if (theNdb!=NULL) {
- int ret = theNdb->init(initThreads);
- if ( ret ) {
- delete theNdb;
- return NULL;
- }
- }
- return theNdb;
- }
-
- %ndbexception("NdbApiException") {
- $action
- if (result) {
- const char * msg = "Cluster was not ready";
- NDB_exception(NdbApiException,msg);
- }
- }
-
- %ndbnoexception;
-
-}
=== removed file 'storage/ndb/swig/ndbapi/NdbDictionary.i'
--- a/storage/ndb/swig/ndbapi/NdbDictionary.i 2008-03-11 15:27:35 +0000
+++ b/storage/ndb/swig/ndbapi/NdbDictionary.i 1970-01-01 00:00:00 +0000
@@ -1,575 +0,0 @@
-/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
- *
- * Copyright (C) 2008 MySQL, Inc.
- *
- * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-class NdbDictObject {
-public:
-
- enum Status {
- New, ///< The object only exist in memory and
- ///< has not been created in the NDB Kernel
- Changed, ///< The object has been modified in memory
- ///< and has to be commited in NDB Kernel for
- ///< changes to take effect
- Retrieved, ///< The object exist and has been read
- ///< into main memory from NDB Kernel
- Invalid, ///< The object has been invalidated
- ///< and should not be used
- Altered ///< Table has been altered in NDB kernel
- ///< but is still valid for usage
- };
-
-
-
- enum Type {
- TypeUndefined = 0, ///< Undefined
- SystemTable = 1, ///< System table
- UserTable = 2, ///< User table (may be temporary)
- UniqueHashIndex = 3, ///< Unique un-ordered hash index
- OrderedIndex = 6, ///< Non-unique ordered index
- HashIndexTrigger = 7, ///< NdbDictionary::Index maintenance, internal
- IndexTrigger = 8, ///< NdbDictionary::Index maintenance, internal
- SubscriptionTrigger = 9,///< Backup or replication, internal
- ReadOnlyConstraint = 10 ///< Trigger, internal
- };
-
- enum State {
- StateUndefined = 0, ///< Undefined
- StateOffline = 1, ///< Offline, not usable
- StateBuilding = 2, ///< Building, not yet usable
- StateDropping = 3, ///< Offlining or dropping, not usable
- StateOnline = 4, ///< Online, usable
- StateBackup = 5, ///< Online, being backuped, usable
- StateBroken = 9 ///< Broken, should be dropped and re-created
- };
-
- enum Store {
- StoreUndefined = 0, ///< Undefined
- StoreNotLogged = 1, ///< Object or data deleted on system restart
- StorePermanent = 2 ///< Permanent. logged to disk
- };
-
- enum FragmentType {
- FragUndefined = 0, ///< Fragmentation type undefined or default
- FragSingle = 1, ///< Only one fragment
- FragAllSmall = 2, ///< One fragment per node, default
- FragAllMedium = 3, ///< two fragments per node
- FragAllLarge = 4, ///< Four fragments per node.
- DistrKeyHash = 5,
- DistrKeyLin = 6,
- UserDefined = 7
- };
-
- virtual NdbDictObject::Status getObjectStatus() const = 0;
-
- virtual int getObjectVersion() const = 0;
-
- virtual int getObjectId() const = 0;
-
-};
-
-
-class NdbDictTable; // forward declaration
-
-class NdbDictColumn {
-public:
- enum Type {
- Undefined = NDB_TYPE_UNDEFINED,
- Tinyint = NDB_TYPE_TINYINT,
- Tinyunsigned = NDB_TYPE_TINYUNSIGNED,
- Smallint = NDB_TYPE_SMALLINT,
- Smallunsigned = NDB_TYPE_SMALLUNSIGNED,
- Mediumint = NDB_TYPE_MEDIUMINT,
- Mediumunsigned = NDB_TYPE_MEDIUMUNSIGNED,
- Int = NDB_TYPE_INT,
- Unsigned = NDB_TYPE_UNSIGNED,
- Bigint = NDB_TYPE_BIGINT,
- Bigunsigned = NDB_TYPE_BIGUNSIGNED,
- Float = NDB_TYPE_FLOAT,
- Double = NDB_TYPE_DOUBLE,
- Olddecimal = NDB_TYPE_OLDDECIMAL,
- Olddecimalunsigned = NDB_TYPE_OLDDECIMALUNSIGNED,
- Decimal = NDB_TYPE_DECIMAL,
- Decimalunsigned = NDB_TYPE_DECIMALUNSIGNED,
- Char = NDB_TYPE_CHAR,
- Varchar = NDB_TYPE_VARCHAR,
- Binary = NDB_TYPE_BINARY,
- Varbinary = NDB_TYPE_VARBINARY,
- Datetime = NDB_TYPE_DATETIME,
- Date = NDB_TYPE_DATE,
- Blob = NDB_TYPE_BLOB,
- Text = NDB_TYPE_TEXT,
- Bit = NDB_TYPE_BIT,
- Longvarchar = NDB_TYPE_LONGVARCHAR,
- Longvarbinary = NDB_TYPE_LONGVARBINARY,
- Time = NDB_TYPE_TIME,
- Year = NDB_TYPE_YEAR,
- Timestamp = NDB_TYPE_TIMESTAMP
- };
- const char* getName() const;
- bool getNullable() const;
- bool getPrimaryKey() const;
- int getColumnNo() const;
- bool equal(const NdbDictColumn& column) const;
- Type getType() const;
- int getPrecision() const;
- int getScale() const;
- int getLength() const;
-// CHARSET_INFO* getCharset() const;
- int getInlineSize() const;
- int getPartSize() const;
- int getStripeSize() const;
- int getSize() const;
- bool getPartitionKey() const;
- NdbDictColumn(const char * name = "");
- NdbDictColumn(const NdbDictColumn& column);
- ~NdbDictColumn();
- void setName(const char * name);
- void setNullable(bool);
- void setPrimaryKey(bool);
- void setType(Type type);
- void setPrecision(int);
- void setScale(int);
- void setLength(int length);
-// TODO: CHARSET_INFO
-// void setCharset(CHARSET_INFO* cs);
- void setInlineSize(int size);
- void setPartSize(int size);
- void setStripeSize(int size);
- void setPartitionKey(bool enable);
- const NdbDictTable * getBlobTable() const;
-
- void setAutoIncrement(bool);
- bool getAutoIncrement() const;
- void setAutoIncrementInitialValue(Uint64 val);
- void setDefaultValue(const char*);
- const char* getDefaultValue() const;
-
-#if defined(MYSQL_50)
- // The problem here is actually a Python issue, but this clears it
- // for the moment
- // <FIXME>
- static const NdbDictColumn * FRAGMENT;
- static const NdbDictColumn * FRAGMENT_MEMORY;
- static const NdbDictColumn * ROW_COUNT;
- static const NdbDictColumn * COMMIT_COUNT;
- static const NdbDictColumn * ROW_SIZE;
- static const NdbDictColumn * RANGE_NO;
-#endif
-
- int getSizeInBytes() const;
-};
-
-%extend NdbDictColumn {
-public:
- const char * getCharsetName() {
- const CHARSET_INFO * csinfo = self->getCharset();
- return csinfo->csname;
- }
- Uint32 getCharsetNumber() {
- const CHARSET_INFO * csinfo = self->getCharset();
- return csinfo->number;
- }
-}
-
-typedef NdbDictColumn Attribute;
-
-class NdbDictTable : public NdbDictObject {
-public:
- const char * getName() const;
- int getTableId() const;
- NdbDictColumn* getColumn(const int attributeId);
- NdbDictColumn* getColumn(const char * name);
- bool getLogging() const;
- NdbDictObject::FragmentType getFragmentType() const;
- int getKValue() const;
- int getMinLoadFactor() const;
- int getMaxLoadFactor() const;
- int getNoOfColumns() const;
- int getNoOfPrimaryKeys() const;
- const char* getPrimaryKey(int no) const;
- bool equal(const NdbDictTable&) const;
-/* There is really no need to expose these */
-// const void* getFrmData() const;
-// Uint32 getFrmLength() const;
-// void setFrm(const void* data, Uint32 len);
- NdbDictTable(const char * name = "");
- NdbDictTable(const NdbDictTable& table);
- virtual ~Table();
- //NdbDictTable& operator=(const NdbDictTable& table);
- void setName(const char * name);
- void addColumn(const NdbDictColumn &);
- void setLogging(bool);
- void setFragmentType(NdbDictObject::FragmentType);
- void setKValue(int kValue);
- void setMinLoadFactor(int);
- void setMaxLoadFactor(int);
- virtual NdbDictObject::Status getObjectStatus() const;
- virtual int getObjectVersion() const;
-// TODO: This is not definied in libndbclient.so but is in the .hpp file
-// void setObjectType(NdbDictObject::Type type);
-// NdbDictObject::Type getObjectType() const;
- void setMaxRows(Uint64 maxRows);
- Uint64 getMaxRows() const;
- void setMinRows(Uint64 minRows);
- Uint64 getMinRows() const;
- int getRowSizeInBytes() const ;
- int createTableInDb(Ndb*, bool existingEqualIsOk = true) const ;
- int getReplicaCount() const ;
-};
-
-class NdbDictIndex : public NdbDictObject {
-public:
-
- enum Type {
- Undefined = 0, ///< Undefined object type (initial value)
- UniqueHashIndex = 3, ///< Unique un-ordered hash index
- ///< (only one currently supported)
- OrderedIndex = 6 ///< Non-unique ordered index
- };
-
- %ndbexception("NdbApiException") {
- $action
- if (result==0) {
- NDB_exception(NdbApiException,"NdbDictionary::Index Error");
- }
- }
-
- const char * getName() const;
- const char * getTable() const;
-
- %ndbexception("NdbApiException") {
- $action
- if (result==NULL) {
- NDB_exception(NdbApiException,"NdbDictionary::Index Error");
- }
- }
-
- const NdbDictColumn * getColumn(unsigned no) const ;
-
- %ndbnoexception;
-
- virtual int getObjectVersion() const;
-
- Type getType() const;
- virtual NdbDictObject::Status getObjectStatus() const;
-
- bool getLogging() const;
- unsigned getNoOfColumns() const;
- NdbDictIndex(const char * name = "");
- virtual ~NdbDictIndex();
-
- void setName(const char * name);
- void setTable(const char * name);
- void addColumn(const NdbDictColumn & c);
- void addColumnName(const char * name);
- void addColumnNames(unsigned noOfNames, const char ** names);
- void setType(Type type);
- void setLogging(bool enable);
-};
-
-class NdbDictDictionary {
-public:
-#if 0
-// Protect swig from this nested class until we redefine it
- /**
- * @class List
- * @brief Structure for retrieving lists of object names
- */
- struct List {
- /**
- * @struct Element
- * @brief NdbDictObject to be stored in an NdbDictDictList
- */
- struct Element {
- unsigned id; ///< Id of object
- NdbDictObject::Type type; ///< Type of object
- NdbDictObject::State state; ///< State of object
- NdbDictObject::Store store; ///< How object is stored
- char * database; ///< In what database the object resides
- char * schema; ///< What schema the object is defined in
- char * name; ///< Name of object
- Element() :
- id(0),
- type(NdbDictObject::TypeUndefined),
- state(NdbDictObject::StateUndefined),
- store(NdbDictObject::StoreUndefined),
- database(0),
- schema(0),
- name(0) {
- }
- };
- unsigned count; ///< Number of elements in list
- Element * elements; ///< Pointer to array of elements
- List() : count(0), elements(0) {}
- ~List() {
- if (elements != 0) {
- for (unsigned i = 0; i < count; i++) {
- delete[] elements[i].database;
- delete[] elements[i].schema;
- delete[] elements[i].name;
- elements[i].name = 0;
- }
- delete[] elements;
- count = 0;
- elements = 0;
- }
- }
- };
-
- int listObjects(List & list,
- NdbDictObject::Type type = NdbDictObject::TypeUndefined);
- int listObjects(List & list,
- NdbDictObject::Type type = NdbDictObject::TypeUndefined) const;
- int listIndexes(List & list, const char * tableName);
- int listIndexes(List & list, const char * tableName) const;
-
-#endif
-
-
- %ndbexception("NdbApiException") {
- $action
- if (result==NULL) {
- NdbError err = arg1->getNdbError();
- NDB_exception(NdbApiException,err.message);
- }
- }
-
- const NdbDictTable * getTable(const char * name) const;
- const NdbDictIndex * getIndex(const char * indexName,
- const char * tableName) const;
- const NdbDictEvent * getEvent(const char * eventName);
-
- %ndbexception("NdbApiException") {
- $action
- if (result==-1) {
- NdbError err = arg1->getNdbError();
- NDB_exception(NdbApiException,err.message);
- }
- }
-
- int createEvent(const NdbDictEvent &event);
- int dropEvent(const char * eventName);
- int createTable(const NdbDictTable &table);
- int dropTable(NdbDictTable & table);
- int dropTable(const char * name);
- int createIndex(const NdbDictIndex &index);
- int dropIndex(const char * indexName,
- const char * tableName);
-#if defined(MYSQL_50)
- int dropIndex(const NdbDictIndex &);
-#endif
-
- %ndbnoexception;
-
- const struct NdbError & getNdbError() const;
-
- void invalidateTable(const char * name);
- void removeCachedTable(const char * table);
- void removeCachedIndex(const char * index, const char * table);
- void invalidateIndex(const char * indexName,
- const char * tableName);
-private:
- NdbDictDictionary();
- ~NdbDictDictionary();
-};
-
-
-class NdbDictEvent : public NdbDictObject {
-
-public:
- enum TableEvent {
- TE_INSERT =1<<0, ///< Insert event on table
- TE_DELETE =1<<1, ///< Delete event on table
- TE_UPDATE =1<<2, ///< Update event on table
- TE_DROP =1<<4, ///< Drop of table
- TE_ALTER =1<<5, ///< Alter of table
- TE_CREATE =1<<6, ///< Create of table
- TE_GCP_COMPLETE=1<<7, ///< GCP is complete
- TE_CLUSTER_FAILURE=1<<8, ///< Cluster is unavailable
- TE_STOP =1<<9, ///< Stop of event operation
- TE_NODE_FAILURE=1<<10, ///< Node failed
- TE_SUBSCRIBE =1<<11, ///< Node subscribes
- TE_UNSUBSCRIBE =1<<12, ///< Node unsubscribes
- TE_ALL=0xFFFF ///< Any/all event on table (not relevant when
- ///< events are received)
- };
-
- enum EventDurability {
- ED_UNDEFINED = 0,
- ED_PERMANENT = 3,
- };
-
- /**
- * Specifies reporting options for table events
- */
- enum EventReport {
- ER_UPDATED = 0,
- ER_ALL = 1, // except not-updated blob inlines
- ER_SUBSCRIBE = 2
- };
-
- /**
- * Constructor
- * @param name Name of event
- */
- NdbDictEvent(const char *name);
- /**
- * Constructor
- * @param name Name of event
- * @param table Reference retrieved from NdbDictionary
- */
- NdbDictEvent(const char *name, const NdbDictTable& table);
- virtual ~Event();
- /**
- * Set unique identifier for the event
- */
- int setName(const char *name);
- /**
- * Get unique identifier for the event
- */
- const char *getName() const;
- /**
- * Get table that the event is defined on
- *
- * @return pointer to table or NULL if no table has been defined
- */
- const NdbDictTable * getTable() const;
- /**
- * Define table on which events should be detected
- *
- * @note calling this method will default to detection
- * of events on all columns. Calling subsequent
- * addEventColumn calls will override this.
- *
- * @param table reference retrieved from NdbDictionary
- */
- void setTable(const NdbDictTable& table);
- /**
- * Set table for which events should be detected
- *
- * @note preferred way is using setTable(const NdbDictionary::Table&)
- * or constructor with table object parameter
- */
- int setTable(const char *tableName);
- /**
- * Get table name for events
- *
- * @return table name
- */
- const char* getTableName() const;
- /**
- * Add type of event that should be detected
- */
- void addTableEvent(const TableEvent te);
- /**
- * Check if a specific table event will be detected
- */
- bool getTableEvent(const TableEvent te) const;
- /**
- * Set durability of the event
- */
- void setDurability(EventDurability);
- /**
- * Get durability of the event
- */
- EventDurability getDurability() const;
- /**
- * Set report option of the event
- */
- void setReport(EventReport);
- /**
- * Get report option of the event
- */
- EventReport getReport() const;
-
- /**
- * Add a column on which events should be detected
- *
- * @param attrId Column id
- *
- * @note errors will mot be detected until createEvent() is called
- */
- void addEventColumn(unsigned attrId);
- /**
- * Add a column on which events should be detected
- *
- * @param columnName Column name
- *
- * @note errors will not be detected until createEvent() is called
- */
- void addEventColumn(const char * columnName);
- /**
- * Add several columns on which events should be detected
- *
- * @param n Number of columns
- * @param columnNames Column names
- *
- * @note errors will mot be detected until
- * NdbDictionary::Dictionary::createEvent() is called
- */
- void addEventColumns(unsigned noOfNames, const char ** names);
-
- /**
- * Get no of columns defined in an Event
- *
- * @return Number of columns, -1 on error
- */
- int getNoOfEventColumns() const;
-
- /**
- * Get a specific column in the event
- */
- const NdbDictColumn * getEventColumn(unsigned no) const;
-
- /**
- * The merge events flag is false by default. Setting it true
- * implies that events are merged in following ways:
- *
- * - for given NdbEventOperation associated with this event,
- * events on same PK within same GCI are merged into single event
- *
- * - a blob table event is created for each blob attribute
- * and blob events are handled as part of main table events
- *
- * - blob post/pre data from the blob part events can be read
- * via NdbBlob methods as a single value
- *
- * NOTE: Currently this flag is not inherited by NdbEventOperation
- * and must be set on NdbEventOperation explicitly.
- */
- void mergeEvents(bool flag);
-
- /**
- * Get object status
- */
- virtual NdbDictObject::Status getObjectStatus() const;
-
- /**
- * Get object version
- */
- virtual int getObjectVersion() const;
-
- /**
- * Get object id
- */
- virtual int getObjectId() const;
-private:
- Event(NdbEventImpl&);
-};
=== removed file 'storage/ndb/swig/ndbapi/NdbError.i'
--- a/storage/ndb/swig/ndbapi/NdbError.i 2008-03-11 15:27:35 +0000
+++ b/storage/ndb/swig/ndbapi/NdbError.i 1970-01-01 00:00:00 +0000
@@ -1,237 +0,0 @@
-/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
- *
- * Copyright (C) 2008 MySQL, Inc.
- *
- * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-class NdbError {
-
-public:
- /**
- * Status categorizes error codes into status values reflecting
- * what the application should do when encountering errors
- */
- enum Status {
- /**
- * The error code indicate success<br>
- * (Includes classification: NdbError::NoError)
- */
- Success = ndberror_st_success,
-
- /**
- * The error code indicates a temporary error.
- * The application should typically retry.<br>
- * (Includes classifications: NdbError::InsufficientSpace,
- * NdbError::TemporaryResourceError, NdbError::NodeRecoveryError,
- * NdbError::OverloadError, NdbError::NodeShutdown
- * and NdbError::TimeoutExpired.)
- */
- TemporaryError = ndberror_st_temporary,
-
- /**
- * The error code indicates a permanent error.<br>
- * (Includes classificatons: NdbError::PermanentError,
- * NdbError::ApplicationError, NdbError::NoDataFound,
- * NdbError::ConstraintViolation, NdbError::SchemaError,
- * NdbError::UserDefinedError, NdbError::InternalError, and,
- * NdbError::FunctionNotImplemented.)
- */
- PermanentError = ndberror_st_permanent,
-
- /**
- * The result/status is unknown.<br>
- * (Includes classifications: NdbError::UnknownResultError, and
- * NdbError::UnknownErrorCode.)
- */
- UnknownResult = ndberror_st_unknown
- };
-
- /**
- * Type of error
- */
- enum Classification {
- /**
- * Success. No error occurred.
- */
- NoError = ndberror_cl_none,
-
- /**
- * Error in application program.
- */
- ApplicationError = ndberror_cl_application,
-
- /**
- * Read operation failed due to missing record.
- */
- NoDataFound = ndberror_cl_no_data_found,
-
- /**
- * E.g. inserting a tuple with a primary key already existing
- * in the table.
- */
- ConstraintViolation = ndberror_cl_constraint_violation,
-
- /**
- * Error in creating table or usage of table.
- */
- SchemaError = ndberror_cl_schema_error,
-
- /**
- * Error occurred in interpreted program.
- */
- UserDefinedError = ndberror_cl_user_defined,
-
- /**
- * E.g. insufficient memory for data or indexes.
- */
- InsufficientSpace = ndberror_cl_insufficient_space,
-
- /**
- * E.g. too many active transactions.
- */
- TemporaryResourceError = ndberror_cl_temporary_resource,
-
- /**
- * Temporary failures which are probably inflicted by a node
- * recovery in progress. Examples: information sent between
- * application and NDB lost, distribution change.
- */
- NodeRecoveryError = ndberror_cl_node_recovery,
-
- /**
- * E.g. out of log file space.
- */
- OverloadError = ndberror_cl_overload,
-
- /**
- * Timeouts, often inflicted by deadlocks in NDB.
- */
- TimeoutExpired = ndberror_cl_timeout_expired,
-
- /**
- * Is is unknown whether the transaction was committed or not.
- */
- UnknownResultError = ndberror_cl_unknown_result,
-
- /**
- * A serious error in NDB has occurred.
- */
- InternalError = ndberror_cl_internal_error,
-
- /**
- * A function used is not yet implemented.
- */
- FunctionNotImplemented = ndberror_cl_function_not_implemented,
-
- /**
- * Error handler could not determine correct error code.
- */
- UnknownErrorCode = ndberror_cl_unknown_error_code,
-
- /**
- * Node shutdown
- */
- NodeShutdown = ndberror_cl_node_shutdown,
-
- /**
- * Schema object already exists
- */
- SchemaObjectExists = ndberror_cl_schema_object_already_exists,
-
- /**
- * Request sent to non master
- */
- InternalTemporary = ndberror_cl_internal_temporary
- };
-
-private:
- /**
- * Error status.
- */
- Status status;
-
- /**
- * Error type
- */
- Classification classification;
-
- /**
- * Error code
- */
- int code;
-
- /**
- * Mysql error code
- */
- int mysql_code;
-
- /**
- * Error message
- */
- const char * message;
- /**
- * The detailed description. This is extra information regarding the
- * error which is not included in the error message.
- *
- * @note Is NULL when no details specified
- */
- char * details;
-
-
- NdbError(){
- status = UnknownResult;
- classification = NoError;
- code = 0;
- mysql_code = 0;
- message = 0;
- details = 0;
- }
- NdbError(const ndberror_struct & ndberror){
- status = (NdbError::Status) ndberror.status;
- classification = (NdbError::Classification) ndberror.classification;
- code = ndberror.code;
- mysql_code = ndberror.mysql_code;
- message = ndberror.message;
- details = ndberror.details;
- }
- operator ndberror_struct() const {
- ndberror_struct ndberror;
- ndberror.status = (ndberror_status_enum) status;
- ndberror.classification = (ndberror_classification_enum) classification;
- ndberror.code = code;
- ndberror.mysql_code = mysql_code;
- ndberror.message = message;
- ndberror.details = details;
- return ndberror;
- }
-
-};
-
-%extend NdbError {
- const char * getMessage() {
- return self->message;
- }
- int getCode() {
- return self->code;
- }
- Classification getClassification() {
- return self->classification;
- }
- Status getStatus() {
- return self->status;
- }
-}
=== removed file 'storage/ndb/swig/ndbapi/NdbEventOperation.i'
--- a/storage/ndb/swig/ndbapi/NdbEventOperation.i 2010-01-05 11:40:01 +0000
+++ b/storage/ndb/swig/ndbapi/NdbEventOperation.i 1970-01-01 00:00:00 +0000
@@ -1,179 +0,0 @@
-/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
- *
- * Copyright (C) 2008 MySQL, Inc.
- *
- * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-class NdbEventOperation {
-
-private:
-
- NdbEventOperation(Ndb *theNdb, const char* eventName);
- ~NdbEventOperation();
-
-public:
- /**
- * State of the NdbEventOperation object
- */
- enum State {
- EO_CREATED, ///< Created but execute() not called
- EO_EXECUTING, ///< execute() called
- EO_DROPPED, ///< Waiting to be deleted, Object unusable.
- EO_ERROR ///< An error has occurred. Object unusable.
- };
-
-
- %ndbnoexception;
-
- /**
- * Get the latest error
- *
- * @return Error object.
- */
- const struct NdbError & getNdbError() const;
-
- bool isConsistent() const;
-
- /**
- * Check if table name has changed, for event TE_ALTER
- */
- bool tableNameChanged() const;
-
- /**
- * Check if table frm has changed, for event TE_ALTER
- */
- bool tableFrmChanged() const;
-
- /**
- * Check if table fragmentation has changed, for event TE_ALTER
- */
- bool tableFragmentationChanged() const;
-
- /**
- * Check if table range partition list name has changed, for event TE_ALTER
- */
- bool tableRangeListChanged() const;
-
- /**
- * Retrieve the GCI of the latest retrieved event
- *
- * @return GCI number
- */
- Uint64 getGCI() const;
-
- /**
- * Retrieve the AnyValue of the latest retrieved event
- *
- * @return AnyValue
- */
- Uint32 getAnyValue() const;
- /**
- * Retrieve the complete GCI in the cluster (not necessarily
- * associated with an event)
- *
- * @return GCI number
- */
- Uint64 getLatestGCI() const;
-
- /**
- * Retrieve current state of the NdbEventOperation object
- */
- State getState();
-
-
- /**
- * See NdbDictionary::Event. Default is false.
- */
- void mergeEvents(bool flag);
-
- /**
- * Query for occured event type.
- *
- * @note Only valid after Ndb::nextEvent() has been called and
- * returned a not NULL value
- *
- * @return type of event
- */
- NdbDictEvent::TableEvent getEventType() const;
-
-
- /* methods that return an object */
- %ndbexception("NdbApiException") {
- $action
- if (result == NULL) {
- NdbError err = arg1->getNdbError();
- NDB_exception(NdbApiException,err.message);
- }
- }
-
- /**
- * See getValue().
- */
- NdbBlob* getBlobHandle(const char *anAttrName);
- NdbBlob* getPreBlobHandle(const char *anAttrName);
-
-
-
- /* methods that return an object */
- %ndbexception("NdbApiException") {
- $action
- if (result == -1) {
- NdbError err = arg1->getNdbError();
- NDB_exception(NdbApiException,err.message);
- }
- }
-
- /**
- * Activates the NdbEventOperation to start receiving events. The
- * changed attribute values may be retrieved after Ndb::nextEvent()
- * has returned not NULL. The getValue() methods must be called
- * prior to execute().
- *
- * @return 0 if successful otherwise -1.
- */
- int execute();
-
- int isOverrun() const;
-
- %ndbnoexception;
-
-};
-
-typedef void (* NdbEventCallback)(NdbEventOperation*, Ndb*, void*);
-
-%extend NdbEventOperation {
-
- %ndbexception("NdbApiException") {
- $action
- if (result==NULL) {
- NdbError err = arg1->getNdbError();
- NDB_exception(NdbApiException,err.message);
- }
- }
-
- NdbRecAttr* getValue(const char* anAttrName) {
- return self->getValue(anAttrName,NULL);
- }
-
-
- NdbRecAttr* getPreValue(const char *anAttrName) {
- return self->getPreValue(anAttrName, NULL);
- }
-
- %ndbnoexception;
-
-};
=== removed file 'storage/ndb/swig/ndbapi/NdbFactory.i'
--- a/storage/ndb/swig/ndbapi/NdbFactory.i 2008-03-11 15:27:35 +0000
+++ b/storage/ndb/swig/ndbapi/NdbFactory.i 1970-01-01 00:00:00 +0000
@@ -1,98 +0,0 @@
-/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
- *
- * Copyright (C) 2008 MySQL, Inc.
- *
- * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-%newobject NdbFactory::createNdbClusterConnection;
-%typemap(newfree) Ndb_cluster_connection * "delete $1;";
-
-%{
-
- class NdbFactory
- {
-
- public:
- static Ndb_cluster_connection * createNdbClusterConnection(const char * connectString = 0)
- {
- Ndb_cluster_connection * theConnection = NULL;
- if (connectString == 0) {
- theConnection = new Ndb_cluster_connection();
- } else {
- theConnection = new Ndb_cluster_connection(connectString);
- }
- return theConnection;
- }
-
- static Ndb * createNdb(Ndb_cluster_connection * theConn,const char* aCatalogName="", const char* aSchemaName="def") {
- return new Ndb(theConn,aCatalogName,aSchemaName);
- }
-
- static NdbTransaction * createTransaction(Ndb * theNdb, const NdbDictTable *table= 0,
- const char *keyData = 0,
- Uint32 keyLen = 0) {
- return theNdb->startTransaction(table,keyData,keyLen);
- }
-
- static NdbTransaction* createTransaction(Ndb * theNdb,
- const char* aTableName,
- const char *keyData) {
- const NdbDictDictionary *myDict = theNdb->getDictionary();
- const NdbDictTable *myTable = myDict->getTable(aTableName);
- return theNdb->startTransaction(myTable,keyData);
- }
- static NdbTransaction* createTransaction(Ndb * theNdb,
- const char* aTableName,
- int keyData) {
- const NdbDictDictionary *myDict = theNdb->getDictionary();
- const NdbDictTable *myTable = myDict->getTable(aTableName);
- return theNdb->startTransaction(myTable,(const char *) &keyData);
- }
-
-
- };
-
- %}
-
-
-class NdbFactory
-{
- // We list these here as private so that SWIG doesnt generate them
- NdbFactory();
- ~NdbFactory();
-public:
-
- %ndbexception("NdbApiException") {
-
- $action
- if (result==NULL) {
- NDB_exception(NdbApiException,"Couldn't allocate object");
- }
- }
- static Ndb_cluster_connection * createNdbClusterConnection(const char * connectString = 0);
- static Ndb * createNdb(Ndb_cluster_connection * theConn,const char* aCatalogName="", const char* aSchemaName="def");
- static NdbTransaction * createTransaction(Ndb * theNdb, const NdbDictTable *table= 0,
- const char *keyData = 0,
- Uint32 keyLen = 0);
- static NdbTransaction* createTransaction(Ndb * theNdb,
- const char* aTableName,
- const char *keyData);
- static NdbTransaction* createTransaction(Ndb * theNdb,
- const char* aTableName,
- int keyData);
-
-};
=== removed file 'storage/ndb/swig/ndbapi/NdbIndexOperation.i'
--- a/storage/ndb/swig/ndbapi/NdbIndexOperation.i 2008-03-11 15:27:35 +0000
+++ b/storage/ndb/swig/ndbapi/NdbIndexOperation.i 1970-01-01 00:00:00 +0000
@@ -1,55 +0,0 @@
-/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
- *
- * Copyright (C) 2008 MySQL, Inc.
- *
- * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-class NdbIndexOperation : public NdbOperation {
-
-private:
- NdbIndexOperation(Ndb* aNdb);
- ~NdbIndexOperation();
-
-public:
-
- %ndbexception("NdbApiException") {
- $action
- if (result==-1) {
- NdbError err = arg1->getNdbError();
- NDB_exception(NdbApiException,err.message);
- }
- }
-
- voidint readTuple(LockMode);
- voidint updateTuple();
- voidint deleteTuple();
-
- voidint interpretedUpdateTuple();
- voidint interpretedDeleteTuple();
-
- %ndbexception("NdbApiException") {
- $action
- if (result==NULL) {
- NdbError err = arg1->getNdbError();
- NDB_exception(NdbApiException,err.message);
- }
- }
- const NdbDictIndex * getIndex() const;
-
- %ndbnoexception;
-
-};
=== removed file 'storage/ndb/swig/ndbapi/NdbIndexScanOperation.i'
--- a/storage/ndb/swig/ndbapi/NdbIndexScanOperation.i 2008-03-11 15:27:35 +0000
+++ b/storage/ndb/swig/ndbapi/NdbIndexScanOperation.i 1970-01-01 00:00:00 +0000
@@ -1,666 +0,0 @@
-/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
- *
- * Copyright (C) 2008 MySQL, Inc.
- *
- * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-class NdbIndexScanOperation : public NdbScanOperation {
-
- NdbIndexScanOperation(Ndb* aNdb);
- virtual ~NdbIndexScanOperation();
-
-public:
-
- enum BoundType {
- BoundLE = 0,
- BoundLT = 1,
- BoundGE = 2,
- BoundGT = 3,
- BoundEQ = 4
- };
-
- %ndbnoexception
-
- bool getSorted() const;
- bool getDescending();
-
- %ndbexception("NdbApiException") {
- $action
- if (result == -1) {
- NdbError err = arg1->getNdbError();
- NDB_exception(NdbApiException,err.message);
- }
- }
-
-#if !defined(SWIG_RUBY_AUTORENAME)
- %rename reset_bounds resetBounds;
- %rename end_of_bound endOfBound;
- %rename get_range_no getRangeNo;
-#endif
-
- voidint reset_bounds(bool forceSend = false);
- voidint end_of_bound(Uint32 range_no);
- voidint get_range_no();
-
- virtual voidint readTuples(NdbOperation::LockMode lock_mode = LM_Read,
- Uint32 scan_flags = 0,
- Uint32 parallel = 0,
- Uint32 batch = 0);
-
- virtual voidint readTuples(LockMode lock_mode,
- Uint32 batch,
- Uint32 parallel,
- bool order_by,
- bool order_desc = false,
- bool read_range_no = false,
- bool keyinfo = false,
- bool multi_range = false);
-
-};
-
-%extend NdbIndexScanOperation {
-
-public:
- %ndbexception("NdbApiException") {
- $action
- if (result == -1) {
- NdbError err = arg1->getNdbError();
- NDB_exception(NdbApiException,err.message);
- }
- }
-
- voidint setBoundNull(const char* anAttrName, BoundType type) {
- return self->setBound(anAttrName,type,(void *)0);
- };
- voidint setBoundNull(Uint32 anAttrId, BoundType type) {
- return self->setBound(anAttrId,type,(void *)0);
- };
-
- voidint setBoundInt(const char* anAttrName, BoundType type,
- const Int32 val) {
- Int32 value = (Int32)val;
- return self->setBound(anAttrName,type,(void *) &value);
- };
- voidint setBoundInt(Uint32 anAttrId, BoundType type,
- const Int32 val) {
- Int32 value = (Int32)val;
- return self->setBound(anAttrId,type,(void *) &value);
- };
-
- voidint setBoundLong(const char* anAttrName, BoundType type,
- const Int64 val) {
- Int64 value = (Int64)val;
- return self->setBound(anAttrName,type,(void *) &value);
- };
- voidint setBoundLong(Uint32 anAttrId, BoundType type,
- const Int64 val) {
- Int64 value = (Int64)val;
- return self->setBound(anAttrId,type,(void *) &value);
- };
-
- voidint setBoundUlong(const char* anAttrName, BoundType type,
- const Uint64 val) {
- Uint64 value = (Uint64)val;
- return self->setBound(anAttrName,type,(void *) &value);
- };
- voidint setBoundUlong(Uint32 anAttrId, BoundType type,
- const Uint64 val) {
- Uint64 value = (Uint64)val;
- return self->setBound(anAttrId,type,(void *) &value);
- };
-
- voidint setBoundDouble(const char* anAttrName, BoundType type,
- const double val) {
- double value = (double)val;
- return self->setBound(anAttrName,type,(void *) &value);
- };
- voidint setBoundDouble(Uint32 anAttrId, BoundType type,
- const double val) {
- double value = (double)val;
- return self->setBound(anAttrId,type,(void *) &value);
- };
-
- voidint setBoundFloat(const char* anAttrName, BoundType type,
- const float val) {
- float value = (float)val;
- return self->setBound(anAttrName,type,(void *) &value);
- };
- voidint setBoundFloat(Uint32 anAttrId, BoundType type,
- const float val) {
- float value = (float)val;
- return self->setBound(anAttrId,type,(void *) &value);
- };
-
- voidint setBoundDecimal(const char* anAttrName, BoundType type,
- decimal_t * val) {
-
- int ret = -1;
- char * theValue = decimal2bytes(val);
- if (theValue != NULL) {
- ret = self->setBound(anAttrName, type, (void *) theValue);
- free(theValue);
- }
- return ret;
- };
- voidint setBoundDecimal(Uint32 anAttrId, BoundType type,
- decimal_t * val) {
-
- int ret = -1;
- char * theValue = decimal2bytes(val);
- if (theValue != NULL) {
- ret = self->setBound(anAttrId, type, (void *) theValue);
- free(theValue);
- }
- return ret;
- };
-
- voidint setBoundTimestamp(const char* anAttrName, BoundType type,
- NdbTimestamp anInputTimestamp) {
- Uint32 value = (Uint32)anInputTimestamp;
- return self->setBound(anAttrName,type,(void *) &value);
- };
- voidint setBoundTimestamp(Uint32 anAttrId, BoundType type,
- NdbTimestamp anInputTimestamp) {
- Uint32 value = (Uint32)anInputTimestamp;
- return self->setBound(anAttrId,type,(void *) &value);
- };
-
- voidint setBoundDatetime(const char* anAttrName, BoundType type,
- NdbDateTime * anInputDateTime) {
- const NdbDictionary::Column * theColumn =
- self->getTable()->getColumn(anAttrName);
-
- Uint64 dtval = ndbFormatDateTime(theColumn,anInputDateTime);
- if (dtval == 1){
- return -1;
- }
- return self->setBound(anAttrName,type,(void *) &dtval);
- };
- voidint setBoundDatetime(Uint32 anAttrId, BoundType type,
- NdbDateTime * anInputDateTime) {
- const NdbDictionary::Column * theColumn =
- self->getTable()->getColumn(anAttrId);
- Uint64 dtval = ndbFormatDateTime(theColumn,anInputDateTime);
- if (dtval == 1){
- return -1;
- }
- return self->setBound(anAttrId,type,(void *) &dtval);
- };
-
- voidint setBoundBytes(const char* anAttrName, BoundType type,
- const char * BYTE, size_t len) {
- const NdbDictionary::Column * theColumn =
- self->getTable()->getColumn(anAttrName);
- char * stringVal = ndbFormatString(theColumn,BYTE,len);
- if (stringVal == NULL) {
- return -1;
- }
- int retval = self->setBound(anAttrName,type,(void *)stringVal);
- free(stringVal);
- return retval;
- };
- voidint setBoundBytes(Uint32 anAttrId, BoundType type,
- const char * BYTE, size_t len) {
- const NdbDictionary::Column * theColumn =
- self->getTable()->getColumn(anAttrId);
- char * stringVal = ndbFormatString(theColumn,BYTE,len);
- if (stringVal == NULL) {
- return -1;
- }
- int retval = self->setBound(anAttrId,type,(void *)stringVal);
- free(stringVal);
- return retval;
- };
-
- voidint setBoundString(const char* anAttrName, BoundType type,
- const char * anInputString, size_t len) {
- const NdbDictionary::Column * theColumn =
- self->getTable()->getColumn(anAttrName);
- char * stringVal = ndbFormatString(theColumn,anInputString,len);
- if (stringVal == NULL) {
- return -1;
- }
- int retval = self->setBound(anAttrName,type,(void *)stringVal);
- free(stringVal);
- return retval;
- };
- voidint setBoundString(Uint32 anAttrId, BoundType type,
- const char * anInputString, size_t len ) {
- const NdbDictionary::Column * theColumn =
- self->getTable()->getColumn(anAttrId);
- char * stringVal = ndbFormatString(theColumn,anInputString,len);
- if (stringVal == NULL) {
- return -1;
- }
- int retval = self->setBound(anAttrId,type,(void *)stringVal);
- free(stringVal);
- return retval;
- };
-
- voidint whereGreaterThan(const char * columnName, Int32 val) {
- Int32 value = (Int32)val;
- return self->setBound(columnName,NdbIndexScanOperation::BoundLT,
- (void *) &value);
- }
- voidint whereGreaterThan(Uint32 columnId, Int32 val) {
- Int32 value = (Int32)val;
- return self->setBound(columnId,NdbIndexScanOperation::BoundLT,
- (void *) &value);
- }
- voidint whereGreaterThan(const char * columnName, Int64 val) {
- Int64 value = (Int64)val;
- return self->setBound(columnName,NdbIndexScanOperation::BoundLT,
- (void *) &value);
- }
- voidint whereGreaterThan(Uint32 columnId, Int64 val) {
- Int64 value = (Int64)val;
- return self->setBound(columnId,NdbIndexScanOperation::BoundLT,
- (void *) &value);
- }
- voidint whereGreaterThan(const char * columnName, Uint64 val) {
- Uint64 value = (Uint64)val;
- return self->setBound(columnName,NdbIndexScanOperation::BoundLT,
- (void *) &value);
- }
- voidint whereGreaterThan(Uint32 columnId, Uint64 val) {
- Uint64 value = (Uint64)val;
- return self->setBound(columnId,NdbIndexScanOperation::BoundLT,
- (void *) &value);
- }
- voidint whereGreaterThan(const char * columnName, double val) {
- double value = (double)val;
- return self->setBound(columnName,NdbIndexScanOperation::BoundLT,
- (void *) &value);
- }
- voidint whereGreaterThan(Uint32 columnId, double val) {
- double value = (double)val;
- return self->setBound(columnId,NdbIndexScanOperation::BoundLT,
- (void *) &value);
- }
- voidint whereGreaterThan(const char * columnName, float val) {
- float value = (float)val;
- return self->setBound(columnName,NdbIndexScanOperation::BoundLT,
- (void *) &value);
- }
- voidint whereGreaterThan(Uint32 columnId, float val) {
- float value = (float)val;
- return self->setBound(columnId,NdbIndexScanOperation::BoundLT,
- (void *) &value);
- }
- voidint whereGreaterThan(const char * columnName, decimal_t * anInputValue) {
-
- int ret = -1;
- char * theValue = decimal2bytes(anInputValue);
- if (theValue != NULL) {
- ret = self->setBound(columnName, NdbIndexScanOperation::BoundLT,
- (void *) theValue);
- free(theValue);
- }
- return ret;
- }
- voidint whereGreaterThan(Uint32 columnId, decimal_t * anInputValue) {
-
- int ret = -1;
- char * theValue = decimal2bytes(anInputValue);
- if (theValue != NULL) {
- ret = self->setBound(columnId, NdbIndexScanOperation::BoundLT,
- (void *) theValue);
- free(theValue);
- }
- return ret;
- }
-
- voidint whereGreaterThan(const char* anAttrName,
- const char * anInputString, size_t len) {
- const NdbDictionary::Column * theColumn =
- self->getTable()->getColumn(anAttrName);
- char * stringVal = ndbFormatString(theColumn,anInputString,len);
- if (stringVal == NULL) {
- return -1;
- }
- int retval = self->setBound(anAttrName,NdbIndexScanOperation::BoundLT,
- (void *)stringVal);
- free(stringVal);
- return retval;
- };
- voidint whereGreaterThan(Uint32 anAttrId,
- const char * anInputString, size_t len ) {
- const NdbDictionary::Column * theColumn =
- self->getTable()->getColumn(anAttrId);
- char * stringVal = ndbFormatString(theColumn,anInputString,len);
- if (stringVal == NULL) {
- return -1;
- }
- int retval = self->setBound(anAttrId,NdbIndexScanOperation::BoundLT,
- (void *)stringVal);
- free(stringVal);
- return retval;
- };
-
-
- voidint whereGreaterThanEqualTo(const char * columnName, Int32 val) {
- Int32 value = (Int32)val;
- return self->setBound(columnName,NdbIndexScanOperation::BoundLE,
- (void *) &value);
- }
- voidint whereGreaterThanEqualTo(Uint32 columnId, Int32 val) {
- Int32 value = (Int32)val;
- return self->setBound(columnId,NdbIndexScanOperation::BoundLE,
- (void *) &value);
- }
-
- voidint whereGreaterThanEqualTo(const char * columnName, Int64 val) {
- Int64 value = (Int64)val;
- return self->setBound(columnName,NdbIndexScanOperation::BoundLE,
- (void *) &value);
- }
- voidint whereGreaterThanEqualTo(Uint32 columnId, Int64 val) {
- Int64 value = (Int64)val;
- return self->setBound(columnId,NdbIndexScanOperation::BoundLE,
- (void *) &value);
- }
-
- voidint whereGreaterThanEqualTo(const char * columnName, Uint64 val) {
- Uint64 value = (Uint64)val;
- return self->setBound(columnName,NdbIndexScanOperation::BoundLE,
- (void *) &value);
- }
- voidint whereGreaterThanEqualTo(Uint32 columnId, Uint64 val) {
- Uint64 value = (Uint64)val;
- return self->setBound(columnId,NdbIndexScanOperation::BoundLE,
- (void *) &value);
- }
-
- voidint whereGreaterThanEqualTo(const char * columnName, double val) {
- double value = (double)val;
- return self->setBound(columnName,NdbIndexScanOperation::BoundLE,
- (void *) &value);
- }
- voidint whereGreaterThanEqualTo(Uint32 columnId, double val) {
- double value = (double)val;
- return self->setBound(columnId,NdbIndexScanOperation::BoundLE,
- (void *) &value);
- }
-
- voidint whereGreaterThanEqualTo(const char * columnName, float val) {
- float value = (float)val;
- return self->setBound(columnName,NdbIndexScanOperation::BoundLE,
- (void *) &value);
- }
- voidint whereGreaterThanEqualTo(Uint32 columnId, float val) {
- float value = (float)val;
- return self->setBound(columnId,NdbIndexScanOperation::BoundLE,
- (void *) &value);
- }
-
- voidint whereGreaterThanEqualTo(const char * columnName,
- decimal_t * anInputDecimal) {
- int ret = -1;
- char * theValue = decimal2bytes(anInputDecimal);
- if (theValue != NULL) {
- ret = self->setBound(columnName, NdbIndexScanOperation::BoundLE,
- (void *) theValue);
- free(theValue);
- }
- return ret;
- }
- voidint whereGreaterThanEqualTo(Uint32 columnId, Int64 anInputDecimal) {
- int ret = -1;
- char * theValue = decimal2bytes(val);
- if (theValue != NULL) {
- ret = self->setBound(columnId, NdbIndexScanOperation::BoundLE,
- (void *) theValue);
- free(theValue);
- }
- return ret;
- Int64 value = (Int64)val;
- }
-
- voidint whereGreaterThanEqualTo(const char* anAttrName,
- const char * anInputString, size_t len) {
- const NdbDictionary::Column * theColumn =
- self->getTable()->getColumn(anAttrName);
- char * stringVal = ndbFormatString(theColumn,anInputString,len);
- if (stringVal == NULL) {
- return -1;
- }
- int retval = self->setBound(anAttrName,NdbIndexScanOperation::BoundLE,
- (void *)stringVal);
- free(stringVal);
- return retval;
- };
- voidint whereGreaterThanEqualTo(Uint32 anAttrId,
- const char * anInputString, size_t len ) {
- const NdbDictionary::Column * theColumn =
- self->getTable()->getColumn(anAttrId);
- char * stringVal = ndbFormatString(theColumn,anInputString,len);
- if (stringVal == NULL) {
- return -1;
- }
- int retval = self->setBound(anAttrId,NdbIndexScanOperation::BoundLE,
- (void *)stringVal);
- free(stringVal);
- return retval;
- };
-
- voidint whereLessThan(const char * columnName, Int32 val) {
- Int32 value = (Int32)val;
- return self->setBound(columnName,NdbIndexScanOperation::BoundGT,
- (void *) &value);
- }
- voidint whereLessThan(Uint32 columnId, Int32 val) {
- Int32 value = (Int32)val;
- return self->setBound(columnId,NdbIndexScanOperation::BoundGT,
- (void *) &value);
- }
-
- voidint whereLessThan(const char * columnName,
- Int64 val) {
- Int64 value = (Int64)val;
- return self->setBound(columnName,NdbIndexScanOperation::BoundGT,
- (void *) &value);
- }
- voidint whereLessThan(Uint32 columnId, Int64 val) {
- Int64 value = (Int64)val;
- return self->setBound(columnId,NdbIndexScanOperation::BoundGT,
- (void *) &value);
- }
-
- voidint whereLessThan(const char * columnName, Uint64 val) {
- Uint64 value = (Uint64)val;
- return self->setBound(columnName,NdbIndexScanOperation::BoundGT,
- (void *) &value);
- }
- voidint whereLessThan(Uint32 columnId, Uint64 val) {
- Uint64 value = (Uint64)val;
- return self->setBound(columnId,NdbIndexScanOperation::BoundGT,
- (void *) &value);
- }
-
- voidint whereLessThan(const char * columnName, double val) {
- double value = (double)val;
- return self->setBound(columnName,NdbIndexScanOperation::BoundGT,
- (void *) &value);
- }
- voidint whereLessThan(Uint32 columnId, double val) {
- double value = (double)val;
- return self->setBound(columnId,NdbIndexScanOperation::BoundGT,(void *) &value);
- }
-
- voidint whereLessThan(const char * columnName, float val) {
- float value = (float)val;
- return self->setBound(columnName,NdbIndexScanOperation::BoundGT,
- (void *) &value);
- }
- voidint whereLessThan(Uint32 columnId, float val) {
- float value = (float)val;
- return self->setBound(columnId,NdbIndexScanOperation::BoundGT,
- (void *) &value);
- }
-
- voidint whereLessThan(const char * columnName, Int64 anInputDecimal) {
- int ret = -1;
- char * theValue = decimal2bytes(anInputDecimal);
- if (theValue != NULL) {
- ret = self->setBound(columnName, NdbIndexScanOperation::BoundGT,
- (void *) theValue);
- free(theValue);
- }
- return ret;
- }
- voidint whereLessThan(Uint32 columnId, Int64 anInputDecimal) {
- int ret = -1;
- char * theValue = decimal2bytes(anInputDecimal);
- if (theValue != NULL) {
- ret = self->setBound(columnId, NdbIndexScanOperation::BoundGT,
- (void *) theValue);
- free(theValue);
- }
- return ret;
- }
-
- voidint whereLessThan(const char* anAttrName,
- const char * anInputString, size_t len) {
- const NdbDictionary::Column * theColumn =
- self->getTable()->getColumn(anAttrName);
- char * stringVal = ndbFormatString(theColumn,anInputString,len);
- if (stringVal == NULL) {
- return -1;
- }
- int retval = self->setBound(anAttrName,NdbIndexScanOperation::BoundGT,
- (void *)stringVal);
- free(stringVal);
- return retval;
- };
- voidint whereLessThan(Uint32 anAttrId,
- const char * anInputString, size_t len ) {
- const NdbDictionary::Column * theColumn =
- self->getTable()->getColumn(anAttrId);
- char * stringVal = ndbFormatString(theColumn,anInputString,len);
- if (stringVal == NULL) {
- return -1;
- }
- int retval = self->setBound(anAttrId,NdbIndexScanOperation::BoundGT,
- (void *)stringVal);
- free(stringVal);
- return retval;
- };
-
- voidint whereLessThanEqualTo(const char * columnName, Int32 val) {
- Int32 value = (Int32)val;
- return self->setBound(columnName,NdbIndexScanOperation::BoundGE,
- (void *) &value);
- }
- voidint whereLessThanEqualTo(Uint32 columnId, Int32 val) {
- Int32 value = (Int32)val;
- return self->setBound(columnId,NdbIndexScanOperation::BoundGE,
- (void *) &value);
- }
-
- voidint whereLessThanEqualTo(const char * columnName, Int64 val) {
- Int64 value = (Int64)val;
- return self->setBound(columnName,NdbIndexScanOperation::BoundGE,
- (void *) &value);
- }
- voidint whereLessThanEqualTo(Uint32 columnId, Int64 val) {
- Int64 value = (Int64)val;
- return self->setBound(columnId,NdbIndexScanOperation::BoundGE,
- (void *) &value);
- }
-
- voidint whereLessThanEqualTo(const char * columnName, Uint64 val) {
- Uint64 value = (Uint64)val;
- return self->setBound(columnName,NdbIndexScanOperation::BoundGE,
- (void *) &value);
- }
- voidint whereLessThanEqualTo(Uint32 columnId, Uint64 val) {
- Uint64 value = (Uint64)val;
- return self->setBound(columnId,NdbIndexScanOperation::BoundGE,
- (void *) &value);
- }
-
- voidint whereLessThanEqualTo(const char * columnName, double val) {
- double value = (double)val;
- return self->setBound(columnName,NdbIndexScanOperation::BoundGE,
- (void *) &value);
- }
- voidint whereLessThanEqualTo(Uint32 columnId, double val) {
- double value = (double)val;
- return self->setBound(columnId,NdbIndexScanOperation::BoundGE,
- (void *) &value);
- }
-
- voidint whereLessThanEqualTo(const char * columnName, float val) {
- float value = (float)val;
- return self->setBound(columnName,NdbIndexScanOperation::BoundGE,
- (void *) &value);
- }
- voidint whereLessThanEqualTo(Uint32 columnId, float val) {
- float value = (float)val;
- return self->setBound(columnId,NdbIndexScanOperation::BoundGE,
- (void *) &value);
- }
-
- voidint whereLessThanEqualTo(const char * columnName, Int64 anInputDecimal) {
- int ret = -1;
- char * theValue = decimal2bytes(anInputDecimal);
- if (theValue != NULL) {
- ret = self->setBound(columnName, NdbIndexScanOperation::BoundGE,
- (void *) theValue);
- free(theValue);
- }
- return ret;
- }
- voidint whereLessThanEqualTo(Uint32 columnId, Int64 anInputDecimal) {
- int ret = -1;
- char * theValue = decimal2bytes(anInputDecimal);
- if (theValue != NULL) {
- ret = self->setBound(columnId, NdbIndexScanOperation::BoundGE,
- (void *) theValue);
- free(theValue);
- }
- return ret;
- }
-
- voidint whereLessThanEqualTo(const char* anAttrName,
- const char * anInputString, size_t len) {
- const NdbDictionary::Column * theColumn =
- self->getTable()->getColumn(anAttrName);
- char * stringVal = ndbFormatString(theColumn,anInputString,len);
- if (stringVal == NULL) {
- return -1;
- }
- int retval = self->setBound(anAttrName,NdbIndexScanOperation::BoundGE,
- (void *)stringVal);
- free(stringVal);
- return retval;
- };
- voidint whereLessThanEqualTo(Uint32 anAttrId,
- const char * anInputString, size_t len ) {
- const NdbDictionary::Column * theColumn =
- self->getTable()->getColumn(anAttrId);
- char * stringVal = ndbFormatString(theColumn,anInputString,len);
- if (stringVal == NULL) {
- return -1;
- }
- int retval = self->setBound(anAttrId,NdbIndexScanOperation::BoundGE,
- (void *)stringVal);
- free(stringVal);
- return retval;
- };
-
-}
=== removed file 'storage/ndb/swig/ndbapi/NdbOperation.i'
--- a/storage/ndb/swig/ndbapi/NdbOperation.i 2008-03-11 15:27:35 +0000
+++ b/storage/ndb/swig/ndbapi/NdbOperation.i 1970-01-01 00:00:00 +0000
@@ -1,616 +0,0 @@
-/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
- *
- * Copyright (C) 2008 MySQL, Inc.
- *
- * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-class NdbOperation {
-
- NdbOperation(Ndb* aNdb, Type aType = PrimaryKeyAccess);
- virtual ~NdbOperation();
-
-public:
-
- enum Type {
- PrimaryKeyAccess = 0,
- UniqueIndexAccess = 1,
- TableScan = 2,
- OrderedIndexScan = 3,
- };
-
- enum LockMode {
- LM_Read = 0,
- LM_Exclusive = 1,
- LM_CommittedRead = 2,
- LM_Dirty = 2
- };
-
- %ndbnoexception;
-
- // These are not expected to fail
- const NdbError & getNdbError() const;
- int getNdbErrorLine();
- const char* getTableName() const;
-
- void setPartitionId(Uint32 id);
- Uint32 getPartitionId() const;
-
- const NdbDictTable * getTable() const;
-
- %ndbexception("NdbApiException") {
- $action
- if (result == NULL) {
- NdbError err = arg1->getNdbError();
- NDB_exception_err(NdbApiException,err.message,err);
- }
- }
-
- NdbTransaction* getNdbTransaction();
-
- virtual NdbBlob* getBlobHandle(const char* anAttrName);
- virtual NdbBlob* getBlobHandle(Uint32 anAttrId);
-
- %ndbexception("NdbApiException") {
- $action
- if (result==-1) {
- NdbError err = arg1->getNdbError();
- NDB_exception_err(NdbApiException,err.message,err);
- }
- }
-
-
- %rename(equalInt) equal(const char *, Int32);
- %rename(equalInt) equal(Uint32, Int32);
- voidint equal(const char* anAttrName, Int32 aValue);
- voidint equal(Uint32 anAttrId, Int32 aValue);
-
- %rename(equalUint) equal(const char *, Uint32);
- %rename(equalUint) equal(Uint32, Uint32);
- voidint equal(const char* anAttrName, Uint32 aValue);
- voidint equal(Uint32 anAttrId, Uint32 aValue);
-
- %rename(equalLong) equal(const char *, Int64);
- %rename(equalLong) equal(Uint32, Int64);
- voidint equal(const char* anAttrName, Int64 aValue);
- voidint equal(Uint32 anAttrId, Int64 aValue);
-
- %rename(equalUlong) equal(const char *, Uint64);
- %rename(equalUlong) equal(Uint32, Uint64);
-
- voidint equal(const char* anAttrName, Uint64 aValue);
- voidint equal(Uint32 anAttrId, Uint64 aValue);
-
-
- virtual voidint readTuple(LockMode);
- virtual voidint insertTuple();
- virtual voidint writeTuple();
- virtual voidint updateTuple();
- virtual voidint deleteTuple();
-
-
-/* Interpreted Program Support */
-
-#if !defined(SWIG_RUBY_AUTORENAME)
- %rename(incValueLong) incValue(const char*, Uint32);
- %rename(incValueLong) incValue(Uint32, Uint32);
- %rename(incValueUlong) incValue(const char*, Uint64);
- %rename(incValueUlong) incValue(Uint32, Uint64);
-
- %rename(subValueLong) subValue(const char*, Uint32);
- %rename(subValueLong) subValue(Uint32, Uint32);
- %rename(subValueUlong) subValue(const char*, Uint64);
- %rename(subValueUlong) subValue(Uint32, Uint64);
-#endif
-
- %contract incValue(const char* anAttrName, Uint32 aValue) {
-require:
- aValue > 0;
- }
- voidint incValue(const char* anAttrName, Uint32 aValue);
-
- %contract incValue(Uint32 anAttrId, Uint32 aValue) {
-require:
- aValue > 0;
- }
- voidint incValue(Uint32 anAttrId, Uint32 aValue);
-
- %contract incValue(const char* anAttrName, Uint64 aValue) {
-require:
- aValue > 0;
- }
- voidint incValue(const char* anAttrName, Uint64 aValue);
-
- %contract incValue(Uint32 anAttrId, Uint64 aValue ) {
-require:
- aValue > 0;
- }
- voidint incValue(Uint32 anAttrId, Uint64 aValue);
-
- voidint subValue(const char* anAttrName, Uint32 aValue);
- voidint subValue(const char* anAttrName, Uint64 aValue);
- voidint subValue(Uint32 anAttrId, Uint32 aValue);
- voidint subValue(Uint32 anAttrId, Uint64 aValue);
-
-#if !defined(SWIG_RUBY_AUTORENAME)
- %rename(defLabel) def_label(int labelNumber);
- %rename(addReg) add_reg(Uint32 RegSource1, Uint32 RegSource2, Uint32 RegDest);
- %rename(subReg) sub_reg(Uint32 RegSource1, Uint32 RegSource2, Uint32 RegDest);
- %rename(loadConstU32) load_const_u32(Uint32 RegDest, Uint32 Constant);
- %rename(loadConstU64) load_const_u64(Uint32 RegDest, Uint64 Constant);
- %rename(loadConstNull) load_const_null(Uint32 RegDest);
- %rename(readAttr) read_attr(const char* anAttrName, Uint32 RegDest);
- %rename(writeAttr) write_attr(const char* anAttrName, Uint32 RegSource);
- %rename(readAttr) read_attr(Uint32 anAttrId, Uint32 RegDest);
- %rename(writeAttr) write_attr(Uint32 anAttrId, Uint32 RegSource);
- %rename(branchGe) branch_ge(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label);
- %rename(branchGt) branch_gt(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label);
- %rename(branchLe) branch_le(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label);
- %rename(branchLt) branch_lt(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label);
- %rename(branchEq) branch_eq(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label);
- %rename(branchNe) branch_ne(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label);
- %rename(branchNeNull) branch_ne_null(Uint32 RegLvalue, Uint32 Label);
- %rename(branchEqNull) branch_eq_null(Uint32 RegLvalue, Uint32 Label);
- %rename(branchLabel) branch_label(Uint32 Label);
- %rename(branchColEqNull) branch_col_eq_null(Uint32 ColId, Uint32 Label);
- %rename(branchColNeNull) branch_col_ne_null(Uint32 ColId, Uint32 Label);
-#endif
-
- voidint def_label(int labelNumber);
- voidint add_reg(Uint32 RegSource1, Uint32 RegSource2, Uint32 RegDest);
- voidint sub_reg(Uint32 RegSource1, Uint32 RegSource2, Uint32 RegDest);
- voidint load_const_u32(Uint32 RegDest, Uint32 Constant);
- voidint load_const_u64(Uint32 RegDest, Uint64 Constant);
- voidint load_const_null(Uint32 RegDest);
- voidint read_attr(const char* anAttrName, Uint32 RegDest);
- voidint write_attr(const char* anAttrName, Uint32 RegSource);
- voidint read_attr(Uint32 anAttrId, Uint32 RegDest);
- voidint write_attr(Uint32 anAttrId, Uint32 RegSource);
- voidint branch_ge(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label);
- voidint branch_gt(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label);
- voidint branch_le(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label);
- voidint branch_lt(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label);
- voidint branch_eq(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label);
- voidint branch_ne(Uint32 RegLvalue, Uint32 RegRvalue, Uint32 Label);
- voidint branch_ne_null(Uint32 RegLvalue, Uint32 Label);
- voidint branch_eq_null(Uint32 RegLvalue, Uint32 Label);
- voidint branch_label(Uint32 Label);
- voidint branch_col_eq_null(Uint32 ColId, Uint32 Label);
- voidint branch_col_ne_null(Uint32 ColId, Uint32 Label);
-
-#if !defined(SWIG_RUBY_AUTORENAME)
- %rename(interpretExitOk) interpret_exit_ok();
- %rename(interpretExitNok) interpret_exit_nok(Uint32);
- %rename(interpretExitNok) interpret_exit_nok();
- %rename(interpretExitLastRow) interpret_exit_last_row();
- %rename(defSubroutine) def_subroutine(int);
- %rename(callSub) call_sub(Uint32);
- %rename(retSub) ret_sub();
-#endif
-
- voidint interpret_exit_ok();
- voidint interpret_exit_nok(Uint32 ErrorCode);
- voidint interpret_exit_nok();
- voidint interpret_exit_last_row();
- voidint def_subroutine(int SubroutineNumber);
- voidint call_sub(Uint32 Subroutine);
- voidint ret_sub();
-
- virtual voidint interpretedUpdateTuple();
- virtual voidint interpretedDeleteTuple();
-
-
- %ndbnoexception;
-
-};
-
-
-%extend NdbOperation {
-
-
-public:
-
- %ndbexception("NdbApiException") {
- $action
- if (result==NULL) {
- NdbError err = arg1->getNdbError();
- NDB_exception_err(NdbApiException,err.message,err);
- }
- }
-
- NdbRecAttr* getValue(const char* anAttrName) {
- return self->getValue(anAttrName,NULL);
- }
- NdbRecAttr* getValue(Uint32 anAttrId) {
- return self->getValue(anAttrId,NULL);
- }
- NdbRecAttr* getValue(const NdbDictColumn* col) {
- return self->getValue(col,NULL);
- }
-
-
- const char * getColumnCharsetName(const char* columnName) {
- const NdbDictColumn * theColumn = self->getTable()->getColumn(columnName);
- const CHARSET_INFO * csinfo = theColumn->getCharset();
- if (csinfo == NULL) {
- return "latin1";
- }
- return csinfo->csname;
- }
-
- %ndbexception("NdbApiException") {
- $action
- if (result==-1) {
- NdbError err = arg1->getNdbError();
- NDB_exception_err(NdbApiException,err.message,err);
- }
- }
-
- voidint equalNull(const NdbDictColumn * theColumn) {
- return self->equal(theColumn->getName(), (char*)0);
- }
- voidint equalNull(const char* anAttrName) {
- return self->equal(anAttrName, (char*)0);
- }
- voidint equalNull(Uint32 anAttrId) {
- return self->equal(anAttrId, (char*)0);
- }
-
- voidint equalInt(const NdbDictColumn * theColumn, Int32 theValue) {
- return self->equal(theColumn->getName(), theValue);
- }
- voidint equalUint(const NdbDictColumn * theColumn, Uint32 theValue) {
- return self->equal(theColumn->getName(), theValue);
- }
- voidint equalLong(const NdbDictColumn * theColumn, Int64 theValue) {
- return self->equal(theColumn->getName(), theValue);
- }
- voidint equalUlong(const NdbDictColumn * theColumn, Uint64 theValue) {
- return self->equal(theColumn->getName(), theValue);
- }
- voidint equalShort(const NdbDictColumn * theColumn, short theValue) {
- return self->equal(theColumn->getName(), theValue);
- }
- voidint equalShort(const char* anAttrName, short theValue) {
- return self->equal(anAttrName, (Int32)theValue);
- }
- voidint equalShort(Uint32 anAttrId, short theValue) {
- return self->equal(anAttrId, (Int32)theValue);
- }
-
- voidint setBytes(const char* anAttrName, const char* BYTE, size_t len) {
- const NdbDictColumn * theColumn = self->getTable()->getColumn(anAttrName);
- char * stringVal = ndbFormatString(theColumn,BYTE,len);
- if (stringVal == NULL)
- return -1;
- int retval = self->setValue(anAttrName,stringVal);
- free(stringVal);
- return retval;
- }
- voidint setBytes(Uint32 anAttrId, const char* BYTE, size_t len) {
- const NdbDictColumn * theColumn = self->getTable()->getColumn(anAttrId);
- char * stringVal = ndbFormatString(theColumn,BYTE,len);
- if (stringVal == NULL)
- return -1;
- int retval = self->setValue(anAttrId,stringVal);
- free(stringVal);
- return retval;
- }
-
- voidint setString(const char* anAttrName,
- const char* anInputString, size_t len) {
- const NdbDictColumn * theColumn = self->getTable()->getColumn(anAttrName);
- char * stringVal = ndbFormatString(theColumn,anInputString,len);
- if (stringVal == NULL)
- return -1;
- int retval = self->setValue(anAttrName,stringVal);
- free(stringVal);
- return retval;
- }
- voidint setString(Uint32 anAttrId,
- const char* anInputString, size_t len) {
- const NdbDictColumn * theColumn = self->getTable()->getColumn(anAttrId);
- char * stringVal = ndbFormatString(theColumn,anInputString,len);
- if (stringVal == NULL)
- return -1;
- int retval = self->setValue(anAttrId,stringVal);
- free(stringVal);
- return retval;
- }
-
- voidint equalString(const char* anAttrName,
- const char* anInputString, size_t len) {
- const NdbDictColumn * theColumn = self->getTable()->getColumn(anAttrName);
- char * stringVal = ndbFormatString(theColumn,anInputString,len);
- if (stringVal == NULL)
- return -1;
- int retval = self->equal(anAttrName,stringVal);
- free(stringVal);
- return retval;
- }
- voidint equalString(Uint32 anAttrId,
- const char* anInputString, size_t len) {
- const NdbDictColumn * theColumn = self->getTable()->getColumn(anAttrId);
- char * stringVal = ndbFormatString(theColumn,anInputString,len);
- if (stringVal == NULL)
- return -1;
- int retval = self->equal(anAttrId,stringVal);
- free(stringVal);
- return retval;
- }
-
- voidint setShort(const char* anAttrName, short intVal) {
- return self->setValue(anAttrName,(Int32)intVal);
- }
- voidint setShort(Uint32 anAttrId, short intVal) {
- return self->setValue(anAttrId,(Int32)intVal);
- }
-
- voidint setInt(const char* anAttrName, Int32 intVal) {
- return self->setValue(anAttrName,intVal);
- }
- voidint setInt(Uint32 anAttrId, Int32 intVal) {
- return self->setValue(anAttrId,intVal);
- }
-
- voidint setLong(const char* anAttrName, Int64 intVal) {
- return self->setValue(anAttrName,intVal);
- }
- voidint setLong(Uint32 anAttrId, Int64 intVal) {
- return self->setValue(anAttrId,intVal);
- }
-
- voidint setDouble(const char* anAttrName, double intVal) {
- return self->setValue(anAttrName,intVal);
- }
- voidint setDouble(Uint32 anAttrId, double intVal) {
- return self->setValue(anAttrId,intVal);
- }
-
- voidint setFloat(const char* anAttrName, float intVal) {
- return self->setValue(anAttrName,intVal);
- }
- voidint setFloat(Uint32 anAttrId, float intVal) {
- return self->setValue(anAttrId,intVal);
- }
-
- voidint setDecimal(Uint32 anAttrId, decimal_t * dec) {
-
- int theScale = dec->frac;
- int thePrecision = (dec->intg)+theScale;
-
- char * theValue = (char *) malloc(decimal_bin_size(thePrecision,
- theScale));
- decimal2bin(dec, theValue, thePrecision, theScale);
- int ret = self->setValue(anAttrId,theValue);
- free(theValue);
- return ret;
- }
- voidint setDecimal(const char* anAttrName, decimal_t * dec) {
-
- int theScale = dec->frac;
- int thePrecision = (dec->intg)+theScale;
-
- char * theValue = (char *) malloc(decimal_bin_size(thePrecision,
- theScale));
- decimal2bin(dec, theValue, thePrecision, theScale);
- int ret = self->setValue(anAttrName,theValue);
- free(theValue);
- return ret;
- }
-
- voidint setDatetime(const char* anAttrName, NdbDateTime * anInputDateTime) {
-
- const NdbDictColumn * theColumn = self->getTable()->getColumn(anAttrName);
-
- Uint64 dtval = ndbFormatDateTime(theColumn,anInputDateTime);
- if (dtval == 1) {
- return dtval;
- }
- return self->setValue(anAttrName,dtval);
-
- }
-
- voidint setDatetime(Uint32 anAttrId, NdbDateTime * anInputDateTime) {
-
- const NdbDictColumn * theColumn = self->getTable()->getColumn(anAttrId);
-
- Uint64 dtval = ndbFormatDateTime(theColumn,anInputDateTime);
- if (dtval == 1) {
- return dtval;
- }
- return self->setValue(anAttrId,dtval);
- }
-
- voidint setTimestamp(const char* anAttrName, NdbTimestamp anInputTimestamp) {
- return self->setValue(anAttrName,anInputTimestamp);
- }
- voidint setTimestamp(Uint32 anAttrId, NdbTimestamp anInputTimestamp) {
- return self->setValue(anAttrId,anInputTimestamp);
- }
-
-
- voidint setNull(const char * anAttrName) {
- return self->setValue(anAttrName,(char *)0);
- }
- voidint setNull(Uint32 anAttrId) {
- return self->setValue(anAttrId,(char *)0);
- }
-
-
- voidint equalBytes(const NdbDictColumn * theColumn,
- const char* BYTE, size_t len) {
- char * stringVal = ndbFormatString(theColumn,BYTE,len);
- if (stringVal == NULL)
- return -1;
- int retval = self->equal(theColumn->getName(),stringVal);
- free(stringVal);
- return retval;
- }
- voidint equalBytes(const char* anAttrName,
- const char* BYTE, size_t len) {
- const NdbDictColumn * theColumn = self->getTable()->getColumn(anAttrName);
- char * stringVal = ndbFormatString(theColumn,BYTE,len);
- if (stringVal == NULL)
- return -1;
- int retval = self->equal(anAttrName,stringVal);
- free(stringVal);
- return retval;
- }
- voidint equalBytes(Uint32 anAttrId,
- const char* BYTE, size_t len) {
- const NdbDictColumn * theColumn = self->getTable()->getColumn(anAttrId);
- char * stringVal = ndbFormatString(theColumn,BYTE,len);
- if (stringVal == NULL)
- return -1;
- int retval = self->equal(anAttrId,stringVal);
- free(stringVal);
- return retval;
- }
-
- voidint equalDatetime(const NdbDictColumn * theColumn,
- NdbDateTime * anInputDateTime) {
-
- Uint64 dtval = ndbFormatDateTime(theColumn,anInputDateTime);
- if (dtval == 1)
- return dtval;
- return self->equal(theColumn->getName(),dtval);
- }
- voidint equalDatetime(const char* anAttrName,
- NdbDateTime * anInputDateTime) {
-
- const NdbDictColumn * theColumn = self->getTable()->getColumn(anAttrName);
-
- Uint64 dtval = ndbFormatDateTime(theColumn,anInputDateTime);
- if (dtval == 1)
- return dtval;
- return self->equal(anAttrName,dtval);
- }
- voidint equalDatetime(Uint32 anAttrId, NdbDateTime * anInputDateTime) {
-
- const NdbDictColumn * theColumn = self->getTable()->getColumn(anAttrId);
-
- Uint64 dtval = ndbFormatDateTime(theColumn,anInputDateTime);
- if (dtval == 1)
- return dtval;
- return self->equal(anAttrId,dtval);
- }
-
- voidint equalTimestamp(const NdbDictColumn * theColumn,
- NdbTimestamp anInputTimestamp) {
- return self->equal(theColumn->getName(),anInputTimestamp);
- }
- voidint equalTimestamp(const char* anAttrName,
- NdbTimestamp anInputTimestamp) {
- return self->equal(anAttrName,anInputTimestamp);
- }
- voidint equalTimestamp(Uint32 anAttrId,
- NdbTimestamp anInputTimestamp) {
- return self->equal(anAttrId,anInputTimestamp);
- }
-
- voidint equalDecimal(const NdbDictColumn * theColumn, decimal_t * decVal) {
-
- const int prec = theColumn->getPrecision();
- const int scale = theColumn->getScale();
-
- char * theValue = (char *) malloc(decimal_bin_size(prec, scale));
- decimal2bin(decVal, theValue, prec, scale);
- int ret = self->equal(theColumn->getName(),theValue);
- free(theValue);
- return ret;
- }
- voidint equalDecimal(Uint32 anAttrId, decimal_t * decVal) {
- const NdbDictColumn * theColumn = self->getTable()->getColumn(anAttrId);
-
- const int prec = theColumn->getPrecision();
- const int scale = theColumn->getScale();
-
- char * theValue = (char *) malloc(decimal_bin_size(prec, scale));
- decimal2bin(decVal, theValue, prec, scale);
- int ret = self->equal(anAttrId,theValue);
- free(theValue);
- return ret;
- }
- voidint equalDecimal(const char * anAttrName, decimal_t * decVal) {
- const NdbDictColumn * theColumn = self->getTable()->getColumn(anAttrName);
-
- const int prec = theColumn->getPrecision();
- const int scale = theColumn->getScale();
-
- char * theValue = (char *) malloc(decimal_bin_size(prec, scale));
- decimal2bin(decVal, theValue, prec, scale);
- int ret = self->equal(anAttrName,theValue);
- free(theValue);
- return ret;
- }
-
- voidint getColumnId(const char* columnName) {
- return getColumnId(self,columnName);
- }
-
-
- voidint branchColEq(Uint32 ColId, Int64 val, Uint32 len,
- bool nopad, Uint32 Label) {
- return self->branch_col_eq(ColId, (void *) &val, len, nopad, Label);
- }
- voidint branchColNe(Uint32 ColId, Int64 val, Uint32 len,
- bool nopad, Uint32 Label) {
- return self->branch_col_ne(ColId, (void *) &val, len, nopad, Label);
- }
- voidint branchColLt(Uint32 ColId, Int64 val, Uint32 len,
- bool nopad, Uint32 Label) {
- return self->branch_col_lt(ColId, (void *) &val, len, nopad, Label);
- }
- voidint branchColLe(Uint32 ColId, Int64 val, Uint32 len,
- bool nopad, Uint32 Label) {
- return self->branch_col_le(ColId, (void *) &val, len, nopad, Label);
- }
- voidint branchColGt(Uint32 ColId, Int64 val, Uint32 len,
- bool nopad, Uint32 Label) {
- return self->branch_col_gt(ColId, (void *) &val, len, nopad, Label);
- }
- voidint branchColGe(Uint32 ColId, Int64 val, Uint32 len,
- bool nopad, Uint32 Label) {
- return self->branch_col_ge(ColId, (void *) &val, len, nopad, Label);
- }
- voidint branchColLikeString(Uint32 ColId,
- const char* anInputString, size_t len,
- bool nopad, Uint32 Label) {
- return self->branch_col_like(ColId, (void *)anInputString, (Uint32)len,
- nopad, Label);
- };
- voidint branchColNotLikeString(Uint32 ColId,
- const char* anInputString, size_t len,
- bool nopad, Uint32 Label) {
- return self->branch_col_notlike(ColId, (void *)anInputString, (Uint32)len,
- nopad, Label);
- };
- voidint branchColLikeBytes(Uint32 ColId, const char* BYTE, size_t len,
- bool nopad, Uint32 Label) {
- return self->branch_col_like(ColId, (void *)BYTE, (Uint32)len,
- nopad, Label);
- };
- voidint branchColNotLikeBytes(Uint32 ColId, const char* BYTE, size_t len,
- bool nopad, Uint32 Label) {
- return self->branch_col_notlike(ColId, (void *)BYTE, (Uint32)len,
- nopad, Label);
- };
- %ndbnoexception;
-
-
-};
-
=== removed file 'storage/ndb/swig/ndbapi/NdbRecAttr.i'
--- a/storage/ndb/swig/ndbapi/NdbRecAttr.i 2008-03-11 15:27:35 +0000
+++ b/storage/ndb/swig/ndbapi/NdbRecAttr.i 1970-01-01 00:00:00 +0000
@@ -1,222 +0,0 @@
-/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
- *
- * Copyright (C) 2008 MySQL, Inc.
- *
- * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-%newobject NdbRecAttr::getString();
-
-
-class NdbRecAttr {
- NdbRecAttr(Ndb*);
-
-public:
- ~NdbRecAttr();
-
- int isNULL();
-
-#if !defined(SWIG_RUBY_AUTORENAME)
- %rename(getInt64) int64_value();
- %rename(getInt32) int32_value();
- %rename(getShort) short_value();
- %rename(getChar) char_value();
- %rename(getUint64) u_64_value() const;
- %rename(getUint32) u_32_value();
- %rename(getUshort) u_short_value() const;
- %rename(getUchar) u_char_value() const;
- %rename(getFloat) float_value() const;
- %rename(getDouble) double_value() const;
-#else
- %rename(get_int64) int64_value();
- %rename(get_int32) int32_value();
- %rename(get_short) short_value();
- %rename(get_char) char_value();
- %rename(get_uint64) u_64_value() const;
- %rename(get_uint32) u_32_value();
- %rename(get_ushort) u_short_value() const;
- %rename(get_uchar) u_char_value() const;
- %rename(get_float) float_value() const;
- %rename(get_double) double_value() const;
- %rename(getSizeInBytes) get_size_in_bytes() const;
-#endif
-
- %ndbexception("NdbApiException") {
- $action
- }
-
- Int64 int64_value();
- Int32 int32_value();
- short short_value();
- char char_value();
- const unsigned long long u_64_value() const;
- const unsigned long u_32_value();
- const unsigned short u_short_value() const;
- const unsigned char u_char_value() const;
- float float_value() const;
- double double_value() const;
-
- char* aRef() const;
-
- %ndbnoexception;
-
- const NdbDictColumn * getColumn() const;
- NdbDictColumn::Type getType() const;
-
- Uint32 get_size_in_bytes() const;
-};
-
-%extend NdbRecAttr {
-
-#define uint2korr(A)(short) (((short) ((unsigned char) (A)[0])) + \
- ((short) ((unsigned char) (A)[1]) << 8))
-
- int getColType() const {
- NdbDictionary::Column::Type x = self->getType();
- int y = (int)x;
- return y;
- }
-
- %ndbexception("NdbApiException") {
- $action
- if (result->buf == NULL) {
- NDB_exception(NdbApiException,"Error fetching data");
- }
- }
-
- decimal_t * getDecimal() {
- NdbDictionary::Column::Type colType = self->getType();
-
- // (an array of ints, not base-10 digits)
- decimal_digit_t digits[DECIMAL_BUFF];
- decimal_t * dec = (decimal_t *)malloc(sizeof(decimal_t));
- dec->intg = 0;
- dec->frac = 0;
- dec->len = DECIMAL_BUFF;
- dec->sign = 0;
- dec->buf = digits;
-
- if(colType == NdbDictionary::Column::Decimal) {
-
- int prec = self->getColumn()->getPrecision();
- int scale = self->getColumn()->getScale();
- bin2decimal(self->aRef(), dec, prec, scale);
- }
-
- return dec;
-
-
- }
-
- %ndbexception("NdbApiException") {
- $action
- if ( (result.theString == NULL) || (result.theLength == -1) ) {
- NDB_exception(NdbApiException,"Error fetching data");
- }
- }
- BYTES getBytes() {
- NdbDictionary::Column::Type colType = self->getType();
- BYTES output;
- output.theString=NULL;
- output.theLength=-1;
-
- char* rec = self->aRef();
-
- if(colType == NdbDictionary::Column::Longvarbinary)
- {
- output.theLength=(int)uint2korr(rec);
- output.theString = &rec[2];
- }
- else if(colType == NdbDictionary::Column::Varbinary)
- {
-
- output.theLength = (int) (rec[0]);
- output.theString = &rec[1];
- }
- else if( colType == NdbDictionary::Column::Binary)
- {
- output.theLength = strlen(rec)-1;
- output.theString = &rec[0];
- }
- return output;
- }
-
- %ndbexception("NdbApiException") {
- $action
- if (result == NULL) {
- NDB_exception(NdbApiException,"Error fetching data");
- }
- }
-
- const char* getString() {
- NdbDictionary::Column::Type colType = self->getType();
-
- char* ref = self->aRef();
-
- if(colType == NdbDictionary::Column::Longvarchar)
- {
- int len=(int)uint2korr(ref);
- char * buff = (char *)malloc(len+1);
- memset(buff,0,len+1);
- ref+=2;
- memcpy(buff,ref,len);
- buff[len+1]='\0';
- return buff;
- }
- else if(colType == NdbDictionary::Column::Varchar)
- {
- short len = (short) (unsigned char) (ref[0]);
- char * buff = (char *)malloc(len+1);
- memset(buff,0, len+1);
- memcpy(buff,++ref,len);
- buff[len+1]='\0';
- return buff;
- }
- else if(colType == NdbDictionary::Column::Char)
- {
- int len=strlen(ref);
- int i=len-1;
- /**
- * truncate spaces...
- */
- while(ref[i] == ' ')
- {
- i--;
- }
- i++; //length of string until space padding starts..
- char * buff = (char *)malloc(i+1); //+1 for null;
- memcpy(buff, ref, i);
- buff[i]='\0';
- return buff;
- }
- return NULL;
- }
-
- %ndbnoexception;
- NdbDateTime * getDatetime() {
- return new NdbDateTime();
- }
-
- %ndbexception("NdbApiException") {
- $action
- }
-
- NdbTimestamp getTimestamp() {
- return (NdbTimestamp)(self->u_32_value());
- }
-
- %ndbnoexception;
-};
=== removed file 'storage/ndb/swig/ndbapi/NdbScanFilter.i'
--- a/storage/ndb/swig/ndbapi/NdbScanFilter.i 2008-03-11 15:27:35 +0000
+++ b/storage/ndb/swig/ndbapi/NdbScanFilter.i 1970-01-01 00:00:00 +0000
@@ -1,686 +0,0 @@
-/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
- *
- * Copyright (C) 2008 MySQL, Inc.
- *
- * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-%{
-
- Uint32 cmpGetColumnLength(const NdbDictionary::Column * theColumn) {
-
- Uint32 cmpLength = 0;
- switch(theColumn->getType()) {
- case NDB_TYPE_VARCHAR:
- case NDB_TYPE_VARBINARY:
- {
- cmpLength=theColumn->getLength()+1;
- break;
- }
- case NDB_TYPE_LONGVARCHAR:
- case NDB_TYPE_LONGVARBINARY:
- {
- cmpLength=theColumn->getLength()+2;
- break;
- }
- case NDB_TYPE_CHAR:
- case NDB_TYPE_BINARY:
- {
- cmpLength=theColumn->getLength();
- break;
- }
- default:
- return 0;
- }
- return cmpLength;
- }
-
- %}
-
-class NdbScanFilter {
-
- class NdbScanFilterImpl & m_impl;
- NdbScanFilter& operator=(const NdbScanFilter&); ///< Defined not implemented
-public:
-
- NdbScanFilter(class NdbOperation * op);
- ~NdbScanFilter();
-
- /**
- * Group operators
- */
- enum Group {
- AND = 1, ///< (x1 AND x2 AND x3)
- OR = 2, ///< (x1 OR x2 OR X3)
- NAND = 3, ///< NOT (x1 AND x2 AND x3)
- NOR = 4 ///< NOT (x1 OR x2 OR x3)
- };
-
- enum BinaryCondition
- {
- COND_LE = 0, ///< lower bound
- COND_LT = 1, ///< lower bound, strict
- COND_GE = 2, ///< upper bound
- COND_GT = 3, ///< upper bound, strict
- COND_EQ = 4, ///< equality
- COND_NE = 5, ///< not equal
- COND_LIKE = 6, ///< like
- COND_NOT_LIKE = 7 ///< not like
- };
-
-
- %ndbexception("NdbApiException") {
- $action
- if (result==NULL) {
- NDB_exception(NdbApiException,"ScanFilter error" );
- }
- }
- NdbOperation * getNdbOperation();
-
- %ndbexception("NdbApiException") {
- $action
- if (result==-1) {
- NDB_exception(NdbApiException,"ScanFilter error" );
- }
- }
- /**
- * Begin of compound.
- * ®return 0 if successful, -1 otherwize
- */
- int begin(Group group = AND);
-
- /**
- * End of compound.
- * ®return 0 if successful, -1 otherwize
- */
- int end();
-
- /** @} *********************************************************************/
-#if defined(SWIG_RUBY_AUTORENAME)
- %rename("is_true?") istrue;
- %rename("is_false?") isfalse;
- %rename("is_null?") isnull;
- %rename("is_not_null?") isnotnull;
-#else
- %rename istrue isTrue;
- %rename isfalse isFalse;
- %rename isnull isNull;
- %rename isnotnull isNotNull;
-#endif
-
- /**
- * <i>Explanation missing</i>
- */
- int istrue();
-
- /**
- * <i>Explanation missing</i>
- */
- int isfalse();
-
- /**
- * Compare column <b>ColId</b> with <b>val</b>
- */
-// int cmp(BinaryCondition cond, int ColId, const void *val, Uint32 len = 0);
-
- /**
- * @name Integer Comparators
- * @{
- */
- /** Compare column value with integer for equal
- * ®return 0 if successful, -1 otherwize
- */
- int eq(int ColId, Uint32 value);
-
- /** Compare column value with integer for not equal.
- * ®return 0 if successful, -1 otherwize
- */
- int ne(int ColId, Uint32 value);
- /** Compare column value with integer for less than.
- * ®return 0 if successful, -1 otherwize
- */
- int lt(int ColId, Uint32 value);
- /** Compare column value with integer for less than or equal.
- * ®return 0 if successful, -1 otherwize
- */
- int le(int ColId, Uint32 value);
- /** Compare column value with integer for greater than.
- * ®return 0 if successful, -1 otherwize
- */
- int gt(int ColId, Uint32 value);
- /** Compare column value with integer for greater than or equal.
- * ®return 0 if successful, -1 otherwize
- */
- int ge(int ColId, Uint32 value);
-
- /** Compare column value with integer for equal. 64-bit.
- * ®return 0 if successful, -1 otherwize
- */
- int eq(int ColId, Uint64 value);
- /** Compare column value with integer for not equal. 64-bit.
- * ®return 0 if successful, -1 otherwize
- */
- int ne(int ColId, Uint64 value);
- /** Compare column value with integer for less than. 64-bit.
- * ®return 0 if successful, -1 otherwize
- */
- int lt(int ColId, Uint64 value);
- /** Compare column value with integer for less than or equal. 64-bit.
- * ®return 0 if successful, -1 otherwize
- */
- int le(int ColId, Uint64 value);
- /** Compare column value with integer for greater than. 64-bit.
- * ®return 0 if successful, -1 otherwize
- */
- int gt(int ColId, Uint64 value);
- /** Compare column value with integer for greater than or equal. 64-bit.
- * ®return 0 if successful, -1 otherwize
- */
- int ge(int ColId, Uint64 value);
- /** @} *********************************************************************/
-
- /** Check if column value is NULL */
- int isnull(int ColId);
- /** Check if column value is non-NULL */
- int isnotnull(int ColId);
-
- %ndbnoexception
-};
-
-%extend NdbScanFilter {
-
- %ndbexception("NdbApiException") {
- $action
- if (result==-1) {
- NDB_exception(NdbApiException,"ScanFilter error" );
- }
- }
-
-
- int cmp(BinaryCondition cond, int ColId) {
- return self->cmp(cond,ColId,(void *)0);
- };
- int cmp(BinaryCondition cond, int ColId, const Int32 val) {
- Int32 value = (Int32)val;
- return self->cmp(cond,ColId,(void *) &value);
- };
- int cmp(BinaryCondition cond, int ColId, const Int64 val) {
- Int64 value = (Int64)val;
- return self->cmp(cond,ColId,(void *) &value);
- };
- int cmp(BinaryCondition cond, int ColId, const Uint64 val) {
- Uint64 value = (Uint64)val;
- return self->cmp(cond,ColId,(void *) &value);
- };
- int cmp(BinaryCondition cond, int ColId, const double val) {
- double value = (double)val;
- return self->cmp(cond,ColId,(void *) &value);
- };
- int cmp(BinaryCondition cond, int ColId, const float val) {
- float value = (float)val;
- return self->cmp(cond,ColId,(void *) &value);
- };
- int cmpTimestamp(BinaryCondition cond, int ColId,
- NdbTimestamp anInputTimestamp) {
- Uint32 value = (Uint32)anInputTimestamp;
- return self->cmp(cond,ColId,(void *) &value);
- };
- int cmp(BinaryCondition cond, int ColId, NdbDateTime *anInputDateTime) {
- NdbOperation * op = self->getNdbOperation();
- if (op == NULL)
- return -1;
- const NdbDictionary::Column * theColumn = op->getTable()->getColumn(ColId);
- Uint64 dtval = ndbFormatDateTime(theColumn,anInputDateTime);
- if (dtval == 1)
- return -1;
- return self->cmp(cond,ColId,(void *) &dtval);
- };
-
- int cmp(BinaryCondition cond, int ColId, const char * BYTE, size_t len) {
- NdbOperation * op = self->getNdbOperation();
- if (op == NULL)
- return -1;
- const NdbDictionary::Column * theColumn = op->getTable()->getColumn(ColId);
- char * stringVal = ndbFormatString(theColumn,BYTE,len);
- if (stringVal == NULL)
- return -1;
-
- Uint32 cmpLength = 0;
- if (cond == NdbScanFilter::COND_EQ) {
- cmpLength = cmpGetColumnLength(theColumn);
- if (cmpLength == 0)
- return -1;
- } else if ((cond == NdbScanFilter::COND_LIKE)
- || (cond == NdbScanFilter::COND_NOT_LIKE)) {
- cmpLength = (Uint32)len;
- }
-
- int retval = self->cmp(cond,ColId,(void *)stringVal,cmpLength);
- free(stringVal);
- return retval;
- };
- int cmpString(BinaryCondition cond, int ColId,
- const char * anInputString, size_t len ) {
- NdbOperation * op = self->getNdbOperation();
- if (op == NULL)
- return -1;
- const NdbDictionary::Column * theColumn = op->getTable()->getColumn(ColId);
- char * stringVal = ndbFormatString(theColumn,anInputString,len);
- if (stringVal == NULL)
- return -1;
-
- Uint32 cmpLength = 0;
- if (cond == NdbScanFilter::COND_EQ) {
- cmpLength = cmpGetColumnLength(theColumn);
- if (cmpLength == 0)
- return -1;
- } else if ((cond == NdbScanFilter::COND_LIKE)
- || (cond == NdbScanFilter::COND_NOT_LIKE)) {
- cmpLength = (Uint32)len;
- }
-
- int retval = self->cmp(cond,ColId,(void *)stringVal,cmpLength);
- free(stringVal);
- return retval;
- };
-
-
-
- int cmp(BinaryCondition cond, const char * ColName) {
- NdbOperation * op = self->getNdbOperation();
- if (op == NULL)
- return -1;
- int ColId = getColumnId(op,ColName);
- if (ColId == -1) {
- return ColId;
- }
- return self->cmp(cond,ColId,(void *)0);
- };
- int cmp(BinaryCondition cond, const char * ColName, const Int32 val) {
- NdbOperation * op = self->getNdbOperation();
- if (op == NULL)
- return -1;
- int ColId = getColumnId(op,ColName);
- if (ColId == -1) {
- return ColId;
- }
- Int32 value = (Int32)val;
- return self->cmp(cond,ColId,(void *) &value);
- };
- int cmp(BinaryCondition cond, const char * ColName, const Int64 val) {
- NdbOperation * op = self->getNdbOperation();
- if (op == NULL)
- return -1;
- int ColId = getColumnId(op,ColName);
- if (ColId == -1) {
- return ColId;
- }
- Int64 value = (Int64)val;
- return self->cmp(cond,ColId,(void *) &value);
- };
- int cmp(BinaryCondition cond, const char * ColName, const Uint64 val) {
- NdbOperation * op = self->getNdbOperation();
- if (op == NULL)
- return -1;
- int ColId = getColumnId(op,ColName);
- if (ColId == -1) {
- return ColId;
- }
- Uint64 value = (Uint64)val;
- return self->cmp(cond,ColId,(void *) &value);
- };
- int cmp(BinaryCondition cond, const char * ColName, const double val) {
- NdbOperation * op = self->getNdbOperation();
- if (op == NULL)
- return -1;
- int ColId = getColumnId(op,ColName);
- if (ColId == -1) {
- return ColId;
- }
- double value = (double)val;
- return self->cmp(cond,ColId,(void *) &value);
- };
- int cmp(BinaryCondition cond, const char * ColName, const float val) {
- NdbOperation * op = self->getNdbOperation();
- if (op == NULL)
- return -1;
- int ColId = getColumnId(op,ColName);
- if (ColId == -1) {
- return ColId;
- }
- float value = (float)val;
- return self->cmp(cond,ColId,(void *) &value);
- };
- int cmpTimestamp(BinaryCondition cond, const char * ColName,
- NdbTimestamp anInputTimestamp) {
- NdbOperation * op = self->getNdbOperation();
- if (op == NULL)
- return -1;
- int ColId = getColumnId(op,ColName);
- if (ColId == -1) {
- return ColId;
- }
- Uint32 value = (Uint32)anInputTimestamp;
- return self->cmp(cond,ColId,(void *) &value);
- };
- int cmp(BinaryCondition cond, const char * ColName,
- NdbDateTime *anInputDateTime) {
- NdbOperation * op = self->getNdbOperation();
- if (op == NULL)
- return -1;
- int ColId = getColumnId(op,ColName);
- if (ColId == -1) {
- return ColId;
- }
- const NdbDictionary::Column * theColumn = op->getTable()->getColumn(ColId);
- Uint64 dtval = ndbFormatDateTime(theColumn,anInputDateTime);
- if (dtval == 1)
- return -1;
- return self->cmp(cond,ColId,(void *) &dtval);
- };
-
- int cmp(BinaryCondition cond, const char * ColName,
- const char * BYTE, size_t len) {
- NdbOperation * op = self->getNdbOperation();
- if (op == NULL)
- return -1;
- int ColId = getColumnId(op,ColName);
- if (ColId == -1) {
- return ColId;
- }
- const NdbDictionary::Column * theColumn = op->getTable()->getColumn(ColId);
- char * stringVal = ndbFormatString(theColumn,BYTE,len);
- if (stringVal == NULL)
- return -1;
-
- Uint32 cmpLength = 0;
- if (cond == NdbScanFilter::COND_EQ) {
- cmpLength = cmpGetColumnLength(theColumn);
- if (cmpLength == 0)
- return -1;
- } else if ((cond == NdbScanFilter::COND_LIKE)
- || (cond == NdbScanFilter::COND_NOT_LIKE)) {
- cmpLength = (Uint32)len;
- }
-
- int retval = self->cmp(cond,ColId,(void *)stringVal,cmpLength);
- free(stringVal);
- return retval;
- };
- int cmpString(BinaryCondition cond, const char * ColName,
- const char * anInputString, size_t len ) {
- NdbOperation * op = self->getNdbOperation();
- if (op == NULL)
- return -1;
- int ColId = getColumnId(op,ColName);
- if (ColId == -1) {
- return ColId;
- }
- const NdbDictionary::Column * theColumn = op->getTable()->getColumn(ColId);
- char * stringVal = ndbFormatString(theColumn,anInputString,len);
- if (stringVal == NULL)
- return -1;
- Uint32 cmpLength = 0;
- if (cond == NdbScanFilter::COND_EQ) {
- cmpLength = cmpGetColumnLength(theColumn);
- if (cmpLength == 0)
- return -1;
- } else if ((cond == NdbScanFilter::COND_LIKE) || (cond == NdbScanFilter::COND_NOT_LIKE)) {
- cmpLength = (Uint32)len;
- }
- int retval = self->cmp(cond,ColId,(void *)stringVal,cmpLength);
- free(stringVal);
- return retval;
- };
-
- /** Compare column value with integer for equal
- * ®return 0 if successful, -1 otherwize
- */
- int eq(const char * ColName, Uint32 value) {
- NdbOperation * op = self->getNdbOperation();
- if (op == NULL)
- return -1;
- int ColId = getColumnId(op,ColName);
- if (ColId == -1) {
- return ColId;
- }
- return self->eq(ColId,value);
- }
-
- /** Compare column value with integer for not equal.
- * ®return 0 if successful, -1 otherwize
- */
- int ne(const char * ColName, Uint32 value) {
- NdbOperation * op = self->getNdbOperation();
- if (op == NULL)
- return -1;
- int ColId = getColumnId(op,ColName);
- if (ColId == -1) {
- return ColId;
- }
- return self->ne(ColId,value);
- }
-
- /** Compare column value with integer for less than.
- * ®return 0 if successful, -1 otherwize
- */
- int lt(const char * ColName, Uint32 value) {
- NdbOperation * op = self->getNdbOperation();
- if (op == NULL)
- return -1;
- int ColId = getColumnId(op,ColName);
- if (ColId == -1) {
- return ColId;
- }
- return self->lt(ColId,value);
- }
-
- /** Compare column value with integer for less than or equal.
- * ®return 0 if successful, -1 otherwize
- */
- int le(const char * ColName, Uint32 value) {
- NdbOperation * op = self->getNdbOperation();
- if (op == NULL)
- return -1;
- int ColId = getColumnId(op,ColName);
- if (ColId == -1) {
- return ColId;
- }
- return self->le(ColId,value);
- }
-
- /** Compare column value with integer for greater than.
- * ®return 0 if successful, -1 otherwize
- */
- int gt(const char * ColName, Uint32 value) {
- NdbOperation * op = self->getNdbOperation();
- if (op == NULL)
- return -1;
- int ColId = getColumnId(op,ColName);
- if (ColId == -1) {
- return ColId;
- }
- return self->gt(ColId,value);
- }
-
- /** Compare column value with integer for greater than or equal.
- * ®return 0 if successful, -1 otherwize
- */
- int ge(const char * ColName, Uint32 value) {
- NdbOperation * op = self->getNdbOperation();
- if (op == NULL)
- return -1;
- int ColId = getColumnId(op,ColName);
- if (ColId == -1) {
- return ColId;
- }
- return self->ge(ColId,value);
- }
-
-
- /** Compare column value with integer for equal. 64-bit.
- * ®return 0 if successful, -1 otherwize
- */
- int eq(const char * ColName, Uint64 value) {
- NdbOperation * op = self->getNdbOperation();
- if (op == NULL)
- return -1;
- int ColId = getColumnId(op,ColName);
- if (ColId == -1) {
- return ColId;
- }
- return self->eq(ColId,value);
- }
- int eq(const char * ColName, const char * anInputString, size_t len ) {
- NdbOperation * op = self->getNdbOperation();
- if (op == NULL)
- return -1;
- int ColId = getColumnId(op,ColName);
- if (ColId == -1) {
- return ColId;
- }
-
- const NdbDictionary::Column * theColumn = op->getTable()->getColumn(ColId);
- char * stringVal = ndbFormatString(theColumn,anInputString,len);
- if (stringVal == NULL)
- return -1;
- Uint32 cmpLength = cmpGetColumnLength(theColumn);
- if (cmpLength == 0)
- return -1;
- int retval = self->cmp(NdbScanFilter::COND_EQ,ColId,
- (void *)stringVal,cmpLength);
- free(stringVal);
- return retval;
- };
-
- int eq(int ColId, const char * anInputString, size_t len ) {
- NdbOperation * op = self->getNdbOperation();
- if (op == NULL)
- return -1;
-
- const NdbDictionary::Column * theColumn = op->getTable()->getColumn(ColId);
- char * stringVal = ndbFormatString(theColumn,anInputString,len);
- if (stringVal == NULL)
- return -1;
- Uint32 cmpLength = cmpGetColumnLength(theColumn);
- if (cmpLength == 0)
- return -1;
- int retval = self->cmp(NdbScanFilter::COND_EQ,ColId,
- (void *)stringVal,cmpLength);
- free(stringVal);
- return retval;
- };
-
- /** Compare column value with integer for not equal. 64-bit.
- * ®return 0 if successful, -1 otherwize
- */
- int ne(const char * ColName, Uint64 value) {
- NdbOperation * op = self->getNdbOperation();
- if (op == NULL)
- return -1;
- int ColId = getColumnId(op,ColName);
- if (ColId == -1) {
- return ColId;
- }
- return self->ne(ColId,value);
- }
-
- /** Compare column value with integer for less than. 64-bit.
- * ®return 0 if successful, -1 otherwize
- */
- int lt(const char * ColName, Uint64 value) {
- NdbOperation * op = self->getNdbOperation();
- if (op == NULL)
- return -1;
- int ColId = getColumnId(op,ColName);
- if (ColId == -1) {
- return ColId;
- }
- return self->lt(ColId,value);
- }
-
- /** Compare column value with integer for less than or equal. 64-bit.
- * ®return 0 if successful, -1 otherwize
- */
- int le(const char * ColName, Uint64 value) {
- NdbOperation * op = self->getNdbOperation();
- if (op == NULL)
- return -1;
- int ColId = getColumnId(op,ColName);
- if (ColId == -1) {
- return ColId;
- }
- return self->le(ColId,value);
- }
-
- /** Compare column value with integer for greater than. 64-bit.
- * ®return 0 if successful, -1 otherwize
- */
- int gt(const char * ColName, Uint64 value) {
- NdbOperation * op = self->getNdbOperation();
- if (op == NULL)
- return -1;
- int ColId = getColumnId(op,ColName);
- if (ColId == -1) {
- return ColId;
- }
- return self->gt(ColId,value);
- }
-
- /** Compare column value with integer for greater than or equal. 64-bit.
- * ®return 0 if successful, -1 otherwize
- */
- int ge(const char * ColName, Uint64 value) {
- NdbOperation * op = self->getNdbOperation();
- if (op == NULL)
- return -1;
- int ColId = getColumnId(op,ColName);
- if (ColId == -1) {
- return ColId;
- }
- return self->ge(ColId,value);
- }
-
- /** Check if column value is NULL */
- int isNull(const char * ColName) {
- NdbOperation * op = self->getNdbOperation();
- if (op == NULL)
- return -1;
- int ColId = getColumnId(op,ColName);
- if (ColId == -1) {
- return ColId;
- }
- return self->isnull(ColId);
- }
-
- /** Check if column value is non-NULL */
- int isNotNull(const char * ColName) {
- NdbOperation * op = self->getNdbOperation();
- if (op == NULL)
- return -1;
- int ColId = getColumnId(op,ColName);
- if (ColId == -1) {
- return ColId;
- }
- return self->isnotnull(ColId);
- }
-
-
-
-
- %ndbnoexception
-
- }
=== removed file 'storage/ndb/swig/ndbapi/NdbScanOperation.i'
--- a/storage/ndb/swig/ndbapi/NdbScanOperation.i 2008-03-11 15:27:35 +0000
+++ b/storage/ndb/swig/ndbapi/NdbScanOperation.i 1970-01-01 00:00:00 +0000
@@ -1,100 +0,0 @@
-/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
- *
- * Copyright (C) 2008 MySQL, Inc.
- *
- * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-class NdbScanOperation : public NdbOperation {
-
-protected:
- NdbScanOperation(Ndb* aNdb,
- NdbOperation::Type aType = NdbOperation::TableScan);
- virtual ~NdbScanOperation();
-
-public:
-
- enum ScanFlag {
- SF_TupScan = (1 << 16), // scan TUP order
- SF_DiskScan = (2 << 16), // scan in DISK order
- SF_OrderBy = (1 << 24), // index scan in order
- SF_Descending = (2 << 24), // index scan in descending order
- SF_ReadRangeNo = (4 << 24), // enable @ref get_range_no
- SF_MultiRange = (8 << 24), // scan is part of multi-range scan
- SF_KeyInfo = 1 // request KeyInfo to be sent back
- };
-
- %ndbexception("NdbApiException") {
- $action
- if (result==-1) {
- NdbError err = arg1->getNdbError();
- NDB_exception(NdbApiException,err.message);
- }
- }
-
- virtual voidint readTuples(LockMode lock_mode=LM_Read, Uint32 scan_flags=0,
- Uint32 parallel=0, Uint32 batch=0);
-
- inline voidint readTuples(int parallell){
- return readTuples(LM_Read, 0, parallell);
- }
-
- inline voidint readTuplesExclusive(int parallell = 0){
- return readTuples(LM_Exclusive, 0, parallell);
- }
-
- int nextResult(bool fetchAllowed = true, bool forceSend = false);
- voidint deleteCurrentTuple();
- voidint deleteCurrentTuple(NdbTransaction* takeOverTransaction);
- voidint restart(bool forceSend = false);
-
- %ndbexception("NdbApiException") {
- $action
- if (result==NULL) {
- NdbError err = arg1->getNdbError();
- NDB_exception(NdbApiException,err.message);
- }
- }
-
- NdbBlob* getBlobHandle(const char* anAttrName);
- NdbBlob* getBlobHandle(Uint32 anAttrId);
- NdbOperation* lockCurrentTuple();
- NdbOperation* lockCurrentTuple(NdbTransaction* lockTrans);
- NdbOperation* updateCurrentTuple();
- NdbOperation* updateCurrentTuple(NdbTransaction* updateTrans);
-
- %ndbnoexception;
-
- const NdbError & getNdbError() const;
-
- void close(bool forceSend = false, bool releaseOp = false);
-};
-
-%extend NdbScanOperation {
-
- %ndbexception("NdbApiException") {
- $action
- if (result==NULL) {
- NdbError err = arg1->getNdbError();
- NDB_exception(NdbApiException,err.message);
- }
- }
-
- NdbScanFilter * getNdbScanFilter() {
- return new NdbScanFilter(self);
- }
- %ndbnoexception
- }
=== removed file 'storage/ndb/swig/ndbapi/NdbTransaction.i'
--- a/storage/ndb/swig/ndbapi/NdbTransaction.i 2008-03-11 15:27:35 +0000
+++ b/storage/ndb/swig/ndbapi/NdbTransaction.i 1970-01-01 00:00:00 +0000
@@ -1,257 +0,0 @@
-/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
- *
- * Copyright (C) 2008 MySQL, Inc.
- *
- * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-%delobject NdbTransaction::close;
-
-class NdbTransaction {
- ~NdbTransaction();
- NdbTransaction(Ndb* aNdb);
-
-public:
-
- const NdbError & getNdbError() const;
-
- %ndbexception("NdbApiException") {
- $action
- if (result==NULL) {
- NdbError err = arg1->getNdbError();
- NDB_exception(NdbApiException,err.message);
- }
- }
- Ndb* getNdb();
-
- NdbOperation* getNdbOperation(const class NdbDictTable* aTable);
- NdbOperation* getNdbOperation(const char* aTableName);
-
- /* These first two are deprecated */
- NdbIndexScanOperation* getNdbIndexScanOperation(const char* anIndexName,
- const char* aTableName);
- NdbIndexScanOperation* getNdbIndexScanOperation(const NdbDictIndex *anIndex,
- const NdbDictTable *aTable);
- NdbIndexScanOperation* getNdbIndexScanOperation(const NdbDictIndex *anIndex);
-
- NdbIndexOperation* getNdbIndexOperation(const char* anIndexName,
- const char* aTableName);
- NdbIndexOperation* getNdbIndexOperation(const NdbDictIndex *anIndex,
- const NdbDictTable *aTable);
- NdbIndexOperation* getNdbIndexOperation(const NdbDictIndex *anIndex);
-
-
- NdbScanOperation* getNdbScanOperation(const class NdbDictTable* aTable);
- NdbScanOperation* getNdbScanOperation(const char* aTableName);
- NdbOperation* getNdbErrorOperation();
-
- %ndbnoexception;
-
- // TODO: Verify that this can't throw?
- const NdbOperation * getNextCompletedOperation(const NdbOperation * op)const;
-
-
- %ndbexception("NdbApiException,NdbApiTemporaryException,"
- "NdbApiPermanentException,"
- "InvalidSchemaObjectVersionException") {
- $action
- if (result < 0) {
- NdbError err = arg1->getNdbError();
- if (err.code == 241) { // Invalid Schema Version - see ndberror.c
- NDB_exception_err(InvalidSchemaObjectVersionException,
- err.message,err);
- } else {
- switch (err.status) {
- case NdbError::TemporaryError:
- NDB_exception_err(NdbApiTemporaryException,err.message,err);
- break;
- case NdbError::PermanentError:
- // TODO: We should probably at least handle all the various
- // error classifications. mmm, thats going to suck
- // and then we should figure out how to do that all over the place
- NDB_exception_err(NdbApiPermanentException,err.message,err);
- break;
- default:
- NDB_exception_err(NdbApiException,err.message,err);
- break;
- }
- }
- }
- }
- int execute(ExecType execType,
- AbortOption abortOption = AbortOnError,
- bool force = 0 );
- int restart(void);
- int getNdbErrorLine();
-
-
-
-};
-
-
-%extend NdbTransaction {
-public:
-
- %ndbnoexception;
-
- ~NdbTransaction() {
- if(self!=0)
- self->close();
- }
-
- void close() {
- if(self!=0)
- self->close();
- }
-
- bool isClosed() {
- return (self==0);
- }
-
- void executeAsynchPrepare(ExecType execType, asynch_callback_t * cb,
- AbortOption abortOption = AbortOnError) {
- cb->create_time=getMicroTime();
- self->executeAsynchPrepare(execType,theCallBack,(void *)cb, abortOption);
- }
-
- %ndbexception("NdbApiException,NdbApiTemporaryException,"
- "NdbApiPermanentException,") {
- $action
- if (result < 0) {
- NdbError err = arg1->getNdbError();
- switch (err.status) {
- case NdbError::TemporaryError:
- NDB_exception_err(NdbApiTemporaryException,err.message,err);
- break;
- case NdbError::PermanentError:
- NDB_exception_err(NdbApiPermanentException,err.message,err);
- break;
- default:
- NDB_exception_err(NdbApiException,err.message,err);
- break;
- }
- }
- }
-
- int executeNoCommit(AbortOption abortOption = AbortOnError) {
- return self->execute(NoCommit, abortOption,false);
- }
- int executeCommit(AbortOption abortOption = AbortOnError) {
- return self->execute(Commit, abortOption,false);
- }
- int executeRollback(AbortOption abortOption = AbortOnError) {
- return self->execute(Rollback, abortOption,false);
- }
- %ndbexception("NdbApiException") {
- $action
- if (result == NULL) {
- NdbError err = arg1->getNdbError();
- NDB_exception(NdbApiException,err.message);
- }
- }
-
- %ndbexception("NdbApiException") {
- $action
- // This should get set before we ever get called.
- static bool selectCountError;
- if ( selectCountError ) {
- NdbError err = arg1->getNdbError();
- NDB_exception(NdbApiException,err.message);
- }
- }
-
- Uint64 selectCount(const char * tbl) {
-
- /**
- * This code is taken from the ndb_select_count.cpp utility program,
- * distributed with mysql-src.
- */
- Uint64 OUTPUT = 0;
- static bool selectCountError=false;
- int MAX_RETRIES=3;
- int retryAttempt=0;
- bool finished=false;
-
- NdbScanOperation *pOp = self->getNdbScanOperation(tbl);
- if (!pOp) {
- selectCountError=true;
- return OUTPUT;
- }
-
- // we retry the transaction up to MAX_RETRIES if we have a temporary error
- while ((retryAttempt < MAX_RETRIES) && !(finished)) {
-
- if( pOp->readTuples(NdbScanOperation::LM_Dirty) ) {
-
- finished=true;
- selectCountError = true; //NDBJ_ERR_SCAN_FAILED;
- }
-
- int check;
- check = pOp->interpret_exit_last_row();
-
- if( check == -1 ) {
-
- finished=true;
- selectCountError = true; //NDBJ_ERR_SCAN_FAILED;
-
- } else if (selectCountError == false) {
-
- Uint64 tmp;
- Uint32 row_size;
- pOp->getValue(NdbDictColumn::ROW_COUNT, (char*)&tmp);
- pOp->getValue(NdbDictColumn::ROW_SIZE, (char*)&row_size);
- check = self->execute(NdbTransaction::NoCommit);
- if( check != -1 ) {
- int eof;
- while((eof = pOp->nextResult(true)) == 0){
- OUTPUT += tmp;
- }
- if (eof == -1) {
- const NdbError err = self->getNdbError();
- // retry the transaction if we have a temporary error
- if (err.status == NdbError::TemporaryError){
- // usleep is Linux-specific. Its time unit is microseconds
- // sleep for 50 milliseconds
- usleep(50*1000);
- retryAttempt++;
- continue;
- }
- selectCountError = true; //NDBJ_SELECT_COUNT_ROW_COUNT_FAILED;
- finished=true;
- } else {
- selectCountError=false; //row_count;
- finished=true;
- }
- } else {
- selectCountError=true; //NDBJ_SELECT_COUNT_TRANS_EXEC_FAILED;
- finished=true;
- }
- }
- }
- if (finished==false) {
- selectCountError=true; //NDBJ_SELECT_COUNT_ROW_COUNT_FAILED;
- }
-
- // The return value 'ret' is the 'length' returned by select_count
- return OUTPUT;
-
- };
- %ndbnoexception;
-
-
-
-};
=== removed file 'storage/ndb/swig/ndbapi/ndbglobals.i'
--- a/storage/ndb/swig/ndbapi/ndbglobals.i 2008-03-11 15:27:35 +0000
+++ b/storage/ndb/swig/ndbapi/ndbglobals.i 1970-01-01 00:00:00 +0000
@@ -1,309 +0,0 @@
-/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
- *
- * Copyright (C) 2008 MySQL, Inc.
- *
- * 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-%include "globals.i"
-%include "config.h"
-
-%{
-
-#include <my_global.h>
-#include <my_sys.h>
-
-#include <mysql.h>
-#include <NdbApi.hpp>
-
-/* These get included in mysql.h. Not sure they should... */
-#undef PACKAGE
-#undef PACKAGE_NAME
-#undef PACKAGE_STRING
-#undef PACKAGE_TARNAME
-#undef PACKAGE_VERSION
-#undef VERSION
-
-#include "config.h"
-
-
- long long getMicroTime()
- {
- struct timeval tTime;
- gettimeofday(&tTime, 0);
- long long microSeconds = (long long) tTime.tv_sec * 1000000 + tTime.tv_usec;
- return microSeconds;
- }
-
-
-/* voidint is a way to mark a method that returns int for SWIG
- to tell it we want the wrapped function to return void, but
- we don't want to discard the return value out of hand because
- we need it at the wrapping layer to find errors */
- typedef int voidint;
- typedef Uint32 NdbTimestamp;
-
-
- typedef struct st_byte {
- char * theString;
- int theLength;
- } BYTES;
-
-#ifdef _mysql_h
-#ifndef _decimal_h
-
-#define DECIMAL_BUFF 9
-
- typedef int32 decimal_digit_t;
-
- typedef struct st_decimal_t {
- int intg, frac, len;
- my_bool sign;
- decimal_digit_t *buf;
- } decimal_t;
-
-#define string2decimal(A,B,C) internal_str2dec((A), (B), (C), 0)
-#define decimal_string_size(dec) (((dec)->intg ? (dec)->intg : 1) + \
- (dec)->frac + ((dec)->frac > 0) + 2)
- extern "C" {
- int decimal_size(int precision, int scale);
- int decimal_bin_size(int precision, int scale);
- int decimal2bin(decimal_t *from, char *to, int precision, int scale);
- int bin2decimal(char *from, decimal_t *to, int precision, int scale);
- int decimal2string(decimal_t *from, char *to, int *to_len,
- int fixed_precision, int fixed_decimals,
- char filler);
- int internal_str2dec(const char *from, decimal_t *to, char **end,
- my_bool fixed);
- }
-#endif
-#endif
-
- char * decimal2bytes(decimal_t * val) {
-
- int theScale = val->frac;
- int thePrecision = (val->intg)+theScale;
-
- char * theValue = (char *) malloc(decimal_bin_size(thePrecision,
- theScale));
- if (theValue == NULL) {
- return NULL;
- }
- decimal2bin(val, theValue, thePrecision, theScale);
- return theValue;
- }
-
- class NdbDateTime
- {
- public:
- unsigned int year, month, day, hour, minute, second;
- NdbDateTime();
- };
-
- NdbDateTime::NdbDateTime() {
- year=0;
- month=0;
- day=0;
- hour=0;
- minute=0;
- second=0;
- }
-
-/* We don't just typedef these right in the first place
- because there because that would mean NdbDictionary::Dictionary
- would get renamed to NdbDictionary at the C level, which
- wouldn't work out so well. */
-
- typedef NdbDictionary::Object NdbDictObject;
- typedef NdbDictionary::Table NdbDictTable;
- typedef NdbDictionary::Column NdbDictColumn;
- typedef NdbDictionary::Index NdbDictIndex;
- typedef NdbDictionary::Dictionary NdbDictDictionary;
- typedef NdbDictionary::Event NdbDictEvent;
-
-
- int getColumnId(NdbOperation * op, const char* columnName) {
- const NdbDictColumn * theColumn = op->getTable()->getColumn(columnName);
- return theColumn->getColumnNo();
- }
-
- char * ndbFormatString(const NdbDictColumn * theColumn,
- const char* aString, size_t len) {
-
- // This method should be safe and do all the error checking.
- // There should be other methods in case you want to bypass checks.
- if (aString==0) {
- return 0;
- }
- if ((!theColumn) || (len>65535)) {
- return NULL;
- }
-
- switch(theColumn->getType()) {
- case NDB_TYPE_VARCHAR:
- case NDB_TYPE_VARBINARY:
- // printf("it's a varchar\n");
- if (len>255) {
- return NULL;
- } else {
- // Need one space for the length
- char * buf = (char *)malloc((len+1));
- unsigned char lowb=len;
- buf[0]=lowb;
- memcpy(buf+1, aString, len);
- return buf;
- }
- break;
- case NDB_TYPE_LONGVARCHAR:
- case NDB_TYPE_LONGVARBINARY:
- {
- char* buff=(char *)malloc(len+2);
-
- short l = (short)len;
- /*
- We need to copy the length of our string into the first 2 bytes
- of the buffer.
- We take a bitwise AND of the 1st byte in the short 'l' and copy
- it int the 1st byte of our buffer.
- */
-
- buff[0]=(unsigned char) ((l & 0x00FF))>>0;
- /*
- We take a bitwise AND of the 2nd byte in the short 'l'
- and copy it into the 2nd byte of our buffer.
- */
-
- buff[1]= (unsigned char)((l & 0xFF00)>>8);
- memcpy(&buff[2],aString, l);
- return buff;
- }
- break;
- case NDB_TYPE_CHAR:
- if (len>255) {
- return NULL;
- } else {
- int colLength = theColumn->getLength();
- char * buf = (char *)malloc(colLength+1);
- memset(buf,32, colLength);
- memcpy(buf, aString, len);
- return buf;
- }
- break;
- case NDB_TYPE_BINARY:
- if (len>255) {
- return NULL;
- } else {
- int colLength = theColumn->getLength();
- char * buf = (char *)malloc(colLength+1);
- memset(buf, 0, colLength);
- memcpy(buf, aString, len);
- return buf;
- }
- break;
- default:
- return NULL;
- }
- }
-
- Uint64 ndbFormatDateTime(const NdbDictColumn * theColumn, NdbDateTime * tm) {
-
- // Returns 1 on failure. How much does that suck?
-
- char dt_buf[20];
- Uint64 val = 0;
- switch(theColumn->getType()) {
- case NDB_TYPE_DATETIME:
- case NDB_TYPE_TIMESTAMP:
- {
- snprintf(dt_buf, 20, "%04d%02d%02d%02d%02d%02d",
- tm->year, tm->month, tm->day, tm->hour, tm->minute, tm->second);
- val=strtoull(dt_buf, 0, 10);
- }
- break;
- case NDB_TYPE_TIME:
- {
- snprintf(dt_buf, 20, "%02d%02d%02d",
- tm->hour, tm->minute, tm->second);
- val=strtoull(dt_buf, 0, 10);
- }
- break;
- case NDB_TYPE_DATE:
- {
- val=(tm->year << 9) | (tm->month << 5) | tm->day;
- //int3store(dt_buf, val);
- }
- break;
- default:
- return 1;
- }
- return val;
- }
-
-
-
- %}
-
-%rename(NdbObject) NdbDictObject;
-%rename(NdbTable) NdbDictTable;
-%rename(NdbColumn) NdbDictColumn;
-%rename(NdbIndex) NdbDictIndex;
-%rename(NdbDictionary) NdbDictDictionary;
-%rename(NdbEvent) NdbDictEvent;
-
-/* Do this here so we can override it in the Java interface */
-%rename(Ndb_cluster_connection) NdbClusterConnection;
-
-long long getMicroTime();
-
-
-enum AbortOption {
- CommitIfFailFree = 0,
- TryCommit = 0,
- AbortOnError = 0,
- CommitAsMuchAsPossible = 2,
- AO_IgnoreError = 2
-};
-
-enum ExecType {
- NoExecTypeDef = -1,
- Prepare = 0,
- NoCommit = 1,
- Commit = 2,
- Rollback = 3
-};
-
-typedef void (* NdbAsynchCallback)(int, NdbTransaction*, void*);
-typedef void (* NdbEventCallback)(NdbEventOperation*, Ndb*, void*);
-
-typedef const char * NdbDatetime;
-typedef const char * NdbDate;
-typedef const char * NdbTime;
-typedef Uint32 NdbTimestamp;
-
-// ndbFormatString mallocs memory. Return value must be free'd by calling code
-%newobject ndbformatString;
-%typemap(newfree) char * "free($1);";
-
-%ndbexception("NdbApiException") {
- $action
- if (result==NULL) {
- NDB_exception(NdbApiException,"Error Converting Argument Type!");
- }
- }
-char * ndbFormatString(const NdbDictColumn * theColumn,
- const char* aString, size_t len);
-
-%ndbnoexception;
=== modified file 'storage/ndb/test/ndbapi/testIndexStat.cpp'
--- a/storage/ndb/test/ndbapi/testIndexStat.cpp 2010-08-17 12:19:46 +0000
+++ b/storage/ndb/test/ndbapi/testIndexStat.cpp 2010-10-07 05:39:39 +0000
@@ -21,7 +21,6 @@
#include <NdbApi.hpp>
#include <NdbIndexStat.hpp>
#include <NdbTest.hpp>
-#include <my_sys.h>
#include <ndb_version.h>
#include <math.h>
=== modified file 'storage/ndb/test/ndbapi/testNdbApi.cpp'
--- a/storage/ndb/test/ndbapi/testNdbApi.cpp 2010-08-09 09:08:03 +0000
+++ b/storage/ndb/test/ndbapi/testNdbApi.cpp 2010-10-06 08:59:33 +0000
@@ -3277,6 +3277,91 @@ int runReadColumnDuplicates(NDBT_Context
return result;
}
+class TransGuard
+{
+ NdbTransaction* pTrans;
+public:
+ TransGuard(NdbTransaction * p) : pTrans(p) {}
+ ~TransGuard() { if (pTrans) pTrans->close(); pTrans = 0; }
+};
+
+int
+runBug51775(NDBT_Context* ctx, NDBT_Step* step)
+{
+ Ndb* pNdb = GETNDB(step);
+
+ NdbTransaction * pTrans1 = pNdb->startTransaction();
+ if (pTrans1 == NULL)
+ {
+ ERR(pNdb->getNdbError());
+ return NDBT_FAILED;
+ }
+ TransGuard g1(pTrans1);
+
+ NdbTransaction * pTrans2 = pNdb->startTransaction();
+ if (pTrans2 == NULL)
+ {
+ pTrans1->close();
+ ERR(pNdb->getNdbError());
+ return NDBT_FAILED;
+ }
+
+ TransGuard g2(pTrans2);
+
+ {
+ NdbOperation * pOp = pTrans1->getNdbOperation(ctx->getTab()->getName());
+ if (pOp == NULL)
+ {
+ ERR(pOp->getNdbError());
+ return NDBT_FAILED;
+ }
+
+ if (pOp->insertTuple() != 0)
+ {
+ ERR(pOp->getNdbError());
+ return NDBT_FAILED;
+ }
+
+ HugoOperations hugoOps(* ctx->getTab());
+ hugoOps.setValues(pOp, 0, 0);
+ }
+
+ {
+ NdbOperation * pOp = pTrans2->getNdbOperation(ctx->getTab()->getName());
+ if (pOp == NULL)
+ {
+ ERR(pOp->getNdbError());
+ return NDBT_FAILED;
+ }
+
+ if (pOp->readTuple() != 0)
+ {
+ ERR(pOp->getNdbError());
+ return NDBT_FAILED;
+ }
+
+ HugoOperations hugoOps(* ctx->getTab());
+ hugoOps.equalForRow(pOp, 0);
+ pOp->getValue(NdbDictionary::Column::FRAGMENT);
+ }
+
+
+ pTrans1->execute(NoCommit); // We now have un uncommitted insert
+
+ /**
+ * Now send a read...which will get 266
+ */
+ pTrans2->executeAsynch(NoCommit, 0, 0);
+ int res = pNdb->pollNdb(1, 1000);
+ ndbout_c("res: %u", res);
+
+ NdbSleep_SecSleep(10);
+ ndbout_c("pollNdb()");
+ while (pNdb->pollNdb() + res == 0);
+
+ return NDBT_OK;
+}
+
int testFragmentedApiFailImpl(NDBT_Context* ctx, NDBT_Step* step)
{
/* Setup a separate connection for running scan operations
@@ -4439,7 +4524,6 @@ int runTestUnlockScan(NDBT_Context* ctx,
return NDBT_OK;
}
-
NDBT_TESTSUITE(testNdbApi);
TESTCASE("MaxNdb",
"Create Ndb objects until no more can be created\n"){
@@ -4613,6 +4697,10 @@ TESTCASE("ReadColumnDuplicates",
STEP(runReadColumnDuplicates);
FINALIZER(runClearTable);
}
+TESTCASE("Bug51775", "")
+{
+ INITIALIZER(runBug51775);
+}
TESTCASE("FragmentedApiFailure",
"Test in-assembly fragment cleanup code for API failure") {
// We reuse some of the infrastructure from ApiFailReqBehaviour here
=== modified file 'storage/ndb/test/ndbapi/test_event_merge.cpp'
--- a/storage/ndb/test/ndbapi/test_event_merge.cpp 2010-08-20 11:10:25 +0000
+++ b/storage/ndb/test/ndbapi/test_event_merge.cpp 2010-10-07 05:39:39 +0000
@@ -20,7 +20,6 @@
#include <ndb_opts.h>
#include <NdbApi.hpp>
#include <NdbTest.hpp>
-#include <my_sys.h>
#include <ndb_version.h>
#include <ndb_rand.h>
=== modified file 'storage/ndb/test/run-test/daily-basic-tests.txt'
--- a/storage/ndb/test/run-test/daily-basic-tests.txt 2010-09-29 13:49:49 +0000
+++ b/storage/ndb/test/run-test/daily-basic-tests.txt 2010-10-11 13:18:51 +0000
@@ -1534,6 +1534,10 @@ cmd: testNdbApi
args: -n ReadColumnDuplicates
max-time: 300
+cmd: testNdbApi
+args: -n Bug51775 T1
+
+max-time: 300
cmd: testBasic
args: -n DDInsertFailUpdateBatch
@@ -1617,4 +1621,3 @@ max-time: 500
cmd testNodeRestart
args: -n ForceStopAndRestart T1
-
=== modified file 'storage/ndb/tools/ndb_test_platform.cpp'
--- a/storage/ndb/tools/ndb_test_platform.cpp 2009-05-26 18:53:34 +0000
+++ b/storage/ndb/tools/ndb_test_platform.cpp 2010-10-07 05:39:39 +0000
@@ -18,7 +18,6 @@
#include <ndb_global.h>
-#include <my_sys.h>
#include <BaseString.hpp>
/*
Attachment: [text/bzr-bundle] bzr/ole.john.aske@oracle.com-20101011131851-3mdg0xqfwa92yh0a.bundle
| Thread |
|---|
| • bzr push into mysql-5.1-telco-7.0-spj-scan-vs-scan branch(ole.john.aske:3310 to 3311) | Ole John Aske | 11 Oct |