diff --git a/mdbx.h b/mdbx.h index 8d5265d4..9285b236 100644 --- a/mdbx.h +++ b/mdbx.h @@ -1683,6 +1683,8 @@ LIBMDBX_API int mdbx_limits_pgsize_min(void); LIBMDBX_API int mdbx_limits_pgsize_max(void); LIBMDBX_API intptr_t mdbx_limits_dbsize_min(intptr_t pagesize); LIBMDBX_API intptr_t mdbx_limits_dbsize_max(intptr_t pagesize); +LIBMDBX_API intptr_t mdbx_limits_keysize_max(intptr_t pagesize); +LIBMDBX_API intptr_t mdbx_limits_txnsize_max(intptr_t pagesize); /*----------------------------------------------------------------------------*/ /* attribute support functions for Nexenta */ diff --git a/src/mdbx.c b/src/mdbx.c index c5148a80..80e6435e 100644 --- a/src/mdbx.c +++ b/src/mdbx.c @@ -5037,14 +5037,7 @@ int __cold mdbx_env_get_maxkeysize(MDBX_env *env) { (((pagesize)-PAGEHDRSZ) / sizeof(pgno_t) - 1) int mdbx_get_maxkeysize(intptr_t pagesize) { - if (pagesize < 1) - pagesize = (intptr_t)mdbx_syspagesize(); - else if (unlikely(pagesize < (intptr_t)MIN_PAGESIZE || - pagesize > (intptr_t)MAX_PAGESIZE || - !mdbx_is_power2((size_t)pagesize))) - return -MDBX_EINVAL; - - return mdbx_maxkey(mdbx_nodemax(pagesize)); + return (int)mdbx_limits_keysize_max(pagesize); } static void __cold mdbx_setup_pagesize(MDBX_env *env, const size_t pagesize) { @@ -12540,6 +12533,17 @@ __cold intptr_t mdbx_limits_dbsize_max(intptr_t pagesize) { : (intptr_t)MAX_MAPSIZE; } +__cold intptr_t mdbx_limits_txnsize_max(intptr_t pagesize) { + if (pagesize < 1) + pagesize = (intptr_t)mdbx_syspagesize(); + else if (unlikely(pagesize < (intptr_t)MIN_PAGESIZE || + pagesize > (intptr_t)MAX_PAGESIZE || + !mdbx_is_power2((size_t)pagesize))) + return (MDBX_EINVAL > 0) ? -MDBX_EINVAL : MDBX_EINVAL; + + return pagesize * (MDBX_PNL_UM_SIZE - 1); +} + /*----------------------------------------------------------------------------*/ /* attribute support functions for Nexenta */