Issue 5840 - mdb online indexing and shutdown
Summary: mdb online indexing and shutdown
Status: VERIFIED DUPLICATE of issue 8958
Alias: None
Product: OpenLDAP
Classification: Unclassified
Component: backends (show other issues)
Version: unspecified
Hardware: All All
: --- normal
Target Milestone: 2.7.0
Assignee: OpenLDAP project
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-02 15:14 UTC by Ralf
Modified: 2022-03-07 17:31 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Ralf 2008-12-02 15:14:28 UTC
Full_Name: Ralf Haferkamp
Version: HEAD, RE24
OS: 
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (89.166.134.124)


When slapd is shutdown while the online indexing task is active it will stop the
indexing task immediately leaving a half created index files behind. Searches
that use the index afterwards will return imcomplete results.

I wonder if we should wait for the indexing task to complete when shutting down
the daemon or if there are any other ways to put the databases and the
configuration back into a consistant state. (Apart from manually running
slapindex)

Comment 1 Howard Chu 2008-12-03 03:07:19 UTC
On Tue, Dec 02, 2008 at 03:14:28PM +0000, rhafer@suse.de wrote:
> Full_Name: Ralf Haferkamp
> Version: HEAD, RE24
> OS: 
> URL: ftp://ftp.openldap.org/incoming/
> Submission from: (NULL) (89.166.134.124)
> 
> 
> When slapd is shutdown while the online indexing task is active it will stop the
> indexing task immediately leaving a half created index files behind. Searches
> that use the index afterwards will return imcomplete results.
> 
> I wonder if we should wait for the indexing task to complete when shutting down
> the daemon or if there are any other ways to put the databases and the
> configuration back into a consistant state. (Apart from manually running
> slapindex)

That's documented behavior. (See the Admin Guide:
  If slapd is stopped before the index task completes, indexing
  will have to be manually completed using the slapindex tool.

Generally when people issue a shutdown command to slapd they want it to
Stop Right Now. I think it would be a bad idea to wait, and I see nothing
to change here. This ITS should be closed.

Comment 2 Ralf 2008-12-03 08:10:05 UTC
Am Mittwoch 03 Dezember 2008 04:10:36 schrieb hyc@symas.com:
> On Tue, Dec 02, 2008 at 03:14:28PM +0000, rhafer@suse.de wrote:
> > Full_Name: Ralf Haferkamp
> > Version: HEAD, RE24
> > OS:
> > URL: ftp://ftp.openldap.org/incoming/
> > Submission from: (NULL) (89.166.134.124)
> >
> >
> > When slapd is shutdown while the online indexing task is active it will
> > stop the indexing task immediately leaving a half created index files
> > behind. Searches that use the index afterwards will return imcomplete
> > results.
> >
> > I wonder if we should wait for the indexing task to complete when
> > shutting down the daemon or if there are any other ways to put the
> > databases and the configuration back into a consistant state. (Apart from
> > manually running slapindex)
>
> That's documented behavior. (See the Admin Guide:
>   If slapd is stopped before the index task completes, indexing
>   will have to be manually completed using the slapindex tool.
>
> Generally when people issue a shutdown command to slapd they want it to
> Stop Right Now. I think it would be a bad idea to wait, and I see nothing
> to change here. This ITS should be closed.
Ok, waiting for the index task to complete is a bad idea as it can take very 
long to complete. But could we indicate the condition somehow that warn the 
user about an incomplete run upon next startup?

-- 
Ralf

Comment 3 ando@openldap.org 2008-12-03 08:20:38 UTC
rhafer@suse.de wrote:
> Am Mittwoch 03 Dezember 2008 04:10:36 schrieb hyc@symas.com:
>> On Tue, Dec 02, 2008 at 03:14:28PM +0000, rhafer@suse.de wrote:
>>> Full_Name: Ralf Haferkamp
>>> Version: HEAD, RE24
>>> OS:
>>> URL: ftp://ftp.openldap.org/incoming/
>>> Submission from: (NULL) (89.166.134.124)
>>>
>>>
>>> When slapd is shutdown while the online indexing task is active it will
>>> stop the indexing task immediately leaving a half created index files
>>> behind. Searches that use the index afterwards will return imcomplete
>>> results.
>>>
>>> I wonder if we should wait for the indexing task to complete when
>>> shutting down the daemon or if there are any other ways to put the
>>> databases and the configuration back into a consistant state. (Apart from
>>> manually running slapindex)
>> That's documented behavior. (See the Admin Guide:
>>   If slapd is stopped before the index task completes, indexing
>>   will have to be manually completed using the slapindex tool.
>>
>> Generally when people issue a shutdown command to slapd they want it to
>> Stop Right Now. I think it would be a bad idea to wait, and I see nothing
>> to change here. This ITS should be closed.
> Ok, waiting for the index task to complete is a bad idea as it can take very 
> long to complete. But could we indicate the condition somehow that warn the 
> user about an incomplete run upon next startup?

- the index should be invalidated
- slapd, at the next manual startup, should complain about the need to 
run slapindex first.
- in order to allow consistent batch restart with no human intervention, 
slapd could allow to be restarted without running slapindex first, but 
without making use of the inconsistent index.

my 2c, not volunteering right now.

p.


Ing. Pierangelo Masarati
OpenLDAP Core Team

SysNet s.r.l.
via Dossi, 8 - 27100 Pavia - ITALIA
http://www.sys-net.it
-----------------------------------
Office:  +39 02 23998309
Mobile:  +39 333 4963172
Fax:     +39 0382 476497
Email:   ando@sys-net.it
-----------------------------------

Comment 4 Hallvard Furuseth 2008-12-08 16:16:35 UTC
ando@sys-net.it writes:
> - the index should be invalidated
> - slapd, at the next manual startup, should complain about the need to 
> run slapindex first.

