Commit Graph

10212 Commits

Author SHA1 Message Date
Panu Matilainen 8591f205f0 Move environment open "refcounting" to db_init() / db_fini() 2010-04-09 15:52:29 +03:00
Panu Matilainen f2957887fb And now lose db_use_env from rpmdb struct
- Environment is always used, shared if possible private otherwise
2010-04-09 15:06:59 +03:00
Panu Matilainen ba6b82d3fa Simplify the dbenv->open() flags shuffle
- We always create an environment. If we dont have permissions to create
  or join a shared environment, we use a private environment. Instead
  of trying to figure out what to do beforehand, retry dbenv->open()
  with different flags to see if it succeeds. This eliminates some
  potential races when others might create/remove the environment
  while we're pondering about appropriate flags.
- Lose the "create" bdb config option, this is something we always
  want to decide internally.
- Remove "force" bdb config option, DB_FORCE is dbenv->remove() option
  and its value clashes with DB_CREATE...
2010-04-09 14:53:31 +03:00
Panu Matilainen 72a36aed42 Move dbi_use_dbenv from dbi to rpmdb, this is a per-rpmdb setting 2010-04-09 11:16:37 +03:00
Panu Matilainen 6a22fb6e30 Move dbhome directory create/verify to openDatabase()
- all db opens must go through openDatabase(), no need to track this
  with a separate variable on each index open
2010-04-09 10:50:32 +03:00
Panu Matilainen 34b57de830 Eliminate DB_JOINENV usage and config option
- DB_JOINENV is a no-op since BDB >= 4.4
2010-04-08 16:15:16 +03:00
Panu Matilainen 4e51e58c23 Eliminate "thread" BDB option
- this is not something that users should be tweaking
- its never been enabled, leave it that way for now
2010-04-08 16:07:58 +03:00
Panu Matilainen 4f6281c2bb Lose redundant dbi_use_env check
- its always enabled when we get here, but might get turned off
  in the initialization process (at least for now)
2010-04-08 16:04:37 +03:00
Panu Matilainen 8f03db2c76 A little bit of sanity to dbiNew()
- lose the hysterical dbi_use_env condition and usedbenv option
  this is always enabled
- ensure mpool is always initialized, lose the config option (this
  is a mandatory BDB subsystem, not a bleeping configurable)
- let pagesize be what it is even when no configuration is present
- avoid overriding dbi_mmapsize and dbi_cachesize if set in the configuratio
- these are all per-environment, not per-dbi settings but for now...
2010-04-08 16:01:20 +03:00
Panu Matilainen 30068b5280 Eliminate exclusive and rdonly BDB configuration options
- we never want DB_CREATE to cause failure - let BDB create the
  db if it needs to, otherwise DB_CREATE doesn't do anything
- rdonly is decided elsewhere, not in bleeping configuration
2010-04-08 14:39:07 +03:00
Panu Matilainen eccf2b5f7e Mop up ancient BDB leftovers 2010-04-08 14:37:51 +03:00
Panu Matilainen 4b9bedce31 Eliminate BDB transaction tuning knobs from configuration
- we dont support transactions yet, and this stuff doesn't
  belong to "user configuration" anyhow, these are just useless
2010-04-08 14:36:55 +03:00
Panu Matilainen 216ca35d62 db_env_create() doesn't take any flags currently 2010-04-08 13:59:05 +03:00
Panu Matilainen d9691e7257 Remove per-dbi perms and configuration
- the file permissions are per-db global, no need to be able to
  speficy different modes for indexes
2010-04-08 13:46:13 +03:00
Panu Matilainen f70a4e6105 Remove per-dbi mode and configuration
- read/write/create mode is global to the entire db, either its
  just readonly or its not
- this doesn't belong to configuration
2010-04-08 13:40:37 +03:00
Panu Matilainen 72a472bdcd Require BDB >= 4.5 for sanity's sake
- replace unused feature tests in configure.ac with a simple version check
2010-04-08 12:33:19 +03:00
Panu Matilainen 946f17a9f8 Remove unused dbi_txnid member from dbiIndex
- transactions aren't currently used, we'll need txnid handles eventually
  but the dbi is unlikely to be the right level to store this, add
  where actually needed when the time comes
