[Xapian-discuss] problem on closing writable databases

Kevin Duraj kevin.softdev at gmail.com
Tue Feb 10 02:12:32 GMT 2009


You must use: copydatabase then your Xapian Index will free unused
disk space from deleted documents.

/usr/local/bin/copydatabase  directory/old directory/new

Kevin Duraj
http://myhealthcare.com/


On Tue, Feb 3, 2009 at 8:56 AM, Markus Wörle <mrks at mrks.de> wrote:
> Hi
>
> (I am using xapian 1.0.10, with perl bindings.)
>
> because of the issue, that xapian btrees thin out in the longrun, I
> decided to add support to my indexer for auto-compacting an index from
> time to time using the xapian-compact binary. It does so by
>
> * flushing the open index
> * undef the database-handle to do an inplicit close (there is no way
> to do an explicit close, right?)
> * running "xapian-compact -n --no-renumber ./index ./index-compact
> 2>&1 >/dev/null"
> * moving ./index -> ./index-old
> (* copying some arbitrary statistic files from ./index-old to ./index-
> compact, but this won't affect anything)
> * moving ./index-compact -> ./index
> * deleting ./index-old
> * reopening the ./index by calling the
> Search::Xapian::WritableDatabase->new() constructor
>
> Now my problem is, that the diskspace ./index-old consumes doesn't get
> freed. So I used lsof and found out that a "cat" process is holding
> open filehandles on the .DB files.
>
> cat  2072  root  36u  REG  8,1  997842944  5529607 /var/lib/wtf/db/
> profile-old/record.DB (deleted)
> cat  2072  root  38u  REG  8,1  121257984  5529616 /var/lib/wtf/db/
> profile-old/value.DB (deleted)
> cat  2072  root  39u  REG  8,1  717463552  5529610 /var/lib/wtf/db/
> profile-old/termlist.DB (deleted)
> cat  2072  root  40u  REG  8,1 1703305216  5529613 /var/lib/wtf/db/
> profile-old/position.DB (deleted)
> cat  2072  root  41u  REG  8,1 1943666688  5529604 /var/lib/wtf/db/
> profile-old/postlist.DB (deleted)
>
> this cat-process corresponds to my index-daemon
>
> root      1656  0.0  0.1 234732 54592 ?        S    16:35   0:00
> indexd overlord
> root      1657 18.6  0.3 342596 164416 ?       R    16:35   5:13  \_
> indexd
> root      1658  0.0  0.0   3868   468 ?        S    16:35   0:00
> \_ /bin/cat
> root      1659  0.0  0.0   3868   468 ?        S    16:35   0:00
> \_ /bin/cat
> root      1660  0.0  0.0   3868   468 ?        S    16:35   0:00
> \_ /bin/cat
> root      1661  0.0  0.0   3868   472 ?        S    16:35   0:00
> \_ /bin/cat
> root      1662  0.0  0.0   3868   468 ?        S    16:35   0:00
> \_ /bin/cat
> root      2072  0.0  0.0   3868   472 ?        S    16:43   0:00
> \_ /bin/cat
> root      3693  0.0  0.0   3868   472 ?        S    17:01   0:00
> \_ /bin/cat
>
> I read earlier that "cat" is used for locking, and I saw that its
> opening the flintlock files. But why does it hold these .DB file open?
> Is there a way to get these files closed properly without acutally
> quitting and restarting the process (which probably would by my
> workaround)?
>
> Regards,
> mrks
>
> _______________________________________________
> Xapian-discuss mailing list
> Xapian-discuss at lists.xapian.org
> http://lists.xapian.org/mailman/listinfo/xapian-discuss
>



More information about the Xapian-discuss mailing list