I'm unsure whether I should apply this to libreoffice-3-6 or maybe
even libreoffice-3-5; I'd be glad of your opinions.
The issue is that embedded HSQLDB does not reclaim space occupied by
deleted rows; it only overwrites them with new rows. So basically this
means that the data portion of an .odb file NEVER shrinks and only
grows or stagnates.
In particular, people that try to make a minimal reproduction case for
bug reports by deleting a lot of rows still have big files that don't
fit in our bugzilla's size limit (that's how I noticed this issue).
This patch tells HSQLDB, on each flush, to "defrag" the database. This
can take time for big databases :-| and will happen at least for each
file save operation.
The alternative would be to introduce an UI element
"compress/cleanup/defrag database", but:
1) It would necessarily be specific to sdbc(x) direct drivers as AFAIK
odbc / jdbc / ... don't have a standard way to do such an
operation.
2) It is not "do the right thing by default"
3) People using big databases should switch to a "real" database
system anyway (and use LibreOffice base as a graphical front-end to
it).
4) More work, and touching the UI, so I won't do it by myself. If we
decide it is the better idea and someone wants to collaborate on
that...
--
Lionel
From 2c46368432bd4f1bd86c7f3fb6c25ec5ad05dee7 Mon Sep 17 00:00:00 2001
From: Lionel Elie Mamane <lionel@mamane.lu>
Date: Tue, 3 Jul 2012 20:17:01 +0200
Subject: [PATCH] embedded HSQLDB: reclaim space occupied by deleted rows
Disadvantage is that saving/closing the file may take a significantly longer time
Change-Id: I1cc35c34b49e60d73e8d341549c5a3c5ef314b6d
---
connectivity/source/drivers/hsqldb/HConnection.cxx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/connectivity/source/drivers/hsqldb/HConnection.cxx
b/connectivity/source/drivers/hsqldb/HConnection.cxx
index 1c85dde..ee7c5b2 100644
--- a/connectivity/source/drivers/hsqldb/HConnection.cxx
+++ b/connectivity/source/drivers/hsqldb/HConnection.cxx
@@ -180,7 +180,7 @@ namespace connectivity { namespace hsqldb
if ( !m_bReadOnly )
{
Reference< XStatement > xStmt( m_xConnection->createStatement(),
UNO_QUERY_THROW );
- xStmt->execute( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CHECKPOINT" ) )
);
+ xStmt->execute( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "CHECKPOINT
DEFRAG" ) ) );
}
}
--
1.7.10
Context
- [PATCH] [REVIEW:3-5,3-6] size optimisation · Lionel Elie Mamane
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.