2010-04-08 10:53:08 +03:00
Panu Matilainen 321925a18d db_create() doesn't take any flags currently 2010-04-08 10:31:00 +03:00
Panu Matilainen 02a13bf65e Eliminate dbiIndexNewItem()
- this is just simple struct with no special allocation, and contents
  are memcpy()'ed so theres no need to malloc it
2010-04-08 09:10:13 +03:00
Panu Matilainen 2771913363 Change nextInstance() to permit retrieval too, use it for bitmap alloc
- The "was this verified already" bitmap uses header instance numbers
  which are monotonically increasing and can be much much larger than
  the number of actually installed headers. Grab the current instance
  number for a better idea how much we'll at least need.
- Throw out the db stats based dbiNumKeys(), this doesn't have the
  kind of performance penalty that stats have and suits our purposes
  better anyway
2010-04-07 13:23:03 +03:00
Panu Matilainen 81754356cd Make rpmdbAdd() and rpmdbRemove() internal-only
- all additions and removals to the rpmdb need to go through the
  transaction machinery, these are very low-level functions that
  API users have no business messing with
2010-04-07 12:43:20 +03:00
Panu Matilainen e9c767a8d7 Stash rpmdb struct definition out of sight into dbi.h
- not perhaps the ideal place for it but the backend level needs
  access to the main db in several places anyway, and this leaves
  rpmdb_internal.h clear for internal-only APIs
2010-04-07 12:38:20 +03:00
Panu Matilainen e16695e932 Unify rpmdbAdd/Remove() interfaces
- rpmdbRemove() takes now a header as argument too - we need both
  the header number and the header itself there anyway, so might as
  well use the header we already have instead of flipping through backwards
  hoops to get to it
2010-04-07 12:28:02 +03:00
Panu Matilainen 037538f00f Eliminate the headerCheck() foo from rpmdbAdd/Remove()
- for rpmdbRemove() these have been completely unused, and for rpmdbAdd()
  the higher levels have had more than one chance of verifying the
  header if checking is enabled in the transaction set
2010-04-07 12:12:51 +03:00
Panu Matilainen 475391dc58 Lift RPMDBI_PACKAGES handling from db add/remove to separate helper
- Remove vs add is rather similar, unify the copy-pasteish code
- Be a bit more careful about error returns from the primary db functions
2010-04-07 11:11:55 +03:00
Panu Matilainen 0bb48a56b8 Lift header instance number figuring out of rpmdbAdd() to helper function 2010-04-07 10:04:47 +03:00
Panu Matilainen a5039afa3f Verify header sanity as the first thing in rpmdbAdd()
- avoid allocating header instance for something that we'd fail to add
- avoid possibly adding data to indexes even if adding the header
  itself fails, duh
2010-04-07 10:03:28 +03:00
Panu Matilainen f40ea7e359 Move header INSTALLTID manipulation out of rpmdbAdd() 2010-04-07 08:35:14 +03:00
Panu Matilainen e23a2bf097 Remove unused require- and provideversion indexes
- For completely unused indexes, these are fairly expensive too
2010-04-07 07:49:32 +03:00
Panu Matilainen b3f5136cdf Eliminate redundant/bogus temporary variable shuffling
- This fetches the special key zero which is used for bookkeeping of
  header "instance" numbers, the actual header to be stored is NOT
  relevant here
- keyp, keylen, datap and datalen are just redundant fluff, manipulate
  the key and data DBT directly
2010-04-07 06:55:15 +03:00
Panu Matilainen 2a52cc81f9 Remove unused _DBI defines 2010-04-06 13:13:14 +03:00
Panu Matilainen 3437ad49b9 Lose unused fluff from openDatabase()
- As RPMDBI_PACKAGES is always the first index, the for-loop never
  did anything else than open the Packages db and exit with success/fail.
  For the same reason RPMDB_FLAG_MINIMAL didn't do anything at all here,
  lose the unnecessary flag..
2010-04-06 13:09:34 +03:00
Panu Matilainen 7b4da15c66 Eliminate static _rebuildinprogress hack, use per-db flag instead
- replace unused RPMDB_FLAG_CHROOT with RPMDB_FLAG_REBUILD and pass
  around as necessary
