|
|
5873fa |
From 1426f086623404ab2eacb04de7e6414177c0993a Mon Sep 17 00:00:00 2001
|
|
|
5873fa |
From: Thierry Bordaz <tbordaz@redhat.com>
|
|
|
5873fa |
Date: Mon, 11 May 2020 17:11:49 +0200
|
|
|
5873fa |
Subject: [PATCH 02/12] Ticket 51082 - abort when a empty valueset is freed
|
|
|
5873fa |
|
|
|
5873fa |
Bug Description:
|
|
|
5873fa |
A large valueset (more than 10 values) manages a sorted array of values.
|
|
|
5873fa |
replication purges old values from a valueset (valueset_array_purge). If it purges all the values
|
|
|
5873fa |
the valueset is freed (slapi_valueset_done).
|
|
|
5873fa |
A problem is that the counter of values, in the valueset, is still reflecting the initial number
|
|
|
5873fa |
of values (before the purge). When the valueset is freed (because empty) a safety checking
|
|
|
5873fa |
detects incoherent values based on the wrong counter.
|
|
|
5873fa |
|
|
|
5873fa |
Fix Description:
|
|
|
5873fa |
When all the values have been purge reset the counter before freeing the valueset
|
|
|
5873fa |
|
|
|
5873fa |
https://pagure.io/389-ds-base/issue/51082
|
|
|
5873fa |
|
|
|
5873fa |
Reviewed by: Mark Reynolds
|
|
|
5873fa |
|
|
|
5873fa |
Platforms tested: F30
|
|
|
5873fa |
|
|
|
5873fa |
Flag Day: no
|
|
|
5873fa |
|
|
|
5873fa |
Doc impact: no
|
|
|
5873fa |
---
|
|
|
5873fa |
.../suites/replication/acceptance_test.py | 57 +++++++++++++++++++
|
|
|
5873fa |
ldap/servers/slapd/valueset.c | 4 ++
|
|
|
5873fa |
2 files changed, 61 insertions(+)
|
|
|
5873fa |
|
|
|
5873fa |
diff --git a/dirsrvtests/tests/suites/replication/acceptance_test.py b/dirsrvtests/tests/suites/replication/acceptance_test.py
|
|
|
5873fa |
index c8e0a4c93..5009f4e7c 100644
|
|
|
5873fa |
--- a/dirsrvtests/tests/suites/replication/acceptance_test.py
|
|
|
5873fa |
+++ b/dirsrvtests/tests/suites/replication/acceptance_test.py
|
|
|
5873fa |
@@ -500,6 +500,63 @@ def test_warining_for_invalid_replica(topo_m4):
|
|
|
5873fa |
assert topo_m4.ms["master1"].ds_error_log.match('.*nsds5ReplicaBackoffMax.*10.*invalid.*')
|
|
|
5873fa |
|
|
|
5873fa |
|
|
|
5873fa |
+@pytest.mark.ds51082
|
|
|
5873fa |
+def test_csnpurge_large_valueset(topo_m2):
|
|
|
5873fa |
+ """Test csn generator test
|
|
|
5873fa |
+
|
|
|
5873fa |
+ :id: 63e2bdb2-0a8f-4660-9465-7b80a9f72a74
|
|
|
5873fa |
+ :setup: MMR with 2 masters
|
|
|
5873fa |
+ :steps:
|
|
|
5873fa |
+ 1. Create a test_user
|
|
|
5873fa |
+ 2. add a large set of values (more than 10)
|
|
|
5873fa |
+ 3. delete all the values (more than 10)
|
|
|
5873fa |
+ 4. configure the replica to purge those values (purgedelay=5s)
|
|
|
5873fa |
+ 5. Waiting for 6 second
|
|
|
5873fa |
+ 6. do a series of update
|
|
|
5873fa |
+ :expectedresults:
|
|
|
5873fa |
+ 1. Should succeeds
|
|
|
5873fa |
+ 2. Should succeeds
|
|
|
5873fa |
+ 3. Should succeeds
|
|
|
5873fa |
+ 4. Should succeeds
|
|
|
5873fa |
+ 5. Should succeeds
|
|
|
5873fa |
+ 6. Should not crash
|
|
|
5873fa |
+ """
|
|
|
5873fa |
+ m1 = topo_m2.ms["master2"]
|
|
|
5873fa |
+
|
|
|
5873fa |
+ test_user = UserAccount(m1, TEST_ENTRY_DN)
|
|
|
5873fa |
+ if test_user.exists():
|
|
|
5873fa |
+ log.info('Deleting entry {}'.format(TEST_ENTRY_DN))
|
|
|
5873fa |
+ test_user.delete()
|
|
|
5873fa |
+ test_user.create(properties={
|
|
|
5873fa |
+ 'uid': TEST_ENTRY_NAME,
|
|
|
5873fa |
+ 'cn': TEST_ENTRY_NAME,
|
|
|
5873fa |
+ 'sn': TEST_ENTRY_NAME,
|
|
|
5873fa |
+ 'userPassword': TEST_ENTRY_NAME,
|
|
|
5873fa |
+ 'uidNumber' : '1000',
|
|
|
5873fa |
+ 'gidNumber' : '2000',
|
|
|
5873fa |
+ 'homeDirectory' : '/home/mmrepl_test',
|
|
|
5873fa |
+ })
|
|
|
5873fa |
+
|
|
|
5873fa |
+ # create a large value set so that it is sorted
|
|
|
5873fa |
+ for i in range(1,20):
|
|
|
5873fa |
+ test_user.add('description', 'value {}'.format(str(i)))
|
|
|
5873fa |
+
|
|
|
5873fa |
+ # delete all values of the valueset
|
|
|
5873fa |
+ for i in range(1,20):
|
|
|
5873fa |
+ test_user.remove('description', 'value {}'.format(str(i)))
|
|
|
5873fa |
+
|
|
|
5873fa |
+ # set purging delay to 5 second and wait more that 5second
|
|
|
5873fa |
+ replicas = Replicas(m1)
|
|
|
5873fa |
+ replica = replicas.list()[0]
|
|
|
5873fa |
+ log.info('nsds5ReplicaPurgeDelay to 5')
|
|
|
5873fa |
+ replica.set('nsds5ReplicaPurgeDelay', '5')
|
|
|
5873fa |
+ time.sleep(6)
|
|
|
5873fa |
+
|
|
|
5873fa |
+ # add some new values to the valueset containing entries that should be purged
|
|
|
5873fa |
+ for i in range(21,25):
|
|
|
5873fa |
+ test_user.add('description', 'value {}'.format(str(i)))
|
|
|
5873fa |
+
|
|
|
5873fa |
+
|
|
|
5873fa |
if __name__ == '__main__':
|
|
|
5873fa |
# Run isolated
|
|
|
5873fa |
# -s for DEBUG mode
|
|
|
5873fa |
diff --git a/ldap/servers/slapd/valueset.c b/ldap/servers/slapd/valueset.c
|
|
|
5873fa |
index 2af3ee18d..12027ecb8 100644
|
|
|
5873fa |
--- a/ldap/servers/slapd/valueset.c
|
|
|
5873fa |
+++ b/ldap/servers/slapd/valueset.c
|
|
|
5873fa |
@@ -801,6 +801,10 @@ valueset_array_purge(const Slapi_Attr *a, Slapi_ValueSet *vs, const CSN *csn)
|
|
|
5873fa |
}
|
|
|
5873fa |
}
|
|
|
5873fa |
} else {
|
|
|
5873fa |
+ /* empty valueset - reset the vs->num so that further
|
|
|
5873fa |
+ * checking will not abort
|
|
|
5873fa |
+ */
|
|
|
5873fa |
+ vs->num = 0;
|
|
|
5873fa |
slapi_valueset_done(vs);
|
|
|
5873fa |
}
|
|
|
5873fa |
|
|
|
5873fa |
--
|
|
|
5873fa |
2.26.2
|
|
|
5873fa |
|