#47960 cookie_change_info returns random negative number if there was no change in a tree
Closed: wontfix Opened by vashirov.

Setup: single master replication (M1 and C1)
Enabled plugins: Content Synchronization and Retro Changelog Plugin.

To retrieve a cookie I use this command:

ldapsearch -h localhost:1189 -D "cn=Directory Manager" -w Secret123 -b dc=example,dc=com -o ldif-wrap=no -E sync=ro | grep "1.3.6.1.4.1.4203.1.9.1.3" | awk '{print $4}' | base64 -d | colrm 1 3

I enabled plugins and restarted the servers. Then I ran several times the command to view the cookie on M1:

rhel7ds.brq.redhat.com:1189#cn=directory manager:dc=example,dc=com:(objectClass=)#-1259389152
rhel7ds.brq.redhat.com:1189#cn=directory manager:dc=example,dc=com:(objectClass=
)#-1476428000
rhel7ds.brq.redhat.com:1189#cn=directory manager:dc=example,dc=com:(objectClass=)#-1677787360
rhel7ds.brq.redhat.com:1189#cn=directory manager:dc=example,dc=com:(objectClass=
)#-1728143584
rhel7ds.brq.redhat.com:1189#cn=directory manager:dc=example,dc=com:(objectClass=*)#-1669394656
...

Then I did some changes in the DIT, after each change I checked the cookie:
rhel7ds.brq.redhat.com:1189#cn=directory manager:dc=example,dc=com:(objectClass=)#1
rhel7ds.brq.redhat.com:1189#cn=directory manager:dc=example,dc=com:(objectClass=
)#2
rhel7ds.brq.redhat.com:1189#cn=directory manager:dc=example,dc=com:(objectClass=)#3
rhel7ds.brq.redhat.com:1189#cn=directory manager:dc=example,dc=com:(objectClass=
)#4
rhel7ds.brq.redhat.com:1189#cn=directory manager:dc=example,dc=com:(objectClass=*)#5
...

It looks like cookie_change_info is not initialized before the first change.


Ticket has been cloned to Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1166260

Hello Noriko,

Just a minor remark from the second patch.
In sync_read_entry_from_changelog, if chgnum is invalid or less than the starting change you need to free 'uniqueid' before returning.

thanks

git patch file (master) -- additional patch for the type mismatch between the change number and cookie_change_info (slapi_ch_free_string is added following the comments by Thierry. Thanks, Thierry!!)
0001-Ticket-47960-cookie_change_info-returns-random-negat.3.patch

Hello Noriko,
good catch, 'chgnr' needs to be freed as well. Shouldn't 'uniqueid' be freed in case of return (sync_read_entry_from_change: lines 482 and 489)?

Replying to [comment:8 tbordaz]:

Hello Noriko,
good catch, 'chgnr' needs to be freed as well. Shouldn't 'uniqueid' be freed in case of return (sync_read_entry_from_change: lines 482 and 489)?

Agh... My bad... Reading your comment and having seen my patch, I blindly thought you pointed out chgnr and chgtype... :p Yes, definitely, uniqueid needs to be freed. Replacing the patch once more.

git patch file (master) -- additional patch for the type mismatch between the change number and cookie_change_info (another slapi_ch_free_string is added following the comments by Thierry. Thanks, Thierry!!)
0001-Ticket-47960-cookie_change_info-returns-random-negat.2.patch

Reviewed by Rich and Thierry (Thank you!!)

Pushed to master:
fb22b38..96c130b master -> master
commit a908c6b57cd77ff2f6e2fe0fe1fa2e0eccba77e0
commit 96c130b432ce0b15028e325c0e337679291aef9f

Pushed to 389-ds-base-1.3.3:
4002f3b..61a4e70 389-ds-base-1.3.3 -> 389-ds-base-1.3.3
commit b7a472c71db4671c127584fcf7bfd8c75930bc8c
commit 61a4e7035742612a1a8bf42b16e93cc55776dc31

Metadata Update from @nkinder:
- Issue assigned to nhosoi
- Issue set to the milestone: 1.3.3 - 12/31 (December)

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This issue has been cloned to Github and is available here:
- https://github.com/389ds/389-ds-base/issues/1291

If you want to receive further updates on the issue, please navigate to the github issue
and click on subscribe button.

Thank you for understanding. We apologize for all inconvenience.

Metadata Update from @spichugi:
- Issue close_status updated to: wontfix (was: Fixed)

Metadata