Bug 640854

Summary: changelog db: _cl5WriteOperation: failed to write entry; db error - 22 Invalid argument
Product: [Retired] 389 Reporter: Noriko Hosoi <nhosoi>
Component: Replication - GeneralAssignee: Noriko Hosoi <nhosoi>
Status: CLOSED CURRENTRELEASE QA Contact: Viktor Ashirov <vashirov>
Severity: medium Docs Contact:
Priority: high    
Version: 1.2.6CC: amsharma, rmeggins
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-12-07 17:00:56 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 576869, 639035    
Attachments:
Description Flags
scripts by Rich: PYTHONPATH=/path/to/directory/containing/dsadmin.py/ PREFIX=/path/to/localinstall (or just omit PREFIX if you are using an rpm installation) python /path/to/bug628791.py
none
git patch file (master) nhosoi: review?, rmeggins: review+

Description Noriko Hosoi 2010-10-06 22:09:50 UTC
Created attachment 452004 [details]
scripts by Rich: PYTHONPATH=/path/to/directory/containing/dsadmin.py/ PREFIX=/path/to/localinstall (or just omit PREFIX if you are using an rpm installation) python /path/to/bug628791.py

Description of problem:
An error occurs in changelog db when the attached script configures MMRs.
[..] NSMMReplicationPlugin - Beginning total update of replica "agmt="cn=meTolocalhost.localdomain1210" (localhost:1210)".
[..] NSMMReplicationPlugin - Finished total update of replica "agmt="cn=meTolocalhost.localdomain1210" (localhost:1210)". Sent 160 entries.
[..] - libdb: Transaction specified for a DB handle opened outside a transaction
[..] NSMMReplicationPlugin - changelog program - _cl5WriteOperation: failed to write entry with csn (4caa35ab000000010000); db error - 22 Invalid argument
[..] NSMMReplicationPlugin - write_changelog_and_ruv: can't add a change for dc=example,dc=com (uniqid: f9d6a323-cff311df-81009ff6-f6ed2452, optype: 8) to changelog csn 4caa35ab000000010000 

This problem was introduced with this change:
Bug 633168 - Share backend dbEnv with the replication changelog

Note: the error message "Transaction specified for a DB handle opened outside a transaction" exists only in db-4.3.29 or older.  There is a corresponding error in db-4.6 or newer "Transaction specified for a non-transactional database".  But the error message was not observed on Fedora 13 & 14 (db4-4.8.30-1.fc13.x86_64, db4-4.8.30-2.fc14.i686)

Comment 1 Noriko Hosoi 2010-10-07 06:36:17 UTC
Created attachment 452044 [details]
git patch file (master)

Description: DBENV open flags is used to determine the DB_OPEN mode
whether to set DB_AUTO_COMMIT or not.  The info was eliminated in
the change made for "Bug 633168 - Share backend dbEnv with the
replication changelog".

This patch picks up the backend dbenv openflags and uses it for
the changelog DB_OPEN.

Files:
 ldap/servers/plugins/replication/cl5_api.c
 ldap/servers/slapd/back-ldbm/dblayer.c
 ldap/servers/slapd/slapi-plugin.h

Comment 2 Noriko Hosoi 2010-10-07 17:15:56 UTC
Reviewed by Rich (Thanks!!)

Pushed to master.

$ git merge work
Updating 9a00a44..3604c48
Fast-forward
 ldap/servers/plugins/replication/cl5_api.c |    8 +++++++-
 ldap/servers/slapd/back-ldbm/dblayer.c     |   12 ++++++++++++
 ldap/servers/slapd/slapi-plugin.h          |    5 ++++-
 3 files changed, 23 insertions(+), 2 deletions(-)

$ git push
Counting objects: 21, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (11/11), done.
Writing objects: 100% (11/11), 1.37 KiB, done.
Total 11 (delta 9), reused 0 (delta 0)
To ssh://git.fedorahosted.org/git/389/ds.git
   9a00a44..3604c48  master -> master

Comment 3 Amita Sharma 2011-06-02 06:43:51 UTC
Hi Noriko,

Seems that this bug was for older DS versions.
How should I verify this one with 389-ds.

Thanks,
Amita

