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 { ...@@ -66,9 +66,8 @@ struct mdb_info {
MDB_env *mi_dbenv; MDB_env *mi_dbenv;
/* DB_ENV parameters */ /* DB_ENV parameters */
/* The DB_ENV can be tuned via DB_CONFIG */
char *mi_dbenv_home; char *mi_dbenv_home;
uint32_t mi_dbenv_flags; unsigned mi_dbenv_flags;
int mi_dbenv_mode; int mi_dbenv_mode;
size_t mi_mapsize; size_t mi_mapsize;
...@@ -81,10 +80,10 @@ struct mdb_info { ...@@ -81,10 +80,10 @@ struct mdb_info {
int mi_search_stack_depth; int mi_search_stack_depth;
int mi_readers; int mi_readers;
uint32_t mi_rtxn_size; unsigned mi_rtxn_size;
int mi_txn_cp; int mi_txn_cp;
uint32_t mi_txn_cp_min; unsigned mi_txn_cp_min;
uint32_t mi_txn_cp_kbyte; unsigned mi_txn_cp_kbyte;
struct re_s *mi_txn_cp_task; struct re_s *mi_txn_cp_task;
struct re_s *mi_index_task; struct re_s *mi_index_task;
......
...@@ -521,22 +521,22 @@ mdb_cf_gen( ConfigArgs *c ) ...@@ -521,22 +521,22 @@ mdb_cf_gen( ConfigArgs *c )
} }
break; break;
case MDB_CHKPT: { case MDB_CHKPT: {
long l; unsigned cp_kbyte, cp_min;
mdb->mi_txn_cp = 1; if ( lutil_atoux( &cp_kbyte, c->argv[1], 0 ) != 0 ) {
if ( lutil_atolx( &l, c->argv[1], 0 ) != 0 ) {
fprintf( stderr, "%s: " fprintf( stderr, "%s: "
"invalid kbyte \"%s\" in \"checkpoint\".\n", "invalid kbyte \"%s\" in \"checkpoint\".\n",
c->log, c->argv[1] ); c->log, c->argv[1] );
return 1; return 1;
} }
mdb->mi_txn_cp_kbyte = l; if ( lutil_atoux( &cp_min, c->argv[2], 0 ) != 0 ) {
if ( lutil_atolx( &l, c->argv[2], 0 ) != 0 ) {
fprintf( stderr, "%s: " fprintf( stderr, "%s: "
"invalid minutes \"%s\" in \"checkpoint\".\n", "invalid minutes \"%s\" in \"checkpoint\".\n",
c->log, c->argv[2] ); c->log, c->argv[2] );
return 1; 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, /* If we're in server mode and time-based checkpointing is enabled,
* submit a task to perform periodic checkpoints. * submit a task to perform periodic checkpoints.
*/ */
......
...@@ -85,7 +85,7 @@ mdb_db_open( BackendDB *be, ConfigReply *cr ) ...@@ -85,7 +85,7 @@ mdb_db_open( BackendDB *be, ConfigReply *cr )
int rc, i; int rc, i;
struct mdb_info *mdb = (struct mdb_info *) be->be_private; struct mdb_info *mdb = (struct mdb_info *) be->be_private;
struct stat stat1; struct stat stat1;
uint32_t flags; unsigned flags;
char *dbhome; char *dbhome;
MDB_txn *txn; MDB_txn *txn;
......
...@@ -331,7 +331,7 @@ typedef struct ww_ctx { ...@@ -331,7 +331,7 @@ typedef struct ww_ctx {
ID key; ID key;
MDB_val data; MDB_val data;
int flag; int flag;
int nentries; unsigned nentries;
} ww_ctx; } ww_ctx;
/* ITS#7904 if we get blocked while writing results to client, /* 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