Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8a47404

Browse files
committed
Add wrapper for DBEnv.set_tx_timeout method to allow time based DB_RECOVER
1 parent b941825 commit 8a47404

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

Modules/_bsddb.c

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
#error "eek! DBVER can't handle minor versions > 9"
9898
#endif
9999

100-
#define PY_BSDDB_VERSION "4.4.1"
100+
#define PY_BSDDB_VERSION "4.4.2"
101101
static char *rcs_id = "$Id$";
102102

103103

@@ -4164,9 +4164,23 @@ DBEnv_set_tx_max(DBEnvObject* self, PyObject* args)
41644164
return NULL;
41654165
CHECK_ENV_NOT_CLOSED(self);
41664166

4167-
MYDB_BEGIN_ALLOW_THREADS;
41684167
err = self->db_env->set_tx_max(self->db_env, max);
4169-
MYDB_END_ALLOW_THREADS;
4168+
RETURN_IF_ERR();
4169+
RETURN_NONE();
4170+
}
4171+
4172+
4173+
static PyObject*
4174+
DBEnv_set_tx_timestamp(DBEnvObject* self, PyObject* args)
4175+
{
4176+
int err;
4177+
time_t stamp;
4178+
4179+
if (!PyArg_ParseTuple(args, "i:set_tx_timestamp", &stamp))
4180+
return NULL;
4181+
CHECK_ENV_NOT_CLOSED(self);
4182+
4183+
err = self->db_env->set_tx_timestamp(self->db_env, &stamp);
41704184
RETURN_IF_ERR();
41714185
RETURN_NONE();
41724186
}
@@ -4723,6 +4737,7 @@ static PyMethodDef DBEnv_methods[] = {
47234737
{"txn_checkpoint", (PyCFunction)DBEnv_txn_checkpoint, METH_VARARGS},
47244738
{"txn_stat", (PyCFunction)DBEnv_txn_stat, METH_VARARGS},
47254739
{"set_tx_max", (PyCFunction)DBEnv_set_tx_max, METH_VARARGS},
4740+
{"set_tx_timestamp", (PyCFunction)DBEnv_set_tx_timestamp, METH_VARARGS},
47264741
{"lock_detect", (PyCFunction)DBEnv_lock_detect, METH_VARARGS},
47274742
{"lock_get", (PyCFunction)DBEnv_lock_get, METH_VARARGS},
47284743
{"lock_id", (PyCFunction)DBEnv_lock_id, METH_VARARGS},

0 commit comments

Comments
 (0)