If it knows enough to complain, why not restart the indexing task?

-- 
Hallvard

Comment 5 ando@openldap.org 2008-12-08 17:34:53 UTC
h.b.furuseth@usit.uio.no wrote:
> ando@sys-net.it writes:
>> - the index should be invalidated
>> - slapd, at the next manual startup, should complain about the need to 
>> run slapindex first.
> 
> If it knows enough to complain, why not restart the indexing task?

There should be an option in doing that.  In fact, I suspect running 
slapindex -q can be much more efficient than letting slapd index while 
serving without index.  Of course, slapd cannot serve while 
slapindex'ing, so I think human intervention is needed to determine 
what's most appropriate on a case by case basis.

p.


Ing. Pierangelo Masarati
OpenLDAP Core Team

SysNet s.r.l.
via Dossi, 8 - 27100 Pavia - ITALIA
http://www.sys-net.it
-----------------------------------
Office:  +39 02 23998309
Mobile:  +39 333 4963172
Fax:     +39 0382 476497
Email:   ando@sys-net.it
-----------------------------------

Comment 6 Howard Chu 2008-12-09 05:05:36 UTC
ando@sys-net.it wrote:
> h.b.furuseth@usit.uio.no wrote:
>> ando@sys-net.it writes:
>>> - the index should be invalidated
>>> - slapd, at the next manual startup, should complain about the need to
>>> run slapindex first.
>> If it knows enough to complain, why not restart the indexing task?
>
> There should be an option in doing that.  In fact, I suspect running
> slapindex -q can be much more efficient than letting slapd index while
> serving without index.  Of course, slapd cannot serve while
> slapindex'ing, so I think human intervention is needed to determine
> what's most appropriate on a case by case basis.

I suppose we should save the last entryID that was indexed at shutdown time, 
so that the indexer task can resume at the next startup. We'd also need some 
coordination with slapindex, so that if you ran slapindex after shutdown, it 
would erase the saved status. Rather than add any fields to the DB index 
files, it would probably be OK to write the status in the cn=config tree.

-- 
   -- Howard Chu
   CTO, Symas Corp.           http://www.symas.com
   Director, Highland Sun     http://highlandsun.com/hyc/
   Chief Architect, OpenLDAP  http://www.openldap.org/project/

Comment 7 Hallvard Furuseth 2008-12-09 12:18:13 UTC
hyc@symas.com writes:
>ando@sys-net.it wrote:
>>h.b.furuseth@usit.uio.no wrote:
>>> If it knows enough to complain, why not restart the indexing task?
>>
>> There should be an option in doing that.

I don't quite see why.  If you add an index via cn=config, that starts
an indexing task while slapd is running.  A following shutdown-restart
is not necessarily related to a desire to not run that task.

>> In fact, I suspect running slapindex -q can be much more efficient
>> than letting slapd index while serving without index.  (...)

If you shut down slapd because you want to use slapindex, then you know
what you want - so just go ahead and use slapindex.  No extra flag
needed.

I suppose there could be a flag to _not_ start the indexing task when
you add an index via cn=config, so you always must slapindex.

> I suppose we should save the last entryID that was indexed at shutdown time, 
> so that the indexer task can resume at the next startup. We'd also need some 
> coordination with slapindex, so that if you ran slapindex after shutdown, it 
> would erase the saved status. Rather than add any fields to the DB index 
> files, it would probably be OK to write the status in the cn=config tree.

Or a status file in the database directory.

A cn=config attribute would make it messy to swap database directories
around, since one must also modify cn=config when doing so.

-- 
Hallvard

Comment 8 Howard Chu 2009-04-11 03:10:20 UTC
Hallvard B Furuseth wrote:
> hyc@symas.com writes:
> I suppose there could be a flag to _not_ start the indexing task when
> you add an index via cn=config, so you always must slapindex.

I'd rather not.

>> I suppose we should save the last entryID that was indexed at shutdown time,
>> so that the indexer task can resume at the next startup. We'd also need some
>> coordination with slapindex, so that if you ran slapindex after shutdown, it
>> would erase the saved status. Rather than add any fields to the DB index
>> files, it would probably be OK to write the status in the cn=config tree.
>
> Or a status file in the database directory.
>
> A cn=config attribute would make it messy to swap database directories
> around, since one must also modify cn=config when doing so.

OK, a status file. It would record the old and new index masks for the 
attributes being reindexed, and the entryID where it stopped.

If slapindex is run without a specific list of attributes, (reindex 
everything) it should remove and ignore the status file.

If slapindex is run with a specific list of attributes, and those attributes 
are in the status file, it should use the saved status and remove the 
specified attributes from the status file. (Deleting the file if there are no 
other attributes remaining.)

Otherwise, when slapd starts, it should read the status file and resume the 
indexing task.

-- 
   -- Howard Chu
   CTO, Symas Corp.           http://www.symas.com
   Director, Highland Sun     http://highlandsun.com/hyc/
   Chief Architect, OpenLDAP  http://www.openldap.org/project/

Comment 9 Howard Chu 2009-06-23 21:34:19 UTC
moved from Incoming to Development
Comment 10 Quanah Gibson-Mount 2020-03-19 04:50:49 UTC
I believe this affects back-mdb as well, so leaving open
Comment 11 Ondřej Kuzník 2022-03-07 17:11:18 UTC
Is this resolved with ITS#8958?
Comment 12 Howard Chu 2022-03-07 17:29:45 UTC
(In reply to Ondřej Kuzník from comment #11)
> Is this resolved with ITS#8958?

Yes

*** This issue has been marked as a duplicate of issue 8958 ***