Skip to content

Commit 03f5d1b

Browse files
authored
Fix three and more nodes replication process stuck error (#584)
1 parent 161da05 commit 03f5d1b

4 files changed

Lines changed: 92 additions & 24 deletions

File tree

.github/workflows/build.yml

Lines changed: 77 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,61 @@ jobs:
160160
opendj-server-legacy/target/package/opendj/bin/ldapsearch --hostname localhost --port 1636 --bindDN "cn=Directory Manager" --bindPassword password --useSsl --trustAll --baseDN "ou=people,dc=example,dc=com" --searchScope sub "(uid=user.*)" dn | grep ^dn: | wc -l | grep -q 10000
161161
opendj-server-legacy/target/package/opendj/bin/stop-ds
162162
rm -rf opendj-server-legacy/target/package/opendj/{config,db,changelogDb,logs,tmp}
163+
- name: Test replication
164+
if: runner.os != 'Windows'
165+
run: |
166+
cp -r ./opendj-server-legacy/target/package/opendj ./opendj-server-legacy/target/package/opendj1
167+
cp -r ./opendj-server-legacy/target/package/opendj ./opendj-server-legacy/target/package/opendj2
168+
cp -r ./opendj-server-legacy/target/package/opendj ./opendj-server-legacy/target/package/opendj3
169+
170+
echo "Setup OpenDJ-1"
171+
172+
opendj-server-legacy/target/package/opendj1/setup -h localhost -p 1389 --ldapsPort 1636 --adminConnectorPort 4444 --enableStartTLS \
173+
--generateSelfSignedCertificate --rootUserDN "cn=Directory Manager" --rootUserPassword password --baseDN dc=example,dc=com \
174+
--sampleData 100000 --cli --acceptLicense --no-prompt
175+
176+
echo "Setup OpenDJ-2 with replication"
177+
178+
opendj-server-legacy/target/package/opendj2/setup -h localhost -p 2389 --ldapsPort 2636 --adminConnectorPort 24444 --enableStartTLS \
179+
--generateSelfSignedCertificate --rootUserDN "cn=Directory Manager" --rootUserPassword password --baseDN dc=example,dc=com \
180+
--addBaseEntry --cli --acceptLicense --no-prompt
181+
182+
opendj-server-legacy/target/package/opendj2/bin/dsreplication enable --no-prompt --host1 localhost --port1 4444 --bindDN1 "cn=Directory Manager" --bindPassword1 password --replicationPort1 8989 \
183+
--host2 localhost --port2 24444 --bindDN2 "cn=Directory Manager" --bindPassword2 password --replicationPort2 28989 \
184+
--adminUID admin --adminPassword password --baseDN dc=example,dc=com --trustAll --noPropertiesFile
185+
186+
opendj-server-legacy/target/package/opendj2/bin/dsreplication initialize --baseDN dc=example,dc=com --adminUID admin --adminPassword password --hostSource localhost \
187+
--portSource 4444 --hostDestination localhost --portDestination 24444 -X -n
188+
189+
opendj-server-legacy/target/package/opendj2/bin/ldapsearch --port 2636 --hostname localhost --bindDN "cn=Directory Manager" --bindPassword password --useSsl --trustAll \
190+
--baseDN "ou=people,dc=example,dc=com" --searchScope sub "(uid=user.*)" dn | grep ^dn: | wc -l | grep -q 100000
191+
192+
echo "Setup OpenDJ-3 with replication"
193+
194+
opendj-server-legacy/target/package/opendj3/setup -h localhost -p 3389 --ldapsPort 3636 --adminConnectorPort 34444 --enableStartTLS \
195+
--generateSelfSignedCertificate --rootUserDN "cn=Directory Manager" --rootUserPassword password --baseDN dc=example,dc=com \
196+
--addBaseEntry --cli --acceptLicense --no-prompt
197+
198+
opendj-server-legacy/target/package/opendj3/bin/dsreplication enable --no-prompt --host1 localhost --port1 24444 --bindDN1 "cn=Directory Manager" --bindPassword1 password --replicationPort1 28989 \
199+
--host2 localhost --port2 34444 --bindDN2 "cn=Directory Manager" --bindPassword2 password --replicationPort2 38989 \
200+
--adminUID admin --adminPassword password --baseDN dc=example,dc=com --trustAll --noPropertiesFile
201+
202+
opendj-server-legacy/target/package/opendj3/bin/dsreplication initialize --baseDN dc=example,dc=com --adminUID admin --adminPassword password --hostSource localhost \
203+
--portSource 24444 --hostDestination localhost --portDestination 34444 -X -n
204+
205+
opendj-server-legacy/target/package/opendj2/bin/ldapsearch --port 3636 --hostname localhost --bindDN "cn=Directory Manager" --bindPassword password --useSsl --trustAll \
206+
--baseDN "ou=people,dc=example,dc=com" --searchScope sub "(uid=user.*)" dn | grep ^dn: | wc -l | grep -q 100000
207+
208+
echo "Stopping and removing OpenDJ instances"
209+
210+
opendj-server-legacy/target/package/opendj1/bin/stop-ds
211+
opendj-server-legacy/target/package/opendj2/bin/stop-ds
212+
opendj-server-legacy/target/package/opendj3/bin/stop-ds
213+
214+
rm -rf ./opendj-server-legacy/target/package/opendj1
215+
rm -rf ./opendj-server-legacy/target/package/opendj2
216+
rm -rf ./opendj-server-legacy/target/package/opendj3
217+
163218
- name: Test on Windows
164219
if: runner.os == 'Windows'
165220
run: |
@@ -196,17 +251,18 @@ jobs:
196251
opendj-dsml-servlet/target/*.war
197252
opendj-rest2ldap-servlet/target/*.war
198253
build-docker:
254+
needs: build-maven
199255
runs-on: 'ubuntu-latest'
200256
services:
201257
registry:
202258
image: registry:2
203259
ports:
204260
- 5000:5000
205261
steps:
206-
- uses: actions/checkout@v4
262+
- name: Download artifacts
263+
uses: actions/download-artifact@v4
207264
with:
208-
fetch-depth: 0
209-
submodules: recursive
265+
name: ubuntu-latest-11
210266
- name: Get latest release version
211267
shell: bash
212268
run: |
@@ -226,9 +282,14 @@ jobs:
226282
uses: docker/setup-buildx-action@v3
227283
with:
228284
driver-opts: network=host
285+
- name: Prepare Dockerfile
286+
shell: bash
287+
run: |
288+
unzip -d ./opendj-packages/opendj-docker ./opendj-packages/opendj-docker/target/Dockerfile.zip
289+
cp ./opendj-server-legacy/target/package/opendj-*.zip ./opendj-packages/opendj-docker
290+
sed -i -E '/^#COPY opendj/s/^#//' ./opendj-packages/opendj-docker/Dockerfile
229291
- name: Build image (default)
230292
uses: docker/build-push-action@v5
231-
continue-on-error: true
232293
with:
233294
context: ./opendj-packages/opendj-docker
234295
file: ./opendj-packages/opendj-docker/Dockerfile
@@ -251,19 +312,21 @@ jobs:
251312
docker exec test 'sh' '-c' '/opt/opendj/bin/start-ds'
252313
docker exec test 'sh' '-c' '/opt/opendj/bin/rebuild-index --bindDN "cn=Directory Manager" --bindPassword password --baseDN "dc=example2,dc=com" --rebuildAll --trustAll'
253314
docker exec test 'sh' '-c' '/opt/opendj/bin/ldapsearch --hostname localhost --port 1636 --bindDN "cn=Directory Manager" --bindPassword password --useSsl --trustAll --baseDN "ou=people,dc=example2,dc=com" --searchScope sub "(uid=user.*)" dn | grep ^dn: | wc -l | grep -q 10000'
315+
docker kill test
254316
255317
build-docker-alpine:
318+
needs: build-maven
256319
runs-on: 'ubuntu-latest'
257320
services:
258321
registry:
259322
image: registry:2
260323
ports:
261324
- 5000:5000
262325
steps:
263-
- uses: actions/checkout@v4
326+
- name: Download artifacts
327+
uses: actions/download-artifact@v4
264328
with:
265-
fetch-depth: 0
266-
submodules: recursive
329+
name: ubuntu-latest-11
267330
- name: Get latest release version
268331
shell: bash
269332
run: |
@@ -284,8 +347,13 @@ jobs:
284347
uses: docker/setup-buildx-action@v3
285348
with:
286349
driver-opts: network=host
350+
- name: Prepare Dockerfile
351+
shell: bash
352+
run: |
353+
unzip -d ./opendj-packages/opendj-docker ./opendj-packages/opendj-docker/target/Dockerfile.zip
354+
cp ./opendj-server-legacy/target/package/opendj-*.zip ./opendj-packages/opendj-docker
355+
sed -i -E '/^#COPY opendj/s/^#//' ./opendj-packages/opendj-docker/Dockerfile-alpine
287356
- name: Build image
288-
continue-on-error: true
289357
uses: docker/build-push-action@v5
290358
with:
291359
context: ./opendj-packages/opendj-docker
@@ -309,4 +377,4 @@ jobs:
309377
docker exec test 'sh' '-c' '/opt/opendj/bin/start-ds'
310378
docker exec test 'sh' '-c' '/opt/opendj/bin/rebuild-index --bindDN "cn=Directory Manager" --bindPassword password --baseDN "dc=example2,dc=com" --rebuildAll --trustAll'
311379
docker exec test 'sh' '-c' '/opt/opendj/bin/ldapsearch --hostname localhost --port 1636 --bindDN "cn=Directory Manager" --bindPassword password --useSsl --trustAll --baseDN "ou=people,dc=example2,dc=com" --searchScope sub "(uid=user.*)" dn | grep ^dn: | wc -l | grep -q 10000'
312-
380+
docker kill test

opendj-packages/opendj-docker/Dockerfile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,22 @@ ENV BACKEND_TYPE="je"
1919
ENV BACKEND_DB_DIRECTORY="db"
2020
#ENV SETUP_ARGS
2121

22+
ARG OPENDJ_DIST_FILENAME=opendj.zip
23+
2224
ARG VERSION
2325

2426
WORKDIR /opt
2527

28+
#COPY opendj-*.zip $OPENDJ_DIST_FILENAME
29+
2630
RUN apt-get update \
2731
&& apt-get install -y --no-install-recommends curl unzip \
2832
&& if [ -z "$VERSION" ] ; then VERSION="$(curl -i -o - --silent https://api.github.com/repos/OpenIdentityPlatform/OpenDJ/releases/latest | grep -m1 "\"name\"" | cut -d\" -f4)"; fi \
29-
&& curl -L https://github.com/OpenIdentityPlatform/OpenDJ/releases/download/$VERSION/opendj-$VERSION.zip --output opendj-$VERSION.zip \
30-
&& unzip opendj-$VERSION.zip \
33+
&& if [ ! -f "$OPENDJ_DIST_FILENAME" ]; then echo file exists && curl -L https://github.com/OpenIdentityPlatform/OpenDJ/releases/download/$VERSION/opendj-$VERSION.zip --output $OPENDJ_DIST_FILENAME; fi \
34+
&& unzip $OPENDJ_DIST_FILENAME \
3135
&& apt-get remove -y --purge curl unzip \
3236
&& rm -rf /var/lib/apt/lists/* \
33-
&& rm -r opendj-*.zip \
37+
&& rm -r $OPENDJ_DIST_FILENAME \
3438
&& groupadd $OPENDJ_USER \
3539
&& useradd -m -r -u 1001 -g $OPENDJ_USER $OPENDJ_USER \
3640
&& install -d -o $OPENDJ_USER /opt/opendj/data \

opendj-packages/opendj-docker/Dockerfile-alpine

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,24 @@ ENV BACKEND_TYPE="je"
1919
ENV BACKEND_DB_DIRECTORY="db"
2020
#ENV SETUP_ARGS
2121

22+
ARG OPENDJ_DIST_FILENAME=opendj.zip
23+
2224
ARG VERSION
2325

2426
WORKDIR /opt
2527

28+
#COPY opendj-*.zip $OPENDJ_DIST_FILENAME
29+
2630
RUN apk add --update --no-cache --virtual builddeps curl unzip \
2731
&& apk upgrade --update --no-cache \
2832
&& apk add bash openjdk11 \
2933
&& if [ -z "$VERSION" ] ; then VERSION="$(curl -i -o - --silent https://api.github.com/repos/OpenIdentityPlatform/OpenDJ/releases/latest | grep -m1 "\"name\"" | cut -d\" -f4)"; fi \
30-
&& curl -L https://github.com/OpenIdentityPlatform/OpenDJ/releases/download/$VERSION/opendj-$VERSION.zip --output opendj-$VERSION.zip \
31-
&& unzip opendj-$VERSION.zip \
34+
&& if [ ! -f "$OPENDJ_DIST_FILENAME" ]; then echo file exists && curl -L https://github.com/OpenIdentityPlatform/OpenDJ/releases/download/$VERSION/opendj-$VERSION.zip --output $OPENDJ_DIST_FILENAME; fi \
35+
&& unzip $OPENDJ_DIST_FILENAME \
3236
&& apk del builddeps \
3337
&& apk del curl \
3438
&& apk del unzip \
35-
&& rm -r opendj-$VERSION.zip \
39+
&& rm -r $OPENDJ_DIST_FILENAME \
3640
&& addgroup -S $OPENDJ_USER \
3741
&& adduser -S -u 1001 -G $OPENDJ_USER $OPENDJ_USER \
3842
&& install -d -o $OPENDJ_USER /opt/opendj/data \

opendj-server-legacy/src/main/java/org/opends/server/replication/service/ReplicationDomain.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*
1414
* Copyright 2008-2010 Sun Microsystems, Inc.
1515
* Portions Copyright 2011-2016 ForgeRock AS.
16-
* Portions Copyright 2025 3A Systems LLC.
16+
* Portions Copyright 2025-2026 3A Systems LLC.
1717
*/
1818
package org.opends.server.replication.service;
1919

@@ -42,7 +42,6 @@
4242
import java.util.concurrent.ConcurrentHashMap;
4343
import java.util.concurrent.ExecutorService;
4444
import java.util.concurrent.Executors;
45-
import java.util.concurrent.TimeUnit;
4645
import java.util.concurrent.TimeoutException;
4746
import java.util.concurrent.atomic.AtomicInteger;
4847
import java.util.concurrent.atomic.AtomicReference;
@@ -3031,13 +3030,6 @@ public void disableService()
30313030
{
30323031
broker.stop();
30333032
}
3034-
try {
3035-
exportThreadPool.shutdown();
3036-
boolean timedOut = exportThreadPool.awaitTermination(100, TimeUnit.SECONDS);
3037-
logger.info(LocalizableMessage.raw("export pool termination timed out: " + timedOut));
3038-
} catch (InterruptedException e) {
3039-
// Give up waiting.
3040-
}
30413033

30423034
// Stop the listener thread
30433035
if (listenerThread != null)

0 commit comments

Comments
 (0)