Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 6430 - implement read-only bdb #6431

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

progier389
Copy link
Contributor

@progier389 progier389 commented Dec 3, 2024

This PR:

  • implement librobdb as derivated work from rpm lib
  • add configure flag to allow 389ds to use librobdb with some glue code interfacing bdb api toward the read only functions.
  • Modify spec file to build 389ds with that librairy if libdb is not available

Issue: #6430

Reviewed by: @tbordaz and @vashirov (Thanks)

Copy link
Contributor

@tbordaz tbordaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The overall looks good. Few comments

#include "bdb_layer.h"
#include <robdb.h>

#define DEBUG 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it be 0 by default

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should not even be defined at all (since we are using #ifdef)

{
int rc = bdbreader_cur_lookup(db->cur->impl, key->data, key->size);
if (rc == DB_SUCCESS) {
rc = dbc_get(db->cur, key, data, flags);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't it call db->cur->c_get than dbc_get ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

db->cur->c_get == dbc_get so it does not really matter.
But to respect the layered approach since we are in the glue code that maps bdb API to robdb API,
bdb_bdbreader_glue.c code should use either internal or librobdb function rather than the bdb API
(So dbc_get looks good.)

@@ -397,6 +397,7 @@ const char *dblayer_op2str(dbi_op_t op)
return str[idx];
}

<<<<<<< HEAD
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably a leftover from a merge.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed: bad conflict resolution when rebasing to main ...


int dbc_close(DBC *dbc)
{
bdbreader_bdb_close(dbc->impl);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean bdbreader_cur_close ?

@progier389
Copy link
Contributor Author

Fixed review cooments about DEBUG, bdbreader_cur_close, and rebase conflict issue

@@ -540,11 +582,11 @@ if ! make DESTDIR="$RPM_BUILD_ROOT" check; then cat ./test-suite.log && false; f

%post
if [ -n "$DEBUGPOSTTRANS" ] ; then
output=$DEBUGPOSTTRANS
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation was removed here and below, is this intentional?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

Summary: Provide basic functions to search and read Berkeley Database records

License: GPL-2.0-or-later
URL: https://github.com/389ds/389-ds-base/lib/librobdb
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Broken URL

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is expected:
Right now, lib/librobdb does not exists yet on main branch, but it will exist once the PR get merged.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then it would be something like this (note the tree and main branch in the URL):
https://github.com/389ds/389-ds-base/tree/main/lib/librobdb

lib/librobdb/robdb.spec Outdated Show resolved Hide resolved
lib/librobdb/robdb.spec Outdated Show resolved Hide resolved
%doc %{_defaultdocdir}/%{name}-devel/README.md
%{_libdir}/*.so
%{_includedir}/*

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since there is test.c for robdb, maybe we should run it as part of %check section?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a make localtest to be able to run the test without having to install the rpm first
and added a %check section to use it

@progier389
Copy link
Contributor Author

Pushed commit about Viktor's review comments

@progier389
Copy link
Contributor Author

Pushed new commit to fix the URL

Copy link
Contributor

@tbordaz tbordaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Impressive patch. Copyrights may be set to 2025 (rather than 2024)
LGTM
(could you restart the (failing) tests in the PR before pushing)

Copy link
Member

@vashirov vashirov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't build the package without robdb, configure picks it up anyway:

checking for db.h... using lib/librobdb/lib/robdb.h

And then fails with

error: Installed (but unpackaged) file(s) found:
   /usr/lib/debug/usr/lib64/dirsrv/librobdb.so-3.1.1.202501071235git0db4461d6-1.fc41.aarch64.debug
   /usr/lib64/dirsrv/librobdb.so

RPM build errors:
    Installed (but unpackaged) file(s) found:
   /usr/lib/debug/usr/lib64/dirsrv/librobdb.so-3.1.1.202501071235git0db4461d6-1.fc41.aarch64.debug
   /usr/lib64/dirsrv/librobdb.so
make: *** [rpm.mk:178: rpms] Error 1

I provided some suggestions to the spec file, but I need to test this more.

rpm/389-ds-base.spec.in Outdated Show resolved Hide resolved
rpm.mk Outdated
ifeq ($(BUNDLE_LIBDB), 1)
BUNDLE_BDBREADERS ?= 0
else
ifeq (,$(wildcard /usr/include/db.h#))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is # a typo? With this I'm always getting robdb-libs package generated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed! I think that I added the # for some testing and forgot to remove it afterwards 😉

rpm.mk Outdated Show resolved Hide resolved
rpm/389-ds-base.spec.in Outdated Show resolved Hide resolved
Makefile.am Outdated
@@ -325,7 +332,7 @@ bin_PROGRAMS = dbscan \
# based on defines
# ----------------------------------------------------------------------------------------

server_LTLIBRARIES = libslapd.la libldaputil.la libns-dshttpd.la librewriters.la
server_LTLIBRARIES = libslapd.la libldaputil.la libns-dshttpd.la librewriters.la librobdb.la
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be also behind a condition?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed! I will fix it.

@progier389 progier389 added the work in progress Work in Progress - can be reviewed, but not ready for merge. label Jan 15, 2025
@progier389
Copy link
Contributor Author

fixed the build break:

  • logic was flawed and rpmbuild was called without robdb but configure was called with robdb
  • avoid to try to install binaries before building them 😉
  • need to exclude robdb library from main package

@progier389
Copy link
Contributor Author

Build is now ok, but there is a problem with the CI test:

Completion plugin: Generating completion cache...
--> Starting dependency resolution
--> Finished dependency resolution
Error: 
 Problem 1: conflicting requests
  - nothing provides 3.1.1.202501152030git3a8fe1d-1.fc40 needed by 389-ds-base-3.1.1.202501152030git3a8fe1d-1.fc40.x86_64 from @commandline
  - nothing provides 389-ds-base-robdb-libs= needed by 389-ds-base-3.1.1.202501152030git3a8fe1d-1.fc40.x86_64 from @commandline

Probably an error in the Require dependency:
should be 389-ds-base-robdb-libs-3.1.1.202501152021git3a8fe1dd9-1.fc40.x86_64 instead of 389-ds-base-robdb-libs-3.1.1.202501152021git3a8fe1dd9-1

@vashirov
Copy link
Member

vashirov commented Jan 16, 2025

nothing provides 389-ds-base-robdb-libs=

There should be space before =

@progier389 progier389 force-pushed the i0_bdb_ro branch 2 times, most recently from 5da66d9 to 03f1436 Compare January 16, 2025 15:30
@progier389 progier389 removed the work in progress Work in Progress - can be reviewed, but not ready for merge. label Jan 17, 2025
@progier389
Copy link
Contributor Author

Fixed the dependency as viktor proposed and now the tests results are the expected one:

  • most bdb tests are failing because the instance cannot be started in bdb mode.
  • same for the few lmdb tests that try to switch to bdb
  • and a few lmdb tests that are known to be unreliable

@progier389
Copy link
Contributor Author

Still some work to do around the CI tests to skip all the bdb tests and the few lmdb tests that tries to generate a bdb instance - should also a a test to check bdb migration as if the system was upgraded

@progier389 progier389 added the work in progress Work in Progress - can be reviewed, but not ready for merge. label Jan 21, 2025
@progier389 progier389 force-pushed the i0_bdb_ro branch 8 times, most recently from 0f87706 to fb81fe8 Compare January 23, 2025 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
work in progress Work in Progress - can be reviewed, but not ready for merge.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Solution to be able to upgrade existing instance when bdb will be no more available
3 participants