fix modify opattrs sync replication (ITS#4820; test019 can't be fixed right now)

This commit is contained in:
Pierangelo Masarati 2007-01-27 16:38:20 +00:00
parent f5d26ed730
commit 5bf79a5686
6 changed files with 52 additions and 46 deletions

View File

@ -881,7 +881,7 @@ void slap_mods_opattrs(
Modifications *mod, **modtail, *modlast;
int gotcsn = 0, gotmname = 0, gotmtime = 0;
if ( SLAP_LASTMOD( op->o_bd ) ) {
if ( SLAP_LASTMOD( op->o_bd ) && !op->orm_no_opattrs ) {
char *ptr;
timestamp.bv_val = timebuf;
for ( modtail = modsp; *modtail; modtail = &(*modtail)->sml_next ) {

View File

@ -1913,6 +1913,7 @@ typedef struct req_compare_s {
typedef struct req_modify_s {
Modifications *rs_modlist;
int rs_increment; /* FIXME: temporary */
char rs_no_opattrs; /* don't att modify operational attrs */
} req_modify_s;
typedef struct req_modrdn_s {
@ -2466,6 +2467,7 @@ typedef struct slap_op {
#define orn_msgid oq_abandon.rs_msgid
#define orm_modlist oq_modify.rs_modlist
#define orm_increment oq_modify.rs_increment
#define orm_no_opattrs oq_modify.rs_no_opattrs
#define ore_reqoid oq_extended.rs_reqoid
#define ore_flags oq_extended.rs_flags

View File

@ -1894,6 +1894,7 @@ retry_add:;
if ( dni.mods ) {
op->o_tag = LDAP_REQ_MODIFY;
op->orm_modlist = dni.mods;
op->orm_no_opattrs = 1;
rc = be->be_modify( op, &rs_modify );
slap_mods_free( op->orm_modlist, 1 );

View File

@ -57,7 +57,6 @@ syncrepl rid=1
credentials=secret
searchbase="dc=example,dc=com"
filter="(objectClass=*)"
attrs="*"
schemachecking=off
scope=sub
type=refreshOnly

View File

@ -25,15 +25,15 @@ mkdir -p $TESTDIR $DBDIR1 $DBDIR2
#
# Test replication:
# - start master
# - start slave
# - start producer
# - start consumer
# - populate over ldap
# - perform some modifies and deleted
# - attempt to modify the slave (referral)
# - attempt to modify the consumer (referral)
# - retrieve database over ldap and compare against expected results
#
echo "Starting master slapd on TCP/IP port $PORT1..."
echo "Starting producer slapd on TCP/IP port $PORT1..."
. $CONFFILTER $BACKEND $MONITORDB < $SRMASTERCONF > $CONF1
$SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
PID=$!
@ -45,7 +45,7 @@ KILLPIDS="$PID"
sleep 1
echo "Using ldapsearch to check that master slapd is running..."
echo "Using ldapsearch to check that producer slapd is running..."
for i in 0 1 2 3 4 5; do
$LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
'objectclass=*' > /dev/null 2>&1
@ -63,7 +63,7 @@ if test $RC != 0 ; then
exit $RC
fi
echo "Using ldapadd to create the context prefix entry in the master..."
echo "Using ldapadd to create the context prefix entry in the producer..."
$LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD < \
$LDIFORDEREDCP > /dev/null 2>&1
RC=$?
@ -73,7 +73,7 @@ if test $RC != 0 ; then
exit $RC
fi
echo "Starting slave slapd on TCP/IP port $PORT2..."
echo "Starting consumer slapd on TCP/IP port $PORT2..."
. $CONFFILTER $BACKEND $MONITORDB < $R1SRSLAVECONF > $CONF2
$SLAPD -f $CONF2 -h $URI2 -d $LVL $TIMING > $LOG2 2>&1 &
SLAVEPID=$!
@ -85,7 +85,7 @@ KILLPIDS="$KILLPIDS $SLAVEPID"
sleep 1
echo "Using ldapsearch to check that slave slapd is running..."
echo "Using ldapsearch to check that consumer slapd is running..."
for i in 0 1 2 3 4 5; do
$LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT2 \
'objectclass=*' > /dev/null 2>&1
@ -103,7 +103,7 @@ if test $RC != 0 ; then
exit $RC
fi
echo "Using ldapadd to populate the master directory..."
echo "Using ldapadd to populate the producer directory..."
$LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD < \
$LDIFORDEREDNOCP > /dev/null 2>&1
RC=$?
@ -116,7 +116,7 @@ fi
echo "Waiting 15 seconds for syncrepl to receive changes..."
sleep 15
echo "Using ldapmodify to modify master directory..."
echo "Using ldapmodify to modify producer directory..."
#
# Do some modifications
@ -205,7 +205,7 @@ fi
echo "Waiting 15 seconds for syncrepl to receive changes..."
sleep 15
echo "Try updating the slave slapd..."
echo "Try updating the consumer slapd..."
$LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT2 -w $PASSWD > \
$TESTOUT 2>&1 << EOMODS
dn: cn=James A Jones 1, ou=Alumni Association, ou=People, dc=example, dc=com
@ -225,40 +225,42 @@ if test $RC != 10 ; then
exit $RC
fi
echo "Using ldapsearch to read all the entries from the master..."
OPATTRS="entryUUID creatorsName createTimestamp modifiersName modifyTimestamp"
echo "Using ldapsearch to read all the entries from the producer..."
$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
'objectclass=*' > $MASTEROUT 2>&1
'(objectclass=*)' '*' $OPATTRS > $MASTEROUT 2>&1
RC=$?
if test $RC != 0 ; then
echo "ldapsearch failed at master ($RC)!"
echo "ldapsearch failed at producer ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
echo "Using ldapsearch to read all the entries from the slave..."
echo "Using ldapsearch to read all the entries from the consumer..."
$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT2 \
'objectclass=*' > $SLAVEOUT 2>&1
'(objectclass=*)' '*' $OPATTRS > $SLAVEOUT 2>&1
RC=$?
if test $RC != 0 ; then
echo "ldapsearch failed at slave ($RC)!"
echo "ldapsearch failed at consumer ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
test $KILLSERVERS != no && kill -HUP $KILLPIDS
echo "Filtering master results..."
echo "Filtering producer results..."
. $LDIFFILTER < $MASTEROUT > $MASTERFLT
echo "Filtering slave results..."
echo "Filtering consumer results..."
. $LDIFFILTER < $SLAVEOUT > $SLAVEFLT
echo "Comparing retrieved entries from master and slave..."
echo "Comparing retrieved entries from producer and consumer..."
$CMP $MASTERFLT $SLAVEFLT > $CMPOUT
if test $? != 0 ; then
echo "test failed - master and slave databases differ"
echo "test failed - producer and consumer databases differ"
exit 1
fi

View File

@ -30,15 +30,15 @@ mkdir -p $TESTDIR $DBDIR1 $DBDIR4
#
# Test replication:
# - start master
# - start slave
# - start producer
# - start consumer
# - populate over ldap
# - perform some modifies and deleted
# - attempt to modify the slave (referral or chain)
# - attempt to modify the consumer (referral or chain)
# - retrieve database over ldap and compare against expected results
#
echo "Starting master slapd on TCP/IP port $PORT1..."
echo "Starting producer slapd on TCP/IP port $PORT1..."
. $CONFFILTER $BACKEND $MONITORDB < $SRMASTERCONF > $CONF1
$SLAPD -f $CONF1 -h $URI1 -d $LVL $TIMING > $LOG1 2>&1 &
PID=$!
@ -50,7 +50,7 @@ KILLPIDS="$PID"
sleep 1
echo "Using ldapsearch to check that master slapd is running..."
echo "Using ldapsearch to check that producer slapd is running..."
for i in 0 1 2 3 4 5; do
$LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
'objectclass=*' > /dev/null 2>&1
@ -68,7 +68,7 @@ if test $RC != 0 ; then
exit $RC
fi
echo "Using ldapadd to create the context prefix entry in the master..."
echo "Using ldapadd to create the context prefix entry in the producer..."
$LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD < \
$LDIFORDEREDCP > /dev/null 2>&1
RC=$?
@ -78,7 +78,7 @@ if test $RC != 0 ; then
exit $RC
fi
echo "Starting slave slapd on TCP/IP port $PORT4..."
echo "Starting consumer slapd on TCP/IP port $PORT4..."
. $CONFFILTER $BACKEND $MONITORDB < $P1SRSLAVECONF > $CONF4
$SLAPD -f $CONF4 -h $URI4 -d $LVL $TIMING > $LOG4 2>&1 &
SLAVEPID=$!
@ -90,7 +90,7 @@ KILLPIDS="$KILLPIDS $SLAVEPID"
sleep 1
echo "Using ldapsearch to check that slave slapd is running..."
echo "Using ldapsearch to check that consumer slapd is running..."
for i in 0 1 2 3 4 5; do
$LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT4 \
'objectclass=*' > /dev/null 2>&1
@ -108,7 +108,7 @@ if test $RC != 0 ; then
exit $RC
fi
echo "Using ldapadd to populate the master directory..."
echo "Using ldapadd to populate the producer directory..."
$LDAPADD -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD < \
$LDIFORDEREDNOCP > /dev/null 2>&1
RC=$?
@ -136,7 +136,7 @@ KILLPIDS="$PID $SLAVEPID"
sleep 1
echo "Using ldapsearch to check that master slapd is running..."
echo "Using ldapsearch to check that producer slapd is running..."
for i in 0 1 2 3 4 5; do
$LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \
'objectclass=*' > /dev/null 2>&1
@ -154,7 +154,7 @@ if test $RC != 0 ; then
exit $RC
fi
echo "Using ldapmodify to modify master directory..."
echo "Using ldapmodify to modify producer directory..."
#
# Do some modifications
@ -247,7 +247,7 @@ echo "Stopping consumer to test recovery..."
kill -HUP $SLAVEPID
wait $SLAVEPID
echo "Modifying more entries on the master..."
echo "Modifying more entries on the producer..."
$LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT1 -w $PASSWD >> \
$TESTOUT 2>&1 << EOMODS
dn: cn=Rosco P. Coltrane, ou=Retired, ou=People, dc=example,dc=com
@ -281,7 +281,7 @@ echo "Waiting 25 seconds for syncrepl to receive changes..."
sleep 25
if test ! $BACKLDAP = "ldapno" ; then
echo "Try updating the slave slapd..."
echo "Try updating the consumer slapd..."
$LDAPMODIFY -v -D "$MANAGERDN" -h $LOCALHOST -p $PORT4 -w $PASSWD > \
$TESTOUT 2>&1 << EOMODS
dn: cn=James A Jones 1, ou=Alumni Association, ou=People, dc=example, dc=com
@ -303,40 +303,42 @@ EOMODS
sleep 15
fi
echo "Using ldapsearch to read all the entries from the master..."
OPATTRS="entryUUID creatorsName createTimestamp modifiersName modifyTimestamp"
echo "Using ldapsearch to read all the entries from the producer..."
$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
'objectclass=*' > $MASTEROUT 2>&1
'(objectclass=*)' '*' $OPATTRS > $MASTEROUT 2>&1
RC=$?
if test $RC != 0 ; then
echo "ldapsearch failed at master ($RC)!"
echo "ldapsearch failed at producer ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
echo "Using ldapsearch to read all the entries from the slave..."
echo "Using ldapsearch to read all the entries from the consumer..."
$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT4 \
'objectclass=*' > $SLAVEOUT 2>&1
'(objectclass=*)' '*' $OPATTRS > $SLAVEOUT 2>&1
RC=$?
if test $RC != 0 ; then
echo "ldapsearch failed at slave ($RC)!"
echo "ldapsearch failed at consumer ($RC)!"
test $KILLSERVERS != no && kill -HUP $KILLPIDS
exit $RC
fi
test $KILLSERVERS != no && kill -HUP $KILLPIDS
echo "Filtering master results..."
echo "Filtering producer results..."
. $LDIFFILTER < $MASTEROUT > $MASTERFLT
echo "Filtering slave results..."
echo "Filtering consumer results..."
. $LDIFFILTER < $SLAVEOUT > $SLAVEFLT
echo "Comparing retrieved entries from master and slave..."
echo "Comparing retrieved entries from producer and consumer..."
$CMP $MASTERFLT $SLAVEFLT > $CMPOUT
if test $? != 0 ; then
echo "test failed - master and slave databases differ"
echo "test failed - producer and consumer databases differ"
exit 1
fi