Updates to support libmdbx 0.12.x.
Also, close some hanging open transactions in some error states. FossilOrigin-Name: 9582fff0788d3f78e9b33f292a2c48afeac32587c89496a5a7d5e97a98085683
This commit is contained in:
parent
080235d55a
commit
7fc1ebb408
4 changed files with 42 additions and 6 deletions
22
.solargraph.yml
Normal file
22
.solargraph.yml
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
---
|
||||||
|
include:
|
||||||
|
- "**/*.rb"
|
||||||
|
exclude:
|
||||||
|
- spec/**/*
|
||||||
|
- test/**/*
|
||||||
|
- vendor/**/*
|
||||||
|
- ".bundle/**/*"
|
||||||
|
require: []
|
||||||
|
domains: []
|
||||||
|
reporters:
|
||||||
|
- rubocop
|
||||||
|
- require_not_found
|
||||||
|
formatter:
|
||||||
|
rubocop:
|
||||||
|
cops: safe
|
||||||
|
except: []
|
||||||
|
only: []
|
||||||
|
extra_args: []
|
||||||
|
require_paths: []
|
||||||
|
plugins: []
|
||||||
|
max_files: 5000
|
||||||
|
|
@ -423,7 +423,7 @@ development.
|
||||||
## Reporting Issues
|
## Reporting Issues
|
||||||
|
|
||||||
Tests are performed against the latest stable MRI Ruby, and I endeavor to test
|
Tests are performed against the latest stable MRI Ruby, and I endeavor to test
|
||||||
against the latest stable libmdbx (as of this writing, the 0.11.x versioning),
|
against the latest stable libmdbx (as of this writing, the 0.12.x versioning),
|
||||||
on both x86 and ARM chipsets.
|
on both x86 and ARM chipsets.
|
||||||
|
|
||||||
Things may work for you in other environments - I'm just not matrix testing
|
Things may work for you in other environments - I'm just not matrix testing
|
||||||
|
|
|
||||||
|
|
@ -168,6 +168,12 @@ rmdbx_open_env( VALUE self )
|
||||||
rb_raise( rmdbx_eDatabaseError, "mdbx_env_open: (%d) %s", rc, mdbx_strerror(rc) );
|
rb_raise( rmdbx_eDatabaseError, "mdbx_env_open: (%d) %s", rc, mdbx_strerror(rc) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Force populate the db->dbi handle. Under 0.12.x, getting a
|
||||||
|
* 'permission denied' doing this for the first access with a RDONLY
|
||||||
|
* for some reason. */
|
||||||
|
rmdbx_open_txn( db, MDBX_TXN_READWRITE );
|
||||||
|
rmdbx_close_txn( db, RMDBX_TXN_ROLLBACK );
|
||||||
|
|
||||||
db->state.open = 1;
|
db->state.open = 1;
|
||||||
return Qtrue;
|
return Qtrue;
|
||||||
}
|
}
|
||||||
|
|
@ -189,8 +195,10 @@ rmdbx_clear( VALUE self )
|
||||||
rmdbx_open_txn( db, MDBX_TXN_READWRITE );
|
rmdbx_open_txn( db, MDBX_TXN_READWRITE );
|
||||||
int rc = mdbx_drop( db->txn, db->dbi, false );
|
int rc = mdbx_drop( db->txn, db->dbi, false );
|
||||||
|
|
||||||
if ( rc != MDBX_SUCCESS )
|
if ( rc != MDBX_SUCCESS ) {
|
||||||
|
rmdbx_close_txn( db, RMDBX_TXN_ROLLBACK );
|
||||||
rb_raise( rmdbx_eDatabaseError, "mdbx_drop: (%d) %s", rc, mdbx_strerror(rc) );
|
rb_raise( rmdbx_eDatabaseError, "mdbx_drop: (%d) %s", rc, mdbx_strerror(rc) );
|
||||||
|
}
|
||||||
|
|
||||||
rmdbx_close_txn( db, RMDBX_TXN_COMMIT );
|
rmdbx_close_txn( db, RMDBX_TXN_COMMIT );
|
||||||
|
|
||||||
|
|
@ -229,8 +237,10 @@ rmdbx_drop( VALUE self, VALUE name )
|
||||||
rmdbx_open_txn( db, MDBX_TXN_READWRITE );
|
rmdbx_open_txn( db, MDBX_TXN_READWRITE );
|
||||||
int rc = mdbx_drop( db->txn, db->dbi, true );
|
int rc = mdbx_drop( db->txn, db->dbi, true );
|
||||||
|
|
||||||
if ( rc != MDBX_SUCCESS )
|
if ( rc != MDBX_SUCCESS ) {
|
||||||
|
rmdbx_close_txn( db, RMDBX_TXN_ROLLBACK );
|
||||||
rb_raise( rmdbx_eDatabaseError, "mdbx_drop: (%d) %s", rc, mdbx_strerror(rc) );
|
rb_raise( rmdbx_eDatabaseError, "mdbx_drop: (%d) %s", rc, mdbx_strerror(rc) );
|
||||||
|
}
|
||||||
|
|
||||||
rmdbx_close_txn( db, RMDBX_TXN_COMMIT );
|
rmdbx_close_txn( db, RMDBX_TXN_COMMIT );
|
||||||
|
|
||||||
|
|
@ -238,6 +248,12 @@ rmdbx_drop( VALUE self, VALUE name )
|
||||||
db->subdb = NULL;
|
db->subdb = NULL;
|
||||||
rmdbx_close_dbi( db ); /* ensure next access is not in the defunct subdb */
|
rmdbx_close_dbi( db ); /* ensure next access is not in the defunct subdb */
|
||||||
|
|
||||||
|
/* Force populate the new db->dbi handle. Under 0.12.x, getting a
|
||||||
|
* 'permission denied' doing this for the first access with a RDONLY
|
||||||
|
* for some reason. */
|
||||||
|
rmdbx_open_txn( db, MDBX_TXN_READWRITE );
|
||||||
|
rmdbx_close_txn( db, RMDBX_TXN_ROLLBACK );
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -830,7 +846,7 @@ rmdbx_stats( VALUE self )
|
||||||
* db.clone => [copy of db]
|
* db.clone => [copy of db]
|
||||||
*
|
*
|
||||||
* Copy the object (clone/dup). The returned copy is closed and needs
|
* Copy the object (clone/dup). The returned copy is closed and needs
|
||||||
* to be reopened before use. This function likely has limited use,
|
* to be reopened before use. This function likely has limited use,
|
||||||
* considering you can't open two handles within the same process.
|
* considering you can't open two handles within the same process.
|
||||||
*/
|
*/
|
||||||
static VALUE rmdbx_init_copy( VALUE copy, VALUE orig )
|
static VALUE rmdbx_init_copy( VALUE copy, VALUE orig )
|
||||||
|
|
|
||||||
|
|
@ -58,8 +58,6 @@ rmdbx_log( const char *level, const char *fmt, va_dcl )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* MDBX initialization
|
* MDBX initialization
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue