Commit 04844921 authored by unknown's avatar unknown

Merge mysql.com:/home/jonas/src/mysql-4.1

into mysql.com:/home/jonas/src/mysql-4.1-ndb


ndb/src/ndbapi/ndberror.c:
  Auto merged
sql/ha_ndbcluster.cc:
  Auto merged
sql/ha_ndbcluster.h:
  Auto merged
parents 76f06e4a 7df58b8c
...@@ -100,6 +100,7 @@ miguel@hegel.txg.br ...@@ -100,6 +100,7 @@ miguel@hegel.txg.br
miguel@light. miguel@light.
miguel@light.local miguel@light.local
miguel@sartre.local miguel@sartre.local
mikael@mc04.(none)
mikron@c-fb0ae253.1238-1-64736c10.cust.bredbandsbolaget.se mikron@c-fb0ae253.1238-1-64736c10.cust.bredbandsbolaget.se
mikron@mikael-ronstr-ms-dator.local mikron@mikael-ronstr-ms-dator.local
mleich@mysql.com mleich@mysql.com
...@@ -130,6 +131,7 @@ mwagner@here.mwagner.org ...@@ -130,6 +131,7 @@ mwagner@here.mwagner.org
mwagner@work.mysql.com mwagner@work.mysql.com
mydev@mysql.com mydev@mysql.com
mysql@home.(none) mysql@home.(none)
mysql@mc04.(none)
mysqldev@build.mysql2.com mysqldev@build.mysql2.com
mysqldev@melody.local mysqldev@melody.local
mysqldev@mysql.com mysqldev@mysql.com
...@@ -159,6 +161,7 @@ ram@ram.(none) ...@@ -159,6 +161,7 @@ ram@ram.(none)
ranger@regul.home.lan ranger@regul.home.lan
rburnett@build.mysql.com rburnett@build.mysql.com
root@home.(none) root@home.(none)
root@mc04.(none)
root@x3.internalnet root@x3.internalnet
salle@banica.(none) salle@banica.(none)
salle@geopard.(none) salle@geopard.(none)
......
...@@ -1548,16 +1548,43 @@ dnl Sets HAVE_NDBCLUSTER_DB if --with-ndbcluster is used ...@@ -1548,16 +1548,43 @@ dnl Sets HAVE_NDBCLUSTER_DB if --with-ndbcluster is used
dnl --------------------------------------------------------------------------- dnl ---------------------------------------------------------------------------
AC_DEFUN([MYSQL_CHECK_NDB_OPTIONS], [ AC_DEFUN([MYSQL_CHECK_NDB_OPTIONS], [
AC_ARG_WITH([ndb-sci],
AC_HELP_STRING([--with-ndb-sci=DIR],
[Provide MySQL with a custom location of
sci library. Given DIR, sci library is
assumed to be in $DIR/lib and header files
in $DIR/include.]),
[mysql_sci_dir=${withval}],
[mysql_sci_dir=""])
case "$mysql_sci_dir" in
"no" )
have_ndb_sci=no
AC_MSG_RESULT([-- not including sci transporter])
;;
* )
if test -f "$mysql_sci_dir/lib/libsisci.a" -a \
-f "$mysql_sci_dir/include/sisci_api.h"; then
NDB_SCI_INCLUDES="-I$mysql_sci_dir/include"
NDB_SCI_LIBS="-L$mysql_sci_dir/lib -lsisci"
AC_MSG_RESULT([-- including sci transporter])
AC_DEFINE([NDB_SCI_TRANSPORTER], [1],
[Including Ndb Cluster DB sci transporter])
AC_SUBST(NDB_SCI_INCLUDES)
AC_SUBST(NDB_SCI_LIBS)
have_ndb_sci="yes"
AC_MSG_RESULT([found sci transporter in $mysql_sci_dir/{include, lib}])
else
AC_MSG_RESULT([could not find sci transporter in $mysql_sci_dir/{include, lib}])
fi
;;
esac
AC_ARG_WITH([ndb-shm], AC_ARG_WITH([ndb-shm],
[ [
--with-ndb-shm Include the NDB Cluster shared memory transporter], --with-ndb-shm Include the NDB Cluster shared memory transporter],
[ndb_shm="$withval"], [ndb_shm="$withval"],
[ndb_shm=no]) [ndb_shm=no])
AC_ARG_WITH([ndb-sci],
[
--with-ndb-sci Include the NDB Cluster sci transporter],
[ndb_sci="$withval"],
[ndb_sci=no])
AC_ARG_WITH([ndb-test], AC_ARG_WITH([ndb-test],
[ [
--with-ndb-test Include the NDB Cluster ndbapi test programs], --with-ndb-test Include the NDB Cluster ndbapi test programs],
...@@ -1590,19 +1617,6 @@ AC_DEFUN([MYSQL_CHECK_NDB_OPTIONS], [ ...@@ -1590,19 +1617,6 @@ AC_DEFUN([MYSQL_CHECK_NDB_OPTIONS], [
;; ;;
esac esac
have_ndb_sci=no
case "$ndb_sci" in
yes )
AC_MSG_RESULT([-- including sci transporter])
AC_DEFINE([NDB_SCI_TRANSPORTER], [1],
[Including Ndb Cluster DB sci transporter])
have_ndb_sci="yes"
;;
* )
AC_MSG_RESULT([-- not including sci transporter])
;;
esac
have_ndb_test=no have_ndb_test=no
case "$ndb_test" in case "$ndb_test" in
yes ) yes )
......
...@@ -3024,11 +3024,11 @@ AC_SUBST([ndb_port_base]) ...@@ -3024,11 +3024,11 @@ AC_SUBST([ndb_port_base])
ndb_transporter_opt_objs="" ndb_transporter_opt_objs=""
if test X"$have_ndb_shm" = Xyes if test X"$have_ndb_shm" = Xyes
then then
ndb_transporter_opt_objs="$(ndb_transporter_opt_objs) SHM_Transporter.lo SHM_Transporter.unix.lo" ndb_transporter_opt_objs="$ndb_transporter_opt_objs SHM_Transporter.lo SHM_Transporter.unix.lo"
fi fi
if test X"$have_ndb_sci" = Xyes if test X"$have_ndb_sci" = Xyes
then then
ndb_transporter_opt_objs="$(ndb_transporter_opt_objs) SCI_Transporter.lo" ndb_transporter_opt_objs="$ndb_transporter_opt_objs SCI_Transporter.lo"
fi fi
AC_SUBST([ndb_transporter_opt_objs]) AC_SUBST([ndb_transporter_opt_objs])
......
drop table if exists t1;
create table t1 (
a char(3) character set latin1 collate latin1_bin primary key
) engine=ndb;
insert into t1 values('aAa');
insert into t1 values('aaa');
insert into t1 values('AAA');
select * from t1 order by a;
a
AAA
aAa
aaa
select * from t1 where a = 'aAa';
a
aAa
select * from t1 where a = 'aaa';
a
aaa
select * from t1 where a = 'AaA';
a
select * from t1 where a = 'AAA';
a
AAA
drop table t1;
create table t1 (
a char(3) character set latin1 collate latin1_swedish_ci primary key
) engine=ndb;
insert into t1 values('aAa');
insert into t1 values('aaa');
ERROR 23000: Duplicate entry 'aaa' for key 1
insert into t1 values('AAA');
ERROR 23000: Duplicate entry 'AAA' for key 1
select * from t1 order by a;
a
aAa
select * from t1 where a = 'aAa';
a
aAa
select * from t1 where a = 'aaa';
a
aAa
select * from t1 where a = 'AaA';
a
aAa
select * from t1 where a = 'AAA';
a
aAa
drop table t1;
create table t1 (
p int primary key,
a char(3) character set latin1 collate latin1_bin not null,
unique key(a)
) engine=ndb;
insert into t1 values(1, 'aAa');
insert into t1 values(2, 'aaa');
insert into t1 values(3, 'AAA');
select * from t1 order by p;
p a
1 aAa
2 aaa
3 AAA
select * from t1 where a = 'aAa';
p a
1 aAa
select * from t1 where a = 'aaa';
p a
2 aaa
select * from t1 where a = 'AaA';
p a
select * from t1 where a = 'AAA';
p a
3 AAA
drop table t1;
create table t1 (
p int primary key,
a char(3) character set latin1 collate latin1_swedish_ci not null,
unique key(a)
) engine=ndb;
insert into t1 values(1, 'aAa');
insert into t1 values(2, 'aaa');
ERROR 23000: Can't write, because of unique constraint, to table 't1'
insert into t1 values(3, 'AAA');
ERROR 23000: Can't write, because of unique constraint, to table 't1'
select * from t1 order by p;
p a
1 aAa
select * from t1 where a = 'aAa';
p a
1 aAa
select * from t1 where a = 'aaa';
p a
1 aAa
select * from t1 where a = 'AaA';
p a
1 aAa
select * from t1 where a = 'AAA';
p a
1 aAa
drop table t1;
create table t1 (
p int primary key,
a char(3) character set latin1 collate latin1_bin not null,
index(a)
) engine=ndb;
insert into t1 values(1, 'aAa');
insert into t1 values(2, 'aaa');
insert into t1 values(3, 'AAA');
insert into t1 values(4, 'aAa');
insert into t1 values(5, 'aaa');
insert into t1 values(6, 'AAA');
select * from t1 order by p;
p a
1 aAa
2 aaa
3 AAA
4 aAa
5 aaa
6 AAA
explain select * from t1 where a = 'zZz' order by p;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref a a 3 const 10 Using where; Using filesort
select * from t1 where a = 'aAa' order by p;
p a
1 aAa
4 aAa
select * from t1 where a = 'aaa' order by p;
p a
2 aaa
5 aaa
select * from t1 where a = 'AaA' order by p;
p a
select * from t1 where a = 'AAA' order by p;
p a
3 AAA
6 AAA
drop table t1;
create table t1 (
p int primary key,
a char(3) character set latin1 collate latin1_swedish_ci not null,
index(a)
) engine=ndb;
insert into t1 values(1, 'aAa');
insert into t1 values(2, 'aaa');
insert into t1 values(3, 'AAA');
insert into t1 values(4, 'aAa');
insert into t1 values(5, 'aaa');
insert into t1 values(6, 'AAA');
select * from t1 order by p;
p a
1 aAa
2 aaa
3 AAA
4 aAa
5 aaa
6 AAA
explain select * from t1 where a = 'zZz' order by p;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ref a a 3 const 10 Using where; Using filesort
select * from t1 where a = 'aAa' order by p;
p a
1 aAa
2 aaa
3 AAA
4 aAa
5 aaa
6 AAA
select * from t1 where a = 'aaa' order by p;
p a
1 aAa
2 aaa
3 AAA
4 aAa
5 aaa
6 AAA
select * from t1 where a = 'AaA' order by p;
p a
1 aAa
2 aaa
3 AAA
4 aAa
5 aaa
6 AAA
select * from t1 where a = 'AAA' order by p;
p a
1 aAa
2 aaa
3 AAA
4 aAa
5 aaa
6 AAA
drop table t1;
...@@ -4,7 +4,7 @@ PORT varchar(16) NOT NULL, ...@@ -4,7 +4,7 @@ PORT varchar(16) NOT NULL,
ACCESSNODE varchar(16) NOT NULL, ACCESSNODE varchar(16) NOT NULL,
POP varchar(48) NOT NULL, POP varchar(48) NOT NULL,
ACCESSTYPE int unsigned NOT NULL, ACCESSTYPE int unsigned NOT NULL,
CUSTOMER_ID varchar(20) NOT NULL, CUSTOMER_ID varchar(20) collate latin1_bin NOT NULL,
PROVIDER varchar(16), PROVIDER varchar(16),
TEXPIRE int unsigned, TEXPIRE int unsigned,
NUM_IP int unsigned, NUM_IP int unsigned,
......
--source include/have_ndb.inc
--disable_warnings
drop table if exists t1;
--enable_warnings
#
# Minimal NDB charset test.
#
# pk - binary
create table t1 (
a char(3) character set latin1 collate latin1_bin primary key
) engine=ndb;
# ok
insert into t1 values('aAa');
insert into t1 values('aaa');
insert into t1 values('AAA');
# 3
select * from t1 order by a;
# 1
select * from t1 where a = 'aAa';
# 1
select * from t1 where a = 'aaa';
# 0
select * from t1 where a = 'AaA';
# 1
select * from t1 where a = 'AAA';
drop table t1;
# pk - case insensitive
create table t1 (
a char(3) character set latin1 collate latin1_swedish_ci primary key
) engine=ndb;
# ok
insert into t1 values('aAa');
# fail
--error 1062
insert into t1 values('aaa');
--error 1062
insert into t1 values('AAA');
# 1
select * from t1 order by a;
# 1
select * from t1 where a = 'aAa';
# 1
select * from t1 where a = 'aaa';
# 1
select * from t1 where a = 'AaA';
# 1
select * from t1 where a = 'AAA';
drop table t1;
# unique hash index - binary
create table t1 (
p int primary key,
a char(3) character set latin1 collate latin1_bin not null,
unique key(a)
) engine=ndb;
# ok
insert into t1 values(1, 'aAa');
insert into t1 values(2, 'aaa');
insert into t1 values(3, 'AAA');
# 3
select * from t1 order by p;
# 1
select * from t1 where a = 'aAa';
# 1
select * from t1 where a = 'aaa';
# 0
select * from t1 where a = 'AaA';
# 1
select * from t1 where a = 'AAA';
drop table t1;
# unique hash index - case insensitive
create table t1 (
p int primary key,
a char(3) character set latin1 collate latin1_swedish_ci not null,
unique key(a)
) engine=ndb;
# ok
insert into t1 values(1, 'aAa');
# fail
--error 1169
insert into t1 values(2, 'aaa');
--error 1169
insert into t1 values(3, 'AAA');
# 1
select * from t1 order by p;
# 1
select * from t1 where a = 'aAa';
# 1
select * from t1 where a = 'aaa';
# 1
select * from t1 where a = 'AaA';
# 1
select * from t1 where a = 'AAA';
drop table t1;
# ordered index - binary
create table t1 (
p int primary key,
a char(3) character set latin1 collate latin1_bin not null,
index(a)
) engine=ndb;
# ok
insert into t1 values(1, 'aAa');
insert into t1 values(2, 'aaa');
insert into t1 values(3, 'AAA');
insert into t1 values(4, 'aAa');
insert into t1 values(5, 'aaa');
insert into t1 values(6, 'AAA');
# 6
select * from t1 order by p;
# plan
explain select * from t1 where a = 'zZz' order by p;
# 2
select * from t1 where a = 'aAa' order by p;
# 2
select * from t1 where a = 'aaa' order by p;
# 0
select * from t1 where a = 'AaA' order by p;
# 2
select * from t1 where a = 'AAA' order by p;
drop table t1;
# ordered index - case insensitive
create table t1 (
p int primary key,
a char(3) character set latin1 collate latin1_swedish_ci not null,
index(a)
) engine=ndb;
# ok
insert into t1 values(1, 'aAa');
insert into t1 values(2, 'aaa');
insert into t1 values(3, 'AAA');
insert into t1 values(4, 'aAa');
insert into t1 values(5, 'aaa');
insert into t1 values(6, 'AAA');
# 6
select * from t1 order by p;
# plan
explain select * from t1 where a = 'zZz' order by p;
# 6
select * from t1 where a = 'aAa' order by p;
# 6
select * from t1 where a = 'aaa' order by p;
# 6
select * from t1 where a = 'AaA' order by p;
# 6
select * from t1 where a = 'AAA' order by p;
drop table t1;
...@@ -9,7 +9,7 @@ CREATE TABLE t1 ( ...@@ -9,7 +9,7 @@ CREATE TABLE t1 (
ACCESSNODE varchar(16) NOT NULL, ACCESSNODE varchar(16) NOT NULL,
POP varchar(48) NOT NULL, POP varchar(48) NOT NULL,
ACCESSTYPE int unsigned NOT NULL, ACCESSTYPE int unsigned NOT NULL,
CUSTOMER_ID varchar(20) NOT NULL, CUSTOMER_ID varchar(20) collate latin1_bin NOT NULL,
PROVIDER varchar(16), PROVIDER varchar(16),
TEXPIRE int unsigned, TEXPIRE int unsigned,
NUM_IP int unsigned, NUM_IP int unsigned,
......
...@@ -3,7 +3,7 @@ LDADD += $(top_builddir)/ndb/test/src/libNDBT.a \ ...@@ -3,7 +3,7 @@ LDADD += $(top_builddir)/ndb/test/src/libNDBT.a \
$(top_builddir)/ndb/src/libndbclient.la \ $(top_builddir)/ndb/src/libndbclient.la \
$(top_builddir)/dbug/libdbug.a \ $(top_builddir)/dbug/libdbug.a \
$(top_builddir)/mysys/libmysys.a \ $(top_builddir)/mysys/libmysys.a \
$(top_builddir)/strings/libmystrings.a $(top_builddir)/strings/libmystrings.a @NDB_SCI_LIBS@
INCLUDES += -I$(srcdir) -I$(top_srcdir)/include \ INCLUDES += -I$(srcdir) -I$(top_srcdir)/include \
-I$(top_srcdir)/ndb/include \ -I$(top_srcdir)/ndb/include \
......
...@@ -3,7 +3,7 @@ LDADD += \ ...@@ -3,7 +3,7 @@ LDADD += \
$(top_builddir)/ndb/src/libndbclient.la \ $(top_builddir)/ndb/src/libndbclient.la \
$(top_builddir)/dbug/libdbug.a \ $(top_builddir)/dbug/libdbug.a \
$(top_builddir)/mysys/libmysys.a \ $(top_builddir)/mysys/libmysys.a \
$(top_builddir)/strings/libmystrings.a $(top_builddir)/strings/libmystrings.a @NDB_SCI_LIBS@
INCLUDES += -I$(srcdir) -I$(top_srcdir)/include \ INCLUDES += -I$(srcdir) -I$(top_srcdir)/include \
-I$(top_srcdir)/ndb/include \ -I$(top_srcdir)/ndb/include \
......
...@@ -46,9 +46,9 @@ ...@@ -46,9 +46,9 @@
* *
* NdbDictionary::Column * NdbDictionary::Column
* setName() * setName()
* setPrimaryKey()
* setType() * setType()
* setLength() * setLength()
* setPrimaryKey()
* setNullable() * setNullable()
* *
* NdbDictionary::Table * NdbDictionary::Table
...@@ -234,9 +234,9 @@ int create_table(Ndb * myNdb) ...@@ -234,9 +234,9 @@ int create_table(Ndb * myNdb)
* Column REG_NO * Column REG_NO
*/ */
myColumn.setName("REG_NO"); myColumn.setName("REG_NO");
myColumn.setPrimaryKey(true);
myColumn.setType(NdbDictionary::Column::Unsigned); myColumn.setType(NdbDictionary::Column::Unsigned);
myColumn.setLength(1); myColumn.setLength(1);
myColumn.setPrimaryKey(true);
myColumn.setNullable(false); myColumn.setNullable(false);
myTable.addColumn(myColumn); myTable.addColumn(myColumn);
...@@ -244,9 +244,9 @@ int create_table(Ndb * myNdb) ...@@ -244,9 +244,9 @@ int create_table(Ndb * myNdb)
* Column BRAND * Column BRAND
*/ */
myColumn.setName("BRAND"); myColumn.setName("BRAND");
myColumn.setPrimaryKey(false);
myColumn.setType(NdbDictionary::Column::Char); myColumn.setType(NdbDictionary::Column::Char);
myColumn.setLength(20); myColumn.setLength(20);
myColumn.setPrimaryKey(false);
myColumn.setNullable(false); myColumn.setNullable(false);
myTable.addColumn(myColumn); myTable.addColumn(myColumn);
...@@ -254,9 +254,9 @@ int create_table(Ndb * myNdb) ...@@ -254,9 +254,9 @@ int create_table(Ndb * myNdb)
* Column COLOR * Column COLOR
*/ */
myColumn.setName("COLOR"); myColumn.setName("COLOR");
myColumn.setPrimaryKey(false);
myColumn.setType(NdbDictionary::Column::Char); myColumn.setType(NdbDictionary::Column::Char);
myColumn.setLength(20); myColumn.setLength(20);
myColumn.setPrimaryKey(false);
myColumn.setNullable(false); myColumn.setNullable(false);
myTable.addColumn(myColumn); myTable.addColumn(myColumn);
...@@ -454,6 +454,7 @@ int populate(Ndb * myNdb, int data, async_callback_t * cbData) ...@@ -454,6 +454,7 @@ int populate(Ndb * myNdb, int data, async_callback_t * cbData)
int main() int main()
{ {
ndb_init();
Ndb* myNdb = new Ndb( "TEST_DB" ); // Object representing the database Ndb* myNdb = new Ndb( "TEST_DB" ); // Object representing the database
/******************************************* /*******************************************
...@@ -493,5 +494,3 @@ int main() ...@@ -493,5 +494,3 @@ int main()
std::cout << "Number of temporary errors: " << tempErrors << std::endl; std::cout << "Number of temporary errors: " << tempErrors << std::endl;
delete myNdb; delete myNdb;
} }
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
int main() int main()
{ {
ndb_init();
Ndb* myNdb = new Ndb( "TEST_DB_1" ); // Object representing the database Ndb* myNdb = new Ndb( "TEST_DB_1" ); // Object representing the database
NdbDictionary::Table myTable; NdbDictionary::Table myTable;
NdbDictionary::Column myColumn; NdbDictionary::Column myColumn;
...@@ -78,16 +79,16 @@ int main() ...@@ -78,16 +79,16 @@ int main()
myTable.setName("MYTABLENAME"); myTable.setName("MYTABLENAME");
myColumn.setName("ATTR1"); myColumn.setName("ATTR1");
myColumn.setPrimaryKey(true);
myColumn.setType(NdbDictionary::Column::Unsigned); myColumn.setType(NdbDictionary::Column::Unsigned);
myColumn.setLength(1); myColumn.setLength(1);
myColumn.setPrimaryKey(true);
myColumn.setNullable(false); myColumn.setNullable(false);
myTable.addColumn(myColumn); myTable.addColumn(myColumn);
myColumn.setName("ATTR2"); myColumn.setName("ATTR2");
myColumn.setPrimaryKey(false);
myColumn.setType(NdbDictionary::Column::Unsigned); myColumn.setType(NdbDictionary::Column::Unsigned);
myColumn.setLength(1); myColumn.setLength(1);
myColumn.setPrimaryKey(false);
myColumn.setNullable(false); myColumn.setNullable(false);
myTable.addColumn(myColumn); myTable.addColumn(myColumn);
......
...@@ -39,6 +39,7 @@ static void callback(int result, NdbConnection* NdbObject, void* aObject); ...@@ -39,6 +39,7 @@ static void callback(int result, NdbConnection* NdbObject, void* aObject);
int main() int main()
{ {
ndb_init();
Ndb* myNdb = new Ndb( "TEST_DB_2" ); // Object representing the database Ndb* myNdb = new Ndb( "TEST_DB_2" ); // Object representing the database
NdbConnection* myNdbConnection[2]; // For transactions NdbConnection* myNdbConnection[2]; // For transactions
......
...@@ -176,6 +176,7 @@ int executeInsertTransaction(int transactionId, Ndb* myNdb) { ...@@ -176,6 +176,7 @@ int executeInsertTransaction(int transactionId, Ndb* myNdb) {
int main() int main()
{ {
ndb_init();
Ndb* myNdb = new Ndb( "TEST_DB_1" ); // Object representing the database Ndb* myNdb = new Ndb( "TEST_DB_1" ); // Object representing the database
/******************************************* /*******************************************
......
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
int main() int main()
{ {
ndb_init();
Ndb* myNdb = new Ndb( "TEST_DB_1" ); // Object representing the database Ndb* myNdb = new Ndb( "TEST_DB_1" ); // Object representing the database
NdbDictionary::Table myTable; NdbDictionary::Table myTable;
NdbDictionary::Column myColumn; NdbDictionary::Column myColumn;
...@@ -79,16 +80,16 @@ int main() ...@@ -79,16 +80,16 @@ int main()
myTable.setName("MYTABLENAME"); myTable.setName("MYTABLENAME");
myColumn.setName("ATTR1"); myColumn.setName("ATTR1");
myColumn.setPrimaryKey(true);
myColumn.setType(NdbDictionary::Column::Unsigned); myColumn.setType(NdbDictionary::Column::Unsigned);
myColumn.setLength(1); myColumn.setLength(1);
myColumn.setPrimaryKey(true);
myColumn.setNullable(false); myColumn.setNullable(false);
myTable.addColumn(myColumn); myTable.addColumn(myColumn);
myColumn.setName("ATTR2"); myColumn.setName("ATTR2");
myColumn.setPrimaryKey(false);
myColumn.setType(NdbDictionary::Column::Unsigned); myColumn.setType(NdbDictionary::Column::Unsigned);
myColumn.setLength(1); myColumn.setLength(1);
myColumn.setPrimaryKey(false);
myColumn.setNullable(false); myColumn.setNullable(false);
myTable.addColumn(myColumn); myTable.addColumn(myColumn);
......
...@@ -65,6 +65,7 @@ int myCreateEvent(Ndb* myNdb, ...@@ -65,6 +65,7 @@ int myCreateEvent(Ndb* myNdb,
int main() int main()
{ {
ndb_init();
Ndb* myNdb = myCreateNdb(); Ndb* myNdb = myCreateNdb();
NdbDictionary::Dictionary *myDict; NdbDictionary::Dictionary *myDict;
......
...@@ -47,9 +47,9 @@ ...@@ -47,9 +47,9 @@
* *
* NdbDictionary::Column * NdbDictionary::Column
* setName() * setName()
* setPrimaryKey()
* setType() * setType()
* setLength() * setLength()
* setPrimaryKey()
* setNullable() * setNullable()
* *
* NdbDictionary::Table * NdbDictionary::Table
...@@ -165,24 +165,24 @@ int create_table(Ndb * myNdb) ...@@ -165,24 +165,24 @@ int create_table(Ndb * myNdb)
myTable.setName("GARAGE"); myTable.setName("GARAGE");
myColumn.setName("REG_NO"); myColumn.setName("REG_NO");
myColumn.setPrimaryKey(true);
myColumn.setType(NdbDictionary::Column::Unsigned); myColumn.setType(NdbDictionary::Column::Unsigned);
myColumn.setLength(1); myColumn.setLength(1);
myColumn.setPrimaryKey(true);
myColumn.setNullable(false); myColumn.setNullable(false);
myTable.addColumn(myColumn); myTable.addColumn(myColumn);
myColumn.setName("BRAND"); myColumn.setName("BRAND");
myColumn.setPrimaryKey(false);
myColumn.setType(NdbDictionary::Column::Char); myColumn.setType(NdbDictionary::Column::Char);
myColumn.setLength(20); myColumn.setLength(20);
myColumn.setPrimaryKey(false);
myColumn.setNullable(false); myColumn.setNullable(false);
myTable.addColumn(myColumn); myTable.addColumn(myColumn);
myColumn.setName("COLOR"); myColumn.setName("COLOR");
myColumn.setPrimaryKey(false);
myColumn.setType(NdbDictionary::Column::Char); myColumn.setType(NdbDictionary::Column::Char);
myColumn.setLength(20); myColumn.setLength(20);
myColumn.setPrimaryKey(false);
myColumn.setNullable(false); myColumn.setNullable(false);
myTable.addColumn(myColumn); myTable.addColumn(myColumn);
...@@ -761,6 +761,7 @@ int scan_print(Ndb * myNdb, int parallelism, ...@@ -761,6 +761,7 @@ int scan_print(Ndb * myNdb, int parallelism,
int main() int main()
{ {
ndb_init();
Ndb* myNdb = new Ndb( "TEST_DB" ); // Object representing the database Ndb* myNdb = new Ndb( "TEST_DB" ); // Object representing the database
...@@ -813,4 +814,3 @@ int main() ...@@ -813,4 +814,3 @@ int main()
delete myNdb; delete myNdb;
} }
...@@ -112,6 +112,7 @@ const char* ResultSetContainer::getAttrName(int i) const {return m_names[i];} ...@@ -112,6 +112,7 @@ const char* ResultSetContainer::getAttrName(int i) const {return m_names[i];}
int main(int argc, const char** argv) int main(int argc, const char** argv)
{ {
ndb_init();
Ndb* myNdb = new Ndb("ndbapi_example4"); // Object representing the database Ndb* myNdb = new Ndb("ndbapi_example4"); // Object representing the database
NdbConnection* myNdbConnection; // For transactions NdbConnection* myNdbConnection; // For transactions
NdbOperation* myNdbOperation; // For operations NdbOperation* myNdbOperation; // For operations
......
...@@ -24,6 +24,32 @@ ...@@ -24,6 +24,32 @@
#include <kernel/LogLevel.hpp> #include <kernel/LogLevel.hpp>
#include <signaldata/EventReport.hpp> #include <signaldata/EventReport.hpp>
class EventLoggerBase {
public:
virtual ~EventLoggerBase();
/**
* LogLevel settings
*/
LogLevel m_logLevel;
/**
* This matrix defines which event should be printed when
*
* threshold - is in range [0-15]
* severity - DEBUG to ALERT (Type of log message)
*/
struct EventRepLogLevelMatrix {
EventReport::EventType eventType;
LogLevel::EventCategory eventCategory;
Uint32 threshold;
Logger::LoggerLevel severity;
};
static const EventRepLogLevelMatrix matrix[];
static const Uint32 matrixSize;
};
/** /**
* The EventLogger is primarily used for logging NDB events * The EventLogger is primarily used for logging NDB events
* in the Management Server. It inherits all logging functionality of Logger. * in the Management Server. It inherits all logging functionality of Logger.
...@@ -58,7 +84,7 @@ ...@@ -58,7 +84,7 @@
* @see Logger * @see Logger
* @version #@ $Id: EventLogger.hpp,v 1.3 2003/09/01 10:15:52 innpeno Exp $ * @version #@ $Id: EventLogger.hpp,v 1.3 2003/09/01 10:15:52 innpeno Exp $
*/ */
class EventLogger : public Logger class EventLogger : public EventLoggerBase, public Logger
{ {
public: public:
/** /**
...@@ -70,7 +96,7 @@ public: ...@@ -70,7 +96,7 @@ public:
/** /**
* Destructor. * Destructor.
*/ */
~EventLogger(); virtual ~EventLogger();
/** /**
* Opens/creates the eventlog with the specified filename. * Opens/creates the eventlog with the specified filename.
...@@ -92,16 +118,6 @@ public: ...@@ -92,16 +118,6 @@ public:
*/ */
void close(); void close();
/**
* Logs the NDB event.
*
* @param nodeId the node id of event origin.
* @param eventType the type of event.
* @param theData the event data.
* @deprecated use log(int eventType, const Uint32* theData, NodeId nodeId)
*/
void log(NodeId nodeId, int eventType, const Uint32* theData);
/** /**
* Logs the NDB event. * Logs the NDB event.
* *
...@@ -109,32 +125,8 @@ public: ...@@ -109,32 +125,8 @@ public:
* @param theData the event data. * @param theData the event data.
* @param nodeId the node id of event origin. * @param nodeId the node id of event origin.
*/ */
void log(int eventType, const Uint32* theData, NodeId nodeId = 0); virtual void log(int, const Uint32*, NodeId = 0,const class LogLevel * = 0);
/**
* Returns the current log levels.
* Enable, disable log levels to filter the events that are sent to the
* eventlog.
*
* @return the log level.
*/
LogLevel& getLoglevel();
/**
* Returns the log level that is used to filter an event. The event will not
* be logged unless its event category's log level is <= levelFilter.
*
* @return the log level filter that is used for all event categories.
*/
int getFilterLevel() const;
/**
* Sets log level filter. The event will be logged if
* the event category's log level is <= 'filterLevel'.
*
* @param level the log level to filter.
*/
void setFilterLevel(int filterLevel);
/** /**
* Returns the event text for the specified event report type. * Returns the event text for the specified event report type.
* *
...@@ -143,72 +135,25 @@ public: ...@@ -143,72 +135,25 @@ public:
* @param nodeId a node id. * @param nodeId a node id.
* @return the event report text. * @return the event report text.
*/ */
static const char* getText(int type, static const char* getText(char * dst, size_t dst_len,
int type,
const Uint32* theData, NodeId nodeId = 0); const Uint32* theData, NodeId nodeId = 0);
/**
* Find a category matching the string
*
* @param str string to match.
* @param cat the event category.
* @param exactMatch only do exact matching.
*
* @return TRUE if match is found, then cat is modified
* FALSE if match is not found
*/
static bool matchEventCategory(const char * str,
LogLevel::EventCategory * cat,
bool exactMatch = false);
/** /**
* Returns category name or NULL if not found. * Returns the log level that is used to filter an event. The event will not
* be logged unless its event category's log level is <= levelFilter.
* *
* @param cat the event category. * @return the log level filter that is used for all event categories.
* @return category name.
*/
static const char * getEventCategoryName(LogLevel::EventCategory cat);
/**
* Specifies allowed event categories/log levels.
*/ */
struct EventCategoryName { int getFilterLevel() const;
LogLevel::EventCategory category;
const char * name;
};
static const EventCategoryName eventCategoryNames[];
static const Uint32 noOfEventCategoryNames;
/**
* This matrix defines which event should be printed when
*
* threshold - is in range [0-15]
* severity - DEBUG to ALERT (Type of log message)
*/
struct EventRepLogLevelMatrix {
EventReport::EventType eventType;
LogLevel::EventCategory eventCategory;
Uint32 threshold;
Logger::LoggerLevel severity;
};
static const EventRepLogLevelMatrix matrix[];
/** /**
* Default log levels for management nodes. * Sets log level filter. The event will be logged if
* the event category's log level is <= 'filterLevel'.
* *
* threshold - is in range [0-15] * @param level the log level to filter.
*/ */
struct EventLogMatrix { void setFilterLevel(int filterLevel);
LogLevel::EventCategory eventCategory;
Uint32 threshold;
};
static const EventLogMatrix defEventLogMatrix[];
static const Uint32 matrixSize;
static const Uint32 defEventLogMatrixSize;
private: private:
/** Prohibit */ /** Prohibit */
...@@ -216,11 +161,10 @@ private: ...@@ -216,11 +161,10 @@ private:
EventLogger operator = (const EventLogger&); EventLogger operator = (const EventLogger&);
bool operator == (const EventLogger&); bool operator == (const EventLogger&);
LogLevel m_logLevel;
Uint32 m_filterLevel; Uint32 m_filterLevel;
STATIC_CONST(MAX_TEXT_LENGTH = 256); STATIC_CONST(MAX_TEXT_LENGTH = 256);
static char m_text[MAX_TEXT_LENGTH]; char m_text[MAX_TEXT_LENGTH];
}; };
......
...@@ -45,81 +45,30 @@ public: ...@@ -45,81 +45,30 @@ public:
* Copy operator * Copy operator
*/ */
LogLevel & operator= (const LogLevel &); LogLevel & operator= (const LogLevel &);
static const Uint32 MIN_LOGLEVEL_ID = CFG_LOGLEVEL_STARTUP;
enum EventCategory {
/**
* Events during all kind of startups
*/
llStartUp = CFG_LOGLEVEL_STARTUP - MIN_LOGLEVEL_ID,
/**
* Events during shutdown
*/
llShutdown = CFG_LOGLEVEL_SHUTDOWN - MIN_LOGLEVEL_ID,
/**
* Transaction statistics
* Job level
* TCP/IP speed
*/
llStatistic = CFG_LOGLEVEL_STATISTICS - MIN_LOGLEVEL_ID,
/**
* Checkpoints
*/
llCheckpoint = CFG_LOGLEVEL_CHECKPOINT - MIN_LOGLEVEL_ID,
/**
* Events during node restart
*/
llNodeRestart = CFG_LOGLEVEL_NODERESTART - MIN_LOGLEVEL_ID,
/**
* Events related to connection / communication
*/
llConnection = CFG_LOGLEVEL_CONNECTION - MIN_LOGLEVEL_ID,
/**
* Assorted event w.r.t unexpected happenings
*/
llError = CFG_LOGLEVEL_ERROR - MIN_LOGLEVEL_ID,
/**
* Assorted event w.r.t warning
*/
llWarning = CFG_LOGLEVEL_WARNING - MIN_LOGLEVEL_ID,
/**
* Assorted event w.r.t information
*/
llInfo = CFG_LOGLEVEL_INFO - MIN_LOGLEVEL_ID,
/**
* Events related to global replication
*/
llGrep = CFG_LOGLEVEL_GREP - MIN_LOGLEVEL_ID
};
struct LogLevelCategoryName { enum EventCategory {
const char* name; llStartUp = CFG_LOGLEVEL_STARTUP - CFG_MIN_LOGLEVEL,
llShutdown = CFG_LOGLEVEL_SHUTDOWN - CFG_MIN_LOGLEVEL,
llStatistic = CFG_LOGLEVEL_STATISTICS - CFG_MIN_LOGLEVEL,
llCheckpoint = CFG_LOGLEVEL_CHECKPOINT - CFG_MIN_LOGLEVEL,
llNodeRestart = CFG_LOGLEVEL_NODERESTART - CFG_MIN_LOGLEVEL,
llConnection = CFG_LOGLEVEL_CONNECTION - CFG_MIN_LOGLEVEL,
llInfo = CFG_LOGLEVEL_INFO - CFG_MIN_LOGLEVEL,
llWarning = CFG_LOGLEVEL_WARNING - CFG_MIN_LOGLEVEL,
llError = CFG_LOGLEVEL_ERROR - CFG_MIN_LOGLEVEL,
llGrep = CFG_LOGLEVEL_GREP - CFG_MIN_LOGLEVEL,
llDebug = CFG_LOGLEVEL_DEBUG - CFG_MIN_LOGLEVEL
,llBackup = CFG_LOGLEVEL_BACKUP - CFG_MIN_LOGLEVEL
}; };
/**
* Log/event level category names. Remember to update the names whenever
* a new category is added.
*/
static const LogLevelCategoryName LOGLEVEL_CATEGORY_NAME[];
/** /**
* No of categories * No of categories
*/ */
#define _LOGLEVEL_CATEGORIES 10 #define _LOGLEVEL_CATEGORIES (CFG_MAX_LOGLEVEL - CFG_MIN_LOGLEVEL + 1);
static const Uint32 LOGLEVEL_CATEGORIES = _LOGLEVEL_CATEGORIES; static const Uint32 LOGLEVEL_CATEGORIES = _LOGLEVEL_CATEGORIES;
void clear(); void clear();
/** /**
* Note level is valid as 0-15 * Note level is valid as 0-15
*/ */
...@@ -130,26 +79,33 @@ public: ...@@ -130,26 +79,33 @@ public:
*/ */
Uint32 getLogLevel(EventCategory ec) const; Uint32 getLogLevel(EventCategory ec) const;
/**
* Set this= max(this, ll) per category
*/
LogLevel& set_max(const LogLevel& ll);
bool operator==(const LogLevel& l) const {
return memcmp(this, &l, sizeof(* this)) == 0;
}
LogLevel& operator=(const class EventSubscribeReq & req);
private: private:
/** /**
* The actual data * The actual data
*/ */
Uint32 logLevelData[LOGLEVEL_CATEGORIES]; Uint8 logLevelData[LOGLEVEL_CATEGORIES];
LogLevel(const LogLevel &);
}; };
inline inline
LogLevel::LogLevel(){ LogLevel::LogLevel(){
clear(); clear();
} }
inline inline
LogLevel & LogLevel &
LogLevel::operator= (const LogLevel & org){ LogLevel::operator= (const LogLevel & org){
for(Uint32 i = 0; i<LOGLEVEL_CATEGORIES; i++){ memcpy(logLevelData, org.logLevelData, sizeof(logLevelData));
logLevelData[i] = org.logLevelData[i];
}
return * this; return * this;
} }
...@@ -165,7 +121,7 @@ inline ...@@ -165,7 +121,7 @@ inline
void void
LogLevel::setLogLevel(EventCategory ec, Uint32 level){ LogLevel::setLogLevel(EventCategory ec, Uint32 level){
assert(ec >= 0 && (Uint32) ec < LOGLEVEL_CATEGORIES); assert(ec >= 0 && (Uint32) ec < LOGLEVEL_CATEGORIES);
logLevelData[ec] = level; logLevelData[ec] = (Uint8)level;
} }
inline inline
...@@ -173,8 +129,30 @@ Uint32 ...@@ -173,8 +129,30 @@ Uint32
LogLevel::getLogLevel(EventCategory ec) const{ LogLevel::getLogLevel(EventCategory ec) const{
assert(ec >= 0 && (Uint32) ec < LOGLEVEL_CATEGORIES); assert(ec >= 0 && (Uint32) ec < LOGLEVEL_CATEGORIES);
return logLevelData[ec]; return (Uint32)logLevelData[ec];
}
inline
LogLevel &
LogLevel::set_max(const LogLevel & org){
for(Uint32 i = 0; i<LOGLEVEL_CATEGORIES; i++){
if(logLevelData[i] < org.logLevelData[i])
logLevelData[i] = org.logLevelData[i];
}
return * this;
} }
#include <signaldata/EventSubscribeReq.hpp>
inline
LogLevel&
LogLevel::operator=(const EventSubscribeReq& req)
{
clear();
for(size_t i = 0; i<req.noOfEntries; i++){
logLevelData[(req.theData[i] >> 16)] = req.theData[i] & 0xFFFF;
}
return * this;
}
#endif #endif
...@@ -89,7 +89,8 @@ public: ...@@ -89,7 +89,8 @@ public:
ArraySizeTooBig = 737, ArraySizeTooBig = 737,
RecordTooBig = 738, RecordTooBig = 738,
InvalidPrimaryKeySize = 739, InvalidPrimaryKeySize = 739,
NullablePrimaryKey = 740 NullablePrimaryKey = 740,
InvalidCharset = 743
}; };
private: private:
......
...@@ -438,8 +438,8 @@ public: ...@@ -438,8 +438,8 @@ public:
case DictTabInfo::ExtText: case DictTabInfo::ExtText:
AttributeType = DictTabInfo::StringType; AttributeType = DictTabInfo::StringType;
AttributeSize = DictTabInfo::an8Bit; AttributeSize = DictTabInfo::an8Bit;
// head + inline part [ attr precision ] // head + inline part [ attr precision lower half ]
AttributeArraySize = (NDB_BLOB_HEAD_SIZE << 2) + AttributeExtPrecision; AttributeArraySize = (NDB_BLOB_HEAD_SIZE << 2) + (AttributeExtPrecision & 0xFFFF);
return true; return true;
}; };
return false; return false;
......
...@@ -135,12 +135,17 @@ public: ...@@ -135,12 +135,17 @@ public:
//GREP //GREP
GrepSubscriptionInfo = 52, GrepSubscriptionInfo = 52,
GrepSubscriptionAlert = 53 GrepSubscriptionAlert = 53,
};
//BACKUP
BackupStarted = 54,
BackupFailedToStart = 55,
BackupCompleted = 56,
BackupAborted = 57
};
void setEventType(EventType type); void setEventType(EventType type);
EventType getEventType() const; EventType getEventType() const;
private:
UintR eventType; // DATA 0 UintR eventType; // DATA 0
}; };
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
* RECIVER: SimBlockCMCtrBlck * RECIVER: SimBlockCMCtrBlck
*/ */
class EventSubscribeReq { struct EventSubscribeReq {
/** /**
* Receiver(s) * Receiver(s)
*/ */
...@@ -38,9 +38,8 @@ class EventSubscribeReq { ...@@ -38,9 +38,8 @@ class EventSubscribeReq {
*/ */
friend class MgmtSrvr; friend class MgmtSrvr;
public: STATIC_CONST( SignalLength = 2 + LogLevel::LOGLEVEL_CATEGORIES );
STATIC_CONST( SignalLength = 22 );
private:
/** /**
* Note: If you use the same blockRef as you have used earlier, * Note: If you use the same blockRef as you have used earlier,
* you update your ongoing subscription * you update your ongoing subscription
...@@ -53,8 +52,15 @@ private: ...@@ -53,8 +52,15 @@ private:
*/ */
Uint32 noOfEntries; Uint32 noOfEntries;
Uint32 theCategories[10]; Uint32 theData[LogLevel::LOGLEVEL_CATEGORIES];
Uint32 theLevels[10];
EventSubscribeReq& operator= (const LogLevel& ll){
noOfEntries = LogLevel::LOGLEVEL_CATEGORIES;
for(size_t i = 0; i<noOfEntries; i++){
theData[i] = (i << 16) | ll.getLogLevel((LogLevel::EventCategory)i);
}
return * this;
}
}; };
#endif #endif
...@@ -130,7 +130,7 @@ private: ...@@ -130,7 +130,7 @@ private:
Uint32 keyLength; Uint32 keyLength;
Uint32 nextLCP; Uint32 nextLCP;
Uint32 noOfKeyAttr; Uint32 noOfKeyAttr;
Uint32 noOfNewAttr; Uint32 noOfNewAttr; // noOfCharsets in upper half
Uint32 checksumIndicator; Uint32 checksumIndicator;
Uint32 noOfAttributeGroups; Uint32 noOfAttributeGroups;
Uint32 GCPIndicator; Uint32 GCPIndicator;
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#define SET_LOGLEVEL_ORD_HPP #define SET_LOGLEVEL_ORD_HPP
#include <LogLevel.hpp> #include <LogLevel.hpp>
#include "EventSubscribeReq.hpp"
#include "SignalData.hpp" #include "SignalData.hpp"
/** /**
...@@ -39,11 +40,10 @@ class SetLogLevelOrd { ...@@ -39,11 +40,10 @@ class SetLogLevelOrd {
friend class NodeLogLevel; friend class NodeLogLevel;
private: private:
STATIC_CONST( SignalLength = 25 ); STATIC_CONST( SignalLength = 1 + LogLevel::LOGLEVEL_CATEGORIES );
Uint32 noOfEntries; Uint32 noOfEntries;
Uint32 theCategories[12]; Uint32 theData[LogLevel::LOGLEVEL_CATEGORIES];
Uint32 theLevels[12];
void clear(); void clear();
...@@ -51,6 +51,22 @@ private: ...@@ -51,6 +51,22 @@ private:
* Note level is valid as 0-15 * Note level is valid as 0-15
*/ */
void setLogLevel(LogLevel::EventCategory ec, int level = 7); void setLogLevel(LogLevel::EventCategory ec, int level = 7);
SetLogLevelOrd& operator= (const LogLevel& ll){
noOfEntries = LogLevel::LOGLEVEL_CATEGORIES;
for(size_t i = 0; i<noOfEntries; i++){
theData[i] = (i << 16) | ll.getLogLevel((LogLevel::EventCategory)i);
}
return * this;
}
SetLogLevelOrd& operator= (const EventSubscribeReq& ll){
noOfEntries = ll.noOfEntries;
for(size_t i = 0; i<noOfEntries; i++){
theData[i] = ll.theData[i];
}
return * this;
}
}; };
inline inline
...@@ -62,9 +78,7 @@ SetLogLevelOrd::clear(){ ...@@ -62,9 +78,7 @@ SetLogLevelOrd::clear(){
inline inline
void void
SetLogLevelOrd::setLogLevel(LogLevel::EventCategory ec, int level){ SetLogLevelOrd::setLogLevel(LogLevel::EventCategory ec, int level){
assert(noOfEntries < 12); theData[noOfEntries] = (ec << 16) | level;
theCategories[noOfEntries] = ec;
theLevels[noOfEntries] = level;
noOfEntries++; noOfEntries++;
} }
......
...@@ -119,12 +119,13 @@ class TupAddAttrReq { ...@@ -119,12 +119,13 @@ class TupAddAttrReq {
friend class Dblqh; friend class Dblqh;
friend class Dbtux; friend class Dbtux;
public: public:
STATIC_CONST( SignalLength = 4 ); STATIC_CONST( SignalLength = 5 );
private: private:
Uint32 tupConnectPtr; Uint32 tupConnectPtr;
Uint32 notused1; Uint32 notused1;
Uint32 attrId; Uint32 attrId;
Uint32 attrDescriptor; Uint32 attrDescriptor;
Uint32 extTypeInfo;
}; };
class TupAddAttrConf { class TupAddAttrConf {
...@@ -141,6 +142,10 @@ class TupAddAttrRef { ...@@ -141,6 +142,10 @@ class TupAddAttrRef {
friend class Dbtup; friend class Dbtup;
public: public:
STATIC_CONST( SignalLength = 2 ); STATIC_CONST( SignalLength = 2 );
enum ErrorCode {
NoError = 0,
InvalidCharset = 743
};
private: private:
Uint32 userPtr; Uint32 userPtr;
Uint32 errorCode; Uint32 errorCode;
...@@ -178,7 +183,8 @@ public: ...@@ -178,7 +183,8 @@ public:
STATIC_CONST( SignalLength = 2 ); STATIC_CONST( SignalLength = 2 );
enum ErrorCode { enum ErrorCode {
NoError = 0, NoError = 0,
InvalidAttributeType = 831, InvalidAttributeType = 742,
InvalidCharset = 743,
InvalidNodeSize = 832 InvalidNodeSize = 832
}; };
private: private:
......
...@@ -55,24 +55,6 @@ ...@@ -55,24 +55,6 @@
extern "C" { extern "C" {
#endif #endif
/**
* Format of statistical information from the NDB Cluster.
* STATISTIC_LINE is sent on the statistical port from the Management server,
* each line is timestamped with STATISTIC_DATE.
*/
#define STATISTIC_LINE "date=%s epochsecs=%d nodeid=%u trans=%u commit=%u " \
"read=%u insert=%u attrinfo=%u cops=%u abort=%u"
/**
* Format of statistical information from the NDB Cluster.
* STATISTIC_LINE is sent on the statistical port from the Management server,
* each line is timestamped with STATISTIC_DATE.
*/
#define STATISTIC_DATE "%d-%.2d-%.2d/%.2d:%.2d:%.2d"
/**
* Format of statistical information from the NDB Cluster.
*/
#define OP_STATISTIC_LINE "date=%s epochsecs=%d nodeid=%d operations=%u"
/** /**
* The NdbMgmHandle. * The NdbMgmHandle.
*/ */
...@@ -272,19 +254,35 @@ extern "C" { ...@@ -272,19 +254,35 @@ extern "C" {
* Log categories * Log categories
*/ */
enum ndb_mgm_event_category { enum ndb_mgm_event_category {
NDB_MGM_EVENT_CATEGORY_STARTUP, ///< Events during all kinds NDB_MGM_ILLEGAL_EVENT_CATEGORY = -1, ///< Invalid
///< of startups /**
NDB_MGM_EVENT_CATEGORY_SHUTDOWN, ///< Events during shutdown * Events during all kinds of startups
NDB_MGM_EVENT_CATEGORY_STATISTIC, ///< Transaction statistics */
///< (Job level, TCP/IP speed) NDB_MGM_EVENT_CATEGORY_STARTUP = CFG_LOGLEVEL_STARTUP,
NDB_MGM_EVENT_CATEGORY_CHECKPOINT, ///< Checkpoints
NDB_MGM_EVENT_CATEGORY_NODE_RESTART, ///< Events during node restart /**
NDB_MGM_EVENT_CATEGORY_CONNECTION, ///< Events related to connection * Events during shutdown
///< and communication */
NDB_MGM_EVENT_CATEGORY_ERROR ///< Assorted event w.r.t. NDB_MGM_EVENT_CATEGORY_SHUTDOWN = CFG_LOGLEVEL_SHUTDOWN,
///< unexpected happenings
/**
* Transaction statistics (Job level, TCP/IP speed)
*/
NDB_MGM_EVENT_CATEGORY_STATISTIC = CFG_LOGLEVEL_STATISTICS,
NDB_MGM_EVENT_CATEGORY_CHECKPOINT = CFG_LOGLEVEL_CHECKPOINT,
NDB_MGM_EVENT_CATEGORY_NODE_RESTART = CFG_LOGLEVEL_NODERESTART,
NDB_MGM_EVENT_CATEGORY_CONNECTION = CFG_LOGLEVEL_CONNECTION,
NDB_MGM_EVENT_CATEGORY_DEBUG = CFG_LOGLEVEL_DEBUG,
NDB_MGM_EVENT_CATEGORY_INFO = CFG_LOGLEVEL_INFO,
NDB_MGM_EVENT_CATEGORY_WARNING = CFG_LOGLEVEL_WARNING,
NDB_MGM_EVENT_CATEGORY_ERROR = CFG_LOGLEVEL_ERROR,
NDB_MGM_EVENT_CATEGORY_GREP = CFG_LOGLEVEL_GREP,
NDB_MGM_EVENT_CATEGORY_BACKUP = CFG_LOGLEVEL_BACKUP,
NDB_MGM_MIN_EVENT_CATEGORY = CFG_MIN_LOGLEVEL,
NDB_MGM_MAX_EVENT_CATEGORY = CFG_MAX_LOGLEVEL
}; };
/***************************************************************************/ /***************************************************************************/
/** /**
* @name Functions: Error Handling * @name Functions: Error Handling
...@@ -420,6 +418,9 @@ extern "C" { ...@@ -420,6 +418,9 @@ extern "C" {
*/ */
const char * ndb_mgm_get_node_status_string(enum ndb_mgm_node_status status); const char * ndb_mgm_get_node_status_string(enum ndb_mgm_node_status status);
ndb_mgm_event_category ndb_mgm_match_event_category(const char *);
const char * ndb_mgm_get_event_category_string(enum ndb_mgm_event_category);
/** @} *********************************************************************/ /** @} *********************************************************************/
/** /**
* @name Functions: State of cluster * @name Functions: State of cluster
...@@ -580,8 +581,7 @@ extern "C" { ...@@ -580,8 +581,7 @@ extern "C" {
*/ */
int ndb_mgm_set_loglevel_clusterlog(NdbMgmHandle handle, int ndb_mgm_set_loglevel_clusterlog(NdbMgmHandle handle,
int nodeId, int nodeId,
/*enum ndb_mgm_event_category category*/ enum ndb_mgm_event_category category,
char * category,
int level, int level,
struct ndb_mgm_reply* reply); struct ndb_mgm_reply* reply);
...@@ -597,8 +597,7 @@ extern "C" { ...@@ -597,8 +597,7 @@ extern "C" {
*/ */
int ndb_mgm_set_loglevel_node(NdbMgmHandle handle, int ndb_mgm_set_loglevel_node(NdbMgmHandle handle,
int nodeId, int nodeId,
/*enum ndb_mgm_event_category category*/ enum ndb_mgm_event_category category,
char * category,
int level, int level,
struct ndb_mgm_reply* reply); struct ndb_mgm_reply* reply);
...@@ -669,6 +668,15 @@ extern "C" { ...@@ -669,6 +668,15 @@ extern "C" {
int ndb_mgm_exit_single_user(NdbMgmHandle handle, int ndb_mgm_exit_single_user(NdbMgmHandle handle,
struct ndb_mgm_reply* reply); struct ndb_mgm_reply* reply);
/**
* Listen event
*
* @param filter pairs of { level, category } that will be
* pushed to fd, level=0 ends lists
* @return fd which events will be pushed to
*/
int ndb_mgm_listen_event(NdbMgmHandle handle, int filter[]);
/** /**
* Get configuration * Get configuration
* @param handle NDB management handle. * @param handle NDB management handle.
......
#ifndef MGMAPI_CONFIG_PARAMTERS_H #ifndef MGMAPI_CONFIG_PARAMTERS_H
#define MGMAPI_CONFIG_PARAMTERS_H #define MGMAPI_CONFIG_PARAMTERS_H
#define CFG_SYS_NAME 3 #define CFG_SYS_NAME 3
#define CFG_SYS_PRIMARY_MGM_NODE 1 #define CFG_SYS_PRIMARY_MGM_NODE 1
#define CFG_SYS_CONFIG_GENERATION 2 #define CFG_SYS_CONFIG_GENERATION 2
...@@ -64,16 +63,6 @@ ...@@ -64,16 +63,6 @@
#define CFG_DB_BACKUP_LOG_BUFFER_MEM 135 #define CFG_DB_BACKUP_LOG_BUFFER_MEM 135
#define CFG_DB_BACKUP_WRITE_SIZE 136 #define CFG_DB_BACKUP_WRITE_SIZE 136
#define CFG_LOGLEVEL_STARTUP 137
#define CFG_LOGLEVEL_SHUTDOWN 138
#define CFG_LOGLEVEL_STATISTICS 139
#define CFG_LOGLEVEL_CHECKPOINT 140
#define CFG_LOGLEVEL_NODERESTART 141
#define CFG_LOGLEVEL_CONNECTION 142
#define CFG_LOGLEVEL_INFO 143
#define CFG_LOGLEVEL_WARNING 144
#define CFG_LOGLEVEL_ERROR 145
#define CFG_LOGLEVEL_GREP 146
#define CFG_LOG_DESTINATION 147 #define CFG_LOG_DESTINATION 147
#define CFG_DB_DISCLESS 148 #define CFG_DB_DISCLESS 148
...@@ -95,6 +84,21 @@ ...@@ -95,6 +84,21 @@
#define CFG_NODE_ARBIT_RANK 200 #define CFG_NODE_ARBIT_RANK 200
#define CFG_NODE_ARBIT_DELAY 201 #define CFG_NODE_ARBIT_DELAY 201
#define CFG_MIN_LOGLEVEL 250
#define CFG_LOGLEVEL_STARTUP 250
#define CFG_LOGLEVEL_SHUTDOWN 251
#define CFG_LOGLEVEL_STATISTICS 252
#define CFG_LOGLEVEL_CHECKPOINT 253
#define CFG_LOGLEVEL_NODERESTART 254
#define CFG_LOGLEVEL_CONNECTION 255
#define CFG_LOGLEVEL_INFO 256
#define CFG_LOGLEVEL_WARNING 257
#define CFG_LOGLEVEL_ERROR 258
#define CFG_LOGLEVEL_GREP 259
#define CFG_LOGLEVEL_DEBUG 260
#define CFG_LOGLEVEL_BACKUP 261
#define CFG_MAX_LOGLEVEL 261
#define CFG_MGM_PORT 300 #define CFG_MGM_PORT 300
#define CFG_CONNECTION_NODE_1 400 #define CFG_CONNECTION_NODE_1 400
...@@ -104,9 +108,9 @@ ...@@ -104,9 +108,9 @@
#define CFG_CONNECTION_NODE_1_SYSTEM 404 #define CFG_CONNECTION_NODE_1_SYSTEM 404
#define CFG_CONNECTION_NODE_2_SYSTEM 405 #define CFG_CONNECTION_NODE_2_SYSTEM 405
#define CFG_CONNECTION_SERVER_PORT 406 #define CFG_CONNECTION_SERVER_PORT 406
#define CFG_CONNECTION_HOSTNAME_1 407
#define CFG_CONNECTION_HOSTNAME_2 408
#define CFG_TCP_HOSTNAME_1 450
#define CFG_TCP_HOSTNAME_2 451
#define CFG_TCP_SERVER 452 #define CFG_TCP_SERVER 452
#define CFG_TCP_SEND_BUFFER_SIZE 454 #define CFG_TCP_SEND_BUFFER_SIZE 454
#define CFG_TCP_RECEIVE_BUFFER_SIZE 455 #define CFG_TCP_RECEIVE_BUFFER_SIZE 455
...@@ -117,19 +121,15 @@ ...@@ -117,19 +121,15 @@
#define CFG_SHM_KEY 502 #define CFG_SHM_KEY 502
#define CFG_SHM_BUFFER_MEM 503 #define CFG_SHM_BUFFER_MEM 503
#define CFG_SCI_ID_0 550 #define CFG_SCI_HOST1_ID_0 550
#define CFG_SCI_ID_1 551 #define CFG_SCI_HOST1_ID_1 551
#define CFG_SCI_SEND_LIMIT 552 #define CFG_SCI_HOST2_ID_0 552
#define CFG_SCI_BUFFER_MEM 553 #define CFG_SCI_HOST2_ID_1 553
#define CFG_SCI_NODE1_ADAPTERS 554 #define CFG_SCI_HOSTNAME_1 554
#define CFG_SCI_NODE1_ADAPTER0 555 #define CFG_SCI_HOSTNAME_2 555
#define CFG_SCI_NODE1_ADAPTER1 556 #define CFG_SCI_SEND_LIMIT 556
#define CFG_SCI_NODE2_ADAPTERS 554 #define CFG_SCI_BUFFER_MEM 557
#define CFG_SCI_NODE2_ADAPTER0 555
#define CFG_SCI_NODE2_ADAPTER1 556
#define CFG_OSE_HOSTNAME_1 600
#define CFG_OSE_HOSTNAME_2 601
#define CFG_OSE_PRIO_A_SIZE 602 #define CFG_OSE_PRIO_A_SIZE 602
#define CFG_OSE_PRIO_B_SIZE 603 #define CFG_OSE_PRIO_B_SIZE 603
#define CFG_OSE_RECEIVE_ARRAY_SIZE 604 #define CFG_OSE_RECEIVE_ARRAY_SIZE 604
......
...@@ -76,6 +76,9 @@ extern "C" { ...@@ -76,6 +76,9 @@ extern "C" {
#include <assert.h> #include <assert.h>
/* call in main() - does not return on error */
extern int ndb_init(void);
#ifndef HAVE_STRDUP #ifndef HAVE_STRDUP
extern char * strdup(const char *s); extern char * strdup(const char *s);
#endif #endif
......
...@@ -32,6 +32,8 @@ ...@@ -32,6 +32,8 @@
#include <ndb_types.h> #include <ndb_types.h>
class Ndb; class Ndb;
struct charset_info_st;
typedef struct charset_info_st CHARSET_INFO;
/** /**
* @class NdbDictionary * @class NdbDictionary
...@@ -257,6 +259,10 @@ public: ...@@ -257,6 +259,10 @@ public:
/** /**
* Set type of column * Set type of column
* @param type Type of column * @param type Type of column
*
* @note setType resets <em>all</em> column attributes
* to (type dependent) defaults and should be the first
* method to call. Default type is Unsigned.
*/ */
void setType(Type type); void setType(Type type);
...@@ -301,28 +307,36 @@ public: ...@@ -301,28 +307,36 @@ public:
*/ */
int getLength() const; int getLength() const;
/**
* For Char or Varchar or Text, set or get MySQL CHARSET_INFO. This
* specifies both character set and collation. See get_charset()
* etc in MySQL. (The cs is not "const" in MySQL).
*/
void setCharset(CHARSET_INFO* cs);
CHARSET_INFO* getCharset() const;
/** /**
* For blob, set or get "inline size" i.e. number of initial bytes * For blob, set or get "inline size" i.e. number of initial bytes
* to store in table's blob attribute. This part is normally in * to store in table's blob attribute. This part is normally in
* main memory and can be indexed and interpreted. * main memory and can be indexed and interpreted.
*/ */
void setInlineSize(int size) { setPrecision(size); } void setInlineSize(int size);
int getInlineSize() const { return getPrecision(); } int getInlineSize() const;
/** /**
* For blob, set or get "part size" i.e. number of bytes to store in * For blob, set or get "part size" i.e. number of bytes to store in
* each tuple of the "blob table". Can be set to zero to omit parts * each tuple of the "blob table". Can be set to zero to omit parts
* and to allow only inline bytes ("tinyblob"). * and to allow only inline bytes ("tinyblob").
*/ */
void setPartSize(int size) { setScale(size); } void setPartSize(int size);
int getPartSize() const { return getScale(); } int getPartSize() const;
/** /**
* For blob, set or get "stripe size" i.e. number of consecutive * For blob, set or get "stripe size" i.e. number of consecutive
* <em>parts</em> to store in each node group. * <em>parts</em> to store in each node group.
*/ */
void setStripeSize(int size) { setLength(size); } void setStripeSize(int size);
int getStripeSize() const { return getLength(); } int getStripeSize() const;
/** /**
* Get size of element * Get size of element
......
...@@ -59,8 +59,6 @@ struct TCP_TransporterConfiguration { ...@@ -59,8 +59,6 @@ struct TCP_TransporterConfiguration {
NodeId localNodeId; NodeId localNodeId;
Uint32 sendBufferSize; // Size of SendBuffer of priority B Uint32 sendBufferSize; // Size of SendBuffer of priority B
Uint32 maxReceiveSize; // Maximum no of bytes to receive Uint32 maxReceiveSize; // Maximum no of bytes to receive
Uint32 byteOrder;
bool compression;
bool checksum; bool checksum;
bool signalId; bool signalId;
}; };
...@@ -72,10 +70,8 @@ struct SHM_TransporterConfiguration { ...@@ -72,10 +70,8 @@ struct SHM_TransporterConfiguration {
Uint32 port; Uint32 port;
NodeId remoteNodeId; NodeId remoteNodeId;
NodeId localNodeId; NodeId localNodeId;
bool compression;
bool checksum; bool checksum;
bool signalId; bool signalId;
int byteOrder;
Uint32 shmKey; Uint32 shmKey;
Uint32 shmSize; Uint32 shmSize;
...@@ -89,10 +85,8 @@ struct OSE_TransporterConfiguration { ...@@ -89,10 +85,8 @@ struct OSE_TransporterConfiguration {
const char *localHostName; const char *localHostName;
NodeId remoteNodeId; NodeId remoteNodeId;
NodeId localNodeId; NodeId localNodeId;
bool compression;
bool checksum; bool checksum;
bool signalId; bool signalId;
int byteOrder;
Uint32 prioASignalSize; Uint32 prioASignalSize;
Uint32 prioBSignalSize; Uint32 prioBSignalSize;
...@@ -103,20 +97,20 @@ struct OSE_TransporterConfiguration { ...@@ -103,20 +97,20 @@ struct OSE_TransporterConfiguration {
* SCI Transporter Configuration * SCI Transporter Configuration
*/ */
struct SCI_TransporterConfiguration { struct SCI_TransporterConfiguration {
const char *remoteHostName;
const char *localHostName;
Uint32 port;
Uint32 sendLimit; // Packet size Uint32 sendLimit; // Packet size
Uint32 bufferSize; // Buffer size Uint32 bufferSize; // Buffer size
Uint32 nLocalAdapters; // 1 or 2, the number of adapters on local host Uint32 nLocalAdapters; // 1 or 2, the number of adapters on local host
Uint32 nRemoteAdapters;
Uint32 remoteSciNodeId0; // SCInodeId for adapter 1 Uint32 remoteSciNodeId0; // SCInodeId for adapter 1
Uint32 remoteSciNodeId1; // SCInodeId for adapter 2 Uint32 remoteSciNodeId1; // SCInodeId for adapter 2
NodeId localNodeId; // Local node Id NodeId localNodeId; // Local node Id
NodeId remoteNodeId; // Remote node Id NodeId remoteNodeId; // Remote node Id
Uint32 byteOrder;
bool compression;
bool checksum; bool checksum;
bool signalId; bool signalId;
......
...@@ -218,15 +218,18 @@ public: ...@@ -218,15 +218,18 @@ public:
void printState(); void printState();
#endif #endif
unsigned short m_service_port; class Transporter_interface {
public:
unsigned short m_service_port;
const char *m_interface;
};
Vector<Transporter_interface> m_transporter_interface;
void add_transporter_interface(const char *interface, unsigned short port);
protected: protected:
private: private:
void * callbackObj; void * callbackObj;
TransporterService *m_transporter_service;
char *m_interface_name;
struct NdbThread *m_start_clients_thread; struct NdbThread *m_start_clients_thread;
bool m_run_start_clients_thread; bool m_run_start_clients_thread;
......
...@@ -40,11 +40,14 @@ public: ...@@ -40,11 +40,14 @@ public:
* Compare kernel attribute values. Returns -1, 0, +1 for less, * Compare kernel attribute values. Returns -1, 0, +1 for less,
* equal, greater, respectively. Parameters are pointers to values, * equal, greater, respectively. Parameters are pointers to values,
* full attribute size in words, and size of available data in words. * full attribute size in words, and size of available data in words.
* There is also pointer to type specific extra info. Char types
* receive CHARSET_INFO in it.
*
* If available size is less than full size, CmpUnknown may be * If available size is less than full size, CmpUnknown may be
* returned. If a value cannot be parsed, it compares like NULL i.e. * returned. If a value cannot be parsed, it compares like NULL i.e.
* less than any valid value. * less than any valid value.
*/ */
typedef int Cmp(const Uint32* p1, const Uint32* p2, Uint32 full, Uint32 size); typedef int Cmp(const void* info, const Uint32* p1, const Uint32* p2, Uint32 full, Uint32 size);
enum CmpResult { enum CmpResult {
CmpLess = -1, CmpLess = -1,
...@@ -55,6 +58,7 @@ public: ...@@ -55,6 +58,7 @@ public:
/** /**
* Kernel data types. Must match m_typeList in NdbSqlUtil.cpp. * Kernel data types. Must match m_typeList in NdbSqlUtil.cpp.
* Now also must match types in NdbDictionary.
*/ */
struct Type { struct Type {
enum Enum { enum Enum {
...@@ -90,6 +94,18 @@ public: ...@@ -90,6 +94,18 @@ public:
*/ */
static const Type& getType(Uint32 typeId); static const Type& getType(Uint32 typeId);
/**
* Get type by id but replace char type by corresponding binary type.
*/
static const Type& getTypeBinary(Uint32 typeId);
/**
* Check character set.
*/
static bool usable_in_pk(Uint32 typeId, const void* cs);
static bool usable_in_hash_index(Uint32 typeId, const void* cs);
static bool usable_in_ordered_index(Uint32 typeId, const void* cs);
private: private:
/** /**
* List of all types. Must match Type::Enum. * List of all types. Must match Type::Enum.
......
...@@ -76,7 +76,7 @@ public: ...@@ -76,7 +76,7 @@ public:
* then close the socket * then close the socket
* Returns true if succeding in binding * Returns true if succeding in binding
*/ */
bool tryBind(unsigned short port, const char * intface = 0) const; static bool tryBind(unsigned short port, const char * intface = 0);
/** /**
* Setup socket * Setup socket
......
This diff is collapsed.
...@@ -2,7 +2,7 @@ SUBDIRS = signaldata ...@@ -2,7 +2,7 @@ SUBDIRS = signaldata
noinst_LTLIBRARIES = libtrace.la noinst_LTLIBRARIES = libtrace.la
libtrace_la_SOURCES = SignalLoggerManager.cpp DebuggerNames.cpp BlockNames.cpp LogLevel.cpp EventLogger.cpp GrepError.cpp libtrace_la_SOURCES = SignalLoggerManager.cpp DebuggerNames.cpp BlockNames.cpp EventLogger.cpp GrepError.cpp
include $(top_srcdir)/ndb/config/common.mk.am include $(top_srcdir)/ndb/config/common.mk.am
include $(top_srcdir)/ndb/config/type_kernel.mk.am include $(top_srcdir)/ndb/config/type_kernel.mk.am
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include <ndb_version.h> #include <ndb_version.h>
#include <ConfigRetriever.hpp> #include <ConfigRetriever.hpp>
#include <SocketServer.hpp>
#include "LocalConfig.hpp" #include "LocalConfig.hpp"
#include <NdbSleep.h> #include <NdbSleep.h>
...@@ -272,43 +273,15 @@ ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf, Uint32 ...@@ -272,43 +273,15 @@ ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf, Uint32
NdbConfig_SetPath(datadir); NdbConfig_SetPath(datadir);
} }
char localhost[MAXHOSTNAMELEN]; if (hostname && hostname[0] != 0 &&
if(NdbHost_GetHostName(localhost) != 0){ !SocketServer::tryBind(0,hostname)) {
snprintf(buf, 255, "Unable to get own hostname"); snprintf(buf, 255, "Config hostname(%s) don't match a local interface,"
" tried to bind, error = %d - %s",
hostname, errno, strerror(errno));
setError(CR_ERROR, buf); setError(CR_ERROR, buf);
return false; return false;
} }
do {
if(strlen(hostname) == 0)
break;
if(strcasecmp(hostname, localhost) == 0)
break;
if(strcasecmp(hostname, "localhost") == 0)
break;
struct in_addr local, config;
bool b1 = false, b2 = false, b3 = false;
b1 = Ndb_getInAddr(&local, localhost) == 0;
b2 = Ndb_getInAddr(&config, hostname) == 0;
b3 = memcmp(&local, &config, sizeof(local)) == 0;
if(b1 && b2 && b3)
break;
b1 = Ndb_getInAddr(&local, "localhost") == 0;
b3 = memcmp(&local, &config, sizeof(local)) == 0;
if(b1 && b2 && b3)
break;
snprintf(buf, 255, "Local hostname(%s) and config hostname(%s) dont match",
localhost, hostname);
setError(CR_ERROR, buf);
return false;
} while(false);
unsigned int _type; unsigned int _type;
if(ndb_mgm_get_int_parameter(it, CFG_TYPE_OF_SECTION, &_type)){ if(ndb_mgm_get_int_parameter(it, CFG_TYPE_OF_SECTION, &_type)){
snprintf(buf, 255, "Unable to get type of node(%d) from config", snprintf(buf, 255, "Unable to get type of node(%d) from config",
...@@ -344,7 +317,7 @@ ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf, Uint32 ...@@ -344,7 +317,7 @@ ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf, Uint32
const char * name; const char * name;
struct in_addr addr; struct in_addr addr;
BaseString tmp; BaseString tmp;
if(!iter.get(CFG_TCP_HOSTNAME_1, &name) && strlen(name)){ if(!iter.get(CFG_CONNECTION_HOSTNAME_1, &name) && strlen(name)){
if(Ndb_getInAddr(&addr, name) != 0){ if(Ndb_getInAddr(&addr, name) != 0){
tmp.assfmt("Unable to lookup/illegal hostname %s, " tmp.assfmt("Unable to lookup/illegal hostname %s, "
"connection from node %d to node %d", "connection from node %d to node %d",
...@@ -354,7 +327,7 @@ ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf, Uint32 ...@@ -354,7 +327,7 @@ ConfigRetriever::verifyConfig(const struct ndb_mgm_configuration * conf, Uint32
} }
} }
if(!iter.get(CFG_TCP_HOSTNAME_2, &name) && strlen(name)){ if(!iter.get(CFG_CONNECTION_HOSTNAME_2, &name) && strlen(name)){
if(Ndb_getInAddr(&addr, name) != 0){ if(Ndb_getInAddr(&addr, name) != 0){
tmp.assfmt("Unable to lookup/illegal hostname %s, " tmp.assfmt("Unable to lookup/illegal hostname %s, "
"connection from node %d to node %d", "connection from node %d to node %d",
......
This diff is collapsed.
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include <ndb_global.h>
#include <NdbMutex.h> #include <NdbMutex.h>
#include <NdbTCP.h> #include <NdbTCP.h>
...@@ -27,13 +28,14 @@ static NdbMutex LOCK_gethostbyname = NDB_MUTEX_INITIALIZER; ...@@ -27,13 +28,14 @@ static NdbMutex LOCK_gethostbyname = NDB_MUTEX_INITIALIZER;
extern "C" extern "C"
int int
Ndb_getInAddr(struct in_addr * dst, const char *address) { Ndb_getInAddr(struct in_addr * dst, const char *address) {
DBUG_ENTER("Ndb_getInAddr");
struct hostent * hostPtr; struct hostent * hostPtr;
NdbMutex_Lock(&LOCK_gethostbyname); NdbMutex_Lock(&LOCK_gethostbyname);
hostPtr = gethostbyname(address); hostPtr = gethostbyname(address);
if (hostPtr != NULL) { if (hostPtr != NULL) {
dst->s_addr = ((struct in_addr *) *hostPtr->h_addr_list)->s_addr; dst->s_addr = ((struct in_addr *) *hostPtr->h_addr_list)->s_addr;
NdbMutex_Unlock(&LOCK_gethostbyname); NdbMutex_Unlock(&LOCK_gethostbyname);
return 0; DBUG_RETURN(0);
} }
NdbMutex_Unlock(&LOCK_gethostbyname); NdbMutex_Unlock(&LOCK_gethostbyname);
...@@ -47,9 +49,11 @@ Ndb_getInAddr(struct in_addr * dst, const char *address) { ...@@ -47,9 +49,11 @@ Ndb_getInAddr(struct in_addr * dst, const char *address) {
#endif #endif
) )
{ {
return 0; DBUG_RETURN(0);
} }
return -1; DBUG_PRINT("error",("inet_addr(%s) - %d - %s",
address, errno, strerror(errno)));
DBUG_RETURN(-1);
} }
#if 0 #if 0
......
...@@ -13,7 +13,7 @@ EXTRA_libtransporter_la_SOURCES = SHM_Transporter.cpp SHM_Transporter.unix.cpp S ...@@ -13,7 +13,7 @@ EXTRA_libtransporter_la_SOURCES = SHM_Transporter.cpp SHM_Transporter.unix.cpp S
libtransporter_la_LIBADD = @ndb_transporter_opt_objs@ libtransporter_la_LIBADD = @ndb_transporter_opt_objs@
libtransporter_la_DEPENDENCIES = @ndb_transporter_opt_objs@ libtransporter_la_DEPENDENCIES = @ndb_transporter_opt_objs@
INCLUDES_LOC = -I$(top_srcdir)/ndb/include/kernel -I$(top_srcdir)/ndb/include/transporter INCLUDES_LOC = -I$(top_srcdir)/ndb/include/kernel -I$(top_srcdir)/ndb/include/transporter @NDB_SCI_INCLUDES@
include $(top_srcdir)/ndb/config/common.mk.am include $(top_srcdir)/ndb/config/common.mk.am
include $(top_srcdir)/ndb/config/type_util.mk.am include $(top_srcdir)/ndb/config/type_util.mk.am
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <TransporterCallback.hpp> #include <TransporterCallback.hpp>
#include <RefConvert.hpp> #include <RefConvert.hpp>
#define MAX_RECEIVED_SIGNALS 1024
Uint32 Uint32
TransporterRegistry::unpack(Uint32 * readPtr, TransporterRegistry::unpack(Uint32 * readPtr,
Uint32 sizeOfData, Uint32 sizeOfData,
...@@ -30,12 +31,15 @@ TransporterRegistry::unpack(Uint32 * readPtr, ...@@ -30,12 +31,15 @@ TransporterRegistry::unpack(Uint32 * readPtr,
LinearSectionPtr ptr[3]; LinearSectionPtr ptr[3];
Uint32 usedData = 0; Uint32 usedData = 0;
Uint32 loop_count = 0;
if(state == NoHalt || state == HaltOutput){ if(state == NoHalt || state == HaltOutput){
while(sizeOfData >= 4 + sizeof(Protocol6)){ while ((sizeOfData >= 4 + sizeof(Protocol6)) &&
(loop_count < MAX_RECEIVED_SIGNALS)) {
Uint32 word1 = readPtr[0]; Uint32 word1 = readPtr[0];
Uint32 word2 = readPtr[1]; Uint32 word2 = readPtr[1];
Uint32 word3 = readPtr[2]; Uint32 word3 = readPtr[2];
loop_count++;
#if 0 #if 0
if(Protocol6::getByteOrder(word1) != MY_OWN_BYTE_ORDER){ if(Protocol6::getByteOrder(word1) != MY_OWN_BYTE_ORDER){
...@@ -112,10 +116,12 @@ TransporterRegistry::unpack(Uint32 * readPtr, ...@@ -112,10 +116,12 @@ TransporterRegistry::unpack(Uint32 * readPtr,
} else { } else {
/** state = HaltIO || state == HaltInput */ /** state = HaltIO || state == HaltInput */
while(sizeOfData >= 4 + sizeof(Protocol6)){ while ((sizeOfData >= 4 + sizeof(Protocol6)) &&
(loop_count < MAX_RECEIVED_SIGNALS)) {
Uint32 word1 = readPtr[0]; Uint32 word1 = readPtr[0];
Uint32 word2 = readPtr[1]; Uint32 word2 = readPtr[1];
Uint32 word3 = readPtr[2]; Uint32 word3 = readPtr[2];
loop_count++;
#if 0 #if 0
if(Protocol6::getByteOrder(word1) != MY_OWN_BYTE_ORDER){ if(Protocol6::getByteOrder(word1) != MY_OWN_BYTE_ORDER){
...@@ -208,12 +214,13 @@ TransporterRegistry::unpack(Uint32 * readPtr, ...@@ -208,12 +214,13 @@ TransporterRegistry::unpack(Uint32 * readPtr,
IOState state) { IOState state) {
static SignalHeader signalHeader; static SignalHeader signalHeader;
static LinearSectionPtr ptr[3]; static LinearSectionPtr ptr[3];
Uint32 loop_count = 0;
if(state == NoHalt || state == HaltOutput){ if(state == NoHalt || state == HaltOutput){
while(readPtr < eodPtr){ while ((readPtr < eodPtr) && (loop_count < MAX_RECEIVED_SIGNALS)) {
Uint32 word1 = readPtr[0]; Uint32 word1 = readPtr[0];
Uint32 word2 = readPtr[1]; Uint32 word2 = readPtr[1];
Uint32 word3 = readPtr[2]; Uint32 word3 = readPtr[2];
loop_count++;
#if 0 #if 0
if(Protocol6::getByteOrder(word1) != MY_OWN_BYTE_ORDER){ if(Protocol6::getByteOrder(word1) != MY_OWN_BYTE_ORDER){
//Do funky stuff //Do funky stuff
...@@ -280,11 +287,11 @@ TransporterRegistry::unpack(Uint32 * readPtr, ...@@ -280,11 +287,11 @@ TransporterRegistry::unpack(Uint32 * readPtr,
} else { } else {
/** state = HaltIO || state == HaltInput */ /** state = HaltIO || state == HaltInput */
while(readPtr < eodPtr){ while ((readPtr < eodPtr) && (loop_count < MAX_RECEIVED_SIGNALS)) {
Uint32 word1 = readPtr[0]; Uint32 word1 = readPtr[0];
Uint32 word2 = readPtr[1]; Uint32 word2 = readPtr[1];
Uint32 word3 = readPtr[2]; Uint32 word3 = readPtr[2];
loop_count++;
#if 0 #if 0
if(Protocol6::getByteOrder(word1) != MY_OWN_BYTE_ORDER){ if(Protocol6::getByteOrder(word1) != MY_OWN_BYTE_ORDER){
//Do funky stuff //Do funky stuff
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment