Commit f5143f99 authored by Ryan Tandy's avatar Ryan Tandy Committed by Quanah Gibson-Mount
Browse files

ITS#7878 Replace uint32_t with unsigned in back-mdb

init.c: align mi_dbenv_flags and flags with mdb_dbi_open, which declares
flags as unsigned int.

search.c: align mi_rtxn_size with ARG_UINT; adjust ww_ctx.nentries to
silence a warning about signed/unsigned comparison.

config.c: parse checkpoint config more carefully. Reject negative or
unreasonably large values for kbytes and minutes. Ensure both values are
parsed successfully before making any changes.

Fixes a compilation failure under MinGW, where stdint.h types are not
implicitly pulled in by other headers.
parent 6fe9b0c6
......@@ -66,9 +66,8 @@ struct mdb_info {
MDB_env *mi_dbenv;
/* DB_ENV parameters */
/* The DB_ENV can be tuned via DB_CONFIG */
char *mi_dbenv_home;
uint32_t mi_dbenv_flags;
unsigned mi_dbenv_flags;
int mi_dbenv_mode;
size_t mi_mapsize;
......@@ -81,10 +80,10 @@ struct mdb_info {
int mi_search_stack_depth;
int mi_readers;
uint32_t mi_rtxn_size;
unsigned mi_rtxn_size;
int mi_txn_cp;
uint32_t mi_txn_cp_min;
uint32_t mi_txn_cp_kbyte;
unsigned mi_txn_cp_min;
unsigned mi_txn_cp_kbyte;
struct re_s *mi_txn_cp_task;
struct re_s *mi_index_task;
......
......@@ -521,22 +521,22 @@ mdb_cf_gen( ConfigArgs *c )
}
break;
case MDB_CHKPT: {
long l;
mdb->mi_txn_cp = 1;
if ( lutil_atolx( &l, c->argv[1], 0 ) != 0 ) {
unsigned cp_kbyte, cp_min;
if ( lutil_atoux( &cp_kbyte, c->argv[1], 0 ) != 0 ) {
fprintf( stderr, "%s: "
"invalid kbyte \"%s\" in \"checkpoint\".\n",
c->log, c->argv[1] );
return 1;
}
mdb->mi_txn_cp_kbyte = l;
if ( lutil_atolx( &l, c->argv[2], 0 ) != 0 ) {
if ( lutil_atoux( &cp_min, c->argv[2], 0 ) != 0 ) {
fprintf( stderr, "%s: "
"invalid minutes \"%s\" in \"checkpoint\".\n",
c->log, c->argv[2] );
return 1;
}
mdb->mi_txn_cp_min = l;
mdb->mi_txn_cp = 1;
mdb->mi_txn_cp_kbyte = cp_kbyte;
mdb->mi_txn_cp_min = cp_min;
/* If we're in server mode and time-based checkpointing is enabled,
* submit a task to perform periodic checkpoints.
*/
......
......@@ -85,7 +85,7 @@ mdb_db_open( BackendDB *be, ConfigReply *cr )
int rc, i;
struct mdb_info *mdb = (struct mdb_info *) be->be_private;
struct stat stat1;
uint32_t flags;
unsigned flags;
char *dbhome;
MDB_txn *txn;
......
......@@ -331,7 +331,7 @@ typedef struct ww_ctx {
ID key;
MDB_val data;
int flag;
int nentries;
unsigned nentries;
} ww_ctx;
/* ITS#7904 if we get blocked while writing results to client,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment