- The instance numbers are often much much bigger than the number
of actual packages, and the hash table grows automatically as needed
so there's no need to over-allocate at the start. Apply some
(fairly arbitrary) heuristics to limit the initial allocation size.
(cherry picked from commit
e40a7c61c422e79838226c69cb84f7a624fa6127)
db->_dbi[dbix] = dbi;
int verifyonly = (flags & RPMDB_FLAG_VERIFYONLY);
if (dbiType(dbi) == DBI_PRIMARY) {
- /* Allocate for current max header instance number + some reserve */
+ /* Allocate based on max header instance number + some reserve */
if (!verifyonly && (db->db_checked == NULL)) {
- db->db_checked = intHashCreate(1024 + pkgInstance(dbi, 0),
+ db->db_checked = intHashCreate(1024 + pkgInstance(dbi, 0) / 4,
uintId, uintCmp, NULL);
}
/* If primary got created, we can safely run without fsync */