Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
HAMANO Tsukasa
OpenLDAP
Commits
66f2b7b2
Commit
66f2b7b2
authored
Oct 22, 2012
by
Howard Chu
Browse files
Make sure mdb_open flags are committed on main DB
If no data was modified in the txn, mdb_open flag changes were dropped.
parent
5f2ddb55
Changes
1
Hide whitespace changes
Inline
Side-by-side
libraries/libmdb/mdb.c
View file @
66f2b7b2
...
@@ -826,6 +826,7 @@ struct MDB_txn {
...
@@ -826,6 +826,7 @@ struct MDB_txn {
*/
*/
#define MDB_TXN_RDONLY 0x01
/**< read-only transaction */
#define MDB_TXN_RDONLY 0x01
/**< read-only transaction */
#define MDB_TXN_ERROR 0x02
/**< an error has occurred */
#define MDB_TXN_ERROR 0x02
/**< an error has occurred */
#define MDB_TXN_DIRTY 0x04
/**< must write, even if dirty list is empty */
/** @} */
/** @} */
unsigned
int
mt_flags
;
/**< @ref mdb_txn */
unsigned
int
mt_flags
;
/**< @ref mdb_txn */
/** Tracks which of the two meta pages was used at the start
/** Tracks which of the two meta pages was used at the start
...
@@ -2005,7 +2006,7 @@ mdb_txn_commit(MDB_txn *txn)
...
@@ -2005,7 +2006,7 @@ mdb_txn_commit(MDB_txn *txn)
return
EINVAL
;
return
EINVAL
;
}
}
if
(
!
txn
->
mt_u
.
dirty_list
[
0
].
mid
)
if
(
!
txn
->
mt_u
.
dirty_list
[
0
].
mid
&&
!
(
txn
->
mt_flags
&
MDB_TXN_DIRTY
)
)
goto
done
;
goto
done
;
DPRINTF
(
"committing txn %zu %p on mdbenv %p, root page %zu"
,
DPRINTF
(
"committing txn %zu %p on mdbenv %p, root page %zu"
,
...
@@ -6715,8 +6716,13 @@ int mdb_open(MDB_txn *txn, const char *name, unsigned int flags, MDB_dbi *dbi)
...
@@ -6715,8 +6716,13 @@ int mdb_open(MDB_txn *txn, const char *name, unsigned int flags, MDB_dbi *dbi)
/* main DB? */
/* main DB? */
if
(
!
name
)
{
if
(
!
name
)
{
*
dbi
=
MAIN_DBI
;
*
dbi
=
MAIN_DBI
;
if
(
flags
&
(
MDB_DUPSORT
|
MDB_REVERSEKEY
|
MDB_INTEGERKEY
))
if
(
flags
&
(
MDB_DUPSORT
|
MDB_REVERSEKEY
|
MDB_INTEGERKEY
))
{
txn
->
mt_dbs
[
MAIN_DBI
].
md_flags
|=
(
flags
&
(
MDB_DUPSORT
|
MDB_REVERSEKEY
|
MDB_INTEGERKEY
));
/* make sure flag changes get committed */
if
((
txn
->
mt_dbs
[
MAIN_DBI
].
md_flags
|
flags
)
!=
txn
->
mt_dbs
[
MAIN_DBI
].
md_flags
)
{
txn
->
mt_dbs
[
MAIN_DBI
].
md_flags
|=
(
flags
&
(
MDB_DUPSORT
|
MDB_REVERSEKEY
|
MDB_INTEGERKEY
));
txn
->
mt_flags
|=
MDB_TXN_DIRTY
;
}
}
mdb_default_cmp
(
txn
,
MAIN_DBI
);
mdb_default_cmp
(
txn
,
MAIN_DBI
);
return
MDB_SUCCESS
;
return
MDB_SUCCESS
;
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment