Commit c6b43dcd authored by Quanah Gibson-Mount's avatar Quanah Gibson-Mount
Browse files

ITS#9635 - Delete back-ndb

parent 31b0bf68
......@@ -27,7 +27,7 @@ build-openssl-heimdal-lloadd:
- autoreconf
- mkdir obj
- cd obj
- ../configure --enable-backends=mod --enable-overlays=mod --enable-modules --enable-dynamic --disable-ndb --enable-balancer=mod --enable-argon2 --with-systemd
- ../configure --enable-backends=mod --enable-overlays=mod --enable-modules --enable-dynamic --enable-balancer=mod --enable-argon2 --with-systemd
- make depend
- make
- export DEBUGINFOD_URLS="${DEBUGINFOD_URLS-https://debuginfod.debian.net}"
......@@ -49,7 +49,7 @@ build-gnutls-mit-standalone-lloadd:
- autoreconf
- mkdir obj
- cd obj
- ../configure --enable-backends=mod --enable-overlays=mod --disable-autoca --enable-modules --enable-dynamic --disable-ndb --enable-balancer=yes --enable-argon2 --with-systemd
- ../configure --enable-backends=mod --enable-overlays=mod --disable-autoca --enable-modules --enable-dynamic --enable-balancer=yes --enable-argon2 --with-systemd
- make depend
- make
- export DEBUGINFOD_URLS="${DEBUGINFOD_URLS-https://debuginfod.debian.net}"
......
......@@ -301,7 +301,6 @@ Backends="dnssrv \
mdb \
meta \
asyncmeta \
ndb \
null \
passwd \
perl \
......@@ -326,8 +325,6 @@ OL_ARG_ENABLE(meta, [AS_HELP_STRING([--enable-meta], [enable metadirectory backe
no, [no yes mod], ol_enable_backends)dnl
OL_ARG_ENABLE(asyncmeta, [AS_HELP_STRING([--enable-asyncmeta], [enable asynchronous metadirectory backend])],
no, [no yes mod], ol_enable_backends)dnl
OL_ARG_ENABLE(ndb, [AS_HELP_STRING([--enable-ndb], [enable MySQL NDB Cluster backend])],
no, [no yes mod], ol_enable_backends)dnl
OL_ARG_ENABLE(null, [AS_HELP_STRING([--enable-null], [enable null backend])],
no, [no yes mod], ol_enable_backends)dnl
OL_ARG_ENABLE(passwd, [AS_HELP_STRING([--enable-passwd], [enable passwd backend])],
......@@ -1962,47 +1959,6 @@ if test $ol_enable_sql != no ; then
fi
fi
dnl ----------------------------------------------------------------
dnl MySQL NDBapi
dnl Note: uses C++, but we don't want to add C++ test overhead to
dnl the rest of the libtool machinery.
ol_link_ndb=no
if test $ol_enable_ndb != no ; then
AC_CHECK_PROG(MYSQL,mysql_config,yes)
if test "$MYSQL" != yes ; then
AC_MSG_ERROR([could not locate mysql_config])
fi
SQL_INC=`mysql_config --include`
SLAPD_NDB_INCS="$SQL_INC $SQL_INC/storage/ndb $SQL_INC/storage/ndb/ndbapi"
save_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$SLAPD_NDB_INCS"
AC_MSG_CHECKING(for NdbApi.hpp)
AC_PREPROC_IFELSE(
[AC_LANG_SOURCE([[#include <NdbApi.hpp>]])],
AC_MSG_RESULT(yes),
AC_MSG_ERROR([could not locate NdbApi headers])
)
CPPFLAGS="$save_CPPFLAGS"
SQL_LIB=`mysql_config --libs_r`
SLAPD_NDB_LIBS="$SQL_LIB -lndbclient -lstdc++"
save_LDFLAGS="$LDFLAGS"
save_LIBS="$LIBS"
LDFLAGS="$SQL_LIB"
AC_CHECK_LIB(ndbclient,ndb_init,[: ok],[
AC_MSG_ERROR([could not locate ndbclient library])
],[-lstdc++])
LIBS="$save_LIBS"
LDFLAGS="$save_LDFLAGS"
if test "$ol_enable_ndb" = yes ; then
SLAPD_LIBS="$SLAPD_LIBS \$(SLAPD_NDB_LIBS)"
fi
fi
dnl ----------------------------------------------------------------
dnl WiredTiger
ol_link_wt=no
......@@ -2656,19 +2612,6 @@ if test "$ol_enable_asyncmeta" != no ; then
AC_DEFINE_UNQUOTED(SLAPD_ASYNCMETA,$MFLAG,[define to support LDAP Async Metadirectory backend])
fi
if test "$ol_enable_ndb" != no ; then
BUILD_SLAPD=yes
BUILD_NDB=$ol_enable_ndb
if test "$ol_enable_ndb" = mod ; then
SLAPD_DYNAMIC_BACKENDS="$SLAPD_DYNAMIC_BACKENDS back-ndb"
MFLAG=SLAPD_MOD_DYNAMIC
else
SLAPD_STATIC_BACKENDS="$SLAPD_STATIC_BACKENDS back-ndb"
MFLAG=SLAPD_MOD_STATIC
fi
AC_DEFINE_UNQUOTED(SLAPD_NDB,$MFLAG,[define to support NDB backend])
fi
if test "$ol_enable_null" != no ; then
BUILD_SLAPD=yes
BUILD_NULL=$ol_enable_null
......@@ -3311,7 +3254,6 @@ AC_CONFIG_FILES([Makefile:build/top.mk:Makefile.in:build/dir.mk]
[servers/slapd/back-meta/Makefile:build/top.mk:servers/slapd/back-meta/Makefile.in:build/mod.mk]
[servers/slapd/back-asyncmeta/Makefile:build/top.mk:servers/slapd/back-asyncmeta/Makefile.in:build/mod.mk]
[servers/slapd/back-monitor/Makefile:build/top.mk:servers/slapd/back-monitor/Makefile.in:build/mod.mk]
[servers/slapd/back-ndb/Makefile:build/top.mk:servers/slapd/back-ndb/Makefile.in:build/mod.mk]
[servers/slapd/back-null/Makefile:build/top.mk:servers/slapd/back-null/Makefile.in:build/mod.mk]
[servers/slapd/back-passwd/Makefile:build/top.mk:servers/slapd/back-passwd/Makefile.in:build/mod.mk]
[servers/slapd/back-perl/Makefile:build/top.mk:servers/slapd/back-perl/Makefile.in:build/mod.mk]
......
......@@ -124,7 +124,6 @@ fi
INDEXDB=noindexdb MAINDB=nomaindb
case $BACKEND in
mdb) INDEXDB=indexdb MAINDB=maindb ;;
ndb) INDEXDB=indexdb ;;
esac
export BACKEND BACKENDTYPE INDEXDB MAINDB \
......@@ -175,16 +174,6 @@ if test -d ${TESTDIR} ; then
/bin/rm -rf ${TESTDIR}/db.*
fi
fi
if test $BACKEND = ndb ; then
mysql --user root <<EOF
drop database if exists db_1;
drop database if exists db_2;
drop database if exists db_3;
drop database if exists db_4;
drop database if exists db_5;
drop database if exists db_6;
EOF
fi
mkdir -p ${TESTDIR}
if test $USERDATA = yes ; then
......
......@@ -46,16 +46,6 @@ for CMD in ${SCRIPTDIR}/test*; do
else
/bin/rm -rf $TESTDIR
fi
if test $BACKEND = ndb ; then
mysql --user root <<EOF
drop database if exists db_1;
drop database if exists db_2;
drop database if exists db_3;
drop database if exists db_4;
drop database if exists db_5;
drop database if exists db_6;
EOF
fi
BCMD=`basename $CMD`
if [ -x "$CMD" ]; then
......
......@@ -124,7 +124,6 @@ fi
INDEXDB=noindexdb MAINDB=nomaindb
case $BACKEND in
mdb) INDEXDB=indexdb MAINDB=maindb ;;
ndb) INDEXDB=indexdb ;;
esac
export BACKEND BACKENDTYPE INDEXDB MAINDB \
......@@ -175,16 +174,6 @@ if test -d ${TESTDIR} ; then
/bin/rm -rf ${TESTDIR}/db.*
fi
fi
if test $BACKEND = ndb ; then
mysql --user root <<EOF
drop database if exists db_1;
drop database if exists db_2;
drop database if exists db_3;
drop database if exists db_4;
drop database if exists db_5;
drop database if exists db_6;
EOF
fi
mkdir -p ${TESTDIR}
if test $USERDATA = yes ; then
......
......@@ -46,16 +46,6 @@ for CMD in ${SCRIPTDIR}/test*; do
else
/bin/rm -rf $TESTDIR
fi
if test $BACKEND = ndb ; then
mysql --user root <<EOF
drop database if exists db_1;
drop database if exists db_2;
drop database if exists db_3;
drop database if exists db_4;
drop database if exists db_5;
drop database if exists db_6;
EOF
fi
BCMD=`basename $CMD`
if [ -x "$CMD" ]; then
......
......@@ -369,7 +369,6 @@ ldif Lightweight Data Interchange Format backend
mdb Memory-Mapped DB backend
meta Metadirectory backend
monitor Monitor backend
ndb MySQL NDB backend
null Null backend
passwd Provides read-only access to {{passwd}}(5)
perl Perl Programmable backend
......
......@@ -269,7 +269,6 @@ ldif Lightweight Data Interchange Format backend
mdb Memory-Mapped DB backend
meta Metadirectory backend
monitor Monitor backend
ndb MySQL NDB backend
null Null backend
passwd Provides read-only access to {{passwd}}(5)
perl Perl Programmable backend
......
......@@ -1216,7 +1216,6 @@ should be one of
.BR mdb ,
.BR meta ,
.BR monitor ,
.BR ndb ,
.BR null ,
.BR passwd ,
.BR perl ,
......
.TH SLAPD-NDB 5 "RELEASEDATE" "OpenLDAP LDVERSION"
.\" Copyright 2008-2021 The OpenLDAP Foundation All Rights Reserved.
.\" Copying restrictions apply. See COPYRIGHT/LICENSE.
.\" $OpenLDAP$
.SH NAME
slapd\-ndb \- MySQL NDB backend to slapd
.SH SYNOPSIS
.B ETCDIR/slapd.conf
.SH DESCRIPTION
The \fBndb\fP backend to
.BR slapd (8)
uses the MySQL Cluster package to store data, through its NDB API.
It provides fault tolerance with extreme scalability, along with
a degree of SQL compatibility.
.LP
This backend is designed to store LDAP information using tables that
are also visible from SQL. It uses a higher level SQL API for creating
these tables, while using the low level NDB API for storing and
retrieving the data within these tables. The NDB Cluster engine
allows data to be partitioned across multiple data nodes, and this
backend allows multiple slapd instances to operate against a given
database concurrently.
.LP
The general approach is to use distinct tables for each LDAP object class.
Entries comprised of multiple object classes will have their data
spread across multiple tables. The data tables use a 64 bit entryID
as their primary key. The DIT hierarchy is maintained in a separate
table, which maps DNs to entryIDs.
.LP
This backend is experimental. While intended to be a general-purpose
backend, it is currently missing a number of common LDAP features.
See the \fBTODO\fP file in the source directory for details.
.SH CONFIGURATION
These
.B slapd.conf
options apply to the \fBndb\fP backend database.
That is, they must follow a "database ndb" line and
come before any subsequent "backend" or "database" lines.
Other database options are described in the
.BR slapd.conf (5)
manual page.
.SH DATA SOURCE CONFIGURATION
.TP
.B dbhost <hostname>
The name or IP address of the host running the MySQL server. The default
is "localhost". On Unix systems, the connection to a local server is made
using a Unix Domain socket, whose path is specified using the
.B dbsocket
directive.
.TP
.B dbuser <username>
The MySQL login ID to use when connecting to the MySQL server. The chosen
user must have sufficient privileges to manipulate the SQL tables in the
target database.
.TP
.B dbpasswd <password>
The password for the \fBdbuser\fP.
.TP
.B dbname <database name>
The name of the MySQL database to use.
.TP
.B dbport <port>
The port number to use for the TCP connection to the MySQL server.
.TP
.B dbsocket <path>
The socket to be used for connecting to a local MySQL server.
.TP
.B dbflag <integer>
Client flags for the MySQL session. See the MySQL documentation for details.
.TP
.B dbconnect <connectstring>
The name or IP address of the host running the cluster manager. The default
is "localhost".
.TP
.B dbconnections <integer>
The number of cluster connections to establish. Using up to 4 may improve
performance under heavier load. The default is 1.
.SH SCHEMA CONFIGURATION
.TP
.B attrlen <attribute> <length>
Specify the column length to use for a particular attribute. LDAP attributes are
stored in individual columns of the SQL tables. The maximum column lengths for
each column must be specified when creating these tables. If a length constraint
was specified in the attribute's LDAP schema definition, that value will be used
by default. If the schema didn't specify a constraint, the default is 128 bytes.
Currently the maximum is 1024.
.TP
.B index <attr[,attr...]>
Specify a list of attributes for which indexing should be maintained.
Currently there is no support for substring indexing; a single index structure
provides presence, equality, and inequality indexing for the specified attributes.
.TP
.B attrset <set> <attrs>
Specify a list of attributes to be treated as an attribute set. This directive
creates a table named \fIset\fP which will contain all of the listed attributes.
Ordinarily an attribute resides in a table named by an object class that uses
the attribute. However, attributes are only allowed to appear in a single table.
For attributes that are derived from an inherited object class definition,
the attribute will only be stored in the superior class's table.
Attribute sets should be defined for any attributes that are used in multiple
unrelated object classes, i.e., classes that are not connected by a simple
inheritance chain.
.SH ACCESS CONTROL
The
.B ndb
backend honors most access control semantics as indicated in
.BR slapd.access (5).
.SH FILES
.TP
.B ETCDIR/slapd.conf
default
.B slapd
configuration file
.SH SEE ALSO
.BR slapd.conf (5),
.BR slapd\-config (5),
.BR slapd (8),
.BR slapadd (8),
.BR slapcat (8),
.BR slapindex (8),
.BR slapmodify (8),
MySQL Cluster documentation.
.SH AUTHOR
Howard Chu, with assistance from Johan Andersson et al @ MySQL.
......@@ -67,12 +67,6 @@ daemon. Only a single instance of the
.B monitor
backend may be defined.
.TP
.B ndb
This backend is experimental, incomplete, and deprecated.
It uses the transactional database interface of the MySQL Cluster Engine
(NDB) to store data. Note that Oracle, which now owns MySQL, has withdrawn
support for NDB and this backend is unlikely to be developed any further.
.TP
.B null
Operations in this backend succeed but do nothing.
.TP
......@@ -125,7 +119,6 @@ default slapd configuration directory
.BR slapd\-mdb (5),
.BR slapd\-meta (5),
.BR slapd\-monitor (5),
.BR slapd\-ndb (5),
.BR slapd\-null (5),
.BR slapd\-passwd (5),
.BR slapd\-perl (5),
......
......@@ -1307,7 +1307,6 @@ should be one of
.BR mdb ,
.BR meta ,
.BR monitor ,
.BR ndb ,
.BR null ,
.BR passwd ,
.BR perl ,
......@@ -1339,7 +1338,6 @@ should be one of
.BR mdb ,
.BR meta ,
.BR monitor ,
.BR ndb ,
.BR null ,
.BR passwd ,
.BR perl ,
......
# Makefile.in for back-ndb
# $OpenLDAP$
## This work is part of OpenLDAP Software <http://www.openldap.org/>.
##
## Copyright 2008-2021 The OpenLDAP Foundation.
## All rights reserved.
##
## Redistribution and use in source and binary forms, with or without
## modification, are permitted only as authorized by the OpenLDAP
## Public License.
##
## A copy of this license is available in the file LICENSE in the
## top-level directory of the distribution or, alternatively, at
## <http://www.OpenLDAP.org/license.html>.
##
## ACKNOWLEDGEMENTS:
## This work was initially developed by Howard Chu for inclusion
## in OpenLDAP Software. This work was sponsored by MySQL.
SRCS = init.cpp tools.cpp config.cpp ndbio.cpp \
add.cpp bind.cpp compare.cpp delete.cpp modify.cpp modrdn.cpp search.cpp
OBJS = init.lo tools.lo config.lo ndbio.lo \
add.lo bind.lo compare.lo delete.lo modify.lo modrdn.lo search.lo
LDAP_INCDIR= ../../../include
LDAP_LIBDIR= ../../../libraries
BUILD_OPT = "--enable-ndb"
BUILD_MOD = @BUILD_NDB@
mod_DEFS = -DSLAPD_IMPORT
MOD_DEFS = $(@BUILD_NDB@_DEFS)
MOD_LIBS = $(SLAPD_NDB_LIBS)
shared_LDAP_LIBS = $(LDAP_LIBLDAP_LA) $(LDAP_LIBLBER_LA)
NT_LINK_LIBS = -L.. -lslapd $(@BUILD_LIBS_DYNAMIC@_LDAP_LIBS)
UNIX_LINK_LIBS = $(@BUILD_LIBS_DYNAMIC@_LDAP_LIBS)
LIBBASE = back_ndb
XINCPATH = -I.. -I$(srcdir)/.. @SLAPD_NDB_INCS@
XDEFS = $(MODULES_CPPFLAGS)
AC_CXX = g++
CXX = $(AC_CXX)
LTCXX_MOD = $(LIBTOOL) $(LTONLY_MOD) --mode=compile \
$(CXX) $(LT_CFLAGS) $(LT_CPPFLAGS) $(MOD_DEFS) -c
all-local-lib: ../.backend
.SUFFIXES: .c .o .lo .cpp
.cpp.lo:
$(LTCXX_MOD) $<
../.backend: lib$(LIBBASE).a
@touch $@
LDAP features not currently supported:
tagged attributes
aliases
substring indexing
subtree rename
/* add.cpp - ldap NDB back-end add routine */
/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
* Copyright 2008-2021 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted only as authorized by the OpenLDAP
* Public License.
*
* A copy of this license is available in the file LICENSE in the
* top-level directory of the distribution or, alternatively, at
* <http://www.OpenLDAP.org/license.html>.
*/
/* ACKNOWLEDGEMENTS:
* This work was initially developed by Howard Chu for inclusion
* in OpenLDAP Software. This work was sponsored by MySQL.
*/
#include "portable.h"
#include <stdio.h>
#include <ac/string.h>
#include "back-ndb.h"
extern "C" int
ndb_back_add(Operation *op, SlapReply *rs )
{
struct ndb_info *ni = (struct ndb_info *) op->o_bd->be_private;
Entry p = {0};
Attribute poc;
char textbuf[SLAP_TEXT_BUFLEN];
size_t textlen = sizeof textbuf;
AttributeDescription *children = slap_schema.si_ad_children;
AttributeDescription *entry = slap_schema.si_ad_entry;
NdbArgs NA;
NdbRdns rdns;
struct berval matched;
struct berval pdn, pndn;
int num_retries = 0;
int success;
LDAPControl **postread_ctrl = NULL;
LDAPControl *ctrls[SLAP_MAX_RESPONSE_CONTROLS];
int num_ctrls = 0;
Debug(LDAP_DEBUG_ARGS, "==> " LDAP_XSTRING(ndb_back_add) ": %s\n",
op->oq_add.rs_e->e_name.bv_val, 0, 0);
ctrls[num_ctrls] = 0;
NA.txn = NULL;
/* check entry's schema */
rs->sr_err = entry_schema_check( op, op->oq_add.rs_e, NULL,
get_relax(op), 1, NULL, &rs->sr_text, textbuf, textlen );
if ( rs->sr_err != LDAP_SUCCESS ) {
Debug( LDAP_DEBUG_TRACE,
LDAP_XSTRING(ndb_back_add) ": entry failed schema check: "
"%s (%d)\n", rs->sr_text, rs->sr_err, 0 );
goto return_results;
}
/* add opattrs to shadow as well, only missing attrs will actually
* be added; helps compatibility with older OL versions */
rs->sr_err = slap_add_opattrs( op, &rs->sr_text, textbuf, textlen, 1 );
if ( rs->sr_err != LDAP_SUCCESS ) {
Debug( LDAP_DEBUG_TRACE,
LDAP_XSTRING(ndb_back_add) ": entry failed op attrs add: "
"%s (%d)\n", rs->sr_text, rs->sr_err, 0 );
goto return_results;
}
/* Get our NDB handle */
rs->sr_err = ndb_thread_handle( op, &NA.ndb );
/*
* Get the parent dn and see if the corresponding entry exists.
*/
if ( be_issuffix( op->o_bd, &op->oq_add.rs_e->e_nname ) ) {
pdn = slap_empty_bv;
pndn = slap_empty_bv;
} else {
dnParent( &op->ora_e->e_name, &pdn );
dnParent( &op->ora_e->e_nname, &pndn );
}
p.e_name = op->ora_e->e_name;
p.e_nname = op->ora_e->e_nname;
op->ora_e->e_id = NOID;
rdns.nr_num = 0;
NA.rdns = &rdns;
if( 0 ) {
retry: /* transaction retry */
NA.txn->close();
NA.txn = NULL;
if ( op->o_abandon ) {
rs->sr_err = SLAPD_ABANDON;
goto return_results;
}
ndb_trans_backoff( ++num_retries );
}
NA.txn = NA.ndb->startTransaction();
rs->sr_text = NULL;
if( !NA.txn ) {
Debug( LDAP_DEBUG_TRACE,
LDAP_XSTRING(ndb_back_add) ": startTransaction failed: %s (%d)\n",
NA.ndb->getNdbError().message, NA.ndb->getNdbError().code, 0 );
rs->sr_err = LDAP_OTHER;
rs->sr_text = "internal error";
goto return_results;
}
/* get entry or parent */
NA.e = &p;
NA.ocs = NULL;
rs->sr_err = ndb_entry_get_info( op, &NA, 0, &matched );
switch( rs->sr_err ) {
case 0:
rs->sr_err = LDAP_ALREADY_EXISTS;
goto return_results;
case LDAP_NO_SUCH_OBJECT:
break;
#if 0
case DB_LOCK_DEADLOCK:
case DB_LOCK_NOTGRANTED:
goto retry;
#endif
case LDAP_BUSY:
rs->sr_text = "ldap server busy";
goto return_results;
default:
rs->sr_err = LDAP_OTHER;
rs->sr_text = "internal error";
goto return_results;
}
if ( NA.ocs ) {
int i;
for ( i=0; !BER_BVISNULL( &NA.ocs[i] ); i++ );
poc.a_numvals = i;
poc.a_desc = slap_schema.si_ad_objectClass;
poc.a_vals = NA.ocs;
poc.a_nvals = poc.a_vals;
poc.a_next = NULL;
p.e_attrs = &poc;
}
if ( ber_bvstrcasecmp( &pndn, &matched ) ) {
rs->sr_matched = matched.bv_val;
Debug( LDAP_DEBUG_TRACE,
LDAP_XSTRING(ndb_back_add) ": parent "
"does not exist\n", 0, 0, 0 );
rs->sr_text = "parent does not exist";
rs->sr_err = LDAP_NO_SUCH_OBJECT;
if ( p.e_attrs && is_entry_referral( &p )) {
is_ref: p.e_attrs = NULL;
ndb_entry_get_data( op, &NA, 0 );
rs->sr_ref = get_entry_referrals( op, &p );
rs->sr_err = LDAP_REFERRAL;
rs->sr_flags = REP_REF_MUSTBEFREED;
attrs_free( p.e_attrs );
p.e_attrs = NULL;
}
goto return_results;
}
p.e_name = pdn;
p