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 3 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
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