Skip to content

Commit 466fc15

Browse files
committed
Skip replication processing when no replication domain is configured
The Multimaster Synchronization provider is enabled by default even on standalone servers with no replication domain configured, and its three per-operation hooks (conflict resolution, pre-operation, post-operation) each called findDomain(), which iterated the request controls and walked the entry DN up to the suffix querying an empty domains map, allocating a fresh result object every time. Return null from findDomain() before the DN walk when no domains are registered (repair-control processing is preserved), and reuse a shared stateless ContinueProcessing result instead of allocating one per hook invocation. An interleaved A/B under concurrent modify load shows no measurable throughput change on an 8-core host — the write path is dominated by the JE write-ahead log — so this is a cleanliness fix: it removes pointless per-write work from every non-replicated deployment rather than a measured win.
1 parent 9ba1cd7 commit 466fc15

1 file changed

Lines changed: 27 additions & 11 deletions

File tree

opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/MultimasterReplication.java

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
*
1414
* Copyright 2006-2010 Sun Microsystems, Inc.
1515
* Portions Copyright 2011-2016 ForgeRock AS.
16+
* Portions Copyright 2026 3A Systems, LLC
1617
*/
1718
package org.opends.server.replication.plugin;
1819

@@ -97,6 +98,12 @@ public class MultimasterReplication
9798

9899
private ReplicationServerListener replicationServerListener;
99100
private static final Map<DN, LDAPReplicationDomain> domains = new ConcurrentHashMap<>(4);
101+
/**
102+
* Shared stateless "continue processing" result: the provider hooks run for
103+
* every operation, so avoid allocating a fresh result each time.
104+
*/
105+
private static final SynchronizationProviderResult CONTINUE =
106+
new SynchronizationProviderResult.ContinueProcessing();
100107
private static final DSRSShutdownSync dsrsShutdownSync = new DSRSShutdownSync();
101108
/** The queue of received update messages, to be treated by the ReplayThread threads. */
102109
private static final BlockingQueue<UpdateToReplay> updateToReplayQueue = new LinkedBlockingQueue<>(10000);
@@ -166,6 +173,15 @@ public static LDAPReplicationDomain findDomain(DN dn, PluginOperation pluginOp)
166173
}
167174
}
168175

176+
if (domains.isEmpty())
177+
{
178+
// The Multimaster Synchronization provider is enabled by default even
179+
// on standalone servers with no replication domain configured: skip
180+
// the walk to the suffix that every write operation would otherwise
181+
// pay three times (conflict resolution, pre- and post-operation).
182+
return null;
183+
}
184+
169185
LDAPReplicationDomain domain = null;
170186
DN temp = dn;
171187
BackendConfigManager backendConfigManager =
@@ -402,7 +418,7 @@ public SynchronizationProviderResult handleConflictResolution(
402418
{
403419
return domain.handleConflictResolution(modifyOperation);
404420
}
405-
return new SynchronizationProviderResult.ContinueProcessing();
421+
return CONTINUE;
406422
}
407423

408424
@Override
@@ -414,7 +430,7 @@ public SynchronizationProviderResult handleConflictResolution(
414430
{
415431
return domain.handleConflictResolution(addOperation);
416432
}
417-
return new SynchronizationProviderResult.ContinueProcessing();
433+
return CONTINUE;
418434
}
419435

420436
@Override
@@ -426,7 +442,7 @@ public SynchronizationProviderResult handleConflictResolution(
426442
{
427443
return domain.handleConflictResolution(deleteOperation);
428444
}
429-
return new SynchronizationProviderResult.ContinueProcessing();
445+
return CONTINUE;
430446
}
431447

432448
@Override
@@ -438,7 +454,7 @@ public SynchronizationProviderResult handleConflictResolution(
438454
{
439455
return domain.handleConflictResolution(modifyDNOperation);
440456
}
441-
return new SynchronizationProviderResult.ContinueProcessing();
457+
return CONTINUE;
442458
}
443459

444460
@Override
@@ -450,7 +466,7 @@ public SynchronizationProviderResult handleConflictResolution(
450466

451467
if (domain == null || !domain.solveConflict())
452468
{
453-
return new SynchronizationProviderResult.ContinueProcessing();
469+
return CONTINUE;
454470
}
455471

456472
EntryHistorical historicalInformation = (EntryHistorical)
@@ -475,14 +491,14 @@ public SynchronizationProviderResult handleConflictResolution(
475491
ResultCode.SUCCESS, null);
476492
}
477493

478-
return new SynchronizationProviderResult.ContinueProcessing();
494+
return CONTINUE;
479495
}
480496

481497
@Override
482498
public SynchronizationProviderResult doPreOperation(
483499
PreOperationDeleteOperation deleteOperation) throws DirectoryException
484500
{
485-
return new SynchronizationProviderResult.ContinueProcessing();
501+
return CONTINUE;
486502
}
487503

488504
@Override
@@ -495,7 +511,7 @@ public SynchronizationProviderResult doPreOperation(
495511

496512
if (domain == null || !domain.solveConflict())
497513
{
498-
return new SynchronizationProviderResult.ContinueProcessing();
514+
return CONTINUE;
499515
}
500516

501517
// The historical object is retrieved from the attachment created
@@ -516,7 +532,7 @@ public SynchronizationProviderResult doPreOperation(
516532
// Add to the operation the historical attribute : "dn:changeNumber:moddn"
517533
historicalInformation.setHistoricalAttrToOperation(modifyDNOperation);
518534

519-
return new SynchronizationProviderResult.ContinueProcessing();
535+
return CONTINUE;
520536
}
521537

522538
@Override
@@ -528,7 +544,7 @@ public SynchronizationProviderResult doPreOperation(
528544
findDomain(addOperation.getEntryDN(), addOperation);
529545
if (domain == null)
530546
{
531-
return new SynchronizationProviderResult.ContinueProcessing();
547+
return CONTINUE;
532548
}
533549

534550
// For LOCAL op only, generate CSN and attach Context
@@ -540,7 +556,7 @@ public SynchronizationProviderResult doPreOperation(
540556
// Add to the operation the historical attribute : "dn:changeNumber:add"
541557
EntryHistorical.setHistoricalAttrToOperation(addOperation);
542558

543-
return new SynchronizationProviderResult.ContinueProcessing();
559+
return CONTINUE;
544560
}
545561

546562
@Override

0 commit comments

Comments
 (0)