Skip to content

Commit

Permalink
Issue 4598 - Copy attribute syntax hashtables to each worker thread
Browse files Browse the repository at this point in the history
Description:

There is a lot of contention around the rwlocks for the attribute
syntax hashtables.  Since syntaxes rarely change we can just keep a
copy in each thread and avoid locking.

Then the worker can check for changes on each loop and rebuild
the hashtables as needed.

Did some code cleanup in schema.c

relates: #4598

Reviewed by: progier(Thanks!)
  • Loading branch information
mreynolds389 committed Apr 5, 2023
1 parent 5f1dc41 commit d628b50
Show file tree
Hide file tree
Showing 15 changed files with 535 additions and 325 deletions.
4 changes: 2 additions & 2 deletions dirsrvtests/tests/suites/basic/basic_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1502,11 +1502,11 @@ def test_suffix_case(topology_st):
backends.create(properties={'nsslapd-suffix': TEST_SUFFIX,
'name': 'upperCaseRoot',
'sample_entries': '001004002'})

domain = Domain(topology_st.standalone, TEST_SUFFIX)
assert domain.dn == TEST_SUFFIX


def test_dscreate(request):
"""Test that dscreate works
Expand Down
4 changes: 2 additions & 2 deletions dirsrvtests/tests/suites/schema/schema_replication_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,11 +339,11 @@ def test_schema_replication_three(topology_m1c1, schema_replication_init):
"""
_header(topology_m1c1, "Extra OC Schema is pushed - no error")

# Do an upate to trigger the schema push attempt
# Do an update to trigger the schema push attempt
# add this OC on consumer. Supplier will no push the schema
add_OC(topology_m1c1.ms["supplier1"], 1, 'consumerNewOCA')

# now push the scheam
# now push the schema
trigger_schema_push(topology_m1c1)
supplier_schema_csn = topology_m1c1.ms["supplier1"].schema.get_schema_csn()
consumer_schema_csn = topology_m1c1.cs["consumer1"].schema.get_schema_csn()
Expand Down
10 changes: 4 additions & 6 deletions dirsrvtests/tests/suites/schema/schema_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ def test_gecos_mixed_definition_topo(topo_m2, request):
repl = ReplicationManager(DEFAULT_SUFFIX)
m1 = topo_m2.ms["supplier1"]
m2 = topo_m2.ms["supplier2"]


# create a test user
testuser_dn = 'uid={},{}'.format('testuser', DEFAULT_SUFFIX)
Expand Down Expand Up @@ -343,7 +343,7 @@ def test_gecos_directoryString_wins_M1(topo_m2, request):
repl = ReplicationManager(DEFAULT_SUFFIX)
m1 = topo_m2.ms["supplier1"]
m2 = topo_m2.ms["supplier2"]


# create a test user
testuser_dn = 'uid={},{}'.format('testuser', DEFAULT_SUFFIX)
Expand Down Expand Up @@ -391,7 +391,6 @@ def test_gecos_directoryString_wins_M1(topo_m2, request):
attributetypes = schema.query_attributetype('gecos')
assert attributetypes[0].syntax == "1.3.6.1.4.1.1466.115.121.1.26"


# update M1 schema to increase its nsschemaCSN
new_at = "( dummy-oid NAME 'dummy' DESC 'dummy attribute' SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 SINGLE-VALUE X-ORIGIN 'RFC 2307' )"
m1.schema.add_schema('attributetypes', ensure_bytes(new_at))
Expand Down Expand Up @@ -471,7 +470,7 @@ def test_gecos_directoryString_wins_M2(topo_m2, request):
repl = ReplicationManager(DEFAULT_SUFFIX)
m1 = topo_m2.ms["supplier1"]
m2 = topo_m2.ms["supplier2"]


# create a test user
testuser_dn = 'uid={},{}'.format('testuser', DEFAULT_SUFFIX)
Expand Down Expand Up @@ -623,11 +622,10 @@ def fin():
# start the instances
inst.start()

i# Check that server is really running.
# Check that server is really running.
assert inst.status()



if __name__ == '__main__':
# Run isolated
# -s for DEBUG mode
Expand Down
1 change: 0 additions & 1 deletion ldap/servers/plugins/replication/repl5_replica_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,6 @@ replica_config_search(Slapi_PBlock *pb,
char val[64];

/* add attribute that contains number of entries in the changelog for this replica */

PR_Lock(s_configLock);

mtnode_ext = _replica_config_get_mtnode_ext(e);
Expand Down
1 change: 1 addition & 0 deletions ldap/servers/plugins/replication/replutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -1018,6 +1018,7 @@ is_chain_on_update_setup(const Slapi_DN *replroot)
0);
slapi_search_internal_pb(pb);
slapi_pblock_get(pb, SLAPI_PLUGIN_INTOP_RESULT, &operation_result);

switch (operation_result) {
case LDAP_SUCCESS: {
Slapi_Entry **entries = NULL;
Expand Down
Loading

0 comments on commit d628b50

Please sign in to comment.