Bug 1748441

Summary: [RFE] Schedule execution of "compactdb" at specific date/time
Product: Red Hat Enterprise Linux 8 Reporter: Rainer Beyel <rbeyel>
Component: 389-ds-baseAssignee: Evgenia Martynyuk <emartyny>
Status: CLOSED ERRATA QA Contact: RHDS QE <ds-qe-bugs>
Severity: low Docs Contact: Marc Muehlfeld <mmuehlfe>
Priority: unspecified    
Version: 8.1CC: bsmejkal, bugzilla-redhat, emartyny, msauton, nkinder, pasik, sgouvern, spichugi, tbordaz, tmihinto, vashirov
Target Milestone: rcKeywords: FutureFeature, TestCaseProvided, Triaged
Target Release: 8.2   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 389-ds-1.4-8050020210531183345.1a75f91c Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-09 18:10:45 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Rainer Beyel 2019-09-03 15:11:30 UTC
Description of problem:
  Setting "nsslapd-changelogcompactdb-interval" schedules the compactdb run every X seconds - the default is 30 days. There seems to be now way to execute the "changelogcompactdb" run at a specific date/time.

Version-Release number of selected component (if applicable):
  RHDS 10

Actual results:
  The execution of the "changelogcompactdb" run is triggered by the interval "nsslapd-changelogcompactdb-interval"

Expected results:
  Feature which enables the exectution of the "changelogcompactdb" run at specific times (e.g. crontab), besides the default use of "nsslapd-changelogcompactdb-interval"

Comment 2 thierry bordaz 2020-08-06 14:48:06 UTC
Compaction of the database is done by calling BDB compact callback. With upstream ticket https://pagure.io/389-ds-base/issue/49562 the changelog database is now integrated with the main database and nsslapd-changelogcompactdb-interval is no longer supported. Instead this is the nsslapd-db-compactdb-interval that is used to trigger the database compact. Compaction is done by the checkpointing database specific thread. This thread is periodically (each 3sec) checkpointing the db txn log and compact the db (on interval). To avoid a significatn change in that thread, the scheduled compaction will be differed after the sleep and checkpointing. So there is a risk that the schedule may not be sharp (by few seconds). Is that a concern ?

Comment 3 mreynolds 2020-08-06 14:50:55 UTC
(In reply to thierry bordaz from comment #2)
> Compaction of the database is done by calling BDB compact callback. With
> upstream ticket https://pagure.io/389-ds-base/issue/49562 the changelog
> database is now integrated with the main database and
> nsslapd-changelogcompactdb-interval is no longer supported. Instead this is
> the nsslapd-db-compactdb-interval that is used to trigger the database
> compact. Compaction is done by the checkpointing database specific thread.
> This thread is periodically (each 3sec) checkpointing the db txn log and
> compact the db (on interval). To avoid a significatn change in that thread,
> the scheduled compaction will be differed after the sleep and checkpointing.
> So there is a risk that the schedule may not be sharp (by few seconds). Is
> that a concern ?

I suspect it is not a concern. I think the idea was to be able to run it during "off peak" hours.  I don't think it being delayed by a few seconds (or even a few minutes) should be a problem, but hopefully the customer can confirm...

Comment 4 Rainer Beyel 2020-08-12 08:43:38 UTC
(In reply to mreynolds from comment #3)
> (In reply to thierry bordaz from comment #2)
> > Compaction of the database is done by calling BDB compact callback. With
> > upstream ticket https://pagure.io/389-ds-base/issue/49562 the changelog
> > database is now integrated with the main database and
> > nsslapd-changelogcompactdb-interval is no longer supported. Instead this is
> > the nsslapd-db-compactdb-interval that is used to trigger the database
> > compact. Compaction is done by the checkpointing database specific thread.
> > This thread is periodically (each 3sec) checkpointing the db txn log and
> > compact the db (on interval). To avoid a significatn change in that thread,
> > the scheduled compaction will be differed after the sleep and checkpointing.
> > So there is a risk that the schedule may not be sharp (by few seconds). Is
> > that a concern ?
> 
> I suspect it is not a concern. I think the idea was to be able to run it
> during "off peak" hours.  I don't think it being delayed by a few seconds
> (or even a few minutes) should be a problem, but hopefully the customer can
> confirm...

Exactly. Thanks

Comment 6 mreynolds 2021-01-13 15:40:29 UTC
Investigate if compaction as a perf impact...

Comment 14 mreynolds 2021-05-21 18:19:02 UTC
Upstream ticket:

https://github.com/389ds/389-ds-base/issues/4778

Comment 15 mreynolds 2021-05-29 17:51:26 UTC
Here is the design doc for the new feature.  It is implemented slightly differently between 389-ds-base-1.4.3 (RHEL 8) and 2.0.0 (RHEL 9).  In RHEL 9 the replication changelog was moved into the main database, so it actually requires less configuration for the compaction scheduling.  Here is the design doc on how to configure the "Time Of Day" settings, and how to issue the new "compaction task".

https://www.port389.org/docs/389ds/design/compact-schedule-design.html

So now you can set the Time Of Day (TOD) the compaction still start once the existing compaction interval has been exceeded.  You can also add a task to the server to manually trigger the compaction - so it can be put into a cronjob for more "precise/complex" scheduling needs.

Comment 16 bsmejkal 2021-06-02 12:44:34 UTC
============================================================================================================ test session starts =============================================================================================================
platform linux -- Python 3.6.8, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 -- /usr/bin/python3.6
cachedir: .pytest_cache
metadata: {'Python': '3.6.8', 'Platform': 'Linux-4.18.0-308.el8.x86_64-x86_64-with-redhat-8.5-Ootpa', 'Packages': {'pytest': '6.2.4', 'py': '1.10.0', 'pluggy': '0.13.1'}, 'Plugins': {'metadata': '1.11.0', 'html': '3.1.1', 'libfaketime': '0.1.2', 'flaky': '3.7.0'}}
389-ds-base: 1.4.3.23-2.module+el8.5.0+11209+cb479c8d
nss: 3.53.1-17.el8_3
nspr: 4.25.0-2.el8_2
openldap: 2.4.46-16.el8
cyrus-sasl: 2.1.27-5.el8
FIPS: disabled
rootdir: /mnt/tests/rhds/tests/upstream/ds/dirsrvtests, configfile: pytest.ini
plugins: metadata-1.11.0, html-3.1.1, libfaketime-0.1.2, flaky-3.7.0
collected 2 items                                                                                                                                                                                                                            

dirsrvtests/tests/suites/config/compact_test.py::test_compact_db_task PASSED                                                                                                                                                           [ 50%]
dirsrvtests/tests/suites/config/compact_test.py::test_compaction_interval_and_time PASSED                                                                                                                                              [100%]

============================================================================================================= 2 passed in 24.90s =============================================================================================================

Marking as Verified:Tested.

Comment 19 sgouvern 2021-06-03 12:13:52 UTC
As per comment 16, marking as VERIFIED

Comment 22 errata-xmlrpc 2021-11-09 18:10:45 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (389-ds-base bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:4203