summaryrefslogtreecommitdiff
path: root/libs/libmdbx/src/test/jitter.cc
diff options
context:
space:
mode:
authorLeonid Yuriev <leo@yuriev.ru>2020-10-08 02:02:18 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-10-09 16:50:37 +0300
commita519d4617ed83a2167a693ae87934e56889fef05 (patch)
tree85c3aea76fe15268fc0891cf18c328913c6d4347 /libs/libmdbx/src/test/jitter.cc
parentbc58e7ec8ef67c37b6d302eaa2e76deedec03106 (diff)
libmdbx: switch to original amalgamated source code (v0.9.1.18)
Amalgamated source code is the recommended form for embedding libmdbx in non-CMake build systems. This amalgamated version contains a minimum of files, is fully ready for use, and make impossible a number of errors. To upgrade or switch to a different version, just unpack to the `src` subdirectory a corresponding `libmdbx-amalgamated-X_Y_Z.zip` at the https://github.com/erthink/libmdbx/releases. For instance, the https://github.com/erthink/libmdbx/releases/download/v0.9.2/libmdbx-amalgamated-0_9_2.zip for the next release. -- Minimal changes have been made to the build configuration: 1. For use the standard `DllMain()` entry of libmdbx: - added the `MDBX_BUILD_SHARED_LIBRARY=1` option; - removed the `MDBX_CONFIG_MANUAL_TLS_CALLBACK` option; - deleted the `miranda.c` file containing only `DllMain()` with the `mdbx_dll_handle()` call, now this is done by the library itself. 2. Removed refs to extra files (that missing in the amalgamated source code): - for building `libmdbx.dll` only the `mdbx.h` and `mdbx.c` are used, but not `mdbx.c++` for a C++ API; - for building the `mdbx_chk`, `mdbx_load`, and `mdbx_dump` utilities only it own sources are used. -- Last libmdbx changes: - Fixed missing installation of `mdbx.h++`. - Fixed use of obsolete `__noreturn`. - Fixed use of `yield` instruction on ARM if unsupported. - Added pthread workaround for buggy toolchain/cmake/buildroot. - Fixed use of `pthread_yield()` for non-GLIBC. - Fixed use of `RegGetValueA()` on Windows 2000/XP. - Fixed use of `GetTickCount64()` on Windows 2000/XP. - Fixed opening DB on a network shares (in the exclusive mode). - Fixed copy&paste typos. - Fixed minor false-positive GCC warning.
Diffstat (limited to 'libs/libmdbx/src/test/jitter.cc')
-rw-r--r--libs/libmdbx/src/test/jitter.cc91
1 files changed, 0 insertions, 91 deletions
diff --git a/libs/libmdbx/src/test/jitter.cc b/libs/libmdbx/src/test/jitter.cc
deleted file mode 100644
index 71d58699de..0000000000
--- a/libs/libmdbx/src/test/jitter.cc
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright 2017-2020 Leonid Yuriev <leo@yuriev.ru>
- * and other libmdbx authors: please see AUTHORS file.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted only as authorized by the OpenLDAP
- * Public License.
- *
- * A copy of this license is available in the file LICENSE in the
- * top-level directory of the distribution or, alternatively, at
- * <http://www.OpenLDAP.org/license.html>.
- */
-
-#include "test.h"
-
-bool testcase_jitter::run() {
- int err;
- size_t upper_limit = config.params.size_upper;
- if (upper_limit < 1)
- upper_limit = config.params.size_now * 2;
-
- while (should_continue()) {
- jitter_delay();
- db_open();
-
- if (upper_limit < 1) {
- MDBX_envinfo info;
- err = mdbx_env_info_ex(db_guard.get(), txn_guard.get(), &info,
- sizeof(info));
- if (err)
- failure_perror("mdbx_env_info_ex()", err);
- upper_limit = (info.mi_geo.upper < INTPTR_MAX)
- ? (intptr_t)info.mi_geo.upper
- : INTPTR_MAX;
- }
-
- if (flipcoin()) {
- jitter_delay();
- txn_begin(true);
- fetch_canary();
- jitter_delay();
- txn_end(flipcoin());
- }
-
- const bool coin4size = flipcoin();
- jitter_delay();
- txn_begin(mode_readonly());
- jitter_delay();
- if (!mode_readonly()) {
- fetch_canary();
- update_canary(1);
- err = mdbx_env_set_geometry(
- db_guard.get(), -1, -1,
- coin4size ? upper_limit * 2 / 3 : upper_limit * 3 / 2, -1, -1, -1);
- if (err != MDBX_SUCCESS && err != MDBX_UNABLE_EXTEND_MAPSIZE &&
- err != MDBX_MAP_FULL && err != MDBX_TOO_LARGE)
- failure_perror("mdbx_env_set_geometry-1", err);
- }
- txn_end(flipcoin());
-
- err = mdbx_env_set_geometry(
- db_guard.get(), -1, -1,
- !coin4size ? upper_limit * 2 / 3 : upper_limit * 3 / 2, -1, -1, -1);
- if (err != MDBX_SUCCESS && err != MDBX_UNABLE_EXTEND_MAPSIZE &&
- err != MDBX_MAP_FULL && err != MDBX_TOO_LARGE)
- failure_perror("mdbx_env_set_geometry-2", err);
-
- if (flipcoin()) {
- jitter_delay();
- txn_begin(true);
- jitter_delay();
- txn_end(flipcoin());
- }
-
- jitter_delay();
- err =
- mdbx_env_set_geometry(db_guard.get(), -1, -1, upper_limit, -1, -1, -1);
- if (err != MDBX_SUCCESS && err != MDBX_UNABLE_EXTEND_MAPSIZE &&
- err != MDBX_MAP_FULL && err != MDBX_TOO_LARGE)
- failure_perror("mdbx_env_set_geometry-3", err);
-
- db_close();
-
- /* just 'align' nops with other tests with batching */
- const auto batching =
- std::max(config.params.batch_read, config.params.batch_write);
- report(std::max(1u, batching / 2));
- }
- return true;
-}