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,16 +125,19 @@ public: ...@@ -109,16 +125,19 @@ 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. * Returns the event text for the specified event report type.
* Enable, disable log levels to filter the events that are sent to the
* eventlog.
* *
* @return the log level. * @param type the event type.
* @param theData the event data.
* @param nodeId a node id.
* @return the event report text.
*/ */
LogLevel& getLoglevel(); static const char* getText(char * dst, size_t dst_len,
int type,
const Uint32* theData, NodeId nodeId = 0);
/** /**
* Returns the log level that is used to filter an event. The event will not * Returns the log level that is used to filter an event. The event will not
...@@ -127,6 +146,7 @@ public: ...@@ -127,6 +146,7 @@ public:
* @return the log level filter that is used for all event categories. * @return the log level filter that is used for all event categories.
*/ */
int getFilterLevel() const; int getFilterLevel() const;
/** /**
* Sets log level filter. The event will be logged if * Sets log level filter. The event will be logged if
* the event category's log level is <= 'filterLevel'. * the event category's log level is <= 'filterLevel'.
...@@ -135,92 +155,16 @@ public: ...@@ -135,92 +155,16 @@ public:
*/ */
void setFilterLevel(int filterLevel); void setFilterLevel(int filterLevel);
/**
* Returns the event text for the specified event report type.
*
* @param type the event type.
* @param theData the event data.
* @param nodeId a node id.
* @return the event report text.
*/
static const char* getText(int type,
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.
*
* @param cat the event category.
* @return category name.
*/
static const char * getEventCategoryName(LogLevel::EventCategory cat);
/**
* Specifies allowed event categories/log levels.
*/
struct EventCategoryName {
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.
*
* threshold - is in range [0-15]
*/
struct EventLogMatrix {
LogLevel::EventCategory eventCategory;
Uint32 threshold;
};
static const EventLogMatrix defEventLogMatrix[];
static const Uint32 matrixSize;
static const Uint32 defEventLogMatrixSize;
private: private:
/** Prohibit */ /** Prohibit */
EventLogger(const EventLogger&); EventLogger(const EventLogger&);
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];
}; };
......
...@@ -46,76 +46,25 @@ public: ...@@ -46,76 +46,25 @@ public:
*/ */
LogLevel & operator= (const LogLevel &); LogLevel & operator= (const LogLevel &);
static const Uint32 MIN_LOGLEVEL_ID = CFG_LOGLEVEL_STARTUP;
enum EventCategory { enum EventCategory {
/** llStartUp = CFG_LOGLEVEL_STARTUP - CFG_MIN_LOGLEVEL,
* Events during all kind of startups llShutdown = CFG_LOGLEVEL_SHUTDOWN - CFG_MIN_LOGLEVEL,
*/ llStatistic = CFG_LOGLEVEL_STATISTICS - CFG_MIN_LOGLEVEL,
llStartUp = CFG_LOGLEVEL_STARTUP - MIN_LOGLEVEL_ID, llCheckpoint = CFG_LOGLEVEL_CHECKPOINT - CFG_MIN_LOGLEVEL,
llNodeRestart = CFG_LOGLEVEL_NODERESTART - CFG_MIN_LOGLEVEL,
/** llConnection = CFG_LOGLEVEL_CONNECTION - CFG_MIN_LOGLEVEL,
* Events during shutdown llInfo = CFG_LOGLEVEL_INFO - CFG_MIN_LOGLEVEL,
*/ llWarning = CFG_LOGLEVEL_WARNING - CFG_MIN_LOGLEVEL,
llShutdown = CFG_LOGLEVEL_SHUTDOWN - MIN_LOGLEVEL_ID, llError = CFG_LOGLEVEL_ERROR - CFG_MIN_LOGLEVEL,
llGrep = CFG_LOGLEVEL_GREP - CFG_MIN_LOGLEVEL,
/** llDebug = CFG_LOGLEVEL_DEBUG - CFG_MIN_LOGLEVEL
* Transaction statistics ,llBackup = CFG_LOGLEVEL_BACKUP - CFG_MIN_LOGLEVEL
* 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 {
const char* name;
};
/**
* 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();
...@@ -130,13 +79,22 @@ public: ...@@ -130,13 +79,22 @@ 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
...@@ -147,9 +105,7 @@ LogLevel::LogLevel(){ ...@@ -147,9 +105,7 @@ LogLevel::LogLevel(){
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,17 +254,33 @@ extern "C" { ...@@ -272,17 +254,33 @@ 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
}; };
/***************************************************************************/ /***************************************************************************/
...@@ -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
class Transporter_interface {
public:
unsigned short m_service_port; 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
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#include <ndb_types.h> #include <ndb_types.h>
/** /**
* The SCI Transporter * The SCI Transporter
* *
* The design goal of the SCI transporter is to deliver high performance * The design goal of the SCI transporter is to deliver high performance
...@@ -135,15 +135,17 @@ public: ...@@ -135,15 +135,17 @@ public:
bool getConnectionStatus(); bool getConnectionStatus();
private: private:
SCI_Transporter(Uint32 packetSize, SCI_Transporter(TransporterRegistry &t_reg,
const char *local_host,
const char *remote_host,
int port,
Uint32 packetSize,
Uint32 bufferSize, Uint32 bufferSize,
Uint32 nAdapters, Uint32 nAdapters,
Uint16 remoteSciNodeId0, Uint16 remoteSciNodeId0,
Uint16 remoteSciNodeId1, Uint16 remoteSciNodeId1,
NodeId localNodeID, NodeId localNodeID,
NodeId remoteNodeID, NodeId remoteNodeID,
int byteorder,
bool compression,
bool checksum, bool checksum,
bool signalId, bool signalId,
Uint32 reportFreq = 4096); Uint32 reportFreq = 4096);
...@@ -160,7 +162,8 @@ private: ...@@ -160,7 +162,8 @@ private:
/** /**
* For statistics on transfered packets * For statistics on transfered packets
*/ */
#ifdef DEBUG_TRANSPORTER //#ifdef DEBUG_TRANSPORTER
#if 1
Uint32 i1024; Uint32 i1024;
Uint32 i2048; Uint32 i2048;
Uint32 i2049; Uint32 i2049;
...@@ -177,10 +180,8 @@ private: ...@@ -177,10 +180,8 @@ private:
struct { struct {
Uint32 * m_buffer; // The buffer Uint32 * m_buffer; // The buffer
Uint32 m_dataSize; // No of words in buffer Uint32 m_dataSize; // No of words in buffer
Uint32 m_bufferSize; // Buffer size Uint32 m_sendBufferSize; // Buffer size
Uint32 m_forceSendLimit; // Send when buffer is this full Uint32 m_forceSendLimit; // Send when buffer is this full
bool full() const { return (m_dataSize * 4) > m_forceSendLimit ;}
} m_sendBuffer; } m_sendBuffer;
SHM_Reader * reader; SHM_Reader * reader;
...@@ -196,7 +197,7 @@ private: ...@@ -196,7 +197,7 @@ private:
Uint32 m_adapters; Uint32 m_adapters;
Uint32 m_numberOfRemoteNodes; Uint32 m_numberOfRemoteNodes;
Uint16* m_remoteNodes; Uint16 m_remoteNodes[2];
typedef struct SciAdapter { typedef struct SciAdapter {
sci_desc_t scidesc; sci_desc_t scidesc;
...@@ -296,12 +297,11 @@ private: ...@@ -296,12 +297,11 @@ private:
*/ */
bool sendIsPossible(struct timeval * timeout); bool sendIsPossible(struct timeval * timeout);
void getReceivePtr(Uint32 ** ptr, Uint32 ** eod){ void getReceivePtr(Uint32 ** ptr, Uint32 ** eod){
reader->getReadPtr(* ptr, * eod); reader->getReadPtr(* ptr, * eod);
} }
void updateReceivePtr(Uint32 * ptr){ void updateReceivePtr(Uint32 *ptr){
reader->updateReadPtr(ptr); reader->updateReadPtr(ptr);
} }
...@@ -341,6 +341,8 @@ private: ...@@ -341,6 +341,8 @@ private:
*/ */
void failoverShmWriter(); void failoverShmWriter();
bool init_local();
bool init_remote();
protected: protected:
...@@ -350,7 +352,8 @@ protected: ...@@ -350,7 +352,8 @@ protected:
* retrying. * retrying.
* @return Returns true on success, otherwize falser * @return Returns true on success, otherwize falser
*/ */
bool connectImpl(Uint32 timeOutMillis); bool connect_server_impl(NDB_SOCKET_TYPE sockfd);
bool connect_client_impl(NDB_SOCKET_TYPE sockfd);
/** /**
* We will disconnect if: * We will disconnect if:
......
...@@ -52,7 +52,7 @@ public: ...@@ -52,7 +52,7 @@ public:
} }
void clear() { void clear() {
m_readIndex = * m_sharedReadIndex; m_readIndex = 0;
} }
/** /**
...@@ -71,7 +71,7 @@ public: ...@@ -71,7 +71,7 @@ public:
/** /**
* Update read ptr * Update read ptr
*/ */
inline void updateReadPtr(Uint32 * readPtr); inline void updateReadPtr(Uint32 *ptr);
private: private:
char * const m_startOfBuffer; char * const m_startOfBuffer;
...@@ -98,8 +98,8 @@ SHM_Reader::empty() const{ ...@@ -98,8 +98,8 @@ SHM_Reader::empty() const{
*/ */
inline inline
void void
SHM_Reader::getReadPtr(Uint32 * & ptr, Uint32 * & eod){ SHM_Reader::getReadPtr(Uint32 * & ptr, Uint32 * & eod)
{
Uint32 tReadIndex = m_readIndex; Uint32 tReadIndex = m_readIndex;
Uint32 tWriteIndex = * m_sharedWriteIndex; Uint32 tWriteIndex = * m_sharedWriteIndex;
...@@ -117,14 +117,14 @@ SHM_Reader::getReadPtr(Uint32 * & ptr, Uint32 * & eod){ ...@@ -117,14 +117,14 @@ SHM_Reader::getReadPtr(Uint32 * & ptr, Uint32 * & eod){
*/ */
inline inline
void void
SHM_Reader::updateReadPtr(Uint32 * ptr){ SHM_Reader::updateReadPtr(Uint32 *ptr)
{
Uint32 tReadIndex = ((char *)ptr) - m_startOfBuffer; Uint32 tReadIndex = ((char*)ptr) - m_startOfBuffer;
assert(tReadIndex < m_totalBufferSize); assert(tReadIndex < m_totalBufferSize);
if(tReadIndex >= m_bufferSize){ if(tReadIndex >= m_bufferSize){
tReadIndex = 0; //-= m_bufferSize; tReadIndex = 0;
} }
m_readIndex = tReadIndex; m_readIndex = tReadIndex;
...@@ -149,7 +149,7 @@ public: ...@@ -149,7 +149,7 @@ public:
} }
void clear() { void clear() {
m_writeIndex = * m_sharedWriteIndex; m_writeIndex = 0;
} }
inline char * getWritePtr(Uint32 sz); inline char * getWritePtr(Uint32 sz);
...@@ -206,7 +206,7 @@ SHM_Writer::updateWritePtr(Uint32 sz){ ...@@ -206,7 +206,7 @@ SHM_Writer::updateWritePtr(Uint32 sz){
assert(tWriteIndex < m_totalBufferSize); assert(tWriteIndex < m_totalBufferSize);
if(tWriteIndex >= m_bufferSize){ if(tWriteIndex >= m_bufferSize){
tWriteIndex = 0; //-= m_bufferSize; tWriteIndex = 0;
} }
m_writeIndex = tWriteIndex; m_writeIndex = tWriteIndex;
......
...@@ -32,13 +32,12 @@ SHM_Transporter::SHM_Transporter(TransporterRegistry &t_reg, ...@@ -32,13 +32,12 @@ SHM_Transporter::SHM_Transporter(TransporterRegistry &t_reg,
int r_port, int r_port,
NodeId lNodeId, NodeId lNodeId,
NodeId rNodeId, NodeId rNodeId,
bool compression,
bool checksum, bool checksum,
bool signalId, bool signalId,
key_t _shmKey, key_t _shmKey,
Uint32 _shmSize) : Uint32 _shmSize) :
Transporter(t_reg, lHostName, rHostName, r_port, lNodeId, rNodeId, Transporter(t_reg, lHostName, rHostName, r_port, lNodeId, rNodeId,
0, compression, checksum, signalId), 0, false, checksum, signalId),
shmKey(_shmKey), shmKey(_shmKey),
shmSize(_shmSize) shmSize(_shmSize)
{ {
...@@ -92,8 +91,6 @@ SHM_Transporter::setupBuffers(){ ...@@ -92,8 +91,6 @@ SHM_Transporter::setupBuffers(){
clientStatusFlag = base2 + 4; clientStatusFlag = base2 + 4;
char * startOfBuf2 = ((char *)base2)+sharedSize; char * startOfBuf2 = ((char *)base2)+sharedSize;
* sharedReadIndex2 = * sharedWriteIndex2 = 0;
if(isServer){ if(isServer){
* serverStatusFlag = 0; * serverStatusFlag = 0;
reader = new SHM_Reader(startOfBuf1, reader = new SHM_Reader(startOfBuf1,
...@@ -109,10 +106,10 @@ SHM_Transporter::setupBuffers(){ ...@@ -109,10 +106,10 @@ SHM_Transporter::setupBuffers(){
sharedWriteIndex2); sharedWriteIndex2);
* sharedReadIndex1 = 0; * sharedReadIndex1 = 0;
* sharedWriteIndex2 = 0; * sharedWriteIndex1 = 0;
* sharedReadIndex2 = 0; * sharedReadIndex2 = 0;
* sharedWriteIndex1 = 0; * sharedWriteIndex2 = 0;
reader->clear(); reader->clear();
writer->clear(); writer->clear();
...@@ -224,6 +221,7 @@ SHM_Transporter::prepareSend(const SignalHeader * const signalHeader, ...@@ -224,6 +221,7 @@ SHM_Transporter::prepareSend(const SignalHeader * const signalHeader,
bool bool
SHM_Transporter::connect_server_impl(NDB_SOCKET_TYPE sockfd) SHM_Transporter::connect_server_impl(NDB_SOCKET_TYPE sockfd)
{ {
DBUG_ENTER("SHM_Transporter::connect_server_impl");
SocketOutputStream s_output(sockfd); SocketOutputStream s_output(sockfd);
SocketInputStream s_input(sockfd); SocketInputStream s_input(sockfd);
char buf[256]; char buf[256];
...@@ -233,7 +231,7 @@ SHM_Transporter::connect_server_impl(NDB_SOCKET_TYPE sockfd) ...@@ -233,7 +231,7 @@ SHM_Transporter::connect_server_impl(NDB_SOCKET_TYPE sockfd)
if (!ndb_shm_create()) { if (!ndb_shm_create()) {
report_error(TE_SHM_UNABLE_TO_CREATE_SEGMENT); report_error(TE_SHM_UNABLE_TO_CREATE_SEGMENT);
NDB_CLOSE_SOCKET(sockfd); NDB_CLOSE_SOCKET(sockfd);
return false; DBUG_RETURN(false);
} }
_shmSegCreated = true; _shmSegCreated = true;
} }
...@@ -243,7 +241,7 @@ SHM_Transporter::connect_server_impl(NDB_SOCKET_TYPE sockfd) ...@@ -243,7 +241,7 @@ SHM_Transporter::connect_server_impl(NDB_SOCKET_TYPE sockfd)
if (!ndb_shm_attach()) { if (!ndb_shm_attach()) {
report_error(TE_SHM_UNABLE_TO_ATTACH_SEGMENT); report_error(TE_SHM_UNABLE_TO_ATTACH_SEGMENT);
NDB_CLOSE_SOCKET(sockfd); NDB_CLOSE_SOCKET(sockfd);
return false; DBUG_RETURN(false);
} }
_attached = true; _attached = true;
} }
...@@ -254,7 +252,7 @@ SHM_Transporter::connect_server_impl(NDB_SOCKET_TYPE sockfd) ...@@ -254,7 +252,7 @@ SHM_Transporter::connect_server_impl(NDB_SOCKET_TYPE sockfd)
// Wait for ok from client // Wait for ok from client
if (s_input.gets(buf, 256) == 0) { if (s_input.gets(buf, 256) == 0) {
NDB_CLOSE_SOCKET(sockfd); NDB_CLOSE_SOCKET(sockfd);
return false; DBUG_RETURN(false);
} }
int r= connect_common(sockfd); int r= connect_common(sockfd);
...@@ -265,17 +263,20 @@ SHM_Transporter::connect_server_impl(NDB_SOCKET_TYPE sockfd) ...@@ -265,17 +263,20 @@ SHM_Transporter::connect_server_impl(NDB_SOCKET_TYPE sockfd)
// Wait for ok from client // Wait for ok from client
if (s_input.gets(buf, 256) == 0) { if (s_input.gets(buf, 256) == 0) {
NDB_CLOSE_SOCKET(sockfd); NDB_CLOSE_SOCKET(sockfd);
return false; DBUG_RETURN(false);
} }
DBUG_PRINT("info", ("Successfully connected server to node %d",
remoteNodeId));
} }
NDB_CLOSE_SOCKET(sockfd); NDB_CLOSE_SOCKET(sockfd);
return r; DBUG_RETURN(r);
} }
bool bool
SHM_Transporter::connect_client_impl(NDB_SOCKET_TYPE sockfd) SHM_Transporter::connect_client_impl(NDB_SOCKET_TYPE sockfd)
{ {
DBUG_ENTER("SHM_Transporter::connect_client_impl");
SocketInputStream s_input(sockfd); SocketInputStream s_input(sockfd);
SocketOutputStream s_output(sockfd); SocketOutputStream s_output(sockfd);
char buf[256]; char buf[256];
...@@ -283,14 +284,18 @@ SHM_Transporter::connect_client_impl(NDB_SOCKET_TYPE sockfd) ...@@ -283,14 +284,18 @@ SHM_Transporter::connect_client_impl(NDB_SOCKET_TYPE sockfd)
// Wait for server to create and attach // Wait for server to create and attach
if (s_input.gets(buf, 256) == 0) { if (s_input.gets(buf, 256) == 0) {
NDB_CLOSE_SOCKET(sockfd); NDB_CLOSE_SOCKET(sockfd);
return false; DBUG_PRINT("error", ("Server id %d did not attach",
remoteNodeId));
DBUG_RETURN(false);
} }
// Create // Create
if(!_shmSegCreated){ if(!_shmSegCreated){
if (!ndb_shm_get()) { if (!ndb_shm_get()) {
NDB_CLOSE_SOCKET(sockfd); NDB_CLOSE_SOCKET(sockfd);
return false; DBUG_PRINT("error", ("Failed create of shm seg to node %d",
remoteNodeId));
DBUG_RETURN(false);
} }
_shmSegCreated = true; _shmSegCreated = true;
} }
...@@ -300,7 +305,9 @@ SHM_Transporter::connect_client_impl(NDB_SOCKET_TYPE sockfd) ...@@ -300,7 +305,9 @@ SHM_Transporter::connect_client_impl(NDB_SOCKET_TYPE sockfd)
if (!ndb_shm_attach()) { if (!ndb_shm_attach()) {
report_error(TE_SHM_UNABLE_TO_ATTACH_SEGMENT); report_error(TE_SHM_UNABLE_TO_ATTACH_SEGMENT);
NDB_CLOSE_SOCKET(sockfd); NDB_CLOSE_SOCKET(sockfd);
return false; DBUG_PRINT("error", ("Failed attach of shm seg to node %d",
remoteNodeId));
DBUG_RETURN(false);
} }
_attached = true; _attached = true;
} }
...@@ -314,21 +321,28 @@ SHM_Transporter::connect_client_impl(NDB_SOCKET_TYPE sockfd) ...@@ -314,21 +321,28 @@ SHM_Transporter::connect_client_impl(NDB_SOCKET_TYPE sockfd)
// Wait for ok from server // Wait for ok from server
if (s_input.gets(buf, 256) == 0) { if (s_input.gets(buf, 256) == 0) {
NDB_CLOSE_SOCKET(sockfd); NDB_CLOSE_SOCKET(sockfd);
return false; DBUG_PRINT("error", ("No ok from server node %d",
remoteNodeId));
DBUG_RETURN(false);
} }
// Send ok to server // Send ok to server
s_output.println("shm client 2 ok"); s_output.println("shm client 2 ok");
DBUG_PRINT("info", ("Successfully connected client to node %d",
remoteNodeId));
} }
NDB_CLOSE_SOCKET(sockfd); NDB_CLOSE_SOCKET(sockfd);
return r; DBUG_RETURN(r);
} }
bool bool
SHM_Transporter::connect_common(NDB_SOCKET_TYPE sockfd) SHM_Transporter::connect_common(NDB_SOCKET_TYPE sockfd)
{ {
if (!checkConnected()) if (!checkConnected()) {
DBUG_PRINT("error", ("Already connected to node %d",
remoteNodeId));
return false; return false;
}
if(!setupBuffersDone) { if(!setupBuffersDone) {
setupBuffers(); setupBuffers();
...@@ -341,5 +355,7 @@ SHM_Transporter::connect_common(NDB_SOCKET_TYPE sockfd) ...@@ -341,5 +355,7 @@ SHM_Transporter::connect_common(NDB_SOCKET_TYPE sockfd)
return true; return true;
} }
DBUG_PRINT("error", ("Failed to set up buffers to node %d",
remoteNodeId));
return false; return false;
} }
...@@ -38,7 +38,6 @@ public: ...@@ -38,7 +38,6 @@ public:
int r_port, int r_port,
NodeId lNodeId, NodeId lNodeId,
NodeId rNodeId, NodeId rNodeId,
bool compression,
bool checksum, bool checksum,
bool signalId, bool signalId,
key_t shmKey, key_t shmKey,
...@@ -127,6 +126,7 @@ protected: ...@@ -127,6 +126,7 @@ protected:
private: private:
bool _shmSegCreated; bool _shmSegCreated;
bool _attached; bool _attached;
bool m_connected;
key_t shmKey; key_t shmKey;
volatile Uint32 * serverStatusFlag; volatile Uint32 * serverStatusFlag;
......
...@@ -70,11 +70,10 @@ TCP_Transporter::TCP_Transporter(TransporterRegistry &t_reg, ...@@ -70,11 +70,10 @@ TCP_Transporter::TCP_Transporter(TransporterRegistry &t_reg,
int r_port, int r_port,
NodeId lNodeId, NodeId lNodeId,
NodeId rNodeId, NodeId rNodeId,
int byte_order, bool chksm, bool signalId,
bool compr, bool chksm, bool signalId,
Uint32 _reportFreq) : Uint32 _reportFreq) :
Transporter(t_reg, lHostName, rHostName, r_port, lNodeId, rNodeId, Transporter(t_reg, lHostName, rHostName, r_port, lNodeId, rNodeId,
byte_order, compr, chksm, signalId), 0, false, chksm, signalId),
m_sendBuffer(sendBufSize) m_sendBuffer(sendBufSize)
{ {
maxReceiveSize = maxRecvSize; maxReceiveSize = maxRecvSize;
...@@ -106,12 +105,14 @@ TCP_Transporter::~TCP_Transporter() { ...@@ -106,12 +105,14 @@ TCP_Transporter::~TCP_Transporter() {
bool TCP_Transporter::connect_server_impl(NDB_SOCKET_TYPE sockfd) bool TCP_Transporter::connect_server_impl(NDB_SOCKET_TYPE sockfd)
{ {
return connect_common(sockfd); DBUG_ENTER("TCP_Transpporter::connect_server_impl");
DBUG_RETURN(connect_common(sockfd));
} }
bool TCP_Transporter::connect_client_impl(NDB_SOCKET_TYPE sockfd) bool TCP_Transporter::connect_client_impl(NDB_SOCKET_TYPE sockfd)
{ {
return connect_common(sockfd); DBUG_ENTER("TCP_Transpporter::connect_client_impl");
DBUG_RETURN(connect_common(sockfd));
} }
bool TCP_Transporter::connect_common(NDB_SOCKET_TYPE sockfd) bool TCP_Transporter::connect_common(NDB_SOCKET_TYPE sockfd)
...@@ -119,6 +120,8 @@ bool TCP_Transporter::connect_common(NDB_SOCKET_TYPE sockfd) ...@@ -119,6 +120,8 @@ bool TCP_Transporter::connect_common(NDB_SOCKET_TYPE sockfd)
theSocket = sockfd; theSocket = sockfd;
setSocketOptions(); setSocketOptions();
setSocketNonBlocking(theSocket); setSocketNonBlocking(theSocket);
DBUG_PRINT("info", ("Successfully set-up TCP transporter to node %d",
remoteNodeId));
return true; return true;
} }
......
...@@ -52,8 +52,7 @@ private: ...@@ -52,8 +52,7 @@ private:
int r_port, int r_port,
NodeId lHostId, NodeId lHostId,
NodeId rHostId, NodeId rHostId,
int byteorder, bool checksum, bool signalId,
bool compression, bool checksum, bool signalId,
Uint32 reportFreq = 4096); Uint32 reportFreq = 4096);
// Disconnect, delete send buffers and receive buffer // Disconnect, delete send buffers and receive buffer
......
...@@ -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 <ndb_global.h>
#include <my_pthread.h>
#include <TransporterRegistry.hpp> #include <TransporterRegistry.hpp>
#include "TransporterInternalDefinitions.hpp" #include "TransporterInternalDefinitions.hpp"
...@@ -48,9 +49,10 @@ ...@@ -48,9 +49,10 @@
SocketServer::Session * TransporterService::newSession(NDB_SOCKET_TYPE sockfd) SocketServer::Session * TransporterService::newSession(NDB_SOCKET_TYPE sockfd)
{ {
DBUG_ENTER("SocketServer::Session * TransporterService::newSession");
if (m_auth && !m_auth->server_authenticate(sockfd)){ if (m_auth && !m_auth->server_authenticate(sockfd)){
NDB_CLOSE_SOCKET(sockfd); NDB_CLOSE_SOCKET(sockfd);
return 0; DBUG_RETURN(0);
} }
{ {
...@@ -60,27 +62,32 @@ SocketServer::Session * TransporterService::newSession(NDB_SOCKET_TYPE sockfd) ...@@ -60,27 +62,32 @@ SocketServer::Session * TransporterService::newSession(NDB_SOCKET_TYPE sockfd)
char buf[256]; char buf[256];
if (s_input.gets(buf, 256) == 0) { if (s_input.gets(buf, 256) == 0) {
NDB_CLOSE_SOCKET(sockfd); NDB_CLOSE_SOCKET(sockfd);
return 0; DBUG_PRINT("error", ("Could not get node id from client"));
DBUG_RETURN(0);
} }
if (sscanf(buf, "%d", &nodeId) != 1) { if (sscanf(buf, "%d", &nodeId) != 1) {
NDB_CLOSE_SOCKET(sockfd); NDB_CLOSE_SOCKET(sockfd);
return 0; DBUG_PRINT("error", ("Error in node id from client"));
DBUG_RETURN(0);
} }
//check that nodeid is valid and that there is an allocated transporter //check that nodeid is valid and that there is an allocated transporter
if ( nodeId < 0 || nodeId >= (int) m_transporter_registry->maxTransporters) { if ( nodeId < 0 || nodeId >= (int)m_transporter_registry->maxTransporters) {
NDB_CLOSE_SOCKET(sockfd); NDB_CLOSE_SOCKET(sockfd);
return 0; DBUG_PRINT("error", ("Node id out of range from client"));
DBUG_RETURN(0);
} }
if (m_transporter_registry->theTransporters[nodeId] == 0) { if (m_transporter_registry->theTransporters[nodeId] == 0) {
NDB_CLOSE_SOCKET(sockfd); NDB_CLOSE_SOCKET(sockfd);
return 0; DBUG_PRINT("error", ("No transporter for this node id from client"));
DBUG_RETURN(0);
} }
//check that the transporter should be connected //check that the transporter should be connected
if (m_transporter_registry->performStates[nodeId] != TransporterRegistry::CONNECTING) { if (m_transporter_registry->performStates[nodeId] != TransporterRegistry::CONNECTING) {
NDB_CLOSE_SOCKET(sockfd); NDB_CLOSE_SOCKET(sockfd);
return 0; DBUG_PRINT("error", ("Transporter in wrong state for this node id from client"));
DBUG_RETURN(0);
} }
Transporter *t= m_transporter_registry->theTransporters[nodeId]; Transporter *t= m_transporter_registry->theTransporters[nodeId];
...@@ -93,14 +100,13 @@ SocketServer::Session * TransporterService::newSession(NDB_SOCKET_TYPE sockfd) ...@@ -93,14 +100,13 @@ SocketServer::Session * TransporterService::newSession(NDB_SOCKET_TYPE sockfd)
t->connect_server(sockfd); t->connect_server(sockfd);
} }
return 0; DBUG_RETURN(0);
} }
TransporterRegistry::TransporterRegistry(void * callback, TransporterRegistry::TransporterRegistry(void * callback,
unsigned _maxTransporters, unsigned _maxTransporters,
unsigned sizeOfLongSignalMemory) { unsigned sizeOfLongSignalMemory) {
m_transporter_service= 0;
nodeIdSpecified = false; nodeIdSpecified = false;
maxTransporters = _maxTransporters; maxTransporters = _maxTransporters;
sendCounter = 1; sendCounter = 1;
...@@ -209,8 +215,6 @@ TransporterRegistry::createTransporter(TCP_TransporterConfiguration *config) { ...@@ -209,8 +215,6 @@ TransporterRegistry::createTransporter(TCP_TransporterConfiguration *config) {
config->port, config->port,
localNodeId, localNodeId,
config->remoteNodeId, config->remoteNodeId,
config->byteOrder,
config->compression,
config->checksum, config->checksum,
config->signalId); config->signalId);
if (t == NULL) if (t == NULL)
...@@ -264,8 +268,6 @@ TransporterRegistry::createTransporter(OSE_TransporterConfiguration *conf) { ...@@ -264,8 +268,6 @@ TransporterRegistry::createTransporter(OSE_TransporterConfiguration *conf) {
conf->localHostName, conf->localHostName,
conf->remoteNodeId, conf->remoteNodeId,
conf->remoteHostName, conf->remoteHostName,
conf->byteOrder,
conf->compression,
conf->checksum, conf->checksum,
conf->signalId); conf->signalId);
if (t == NULL) if (t == NULL)
...@@ -306,15 +308,17 @@ TransporterRegistry::createTransporter(SCI_TransporterConfiguration *config) { ...@@ -306,15 +308,17 @@ TransporterRegistry::createTransporter(SCI_TransporterConfiguration *config) {
if(theTransporters[config->remoteNodeId] != NULL) if(theTransporters[config->remoteNodeId] != NULL)
return false; return false;
SCI_Transporter * t = new SCI_Transporter(config->sendLimit, SCI_Transporter * t = new SCI_Transporter(*this,
config->localHostName,
config->remoteHostName,
config->port,
config->sendLimit,
config->bufferSize, config->bufferSize,
config->nLocalAdapters, config->nLocalAdapters,
config->remoteSciNodeId0, config->remoteSciNodeId0,
config->remoteSciNodeId1, config->remoteSciNodeId1,
localNodeId, localNodeId,
config->remoteNodeId, config->remoteNodeId,
config->byteOrder,
config->compression,
config->checksum, config->checksum,
config->signalId); config->signalId);
...@@ -357,7 +361,6 @@ TransporterRegistry::createTransporter(SHM_TransporterConfiguration *config) { ...@@ -357,7 +361,6 @@ TransporterRegistry::createTransporter(SHM_TransporterConfiguration *config) {
config->port, config->port,
localNodeId, localNodeId,
config->remoteNodeId, config->remoteNodeId,
config->compression,
config->checksum, config->checksum,
config->signalId, config->signalId,
config->shmKey, config->shmKey,
...@@ -855,8 +858,8 @@ TransporterRegistry::performReceive(){ ...@@ -855,8 +858,8 @@ TransporterRegistry::performReceive(){
if(t->isConnected() && t->checkConnected()){ if(t->isConnected() && t->checkConnected()){
Uint32 * readPtr, * eodPtr; Uint32 * readPtr, * eodPtr;
t->getReceivePtr(&readPtr, &eodPtr); t->getReceivePtr(&readPtr, &eodPtr);
readPtr = unpack(readPtr, eodPtr, nodeId, ioStates[nodeId]); Uint32 *newPtr = unpack(readPtr, eodPtr, nodeId, ioStates[nodeId]);
t->updateReceivePtr(readPtr); t->updateReceivePtr(newPtr);
} }
} }
} }
...@@ -870,8 +873,8 @@ TransporterRegistry::performReceive(){ ...@@ -870,8 +873,8 @@ TransporterRegistry::performReceive(){
if(t->isConnected() && t->checkConnected()){ if(t->isConnected() && t->checkConnected()){
Uint32 * readPtr, * eodPtr; Uint32 * readPtr, * eodPtr;
t->getReceivePtr(&readPtr, &eodPtr); t->getReceivePtr(&readPtr, &eodPtr);
readPtr = unpack(readPtr, eodPtr, nodeId, ioStates[nodeId]); Uint32 *newPtr = unpack(readPtr, eodPtr, nodeId, ioStates[nodeId]);
t->updateReceivePtr(readPtr); t->updateReceivePtr(newPtr);
} }
} }
} }
...@@ -1023,7 +1026,9 @@ TransporterRegistry::setIOState(NodeId nodeId, IOState state) { ...@@ -1023,7 +1026,9 @@ TransporterRegistry::setIOState(NodeId nodeId, IOState state) {
static void * static void *
run_start_clients_C(void * me) run_start_clients_C(void * me)
{ {
my_thread_init();
((TransporterRegistry*) me)->start_clients_thread(); ((TransporterRegistry*) me)->start_clients_thread();
my_thread_end();
NdbThread_Exit(0); NdbThread_Exit(0);
return me; return me;
} }
...@@ -1106,6 +1111,7 @@ TransporterRegistry::update_connections() ...@@ -1106,6 +1111,7 @@ TransporterRegistry::update_connections()
void void
TransporterRegistry::start_clients_thread() TransporterRegistry::start_clients_thread()
{ {
DBUG_ENTER("TransporterRegistry::start_clients_thread");
while (m_run_start_clients_thread) { while (m_run_start_clients_thread) {
NdbSleep_MilliSleep(100); NdbSleep_MilliSleep(100);
for (int i= 0, n= 0; n < nTransporters && m_run_start_clients_thread; i++){ for (int i= 0, n= 0; n < nTransporters && m_run_start_clients_thread; i++){
...@@ -1129,6 +1135,7 @@ TransporterRegistry::start_clients_thread() ...@@ -1129,6 +1135,7 @@ TransporterRegistry::start_clients_thread()
} }
} }
} }
DBUG_VOID_RETURN;
} }
bool bool
...@@ -1159,55 +1166,67 @@ TransporterRegistry::stop_clients() ...@@ -1159,55 +1166,67 @@ TransporterRegistry::stop_clients()
return true; return true;
} }
bool void
TransporterRegistry::start_service(SocketServer& socket_server) TransporterRegistry::add_transporter_interface(const char *interface, unsigned short port)
{ {
#if 0 DBUG_ENTER("TransporterRegistry::add_transporter_interface");
for (int i= 0, n= 0; n < nTransporters; i++){ DBUG_PRINT("enter",("interface=%s, port= %d", interface, port));
Transporter * t = theTransporters[i]; if (interface && strlen(interface) == 0)
if (!t) interface= 0;
for (unsigned i= 0; i < m_transporter_interface.size(); i++)
{
Transporter_interface &tmp= m_transporter_interface[i];
if (port != tmp.m_service_port)
continue; continue;
n++; if (interface != 0 && tmp.m_interface != 0 &&
if (t->isServer) { strcmp(interface, tmp.m_interface) == 0)
t->m_service = new TransporterService(new SocketAuthSimple("ndbd passwd"));
if(!socket_server.setup(t->m_service, t->m_r_port, 0))
{ {
ndbout_c("Unable to setup transporter service port: %d!\n" DBUG_VOID_RETURN; // found match, no need to insert
"Please check if the port is already used,\n"
"(perhaps a mgmt server is already running)",
m_service_port);
delete t->m_service;
return false;
} }
if (interface == 0 && tmp.m_interface == 0)
{
DBUG_VOID_RETURN; // found match, no need to insert
} }
} }
#endif Transporter_interface t;
t.m_service_port= port;
if (m_service_port != 0) { t.m_interface= interface;
m_transporter_interface.push_back(t);
m_transporter_service = new TransporterService(new SocketAuthSimple("ndbd", "ndbd passwd")); DBUG_PRINT("exit",("interface and port added"));
DBUG_VOID_RETURN;
}
if (nodeIdSpecified != true) { bool
TransporterRegistry::start_service(SocketServer& socket_server)
{
if (m_transporter_interface.size() > 0 && nodeIdSpecified != true)
{
ndbout_c("TransporterRegistry::startReceiving: localNodeId not specified"); ndbout_c("TransporterRegistry::startReceiving: localNodeId not specified");
return false; return false;
} }
//m_interface_name = "ndbd"; for (unsigned i= 0; i < m_transporter_interface.size(); i++)
m_interface_name = 0; {
Transporter_interface &t= m_transporter_interface[i];
if(!socket_server.setup(m_transporter_service, m_service_port, m_interface_name)) if (t.m_service_port == 0)
{ {
ndbout_c("Unable to setup transporter service port: %d!\n" continue;
}
TransporterService *transporter_service =
new TransporterService(new SocketAuthSimple("ndbd", "ndbd passwd"));
if(!socket_server.setup(transporter_service,
t.m_service_port, t.m_interface))
{
ndbout_c("Unable to setup transporter service port: %s:%d!\n"
"Please check if the port is already used,\n" "Please check if the port is already used,\n"
"(perhaps a mgmt server is already running)", "(perhaps the node is already running)",
m_service_port); t.m_interface ? t.m_interface : "*", t.m_service_port);
delete m_transporter_service; delete transporter_service;
return false; return false;
} }
m_transporter_service->setTransporterRegistry(this); transporter_service->setTransporterRegistry(this);
} else }
m_transporter_service= 0;
return true; return true;
} }
...@@ -1281,3 +1300,5 @@ NdbOut & operator <<(NdbOut & out, SignalHeader & sh){ ...@@ -1281,3 +1300,5 @@ NdbOut & operator <<(NdbOut & out, SignalHeader & sh){
out << "trace: " << (int)sh.theTrace << endl; out << "trace: " << (int)sh.theTrace << endl;
return out; return out;
} }
template class Vector<TransporterRegistry::Transporter_interface>;
...@@ -9,7 +9,7 @@ libgeneral_la_SOURCES = \ ...@@ -9,7 +9,7 @@ libgeneral_la_SOURCES = \
NdbSqlUtil.cpp new.cpp \ NdbSqlUtil.cpp new.cpp \
uucode.c random.c getarg.c version.c \ uucode.c random.c getarg.c version.c \
strdup.c strlcat.c strlcpy.c \ strdup.c strlcat.c strlcpy.c \
ConfigValues.cpp ConfigValues.cpp ndb_init.c
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
......
This diff is collapsed.
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <ndb_global.h> #include <ndb_global.h>
#include <my_pthread.h>
#include <SocketServer.hpp> #include <SocketServer.hpp>
...@@ -46,7 +47,7 @@ SocketServer::~SocketServer() { ...@@ -46,7 +47,7 @@ SocketServer::~SocketServer() {
} }
bool bool
SocketServer::tryBind(unsigned short port, const char * intface) const { SocketServer::tryBind(unsigned short port, const char * intface) {
struct sockaddr_in servaddr; struct sockaddr_in servaddr;
memset(&servaddr, 0, sizeof(servaddr)); memset(&servaddr, 0, sizeof(servaddr));
servaddr.sin_family = AF_INET; servaddr.sin_family = AF_INET;
...@@ -83,7 +84,8 @@ bool ...@@ -83,7 +84,8 @@ bool
SocketServer::setup(SocketServer::Service * service, SocketServer::setup(SocketServer::Service * service,
unsigned short port, unsigned short port,
const char * intface){ const char * intface){
DBUG_ENTER("SocketServer::setup");
DBUG_PRINT("enter",("interface=%s, port=%d", intface, port));
struct sockaddr_in servaddr; struct sockaddr_in servaddr;
memset(&servaddr, 0, sizeof(servaddr)); memset(&servaddr, 0, sizeof(servaddr));
servaddr.sin_family = AF_INET; servaddr.sin_family = AF_INET;
...@@ -92,36 +94,44 @@ SocketServer::setup(SocketServer::Service * service, ...@@ -92,36 +94,44 @@ SocketServer::setup(SocketServer::Service * service,
if(intface != 0){ if(intface != 0){
if(Ndb_getInAddr(&servaddr.sin_addr, intface)) if(Ndb_getInAddr(&servaddr.sin_addr, intface))
return false; DBUG_RETURN(false);
} }
const NDB_SOCKET_TYPE sock = socket(AF_INET, SOCK_STREAM, 0); const NDB_SOCKET_TYPE sock = socket(AF_INET, SOCK_STREAM, 0);
if (sock == NDB_INVALID_SOCKET) { if (sock == NDB_INVALID_SOCKET) {
return false; DBUG_PRINT("error",("socket() - %d - %s",
errno, strerror(errno)));
DBUG_RETURN(false);
} }
const int on = 1; const int on = 1;
if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR,
(const char*)&on, sizeof(on)) == -1) { (const char*)&on, sizeof(on)) == -1) {
DBUG_PRINT("error",("getsockopt() - %d - %s",
errno, strerror(errno)));
NDB_CLOSE_SOCKET(sock); NDB_CLOSE_SOCKET(sock);
return false; DBUG_RETURN(false);
} }
if (bind(sock, (struct sockaddr*) &servaddr, sizeof(servaddr)) == -1) { if (bind(sock, (struct sockaddr*) &servaddr, sizeof(servaddr)) == -1) {
DBUG_PRINT("error",("bind() - %d - %s",
errno, strerror(errno)));
NDB_CLOSE_SOCKET(sock); NDB_CLOSE_SOCKET(sock);
return false; DBUG_RETURN(false);
} }
if (listen(sock, m_maxSessions) == -1){ if (listen(sock, m_maxSessions) == -1){
DBUG_PRINT("error",("listen() - %d - %s",
errno, strerror(errno)));
NDB_CLOSE_SOCKET(sock); NDB_CLOSE_SOCKET(sock);
return false; DBUG_RETURN(false);
} }
ServiceInstance i; ServiceInstance i;
i.m_socket = sock; i.m_socket = sock;
i.m_service = service; i.m_service = service;
m_services.push_back(i); m_services.push_back(i);
return true; DBUG_RETURN(true);
} }
void void
...@@ -177,8 +187,9 @@ void* ...@@ -177,8 +187,9 @@ void*
socketServerThread_C(void* _ss){ socketServerThread_C(void* _ss){
SocketServer * ss = (SocketServer *)_ss; SocketServer * ss = (SocketServer *)_ss;
my_thread_init();
ss->doRun(); ss->doRun();
my_thread_end();
NdbThread_Exit(0); NdbThread_Exit(0);
return 0; return 0;
} }
...@@ -287,8 +298,10 @@ void* ...@@ -287,8 +298,10 @@ void*
sessionThread_C(void* _sc){ sessionThread_C(void* _sc){
SocketServer::Session * si = (SocketServer::Session *)_sc; SocketServer::Session * si = (SocketServer::Session *)_sc;
my_thread_init();
if(!transfer(si->m_socket)){ if(!transfer(si->m_socket)){
si->m_stopped = true; si->m_stopped = true;
my_thread_end();
NdbThread_Exit(0); NdbThread_Exit(0);
return 0; return 0;
} }
...@@ -301,6 +314,7 @@ sessionThread_C(void* _sc){ ...@@ -301,6 +314,7 @@ sessionThread_C(void* _sc){
} }
si->m_stopped = true; si->m_stopped = true;
my_thread_end();
NdbThread_Exit(0); NdbThread_Exit(0);
return 0; return 0;
} }
......
...@@ -14,17 +14,16 @@ ...@@ -14,17 +14,16 @@
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
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 <LogLevel.hpp> #include <ndb_global.h>
#include <my_sys.h>
const LogLevel::LogLevelCategoryName LogLevel::LOGLEVEL_CATEGORY_NAME[] = { int
{ "LogLevelStartup" }, ndb_init()
{ "LogLevelShutdown" }, {
{ "LogLevelStatistic" }, if (my_init()) {
{ "LogLevelCheckpoint" }, const char* err = "my_init() failed - exit\n";
{ "LogLevelNodeRestart" }, write(2, err, strlen(err));
{ "LogLevelConnection" }, exit(1);
{ "LogLevelError" }, }
{ "LogLevelWarning" }, return 0;
{ "LogLevelInfo" }, }
{ "LogLevelGrep" }
};
This diff is collapsed.
...@@ -378,7 +378,7 @@ CPCD::getProcessList() { ...@@ -378,7 +378,7 @@ CPCD::getProcessList() {
} }
void void
CPCD::RequestStatus::err(enum RequestStatusCode status, char *msg) { CPCD::RequestStatus::err(enum RequestStatusCode status, const char *msg) {
m_status = status; m_status = status;
snprintf(m_errorstring, sizeof(m_errorstring), "%s", msg); snprintf(m_errorstring, sizeof(m_errorstring), "%s", msg);
} }
......
...@@ -91,7 +91,7 @@ public: ...@@ -91,7 +91,7 @@ public:
RequestStatus() { m_status = OK; m_errorstring[0] = '\0'; }; RequestStatus() { m_status = OK; m_errorstring[0] = '\0'; };
/** @brief Sets an errorcode and a printable message */ /** @brief Sets an errorcode and a printable message */
void err(enum RequestStatusCode, char *); void err(enum RequestStatusCode, const char *);
/** @brief Returns the error message */ /** @brief Returns the error message */
char *getErrMsg() { return m_errorstring; }; char *getErrMsg() { return m_errorstring; };
......
...@@ -7,7 +7,7 @@ LDADD_LOC = \ ...@@ -7,7 +7,7 @@ LDADD_LOC = \
$(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@
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
......
This diff is collapsed.
...@@ -55,7 +55,7 @@ LDADD += \ ...@@ -55,7 +55,7 @@ LDADD += \
$(top_builddir)/ndb/src/common/util/libgeneral.la \ $(top_builddir)/ndb/src/common/util/libgeneral.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@
# Don't update the files from bitkeeper # Don't update the files from bitkeeper
%::SCCS/s.% %::SCCS/s.%
This diff is collapsed.
...@@ -48,6 +48,7 @@ static Uint32 logEntryNo; ...@@ -48,6 +48,7 @@ static Uint32 logEntryNo;
int int
main(int argc, const char * argv[]){ main(int argc, const char * argv[]){
ndb_init();
if(argc <= 1){ if(argc <= 1){
printf("Usage: %s <filename>", argv[0]); printf("Usage: %s <filename>", argv[0]);
exit(1); exit(1);
......
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