Changeset View
Changeset View
Standalone View
Standalone View
src/engine/database.cpp
Show All 16 Lines | |||||
17 | * License along with this library; if not, write to the Free Software | 17 | * License along with this library; if not, write to the Free Software | ||
18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
19 | * | 19 | * | ||
20 | */ | 20 | */ | ||
21 | 21 | | |||
22 | #include "database.h" | 22 | #include "database.h" | ||
23 | #include "transaction.h" | 23 | #include "transaction.h" | ||
24 | #include "postingdb.h" | 24 | #include "postingdb.h" | ||
25 | #include "fuzzydb.h" | ||||
bruns: later ... | |||||
25 | #include "documentdb.h" | 26 | #include "documentdb.h" | ||
26 | #include "documenturldb.h" | 27 | #include "documenturldb.h" | ||
27 | #include "documentiddb.h" | 28 | #include "documentiddb.h" | ||
28 | #include "positiondb.h" | 29 | #include "positiondb.h" | ||
29 | #include "documenttimedb.h" | 30 | #include "documenttimedb.h" | ||
30 | #include "documentdatadb.h" | 31 | #include "documentdatadb.h" | ||
31 | #include "mtimedb.h" | 32 | #include "mtimedb.h" | ||
32 | 33 | | |||
▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Line(s) | 99 | if (rc) { | |||
99 | m_env = nullptr; | 100 | m_env = nullptr; | ||
100 | return false; | 101 | return false; | ||
101 | } | 102 | } | ||
102 | 103 | | |||
103 | /** | 104 | /** | ||
104 | * maximal number of allowed named databases, must match number of databases we create below | 105 | * maximal number of allowed named databases, must match number of databases we create below | ||
105 | * each additional one leads to overhead | 106 | * each additional one leads to overhead | ||
106 | */ | 107 | */ | ||
107 | mdb_env_set_maxdbs(m_env, 12); | 108 | mdb_env_set_maxdbs(m_env, 13); | ||
bruns: later ... | |||||
108 | 109 | | |||
109 | /** | 110 | /** | ||
110 | * size limit for database == size limit of mmap | 111 | * size limit for database == size limit of mmap | ||
111 | * use 1 GB on 32-bit, use 256 GB on 64-bit | 112 | * use 1 GB on 32-bit, use 256 GB on 64-bit | ||
112 | */ | 113 | */ | ||
113 | const size_t maximalSizeInBytes = size_t((sizeof(size_t) == 4) ? 1 : 256) * size_t(1024) * size_t(1024) * size_t(1024); | 114 | const size_t maximalSizeInBytes = size_t((sizeof(size_t) == 4) ? 1 : 256) * size_t(1024) * size_t(1024) * size_t(1024); | ||
114 | mdb_env_set_mapsize(m_env, maximalSizeInBytes); | 115 | mdb_env_set_mapsize(m_env, maximalSizeInBytes); | ||
115 | 116 | | |||
Show All 24 Lines | 138 | if (mode != CreateDatabase) { | |||
140 | if (rc) { | 141 | if (rc) { | ||
141 | mdb_env_close(m_env); | 142 | mdb_env_close(m_env); | ||
142 | m_env = nullptr; | 143 | m_env = nullptr; | ||
143 | return false; | 144 | return false; | ||
144 | } | 145 | } | ||
145 | 146 | | |||
146 | m_dbis.postingDbi = PostingDB::open(txn); | 147 | m_dbis.postingDbi = PostingDB::open(txn); | ||
147 | m_dbis.positionDBi = PositionDB::open(txn); | 148 | m_dbis.positionDBi = PositionDB::open(txn); | ||
149 | m_dbis.fuzzyDbi = FuzzyDB::open(txn); | ||||
148 | 150 | | |||
149 | m_dbis.docTermsDbi = DocumentDB::open("docterms", txn); | 151 | m_dbis.docTermsDbi = DocumentDB::open("docterms", txn); | ||
150 | m_dbis.docFilenameTermsDbi = DocumentDB::open("docfilenameterms", txn); | 152 | m_dbis.docFilenameTermsDbi = DocumentDB::open("docfilenameterms", txn); | ||
151 | m_dbis.docXattrTermsDbi = DocumentDB::open("docxatrrterms", txn); | 153 | m_dbis.docXattrTermsDbi = DocumentDB::open("docxatrrterms", txn); | ||
152 | 154 | | |||
153 | m_dbis.idTreeDbi = IdTreeDB::open(txn); | 155 | m_dbis.idTreeDbi = IdTreeDB::open(txn); | ||
154 | m_dbis.idFilenameDbi = IdFilenameDB::open(txn); | 156 | m_dbis.idFilenameDbi = IdFilenameDB::open(txn); | ||
155 | 157 | | |||
Show All 26 Lines | 181 | } else { | |||
182 | if (rc) { | 184 | if (rc) { | ||
183 | mdb_env_close(m_env); | 185 | mdb_env_close(m_env); | ||
184 | m_env = nullptr; | 186 | m_env = nullptr; | ||
185 | return false; | 187 | return false; | ||
186 | } | 188 | } | ||
187 | 189 | | |||
188 | m_dbis.postingDbi = PostingDB::create(txn); | 190 | m_dbis.postingDbi = PostingDB::create(txn); | ||
189 | m_dbis.positionDBi = PositionDB::create(txn); | 191 | m_dbis.positionDBi = PositionDB::create(txn); | ||
192 | m_dbis.fuzzyDbi = FuzzyDB::create(txn); | ||||
190 | 193 | | |||
191 | m_dbis.docTermsDbi = DocumentDB::create("docterms", txn); | 194 | m_dbis.docTermsDbi = DocumentDB::create("docterms", txn); | ||
192 | m_dbis.docFilenameTermsDbi = DocumentDB::create("docfilenameterms", txn); | 195 | m_dbis.docFilenameTermsDbi = DocumentDB::create("docfilenameterms", txn); | ||
193 | m_dbis.docXattrTermsDbi = DocumentDB::create("docxatrrterms", txn); | 196 | m_dbis.docXattrTermsDbi = DocumentDB::create("docxatrrterms", txn); | ||
194 | 197 | | |||
195 | m_dbis.idTreeDbi = IdTreeDB::create(txn); | 198 | m_dbis.idTreeDbi = IdTreeDB::create(txn); | ||
196 | m_dbis.idFilenameDbi = IdFilenameDB::create(txn); | 199 | m_dbis.idFilenameDbi = IdFilenameDB::create(txn); | ||
197 | 200 | | |||
Show All 40 Lines |
later ...