Comment 4 Noriko Hosoi 2011-06-02 17:27:06 UTC
(In reply to comment #3)
> Hi Noriko,
> 
> Seems that this bug was for older DS versions.
> How should I verify this one with 389-ds.
> 
> Thanks,
> Amita

Hi Amita.

The bug is in ds-replication code.  Could you still verify this bug?  The error message which should not appear in the error log would be:
  "Transaction specified for a non-transactional database".

Thanks!
--noriko

Comment 5 Amita Sharma 2011-06-03 13:25:13 UTC
Executed the Python script attached but got error 
setup c1 to chain to ldap://localhost.localdomain:1200 localhost.localdomain:1210/
bind to c1 as uid=scarter
turn on error logging on c1
shutdown m1 - see if still can search
Traceback (most recent call last):
  File "bug628791.py", line 98, in <module>
    userc1.search_s(userdn, ldap.SCOPE_BASE)
  File "/usr/lib64/python2.6/site-packages/ldap/ldapobject.py", line 516, in search_s
    return self.search_ext_s(base,scope,filterstr,attrlist,attrsonly,None,None,timeout=self.timeout)
  File "/usr/lib64/python2.6/site-packages/ldap/ldapobject.py", line 510, in search_ext_s
    return self.result(msgid,all=1,timeout=timeout)[1]
  File "/usr/lib64/python2.6/site-packages/ldap/ldapobject.py", line 436, in result
    res_type,res_data,res_msgid = self.result2(msgid,all,timeout)
  File "/usr/lib64/python2.6/site-packages/ldap/ldapobject.py", line 440, in result2
    res_type, res_data, res_msgid, srv_ctrls = self.result3(msgid,all,timeout)
  File "/usr/lib64/python2.6/site-packages/ldap/ldapobject.py", line 446, in result3
    ldap_result = self._ldap_call(self._l.result3,msgid,all,timeout)
  File "/usr/lib64/python2.6/site-packages/ldap/ldapobject.py", line 96, in _ldap_call
    result = func(*args,**kwargs)
ldap.OPERATIONS_ERROR: {'info': "Can't contact LDAP server", 'desc': 'Operations error'}

Please guide.

Comment 6 Rich Megginson 2011-06-03 14:25:46 UTC
(In reply to comment #5)
> Executed the Python script attached but got error 
> setup c1 to chain to ldap://localhost.localdomain:1200
> localhost.localdomain:1210/
> bind to c1 as uid=scarter
> turn on error logging on c1
> shutdown m1 - see if still can search
> Traceback (most recent call last):
>   File "bug628791.py", line 98, in <module>
>     userc1.search_s(userdn, ldap.SCOPE_BASE)
>   File "/usr/lib64/python2.6/site-packages/ldap/ldapobject.py", line 516, in
> search_s
>     return
> self.search_ext_s(base,scope,filterstr,attrlist,attrsonly,None,None,timeout=self.timeout)
>   File "/usr/lib64/python2.6/site-packages/ldap/ldapobject.py", line 510, in
> search_ext_s
>     return self.result(msgid,all=1,timeout=timeout)[1]
>   File "/usr/lib64/python2.6/site-packages/ldap/ldapobject.py", line 436, in
> result
>     res_type,res_data,res_msgid = self.result2(msgid,all,timeout)
>   File "/usr/lib64/python2.6/site-packages/ldap/ldapobject.py", line 440, in
> result2
>     res_type, res_data, res_msgid, srv_ctrls = self.result3(msgid,all,timeout)
>   File "/usr/lib64/python2.6/site-packages/ldap/ldapobject.py", line 446, in
> result3
>     ldap_result = self._ldap_call(self._l.result3,msgid,all,timeout)
>   File "/usr/lib64/python2.6/site-packages/ldap/ldapobject.py", line 96, in
> _ldap_call
>     result = func(*args,**kwargs)
> ldap.OPERATIONS_ERROR: {'info': "Can't contact LDAP server", 'desc':
> 'Operations error'}
> 
> Please guide.

Right.  See https://bugzilla.redhat.com/show_bug.cgi?id=628791#c5 - we should open another bug for that problem.  Please verify bug 640854 has been fixed, then open another bug for 628791#c5.

Comment 7 Amita Sharma 2011-06-03 17:43:04 UTC
No, I don't see "Transaction specified for a non-transactional database".
in the error logs hence marking this bug as VERIFIED but for the comment#5, I am opening another bug.