From kde-commits Sun Sep 11 16:58:32 2016 From: Christoph Cullmann Date: Sun, 11 Sep 2016 16:58:32 +0000 To: kde-commits Subject: [baloo] src: Increase size limit of baloo index for 64-bit machines Message-Id: X-MARC-Message: https://marc.info/?l=kde-commits&m=147361312632419 Git commit b0890aca71aa4f0fdabe65ee7b7fbd0bc844d8b8 by Christoph Cullmann. Committed on 11/09/2016 at 16:54. Pushed by cullmann into branch 'master'. Increase size limit of baloo index for 64-bit machines CHANGELOG: On 64-bit systems baloo allows now > 5 GB index storage. Increase size limit of baloo index for 64-bit machines to avoid crashs afte= r > 5GB of index size. (Better would be additional out-of-space handling, but ATM baloo has zero c= hecks for that) The size limit for 32-bit is still 1GB, like before (there was a silent ove= rflow from 5GB to 1GB in the computation), people with large homes will sti= ll get random segfaults on 32-bit. Patch based on patch from Hao Zhang, Bug 364475 REVIEW: 128885 BUG: 364475 M +11 -1 src/engine/database.cpp M +14 -14 src/engine/databasesize.h M +1 -1 src/engine/transaction.cpp M +2 -2 src/tools/balooctl/statuscommand.cpp http://commits.kde.org/baloo/b0890aca71aa4f0fdabe65ee7b7fbd0bc844d8b8 diff --git a/src/engine/database.cpp b/src/engine/database.cpp index 89e2e03..ec7ae2e 100644 --- a/src/engine/database.cpp +++ b/src/engine/database.cpp @@ -93,8 +93,18 @@ bool Database::open(OpenMode mode) return false; } = + /** + * maximal number of allowed named databases, must match number of dat= abases we create below + * each additional one leads to overhead + */ mdb_env_set_maxdbs(m_env, 12); - mdb_env_set_mapsize(m_env, static_cast(1024) * 1024 * 1024 * 5= ); // 5 gb + + /** + * size limit for database =3D=3D size limit of mmap + * use 1 GB on 32-bit, use 256 GB on 64-bit + */ + const size_t maximalSizeInBytes =3D size_t((sizeof(size_t) =3D=3D 4) ?= 1 : 256) * size_t(1024) * size_t(1024) * size_t(1024); + mdb_env_set_mapsize(m_env, maximalSizeInBytes); = // The directory needs to be created before opening the environment QByteArray arr =3D QFile::encodeName(indexInfo.absoluteFilePath()); diff --git a/src/engine/databasesize.h b/src/engine/databasesize.h index aa180fb..0a1b97e 100644 --- a/src/engine/databasesize.h +++ b/src/engine/databasesize.h @@ -31,30 +31,30 @@ public: * This is the size which is computed with all the pages used from all= the * individual database pages */ - uint expectedSize; + size_t expectedSize; = /** * This is the size based on the MDB_env and the total number of pages= used */ - uint actualSize; + size_t actualSize; = - uint postingDb; - uint positionDb; + size_t postingDb; + size_t positionDb; = - uint docTerms; - uint docFilenameTerms; - uint docXattrTerms; + size_t docTerms; + size_t docFilenameTerms; + size_t docXattrTerms; = - uint idTree; - uint idFilename; + size_t idTree; + size_t idFilename; = - uint docTime; - uint docData; + size_t docTime; + size_t docData; = - uint contentIndexingIds; - uint failedIds; + size_t contentIndexingIds; + size_t failedIds; = - uint mtimeDb; + size_t mtimeDb; }; = } diff --git a/src/engine/transaction.cpp b/src/engine/transaction.cpp index 0af20be..908a81f 100644 --- a/src/engine/transaction.cpp +++ b/src/engine/transaction.cpp @@ -402,7 +402,7 @@ QVector Transaction::documentXattrTerms(qui= nt64 docId) const // // File Size // -static uint dbiSize(MDB_txn* txn, MDB_dbi dbi) +static size_t dbiSize(MDB_txn* txn, MDB_dbi dbi) { MDB_stat stat; mdb_stat(txn, dbi, &stat); diff --git a/src/tools/balooctl/statuscommand.cpp b/src/tools/balooctl/stat= uscommand.cpp index 73289c4..1a56c64 100644 --- a/src/tools/balooctl/statuscommand.cpp +++ b/src/tools/balooctl/statuscommand.cpp @@ -92,8 +92,8 @@ int StatusCommand::exec(const QCommandLineParser& parser) = const QString path =3D fileIndexDbPath(); = - QFileInfo indexInfo(path + QLatin1String("/index")); - quint32 size =3D indexInfo.size(); + const QFileInfo indexInfo(path + QLatin1String("/index")); + const auto size =3D indexInfo.size(); KFormat format(QLocale::system()); if (size) { out << "Current size of index is " << format.formatByteSize(si= ze, 2) << endl;