Hi all,
Two weeks ago I also wrote to this mailinglist, but now my problem is much more clear. I succesfully installed slapd and managed to start it with back-sql. However, I have one problem. Once slapd has retrieved childs from a certain entry, it is not able to refresh it. A slapd restart is needed for that.
The problem is due to the MySQL engine used: InnoDB. I discovered that when I converted my database to MyISAM, which had no problems at all. Upgrading myodbc to version 5.1.6 (I as on 3.51 before) did not help.
Converting to MyISAM is not an option and was just for testing. Restarting the server each 5 minutes looks like a ugly solution to me. What could be wrong?
Thank you. Frederik Bosch
Problem solved. I had to comment a line in sql_wrap.c:
/* * TimesTen : Turn off autocommit. We must explicitly * commit any transactions. */ SQLSetConnectOption( *dbhp, SQL_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF );
This last line actually prevents slapd from updating resultsets (which are committed) in InnoDB.
Perhaps autocommit should be enabled by default, but the user should be able to disable it through a configuration option in slapd.conf. Should I file a request or bug for this?
Regards, Frederik
On 07/28/2010 12:32 PM, Frederik Bosch wrote:
Hi all,
Two weeks ago I also wrote to this mailinglist, but now my problem is much more clear. I succesfully installed slapd and managed to start it with back-sql. However, I have one problem. Once slapd has retrieved childs from a certain entry, it is not able to refresh it. A slapd restart is needed for that.
The problem is due to the MySQL engine used: InnoDB. I discovered that when I converted my database to MyISAM, which had no problems at all. Upgrading myodbc to version 5.1.6 (I as on 3.51 before) did not help.
Converting to MyISAM is not an option and was just for testing. Restarting the server each 5 minutes looks like a ugly solution to me. What could be wrong?
Thank you. Frederik Bosch
Problem solved. I had to comment a line in sql_wrap.c:
/*
- TimesTen : Turn off autocommit. We must explicitly
- commit any transactions.
*/ SQLSetConnectOption( *dbhp, SQL_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF );
This last line actually prevents slapd from updating resultsets (which are committed) in InnoDB.
I believe this is not correct; we need autocommit to be off since operations that need a commit explicitly do it. I think the problem is in the RDBMS you're using, since other RDBMSes always worked as intended.
Perhaps autocommit should be enabled by default, but the user should be able to disable it through a configuration option in slapd.conf. Should I file a request or bug for this?
Feel free. Configuration options that improve interoperation are always welcome, pending my comment above.
p.
Thanks p.. I did some more testing and you are right. It is a RDBMS problem. This is what I found (tested with iSQL and directly on the RDBMS).
In chronological order:
1. SET autocommit=0 2. SELECT @@autocommit -> result: 0, it is turned off
This is standard slapd/back-sql config.
3. SELECT * FROM ldap_entries -> 10 results 4. Now I change the data directly using a different connection and other GUI. I add a record (and commit it). 5. SELECT * FROM ldap_entries -> 10 results
The latter result surprised me. So if data is changed by another connection, it will not be refresh data on other connections.
6. COMMIT 7. SELECT * FROM ldap_entries -> 11 results
So, in order to refresh data, slapd has to prepend every read operation with a COMMIT. This is not logical, is it?
So, I believe adding a configuration option, for people who want to use back-sql with MySQL/InnoDB, could be a handy solution. Where can I add this feature request?
Regards, Frederik
On 07/28/2010 03:01 PM, masarati@aero.polimi.it wrote:
Problem solved. I had to comment a line in sql_wrap.c:
/*
- TimesTen : Turn off autocommit. We must explicitly
- commit any transactions.
*/ SQLSetConnectOption( *dbhp, SQL_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF );
This last line actually prevents slapd from updating resultsets (which are committed) in InnoDB.
I believe this is not correct; we need autocommit to be off since operations that need a commit explicitly do it. I think the problem is in the RDBMS you're using, since other RDBMSes always worked as intended.
Perhaps autocommit should be enabled by default, but the user should be able to disable it through a configuration option in slapd.conf. Should I file a request or bug for this?
Feel free. Configuration options that improve interoperation are always welcome, pending my comment above.
p.
Thanks p.. I did some more testing and you are right. It is a RDBMS problem. This is what I found (tested with iSQL and directly on the RDBMS).
In chronological order:
- SET autocommit=0
- SELECT @@autocommit -> result: 0, it is turned off
This is standard slapd/back-sql config.
- SELECT * FROM ldap_entries -> 10 results
- Now I change the data directly using a different connection and other
GUI. I add a record (and commit it). 5. SELECT * FROM ldap_entries -> 10 results
The latter result surprised me. So if data is changed by another connection, it will not be refresh data on other connections.
- COMMIT
- SELECT * FROM ldap_entries -> 11 results
So, in order to refresh data, slapd has to prepend every read operation with a COMMIT. This is not logical, is it?
So, I believe adding a configuration option, for people who want to use back-sql with MySQL/InnoDB, could be a handy solution. Where can I add this feature request?
You may reference this thread (point to the relevant message from the official archives).
p.
openldap-technical@openldap.org