2010-04-06 13:07:23 +03:00
Panu Matilainen cd12be9dbb Bury rpmdb flags inside rpmdb.c, not used by anything outside it 2010-04-06 13:07:08 +03:00
Panu Matilainen 46de075bfa Unbreak --rebuilddb
- managed to bust up the rebuilddb-path generation once again in commit
  890cea56c9, doh
- make the intended logic more obviours
2010-04-06 11:35:33 +03:00
Yuri Chornoivan fc46b4ecef l10n: Updates to Ukrainian (uk) translation
Transmitted-via: Transifex (www.transifex.net)
2010-04-05 07:22:31 +00:00
Misha Shnurapet b663b6b2ef l10n: Updates to Russian (ru) translation
Transmitted-via: Transifex (www.transifex.net)
2010-04-02 12:55:37 +00:00
Panu Matilainen 8e9d2aff44 Nuke bogus comments + related NULL-checks
- db->_dbi cannot be NULL if db is not NULL, it's allocated at
  newRpmDB() and freed in rpmdbClose() and nothing else touches it
2010-04-01 18:19:49 +03:00
Panu Matilainen ca2c8172d1 Clean up rpmdb struct initialization
- lose the dumb template assignment and related defines
2010-04-01 17:59:38 +03:00
Panu Matilainen 2ba47e8e5b Lose unused static initialization foo 2010-04-01 17:49:07 +03:00
Panu Matilainen 91953f1f93 Clean up formatting in rpmdbCountPackages() (just cosmetics) 2010-04-01 16:58:36 +03:00
Panu Matilainen 76b36936ea Remove unused rpmdbCloseDBI()
- this was used by the Depends temporary db hack, forcing it
  to be exposed in the API... not anymore
2010-04-01 16:29:38 +03:00
Panu Matilainen fed962f059 Generate package database statistics on close & make use of it on open
- Turn dbiStat() into more useful: return the number of keys in the
  index, hiding away the BDB internal access method stuff into the backend
- Force statistics gathering at Packages db close, take advantage of
  that when its opened to get a fairly accurate count of packages for
  initial "header verified" bitmap allocation. Previously DB_FAST_STAT
  was used on open but it never returns anything when no stats have
  been previously collected, hence the need for the expensive slow stat.
- The performance hit from stat generation is hardly worth it for
  the bitmap allocation alone, but lets see if there are other uses...
- Also gets rid of dbi_stats member, this is not particularly useful
2010-04-01 15:34:08 +03:00
Panu Matilainen 86348031c2 Lose "support" for truly ancient BDB versions
- BDB >= 4.3 is required now, and even thats several years old
2010-04-01 13:55:28 +03:00
Panu Matilainen 3bd1951bbd Rename dbiOpen() + dbiOpenDB() to make their layer obvious from the name
- dbiOpen() in rpmdb.c operates on "rpmdb layer" so calling it
  rpmdbOpenIndex(), dbiOpenDB() on the other hand is the lowest level
  backend thing, which is now called dbiOpen() to be in line with
  the other operations like dbiClose()
2010-04-01 12:50:33 +03:00
Panu Matilainen a7b08b448b Pass rpmdb to dbiFindByLabel() / rpmdbiFindMatch() directly
- avoids having to go backwards from the dbi to rpmdb when we very well
  have the rpmdb handle at hand here...
2010-04-01 12:34:59 +03:00
Panu Matilainen 298812d338 Eliminate dbi_rpmtag member from dbiIndex struct
- the backend doesn't care about the tag beyond initialization,
  and the tag is only used for error messages from rpmdb layer which
  already knows what the tag is
2010-04-01 12:25:04 +03:00
Panu Matilainen c8cfbc941b Define + use enum for primary/secondary index types + api to get it
- no functional changes, making the type more obvious than
  "case 2*sizeof(int32_t):"
2010-04-01 12:03:14 +03:00
Panu Matilainen 7b666ce208 Rename the dbi access method member dbi_type -> dbi_dbtype
- make it more obvious what it is
2010-04-01 11:47:15 +03:00
Panu Matilainen f30e6d409a Split dbiIndex out of rpmdb_internal.h into header of its own
- the dbi presents an internal api of its own, and deserves a separate
  header (baby steps to making dbiIndex opaque outside the backend)
- move dbiVerify() to the backend where it belongs
- mark all the dbiFoo() functions as internal
2010-04-01 11:13:37 +03:00