diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 38ca0aff0..000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,22 +0,0 @@ -version: 2 -jobs: - build: - branches: - ignore: - - gh-pages - docker: - - image: circleci/buildpack-deps:20.04 - environment: - - TESTDB: /tmp/test.db - - TESTLOG: /tmp/test.log - steps: - - checkout - - run: ulimit -c unlimited && MDBX_BUILD_OPTIONS="-DNDEBUG=1 -DMDBX_FORCE_ASSERTIONS=1" make test-ubsan - - run: - command: | - mkdir -p /tmp/artifacts - mv -t /tmp/artifacts $TESTLOG $TESTDB core.* - when: on_fail - - store_artifacts: - path: /tmp/artifacts - destination: test-artifacts diff --git a/.cirrus.yml b/.cirrus.yml deleted file mode 100644 index e0b3dc222..000000000 --- a/.cirrus.yml +++ /dev/null @@ -1,6 +0,0 @@ -freebsd_instance: - image_family: freebsd-12-1-snap - -task: - install_script: pkg install -y gmake bash git - script: git fetch --tags --force && gmake MDBX_BUILD_OPTIONS="-DNDEBUG=1 -DMDBX_FORCE_ASSERTIONS=1" check diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index f0bf916c5..000000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1,12 +0,0 @@ -# These are supported funding model platforms - -github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] -patreon: # Replace with a single Patreon username -open_collective: # Replace with a single Open Collective username -ko_fi: # Replace with a single Ko-fi username -tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel -community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry -liberapay: # Replace with a single Liberapay username -issuehunt: # Replace with a single IssueHunt username -otechie: # Replace with a single Otechie username -custom: ['https://sobe.ru/na/libmdbx'] diff --git a/.github/actions/spelling/excludes.txt b/.github/actions/spelling/excludes.txt deleted file mode 100644 index b04800cb4..000000000 --- a/.github/actions/spelling/excludes.txt +++ /dev/null @@ -1,11 +0,0 @@ -\.def$ -^AUTHORS$ -^\.github/FUNDING\.yml$ -^\.github/actions/spelling/ -^\.github/workflows/ci\.yml$ -^\.github/workflows/coverity\.yml$ -^\.github/workflows/doxygen-github-pages\.yml$ -^\.gitignore$ -^\.travis\.yml$ -^packages/buildroot/ -^CMakeSettings\.json$ diff --git a/.github/actions/spelling/expect.txt b/.github/actions/spelling/expect.txt deleted file mode 100644 index 77f7d3a63..000000000 --- a/.github/actions/spelling/expect.txt +++ /dev/null @@ -1,2030 +0,0 @@ -aarch -abcdef -abf -abra -ABRT -abstime -ACI -acision -AClass -adata -addprefix -addressof -addsuffix -addtogroup -advapi -Affero -ahupowerdns -ahutils -ailfast -Akhunov -Akula -Aleksey -alevel -Alexey -alexey -Alfke -alignas -alignof -alldbs -ALLDUPS -ALLEXTERNALS -ALLINPUT -allleaf -alloc -alloca -ALLOCLEN -allones -ALLPOSTMESSAGE -allthrough -alphabase -ALRM -altlinux -AMAX -amd -amsmath -ANamespace -anf -ao -Apc -api -APIENTRY -appenda -APPENDDUP -appflag -apps -appveyor -argc -ARGN -args -argv -ARMEB -ARMEL -ARMT -Artem -asan -Ashikhmin -asis -asm -asprintf -aspx -assection -AstraLinux -astralinux -atal -atexit -atfork -attr -attrptr -ault -AUTOBRIEF -autodetection -autogen -AUTOLINK -autosync -avalue -AVPHYS -badend -badpage -bak -bareos -barrierattr -basetype -batchmode -bbolt -bcmp -bdb -beginchild -benaphore -betterem -bfd -bfin -biarch -bibtex -BIGDATA -bigdata -Binance -binance -bindir -binfmt -binutils -bitfield -bitmaps -bitmask -bitness -bitops -BITSIZE -blogger -blogs -blogspot -bootid -bootime -bootseq -bootsession -bootsessionuuid -boottime -botanicus -branchpage -brisson -brs -BSD's -bsdi -bsearch -bswap -btree -buf -buflen -bufsize -BUGLIST -bugzilla -buildflags -buildpack -buildroot -builtins -burtleburtle -byteorder -byteswap -bytevalue -bzero -cachectl -cacheflush -cacheline -cadabra -callergraph -callgraph -calloc -cas -casename -cassert -castis -castortech -cattr -cbegin -cch -CCompiler -cctype -cdefs -cdnjs -cdst -cend -CFG -CFLAGS -cgi -checkdata -CHECKOWNER -CHECKPID -chipitsine -chk -CHLD -chrono -ci -cifs -cinttypes -circleci -claude -climits -clockid -CLOEXEC -closefile -cloudflare -clz -clzl -clzll -cmake -cmakedefine -cmath -cmdline -cmikk -cmp -cntl -cntvct -CODEFILE -COLORSTYLE -colorwheel -compactified -compat -CONCAT -condattr -condpair -config -constexpr -constmeta -coprs -copyable -copydetails -copydoc -copyfd -copyfilerange -copythr -coredump -coreos -couchbase -countp -cout -coverity -cpack -cpflags -cplus -cplusplus -cpp -cppreference -cpuid -CROSSCOMPILING -crtdbg -csa -Csharp -CSource -csr -csrc -CSRSS -css -cstdarg -cstdatomic -cstddef -cstdint -cstr -cstring -ctags -ctest -cthr -ctl -CTORS -ctx -ctype -ctz -ctzl -currentkey -cwalk -cx -cxa -cxx -CXXFLAGS -CXXSTD -cygwin -daringfireball -databytes -datacmp -datalen -DATANAME -DATASIGN -datasync -dataview -datetime -DBC -dbenv -dbflags -dbfull -dbg -dbgeo -dbi -dbiflags -dbiseqs -dbistate -dbm -dbpath -dbs -dbsize -dbstate -DBT -dbuf -dbx -dcache -dcmp -dcount -dda -DDBI -ddfd -ddl -deadread -deadwrite -DEBIAN -debian -Debroux -debrouxl -debruijn -DECC -declspec -deepmask -defgroup -delaystart -Demakov -demangle -deno -DEPRECATEDLIST -deps -depthmask -deque -deref -deserialize -Desh -dest -DESTDIR -devtoolset -df -dgst -DHTML -diafile -dirname -DIRS -dirs -dirtylist -dirtylru -dirtyroom -diskutil -distclean -DKBUF -dkey -dlist -dll -dllexport -dllimport -dlltool -dmbarbour -DMC -dmi -docbook -docset -DODUMP -dont'sync -DONTCHANGE -DONTDUMP -DONTFORK -dontinclude -DONTNEED -dontwait -dotfile -DOTFONTPATH -dox -doxyfile -doxygen -doxygenversion -doxyindexer -doxyrules -doxysearch -Doxywizard -dpage -DPK -dpl -dprefix -DPs -dqiqg -dreamsxin -drv -drvfs -dsize -dso -dst -dsync -dtop -dtor -DUBOIS -dumpbyte -dumpmachine -dumpval -dupdata -dupdb -dupfixed -dupsort -DVAL -DVI -dw -DWORD -dwords -dxb -dxbfile -dylib -eacces -EAFNOSUPPORT -EAGAIN -EB -EBADF -EBADFD -EBADSIGN -EBUSY -eccf -ECLIPSEHELP -ecount -EDEADLK -EEXIST -EFAULT -EHa -EHc -EHsc -Ei -EIDRM -EINTR -EINVAL -EIO -EISDIR -ejdb -EKEYMISMATCH -elbrus -ELBRUSC -ELBRUSCXX -elif -elseif -emoji -EMSCRIPTEN -emscripten -EMULTIVAL -emulu -endcond -endef -endforeach -endian -endianness -endif -endl -endmacro -endmntent -endpgno -endutxent -enewcommand -ENODATA -ENOENT -ENOFILE -ENOIMPL -ENOLCK -ENOMEM -ENOPROTOOPT -ENOSPC -ENOSUPP -enosys -ENOTBLK -ENOTSUP -ENOTTY -ent -entbuf -enum -ENVCOPY -envflags -envinfo -ENVLIST -envmode -envname -envstat -EOPNOTSUPP -eot -EOTDONE -EOWNERDEAD -EPERM -EPIPE -erasevolume -EREMOTE -Erigon -EROFS -errcode -errno -errnum -ERRORCHECK -errored -erthink -esac -ethereum -eturn -etval -euo -Evensen -Evensen's -ewcommand -EWOULDBLOCK -Exa -exactkey -exactp -excpt -EXDEV -exe -executables -exename -exherbo -exitcode -EXPONENTA -expr -FADV -fadvise -failfast -fallthrough -FALLTHRU -FASTMATH -fastmutex -fastpath -fcntl -FCXX -fd -fdatasync -featuredarticles -fedorainfracloud -fedotov -FEEDNAME -feof -ferror -fetchm -FEXCEPTIONS -fflush -fflushall -fgetc -fgets -filehandle -FILELIST -fileno -FILEPATH -filesize -filesync -filesystem -filetime -fillfactor -Firefox -firstvalue -fixedpoint -FIXME -fjvallarino -flagbit -flg -Flibmdbx -flipcoin -flushall -FNO -FONTNAME -FONTPATH -FONTSIZE -forceinline -foreach -forestdb -fprintf -fputc -fputs -freebsd -freecount -freedb -freelist -freepages -freinfo -freopen -fromleft -FSCTL -fseek -FSM -fsname -FST -fstat -fstatfs -fstatvfs -fstype -fstypename -FSTYPSZ -fsync -ftok -ftol -ftp -ftruncate -FULLFSYNC -func -funlock -FUNWIND -furuseth -fuseblk -futex -futexes -gc -gcc -gcda -GCFREEZE -gcno -gcov -gcxfd -gdiplus -getenv -gethostid -gethostuuid -gethrtime -getlk -getmntent -getopt -getpagesize -getpid -getppid -getpshared -getres -getrusage -getspecific -gettime -getutxid -Gg -ggdb -gh -Gibibyte -gitdir -github -githubusercontent -gitignore -glibc -GLIBCXX -globals -gmail -gmake -gmx -gno -gnuabi -GNUC -GNUCC -GNUCXX -gnueabihf -gnumake -gotchas -gprof -graphviz -grayscales -grep -gtags -gz -gzip -hackage -HAGL -hallvard -hardcoded -haskell -HASSEMAPHORE -hdiutil -hdr -headcopy -Hedenfalk -Heiko -heirecka -Hewson -hexc -hh -hhc -hhk -hhp -hidecallergraph -hidecallgraph -hideinitializer -highload -HINSTANCE -hippeus -hkey -HKLM -hlp -HOfynt -hostid -HOSTUUID -hotfix -hpp -hppa -hpux -href -hrows -hsr -htags -htm -html -HTMLHELP -htobe -htole -http -Hubert's -hxx -hyc -hyperlink -hypotetic -IBERTY -IBMC -ibmxl -idempotence -idl -idx -ieeetr -ield -ietf -iex -IFBLK -IFCHR -ifdef -IFDIR -ifeq -IFIFO -IFLNK -IFMT -ifndef -ifneq -IFREG -IFSOCK -ignacio -iki -ilelock -iles -img -impl -IMPLIB -inblock -INCLUDEDIR -indx -INDXSIZE -ini -initd -INITED -inited -initialiser -inl -inlined -inplace -inprocess -INSTEADOF -integerdup -integerkey -interoperability -interprocedural -intlimits -intptr -intrin -intrinsics -inttypes -ioarena -IODQ -IOPs -iops -iostream -iov -iovcnt -iovec -ip -ipc -ipclock -IPHONE -ipo -ipp -iptr -IRGRP -IROTH -irst -IRUSR -IRWXG -IRWXO -IRWXU -isa -isatty -ISDIR -iset -ISOC -isode -isprint -ISREG -ISSET -isspace -issuecomment -istty -isxdigit -itanium -itc -itcl -Iu -IWGRP -IWOTH -IWUSR -IXGRP -IXOTH -ixx -jahewson -javadoc -javascript -Jax -jcd -Jenkins's -jgamble -jmp -jpg -json -kaiwetlesen -kbuf -Kerollmops -kerr -keybytes -keycase -keycmp -KEYEXIST -keygen -keygencase -keylen -keymode -keyptr -keysize -keyspace -keyvalue -killall -klaus -klen -KMGTPEZY -knipp -kp -kriszyp -ks -ksize -kstat -Kuntze -kurt -kuznik -kval -kwetlesen -Lanfranchi -largedata -largepage -lastbyte -lastest -lastvalue -lastword -Launay -lcc -lck -lckless -lcklist -LDAP -LDFLAGS -leafnode -Ledgerwatch -ledgerwatch -leetal -Leier -leisim -len -lenfast -Lenovo -leveldb -lfd -libasan -libbfd -libc -libclang -LIBCXX -libdir -liberr -libfpta -libiberty -libiconv -libkern -libm -libmdbx -libmera -libmithrildb -libpthread -libstdc -LIFORECLAIM -lineno -linkedin -linkmode -linux -lkstat -lld -LLONG -LLV -llvm -lmb -lmdb -lmdbx -LMEM -LNK -lnps -lntdll -LOBYTE -localtime -lockf -lockfile -lockinfo -LOCKNAME -locktable -LOGFILE -loglevel -longlived -LONGLONG -lowerbound -lowerboundvalue -LOWORD -LPCSTR -LPDWORD -LPFILETIME -lpsz -LPVOID -LPWSTR -lrint -lrt -lru -lsb -lseek -lsize -LSTATUS -LTCG -lto -lvl -lwsync -lyeager -lyuryev -lz -machdep -machineid -macos -MACROFILE -MADV -madvise -mahlonsmith -mailto -maindb -mainpage -maj -majflt -Makefiles -MAKEFLAGS -makeindex -MAKELANGID -MAKEVAR -malloc -malloc'ed -mallocation -malorny -MANPAGES -mapaddr -MAPASYNC -mapresize -mapsize -mapview -mathjax -mattr -MAXDATASIZE -maxdbs -maxed -maxgc -maxkey -maxkeysize -maxlen -maxname -maxnode -maxpg -maxreaders -maxrss -maxsize -maxspan -MAXSSIZE -maxval -maxvalsize -maxwith -MAYMOVE -mbarrier -mbstowcs -mcount -mcst -mday -MDB -mdbenv -mdbx -mdbxjni -MDFILE -mdx -Medvedev -Mega -mei -Meili -meilisearch -memalign -MEMB -memcheck -memchr -memcmp -memcpy -memmove -MEMORYCHECK -MEMORYSTATUSEX -MEMPOOL -memset -MEMSIZE -MERGESORT -metacharacter -metadata -metapage -mfctl -mfence -MFSNAMELEN -mfspr -MFSTYPENAMELEN -mftb -mftbu -mfunc -Mgold -microsoft -Mikkelson -minflt -MINGW -mingw -minimalistic -minkeys -minlen -MINSIZEREL -minval -minwith -MIPSEB -MIPSEL -miranda -misoptimization -mithril -Miximal -mkdir -mkey -MLHCPB -mlopn -mman -mmap -mmapped -mmapping -MML -mmove -mnt -mntent -mnttab -modtxnid -MODX -monoclock -monotime -monotine -mostlymangling -mostrecent -mov -MPOOL -mport -mrc -mreco -mremap -mresize -MRX -msc -mscfile -msdn -msgpack -msize -mst -msvc -msync -MSYS -mtab -mti -mul -multiarch -MULTILINE -multimap -MULTIOPEN -multivalue -munmap -Mup -musl -MUSTDIE -mutex -mutexattr -mutexes -mvalue -mvcc -MWERKS -mx -mycompany -myfile -myproject -MZNTD -nactors -namebuf -namedup -namelen -NAMELINK -namespace -nanosleep -narg -naumov -nbytes -ncpfs -NDEBUG -ndk -nelem -nentries -nessdb -newdata -newfd -newindx -newkey -newpgno -nexenta -nextkey -nextvalue -nf -nflags -nfs -nimdbx -nkey -nkeys -nlink -nn -NOACCESS -noaccount -nocache -NOCANDO -nocheckloglevel -nochk -NOCORE -NOCTTY -nodedata -NODEFAULTLIB -nodekey -nodemax -NODESIZE -NODUP -NODUPDATA -noexcept -NOFOLLOW -NOHDR -NOHUGEPAGE -noinline -NOLOCK -nomeminit -nometasync -NOMINMAX -nomount -nonblock -NONCONST -nondupsort -nonoptimal -NOOVERWRITE -nops -NOQEMU -nordahead -NOREPLACE -NORESERVE -noreturn -NOSANITIZE -nospill -nosubdir -nosync -NOTFOUND -notfound -nothrow -notls -notracking -NOWAIT -npages -npmjs -npos -npr -nproc -nptl -nreaders -nrepeat -nsize -NSPACES -nsr -nsubkeys -nswap -NTAPI -ntdll -nthreads -ntifs -ntpl -ntstatus -nttld -nullkey -nullptr -numdbs -numer -numkeys -numreaders -nvidia -nvv -nw -OBJC -OBJCXX -odl -odo -odr -Oem -Ofast -OFD -OFDLOCKS -offsetof -oksize -olddata -olen -Olog -OMG -OMG's -ominimal -omp -ondrej -onoff -onstack -onstask -oom -oomfunc -openfile -openldap -openmp -openssl -OPMASK -optarg -opterr -optind -optlen -optopt -optstring -OR'ed -OR'ing -orivej -ormat -orward -osal -osf -oskari -OSs -ostream -ostringstream -osubgrouping -osx -ote -oublock -OUTOFMEMORY -ov -overf -overrided -ovpage -pageable -pagecache -PAGECHECKS -pagehdr -PAGEHDRSZ -pagemap -pageno -pagenums -PAGEPERTURB -PAGEROOM -pageroom -pagetype -par -PARAMDOC -params -PARISC -parityll -PATCHLEVEL -pathbuf -patsubst -pattr -pb -pbuf -PBYTE -pcb -pchar -pcount -pcrf -PDB -pdf -pdflatex -pdst -pdw -Pelle -penv -perl -PERLMOD -perror -PFILE -pflags -pgcount -PGL -pgl -pglist -pgno -pgnumber -pgop -pgr -pgsize -pgstate -pgvisitor -pgwalk -PHANDLE -philipp -php -phtml -PHYSMEM -pid -pidsbuf -PIMAGE -pipefail -plainnat -plantuml -PLARGE -plugin -plusa -pmax -pmccntr -pmcntenset -pmedvedev -pmeta -pmr -pmuseren -pmwkaa -pn -png -pnl -POBJECT -poka -popd -popen -posix -Postgre -powerof -powerpc -ppc -pragma -pread -PREALLOC -prealloc -PREDEF -prefetch -Prefetcher -PREREQ -prerequirements -PRESORTED -prevk -prevkey -prevvalue -PRIa -PRId -PRIi -printf -prioritization -PRIu -prng -prno -proba -proces -procfs -progname -programdata -PROGRAMLISTING -projectbrief -projectlogo -projectname -projectnumber -propget -propput -PROT -prot -PSECTION -pshared -psrc -ptf -pthread -ptl -ptop -ptr -ptrdiff -ptrdouble -ptrfloat -ptsecurity -pushd -putc -putchar -putflags -pv -pvalue -PVOID -pwd -PWIM -PWIN -PWOF -pwrite -pwritev -pwsh -py -pymdownx -pyw -qch -qemu -qhelpgenerator -QHG -qhp -qi -qsf -qthelpproject -quanah -quicksort -Quinteiro -qwest -radixsort -radvisory -RAII -ramdev -ramdisk -ramfs -ranf -ranlib -rbegin -rcs -RDADVISE -RDAHEAD -rdata -rdhwr -RDLCK -rdonly -rdp -rdpmccntr -rdrinfo -rdt -rdtsc -RDWR -reachedn -readahead -Readeaders -readhdr -readheader -readline -readlink -README -readonly -READWRITE -readwrite -realloc -REALMEM -REALPATH -realtime -Rebuffo -rebuffo -RECO -redis -reedom -reefont -refname -refreshenv -REGEX -regexp -reinited -rej -relpath -relro -RELWITHDEBINFO -removedirectory -removefile -Rescure -resizable -resizeable -reson -retryleft -returted -retval -reversedup -reversekey -revlist -rfc -RHEL -ripco -riverbankcomputing -rkey -rlock -rlt -rmdir -RMID -rmw -rocksdb -rolledback -roolback -ROOTONLY -rosalinux -rotr -rouzier -rp -rpa -rpath -rpb -rpcc -rpid -RPMs -rqest -rr -RRF -rrxmrrxmsx -rsize -rslot -rtch -rtf -rthc -rtn -rtti -ru -rubygems -rusage -rw -samedata -samelength -SAMSUNG -sasgas -savailable -scalability -sched -sdb -SDK -SDKDDK -searchdata -SEARCHENGINE -sebastien -segfault -SEGV -sema -sembuf -semctl -semget -semid -semop -sems -sendfile -sepkey -sergey -SETALL -SETFD -setlen -setlevel -setlk -setlkw -setmntent -setprotocol -setpshared -setrobust -setspecific -settype -setutxent -SETVAL -sgi -Sharov -shasum -shink -Shipitsin -shm -showinitializer -showned -shrinked -sideeffect -SIGABRT -sigaction -sigaddset -sigalarm -SIGALRM -SIGBUS -SIGCHLD -SIGCONT -sigemptyset -SIGEMT -SIGFPE -SIGHUP -SIGINT -SIGIO -SIGKILL -sigmask -SIGPIPE -SIGPOLL -sigprocmask -SIGPROF -SIGPWR -SIGQUIT -SIGSEGV -sigset -SIGSTKFLT -SIGSTOP -SIGSYS -SIGTERM -SIGTRAP -SIGTSTP -SIGTTIN -SIGTTOU -SIGURG -sigusr -SIGVTALRM -sigwait -SIGWINCH -SIGXCPU -SIGXFSZ -singlemode -singleprocess -sizeof -skeeto -SKIPORD -slaunay -slowpath -smallprng -Smath -smbfs -SNAPTHREAD -SNC -snej -snprintf -Solaris -Soref -sosuffix -sourceforge -sourcery -sourceware -SOVERSION -spaceleft -spage -spanpgno -sparc -SPDX -spinics -Sporaw -sprintf -sqlite -src -SRCDIR -srcnode -srcpg -srlx -SRW -srwl -srwlock -sscanf -SSDs -sshfs -ssize -Sstimate -sstream -Ssymbols -standalone -startuml -STARTUPINFOA -statfs -statinfo -statvfs -stck -stdalign -stdarg -stdatomic -stdc -stddef -stderr -stdexcept -STDGNU -stdin -stdint -stdio -stdlib -stdout -stepbystep -STKFLT -storz -stoull -strcasecmp -strcasestr -strcat -strchr -strcmp -strcpy -strdup -STREQUAL -strerr -strerror -stricmp -strikethrough -STRINGIFY -strlen -STRLENOF -strncasecmp -strncmp -strncpy -strnlen -strp -strstr -strtol -strtoul -strtoull -structs -stylesheet -subalign -SUBDATA -subdatabase -subdb -subdbi -subdir -subgrouping -subheader -SUBKEY -SUBLANG -subleaf -subname -SUBP -subpage -subpayload -subunused -sudo -SUNPRO -superfences -sval -svg -svnweb -svr -swait -swappable -symas -SYMLINKS -syncbytes -syncfilerange -syncmode -syncperiod -synctype -sys -SYSC -syscall -sysconf -sysctl -sysctlbyname -sysname -syspagesize -sysraminfo -systemtime -sysv -sz -tablename -tagfile -tagname -tailroom -tarantool -tarball -tasklist -tassert -tbl -tcl -TEAMCITY -Tebibyte -tempdir -testcase -testdb -TESTLIST -TESTLOG -testset -Thermi -thr -THREADENTRY -THUMBEB -THUMBEL -THW -timebase -timedwait -TIMEOFDAY -TIMERR -timeslice -timespec -timeval -timperi -tl -tlhelp -tls -Tme -tmp -tmpdir -tmpfs -toc -todo -TODOLIST -toh -toolchain -toolhelp -toolset -tooltip -torquem -TOUPPER -Transcoder -transcoder -transcoding -treeview -tribudubois -Tru -TRYFIXED -trylock -trywait -tsan -tsd -tsize -TSTP -ttf -TTIN -ttl -TTOU -TVvqnwctdis -tw -twistylittlepassagesallalike -txkey -txl -txn -TXNFULL -txnid -txnsize -typedef -typedef'ed -typename -ubsan -ubuntu -ucf -UCLIBC -UCRT -udelay -ue -uint -uintptr -uio -ul -ulen -ULIBMDBX -ulimit -ulong -ULONGLONG -Umakefile -UML -umount -umul -umulh -umull -uname -undef -underfilled -UNDOC -unicode -UNIFORUM -uninit -uninstall -UNINSTALLING -uniq -unistd -UNLCK -unmap -unmapping -Unpoisoning -unregister -unshallow -unspill -unspilling -unsync -UNTRACK -updation -UPPERBOUND -upsert -UPSERTING -upsertion -upto -URG -url -usec -usedbytes -usepackage -userctx -userdb -USERMEM -ushort -usit -usleep -usr -USRVALID -utc -utf -utils -utime -utmpx -utsname -uuid -uvm -Vaefnrs -valbool -valgrind -validator -Vallarino -valnum -valsize -valstr -valuemode -vasprintf -vedisdb -VERINFO -versioned -versioning -Veyor -vfprintf -vfstype -vhd -vhdl -vladimirromanov -vlen -vm -vma -vmmeter -vmstat -vmtotal -voidptr -vorot -Vorotnikov -vromanov -Vrq -vscprintf -vsnprintf -VTALRM -vvn -vvnw -vvv -vvvv -vvvvv -waitable -waitfor -waitpid -waitstatus -wangjia -wbatch -wbuf -wchar -WCONTINUED -WCOREDUMP -wcsnicmp -wdm -webassembly -webclient -WERROR -Wetlesen -WEXITSTATUS -WEXTRA -whitelist -wholetable -WIFCONTINUED -WIFEXITED -WIFSIGNALED -WIFSTOPPED -wiki -wikipedia -wiktionary -wildcards -WILLNEED -WINAPI -windowsbug -wingetopt -winioctl -winmm -winnt -winternl -WINVER -wiredtiger -wlen -wlock -WNO -WNOHANG -wof -WORDBITS -workaround -workflow -Wpedantic -writeback -WRITEBUF -writefault -writefaultn -writemap -writev -WRLCK -WRONLY -wsize -WSL -wsl -wstr -wstring -WTERMSIG -WUNTRACED -www -WX -xapian -xappend -xargs -xcode -XCONCAT -XCPU -xcursor -xdata -xf -xflags -XFSZ -xhtml -xkeep -XLB -xmerge -xml -xnu -XOPEN -xp -XSI -xsize -yml -Yota -Yotta -yperbasis -Yq -yuriev -Zano -zarch -Zc -zd -zeilenga -zerofill -ZEROINIT -zi -ZLIB -zu -zx -Zyp diff --git a/.github/actions/spelling/patterns.txt b/.github/actions/spelling/patterns.txt deleted file mode 100644 index 1f85a21c8..000000000 --- a/.github/actions/spelling/patterns.txt +++ /dev/null @@ -1,6 +0,0 @@ -# numbers -(?:[\\0][xX]|[uU]\+|#)[0-9a-fA-FgGrR]{2,}[uU]?[lL]{0,2}\b -# avoid false positive - -{1,2}force\W -# flags -(?!\w)-{1,2}[fDW] diff --git a/.github/workflows/MinGW.yml b/.github/workflows/MinGW.yml deleted file mode 100644 index 7960c9572..000000000 --- a/.github/workflows/MinGW.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: MinGW - -on: - pull_request: - push: - branches: mingw - paths-ignore: - - '.circleci/**' - - '.github/actions/spelling/**' - - 'docs/**' - - 'packages**' - - .cirrus.yml - - .clang-format - - .gitignore - - .travis.yml - - AUTHORS - - COPYRIGHT - - ChangeLog.md - - LICENSE - - README.md - - appveyor.yml - -jobs: - build: - runs-on: [windows-latest] - steps: - - uses: actions/checkout@v2 - - name: fetch tags - run: git fetch --unshallow --tags --prune --force - - name: append PATH - run: echo 'C:/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/bin' >> $GITHUB_PATH - - name: update mingw64 - # wanna version >= 10.2 - run: choco upgrade mingw -y --no-progress && refreshenv - - name: build-make - shell: bash - run: | - CC=gcc CXX=g++ make MDBX_BUILD_OPTIONS=-DMDBX_DEBUG=1 all build-test tools-static - - name: configure-dll - shell: bash - run: | - mkdir build-dll && cd build-dll && \ - cmake -G "MinGW Makefiles" -DMDBX_BUILD_SHARED_LIBRARY:BOOL=ON -DMDBX_INSTALL_STATIC:BOOL=OFF -DMDBX_ENABLE_TESTS:BOOL=ON .. - - name: build-dll - shell: bash - run: cd build-dll && cmake --build . - - name: test-dll - shell: bash - run: | - export "PATH=/c/programdata/chocolatey/lib/mingw/tools/install/mingw64/bin:$PATH" && \ - cd build-dll && \ - ./mdbx_test.exe --progress --console=no --pathname=test.db --dont-cleanup-after basic && \ - ./mdbx_chk.exe -nvv test.db - - name: configure-static - shell: bash - run: | - mkdir build-static && cd build-static && \ - cmake -G "MinGW Makefiles" -DMDBX_BUILD_SHARED_LIBRARY:BOOL=OFF -DMDBX_INSTALL_STATIC:BOOL=ON -DMDBX_ENABLE_TESTS:BOOL=ON .. - - name: build-static - shell: bash - run: | - cd build-static && cmake --build . - - name: run-test - shell: bash - run: | - export "PATH=/c/programdata/chocolatey/lib/mingw/tools/install/mingw64/bin:$PATH" && \ - cd build-static && \ - ./mdbx_test.exe --progress --console=no --pathname=test.db --dont-cleanup-after basic && \ - ./mdbx_chk.exe -nvv test.db diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml deleted file mode 100644 index 9565586de..000000000 --- a/.github/workflows/android.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Android - -on: - pull_request: - push: - branches-ignore: - - coverity_scan - paths-ignore: - - '.circleci/**' - - '.github/actions/spelling/**' - - 'docs/**' - - 'packages**' - - .cirrus.yml - - .clang-format - - .gitignore - - .travis.yml - - AUTHORS - - COPYRIGHT - - ChangeLog.md - - LICENSE - - README.md - - appveyor.yml - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: fetch tags - run: git fetch --unshallow --tags --prune --force - - uses: nttld/setup-ndk@v1 - id: setup-ndk - with: - ndk-version: r21e - add-to-path: true - - name: configure - env: - ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} - run: cmake --version && cmake --toolchain "${{ steps.setup-ndk.outputs.ndk-path }}/build/cmake/android.toolchain.cmake" - - name: build - run: cmake --build . diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 3f91bd1c5..000000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: CI - -on: - pull_request: - push: - branches-ignore: - - coverity_scan - paths-ignore: - - '.circleci/**' - - '.github/actions/spelling/**' - - 'docs/**' - - 'packages**' - - .cirrus.yml - - .clang-format - - .gitignore - - .travis.yml - - AUTHORS - - COPYRIGHT - - ChangeLog.md - - LICENSE - - README.md - - appveyor.yml - -jobs: - build: - runs-on: ${{ matrix.os }} - strategy: - matrix: -#, windows-latest - os: [ubuntu-latest, macos-latest, ubuntu-18.04] - steps: - - uses: actions/checkout@v2 - - name: fetch tags - run: git fetch --unshallow --tags --prune --force - - name: make check - run: make MDBX_BUILD_OPTIONS="-DNDEBUG=1 -DMDBX_FORCE_ASSERTIONS=1" --keep-going all && MALLOC_CHECK_=7 MALLOC_PERTURB_=42 make MDBX_BUILD_OPTIONS="-DNDEBUG=1 -DMDBX_FORCE_ASSERTIONS=1" --keep-going check - shell: bash - - name: if_failure - if: failure() - run: for F in *.err; do echo --- $F; cat $F; done diff --git a/.github/workflows/coverity.yml b/.github/workflows/coverity.yml deleted file mode 100644 index 44e0f5d99..000000000 --- a/.github/workflows/coverity.yml +++ /dev/null @@ -1,55 +0,0 @@ -name: Coverity - -on: - push: - branches: coverity_scan - paths-ignore: - - '.circleci/**' - - '.github/actions/spelling/**' - - 'docs/**' - - 'packages**' - - .cirrus.yml - - .clang-format - - .gitignore - - .travis.yml - - AUTHORS - - COPYRIGHT - - ChangeLog.md - - LICENSE - - README.md - - appveyor.yml - -env: - COVERITY_SCAN_PROJECT_NAME: 'ReOpen/libmdbx' - COVERITY_SCAN_TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }} - COVERITY_SCAN_BUILD_COMMAND: 'make MDBX_BUILD_OPTIONS=-DMDBX_DEBUG=2 CXXSTD=-std=gnu++17 build-test' - COVERITY_SCAN_NOTIFICATION_EMAIL: 'leo@yuriev.ru' - COVERITY_UNSUPPORTED_COMPILER_INVOCATION: 1 - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: fetch tags - run: git fetch --unshallow --tags --prune --force - - name: Download Coverity Build Tool - run: | - wget -q https://scan.coverity.com/download/cxx/linux64 --post-data "token=$COVERITY_SCAN_TOKEN&project=$COVERITY_SCAN_PROJECT_NAME" -O cov-analysis-linux64.tar.gz - mkdir cov-analysis-linux64 - tar xzf cov-analysis-linux64.tar.gz --strip 1 -C cov-analysis-linux64 - - name: Build with cov-build - run: | - export PATH=`pwd`/cov-analysis-linux64/bin:$PATH - cov-build --dir cov-int $COVERITY_SCAN_BUILD_COMMAND - - name: Submit the result to Coverity Scan - run: | - tar czvf libmdbx.tgz cov-int - curl \ - --form project=$COVERITY_SCAN_PROJECT_NAME \ - --form token=$COVERITY_SCAN_TOKEN \ - --form email=$COVERITY_SCAN_NOTIFICATION_EMAIL \ - --form file=@libmdbx.tgz \ - --form version=$GITHUB_SHA \ - --form description="GithubActionCI $GITHUB_ACTION" \ - https://scan.coverity.com/builds?project=$COVERITY_SCAN_PROJECT_NAME diff --git a/.github/workflows/doxygen-github-pages.yml b/.github/workflows/doxygen-github-pages.yml deleted file mode 100644 index d65de92bb..000000000 --- a/.github/workflows/doxygen-github-pages.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: doxygen-github-pages - -on: - push: - branches: master - -jobs: - build: - runs-on: ubuntu-20.04 - steps: - - name: Set Actions Allow Unsecure Commands (temporary) - run: | - echo "ACTIONS_ALLOW_UNSECURE_COMMANDS=true" >> $GITHUB_ENV - - name: Checkout code - uses: actions/checkout@v2.3.1 - with: - fetch-depth: 0 - - name: Install doxygen - run: sudo apt install doxygen graphviz fonts-freefont-ttf - - name: Build html docs - run: make doxygen && cp -R .circleci docs/html/ - - name: Deploy gh-pages - uses: JamesIves/github-pages-deploy-action@3.5.7 - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - BRANCH: gh-pages - FOLDER: docs/html - CLEAN: true - SINGLE_COMMIT: true diff --git a/.github/workflows/release-assets.yml b/.github/workflows/release-assets.yml deleted file mode 100644 index 2402d318f..000000000 --- a/.github/workflows/release-assets.yml +++ /dev/null @@ -1,58 +0,0 @@ -# Based on the https://github.com/actions/upload-release-asset example - -on: - push: - # Sequence of patterns matched against refs/tags - tags: - - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 - -name: Upload Release Asset - -jobs: - build: - name: Upload Release Asset - runs-on: ubuntu-20.04 - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Build assets - run: | - make release-assets - - id: name - run: | - echo "::set-output name=tarball::$(ls *.tar.gz)" - echo "::set-output name=zip::$(ls *.zip)" - echo "::set-output name=suffix_unix::$(sed 's|^\([0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\)\.\(.*\)$|\1|' dist/VERSION.txt)" - echo "::set-output name=suffix_dos::$(sed 's|^\([0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}\)\.\(.*\)$|\1|' dist/VERSION.txt | tr . _)" - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref }} - release_name: Release ${{ github.ref }} - draft: true - prerelease: true - - name: Upload tarball - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ${{ steps.name.outputs.tarball }} - asset_name: libmdbx-amalgamated-${{ steps.name.outputs.suffix_unix }}.tar.gz - # asset_label: Amalgamated source tarball - asset_content_type: application/tar+gzip - - name: Upload zip - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ${{ steps.name.outputs.zip }} - asset_name: libmdbx-amalgamated-${{ steps.name.outputs.suffix_dos }}.zip - # asset_label: Amalgamated source zip-archive - asset_content_type: application/zip diff --git a/.github/workflows/spelling.yml b/.github/workflows/spelling.yml deleted file mode 100644 index 292f45463..000000000 --- a/.github/workflows/spelling.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: Spell checking -on: - push: - branches: spelling - pull_request: - -jobs: - build: - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 5 - - uses: check-spelling/check-spelling@main diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index bc0395002..000000000 --- a/.travis.yml +++ /dev/null @@ -1,89 +0,0 @@ -language: c cpp -sudo: false - -env: - global: - - secure: "M+W+heGGyRQJoBq2W0uqWVrpL4KBXmL0MFL7FSs7f9vmAaDyEgziUXeZRj3GOKzW4kTef3LpIeiu9SmvqSMoQivGGiomZShqPVl045o/OUgRCAT7Al1RLzEZ0efSHpIPf0PZ6byEf6GR2ML76OfuL6JxTVdnz8iVyO2sgLE1HbX1VeB+wgd/jfMeOBhCCXskfK6MLyZihfMYsiYZYSaV98ZDhDLSlzuuRIgzb0bMi8aL6AErs0WLW0NelRBeHkKPYfAUc85pdQHscgrJw6Rh/zT6+8BQ/q5f4IgWhiu4xoRg3Ngl7SNoedRQh93ADM3UG2iGl6HDFpVORaXcFWKAtuYY+kHQ0HB84BRYpQmeBuXNpltsfxQ3d1Q3u0RlE45zRvmr2+X1mFnkcNUAWISLPbsOUlriDQM8irGwRpho77/uYnRC00bJsHW//s6+uPf9zrAw1nI4f0y3PAWukGF/xs6HAI3FZPsuSSnx18Tj3Opgbc9Spop+V3hkhdiJoPGpNKTkFX4ZRXfkPgoRVJmtp4PpbpH0Ps/mCriKjMEfGGi0HcVCi0pEGLXiecdqJ5KPg5+22zNycEujQBJcNTKd9shN+R3glrbmhAxTEzGdGwxXXJ2ybwJ2PWJLMYZ7g98nLyX+uQPaA3BlsbYJHNeS5283/9pJsd9DzfHKsN2nFSc=" - -addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - cmake - - clang-format - update: true - -matrix: - include: - - os: linux - dist: focal - compiler: gcc - env: CC=cc CXX=c++ - - os: linux - dist: focal - compiler: clang - env: CC=clang CXX=clang++ - - os: linux - dist: bionic - compiler: gcc - env: CC=cc CXX=c++ - - os: linux - dist: bionic - compiler: clang - env: CC=clang CXX=clang++ - - os: linux - dist: xenial - compiler: gcc - env: CC=cc CXX=c++ - - os: linux - dist: xenial - compiler: clang - env: CC=clang CXX=clang++ - - os: osx - osx_image: xcode11.3 - env: CC=cc CXX=c++ - - os: osx - osx_image: xcode9.4 - env: CC=cc CXX=c++ - -before_script: | - if [ "${TRAVIS_BRANCH}" = "coverity_scan" ]; then - # call Coverity Scan manually of addons.coverity_scan for first job only - if [ "${TRAVIS_JOB_NUMBER}" = "${TRAVIS_BUILD_NUMBER}.1" ]; then - export COVERITY_SCAN_BRANCH=1 - echo -n | openssl s_client -connect scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca- - curl -s 'https://scan.coverity.com/scripts/travisci_build_coverity_scan.sh' -o coverity_scan.sh - else - echo 'echo "Skip CoverityScan for unrelated os/compiler"' > coverity_scan.sh - fi - fi - -script: | - ${CC} --version - ${CXX} --version - git fetch --unshallow --tags --prune --force || exit 1 - if [ ! -s ./coverity_scan.sh ]; then - make --keep-going all && MALLOC_CHECK_=7 MALLOC_PERTURB_=42 make --keep-going check - else - COVERITY_UNSUPPORTED_COMPILER_INVOCATION=1 \ - COVERITY_SCAN_PROJECT_NAME="ReOpen/libmdbx" \ - COVERITY_SCAN_NOTIFICATION_EMAIL="leo@yuriev.ru" \ - COVERITY_SCAN_BUILD_COMMAND_PREPEND="" \ - COVERITY_SCAN_BUILD_COMMAND="make MDBX_BUILD_OPTIONS=-DMDBX_DEBUG=2 CXXSTD=-std=gnu++17 build-test" \ - COVERITY_SCAN_BRANCH_PATTERN="$TRAVIS_BRANCH" \ - bash ./coverity_scan.sh || cat cov-int/scm_log.txt - fi - -after_script: | - if [ "${TRAVIS_BRANCH}" != "coverity_scan" -a "${TRAVIS_JOB_NUMBER}" = "${TRAVIS_BUILD_NUMBER}.1" ] && make reformat && [[ -n $(git diff) ]]; then - echo "You must run 'make reformat' before submitting a pull request" - echo "-------------------------------------------------------------------------------" - git diff - sleep 1 - echo "-------------------------------------------------------------------------------" - sleep 1 - exit -1 - fi - echo "-------------------------------------------------------------------------------" - sleep 1 diff --git a/CMakeLists.txt b/CMakeLists.txt index 6db245f53..2ddc192be 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,7 +14,7 @@ ## ## libmdbx = { Revised and extended descendant of Symas LMDB. } -## Please see README.md at https://github.com/erthink/libmdbx +## Please see README.md at https://gitflic.ru/project/erthink/libmdbx ## ## Libmdbx is superior to LMDB in terms of features and reliability, ## not inferior in performance. libmdbx works on Linux, FreeBSD, MacOS X @@ -112,7 +112,10 @@ else() endif() endif() -if(MDBX_AMALGAMATED_SOURCE AND DEFINED MDBX_ENABLE_TESTS AND MDBX_ENABLE_TESTS) +if(NOT MDBX_AMALGAMATED_SOURCE) + include(CTest) + option(MDBX_ENABLE_TESTS "Build libmdbx tests." ${BUILD_TESTING}) +elseif(DEFINED MDBX_ENABLE_TESTS AND MDBX_ENABLE_TESTS) message(WARNING "MDBX_ENABLE_TESTS=${MDBX_ENABLE_TESTS}: But amalgamated source code don't includes tests.") set(MDBX_ENABLE_TESTS OFF) endif() @@ -608,7 +611,7 @@ endmacro() macro(libmdbx_setup_libs TARGET MODE) target_link_libraries(${TARGET} ${MODE} Threads::Threads) if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") - target_link_libraries(${TARGET} ${MODE} ntdll) + target_link_libraries(${TARGET} ${MODE} ntdll advapi32) if(MDBX_NTDLL_EXTRA_IMPLIB AND MDBX_WITHOUT_MSVC_CRT) target_link_libraries(${TARGET} ${MODE} ntdll_extra) endif() @@ -618,7 +621,7 @@ macro(libmdbx_setup_libs TARGET MODE) target_link_libraries(${TARGET} ${MODE} log) endif() if(LIBCXX_FILESYSTEM AND MDBX_BUILD_CXX) - if(CMAKE_COMPILER_IS_ELBRUSCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 1.26.0 + if(CMAKE_COMPILER_IS_ELBRUSCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 1.25.23 AND NOT CMAKE_VERSION VERSION_LESS 3.13) target_link_options(${TARGET} PUBLIC "-Wl,--allow-multiple-definition") endif() @@ -858,16 +861,33 @@ endif() # make a build-target triplet if(CMAKE_C_COMPILER_TARGET) set(MDBX_BUILD_TARGET "${CMAKE_C_COMPILER_TARGET}") -elseif(CMAKE_C_PLATFORM_ID AND NOT CMAKE_C_PLATFORM_ID STREQUAL CMAKE_SYSTEM_NAME) - string(STRIP "${CMAKE_C_PLATFORM_ID}-${CMAKE_SYSTEM_NAME}" MDBX_BUILD_TARGET) -elseif(CMAKE_LIBRARY_ARCHITECTURE) - string(STRIP "${CMAKE_LIBRARY_ARCHITECTURE}-${CMAKE_SYSTEM_NAME}" MDBX_BUILD_TARGET) -elseif(CMAKE_GENERATOR_PLATFORM AND NOT CMAKE_C_PLATFORM_ID STREQUAL CMAKE_SYSTEM_NAME) - string(STRIP "${CMAKE_GENERATOR_PLATFORM}-${CMAKE_SYSTEM_NAME}" MDBX_BUILD_TARGET) -elseif(CMAKE_SYSTEM_ARCH) - string(STRIP "${CMAKE_SYSTEM_ARCH}-${CMAKE_SYSTEM_NAME}" MDBX_BUILD_TARGET) else() - string(STRIP "${CMAKE_SYSTEM_PROCESSOR}-${CMAKE_SYSTEM_NAME}" MDBX_BUILD_TARGET) + if(CMAKE_C_COMPILER_ARCHITECTURE_ID) + string(STRIP "${CMAKE_C_COMPILER_ARCHITECTURE_ID}" MDBX_BUILD_TARGET) + elseif(CMAKE_GENERATOR_PLATFORM AND NOT CMAKE_GENERATOR_PLATFORM STREQUAL CMAKE_SYSTEM_NAME) + string(STRIP "${CMAKE_GENERATOR_PLATFORM}" MDBX_BUILD_TARGET) + elseif(CMAKE_SYSTEM_ARCH) + string(STRIP "${CMAKE_SYSTEM_ARCH}" MDBX_BUILD_TARGET) + elseif(CMAKE_LIBRARY_ARCHITECTURE) + string(STRIP "${CMAKE_LIBRARY_ARCHITECTURE}" MDBX_BUILD_TARGET) + elseif(CMAKE_SYSTEM_PROCESSOR) + string(STRIP "${CMAKE_SYSTEM_PROCESSOR}" MDBX_BUILD_TARGET) + else() + set(MDBX_BUILD_TARGET "unknown") + endif() + if(CMAKE_C_COMPILER_ABI + AND NOT (CMAKE_C_COMPILER_ABI MATCHES ".*${MDBX_BUILD_TARGET}.*" OR MDBX_BUILD_TARGET MATCHES ".*${CMAKE_C_COMPILER_ABI}.*")) + string(APPEND MDBX_BUILD_TARGET "-${CMAKE_C_COMPILER_ABI}") + endif() + if(CMAKE_C_PLATFORM_ID + AND NOT (CMAKE_SYSTEM_NAME + AND (CMAKE_C_PLATFORM_ID MATCHES ".*${CMAKE_SYSTEM_NAME}.*" OR CMAKE_SYSTEM_NAME MATCHES ".*${CMAKE_C_PLATFORM_ID}.*")) + AND NOT (CMAKE_C_PLATFORM_ID MATCHES ".*${CMAKE_C_PLATFORM_ID}.*" OR MDBX_BUILD_TARGET MATCHES ".*${CMAKE_C_PLATFORM_ID}.*")) + string(APPEND MDBX_BUILD_TARGET "-${CMAKE_C_COMPILER_ABI}") + endif() + if(CMAKE_SYSTEM_NAME) + string(APPEND MDBX_BUILD_TARGET "-${CMAKE_SYSTEM_NAME}") + endif() endif() # provide build-type diff --git a/ChangeLog.md b/ChangeLog.md index 0067b3381..f677fed8d 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -3,21 +3,33 @@ ChangeLog ### TODO - - [Engage an "overlapped I/O" on Windows](https://github.com/erthink/libmdbx/issues/224). - - [Simple careful mode for working with corrupted DB](https://github.com/erthink/libmdbx/issues/223). - - [Move most of `mdbx_chk` functional to the library API](https://github.com/erthink/libmdbx/issues/204). - - [Replace SRW-lock on Windows to allow shrink DB with `MDBX_NOTLS` option](https://github.com/erthink/libmdbx/issues/210). - - [More flexible support of asynchronous runtime/framework(s)](https://github.com/erthink/libmdbx/issues/200). - - [Migration guide from LMDB to MDBX](https://github.com/erthink/libmdbx/issues/199). - - [Get rid of dirty-pages list in MDBX_WRITEMAP mode](https://github.com/erthink/libmdbx/issues/193). - - [Large/Overflow pages accounting for dirty-room](https://github.com/erthink/libmdbx/issues/192). - - [Support for RAW devices](https://github.com/erthink/libmdbx/issues/124). - - [Support MessagePack for Keys & Values](https://github.com/erthink/libmdbx/issues/115). - - [Engage new terminology](https://github.com/erthink/libmdbx/issues/137). + - [Engage an "overlapped I/O" on Windows](todo4recovery://erased_by_github/libmdbx/issues/224). + - [Simple careful mode for working with corrupted DB](todo4recovery://erased_by_github/libmdbx/issues/223). + - [Move most of `mdbx_chk` functional to the library API](todo4recovery://erased_by_github/libmdbx/issues/204). + - [Replace SRW-lock on Windows to allow shrink DB with `MDBX_NOTLS` option](todo4recovery://erased_by_github/libmdbx/issues/210). + - [More flexible support of asynchronous runtime/framework(s)](todo4recovery://erased_by_github/libmdbx/issues/200). + - [Migration guide from LMDB to MDBX](todo4recovery://erased_by_github/libmdbx/issues/199). + - [Get rid of dirty-pages list in MDBX_WRITEMAP mode](todo4recovery://erased_by_github/libmdbx/issues/193). + - [Large/Overflow pages accounting for dirty-room](todo4recovery://erased_by_github/libmdbx/issues/192). + - [Support for RAW devices](todo4recovery://erased_by_github/libmdbx/issues/124). + - [Support MessagePack for Keys & Values](todo4recovery://erased_by_github/libmdbx/issues/115). + - [Engage new terminology](todo4recovery://erased_by_github/libmdbx/issues/137). - Packages for [Astra Linux](https://astralinux.ru/), [ALT Linux](https://www.altlinux.org/), [ROSA Linux](https://www.rosalinux.ru/), etc. -## v0.11.7 (underway) +## v0.11.7 at 2022-04-22 + +The stable risen release after the Github's intentional malicious disaster. + +#### We have migrated to a reliable trusted infrastructure +The origin for now is at [GitFlic](https://gitflic.ru/project/erthink/libmdbx) +since on 2022-04-15 the Github administration, without any warning nor +explanation, deleted _libmdbx_ along with a lot of other projects, +simultaneously blocking access for many developers. +For the same reason ~~Github~~ is blacklisted forever. + +GitFlic already support Russian and English languages, plan to support more, +including 和 中文. You are welcome! New: @@ -25,6 +37,10 @@ New: - Support for Microsoft Visual Studio 2022. - Support build by MinGW' make from command line without CMake. - Added `mdbx::filesystem` C++ API namespace that corresponds to `std::filesystem` or `std::experimental::filesystem`. + - Created [website](https://libmdbx.website.yandexcloud.net/) for online auto-generated documentation. + - Used `todo4recovery://erased_by_github/` for dead (or temporarily lost) resources deleted by ~~Github~~. + - Added `--loglevel=` command-line option to the `mdbx_test` tool. + - Added few fast smoke-like tests into CMake builds. Fixes: @@ -35,6 +51,10 @@ Fixes: - Added workaround for GNU Make 3.81 and earlier. - Added workaround for Elbrus/LCC 1.25 compiler bug of class inline `static constexpr` member field. - [Fixed](https://github.com/ledgerwatch/erigon/issues/3874) minor assertion regression (only debug builds were affected). + - Fixed detection of `C++20` concepts accessibility. + - Fixed detection of Clang's LTO availability for Android. + - Fixed build for ARM/ARM64 by MSVC. + - Fixed non-x86 Windows builds with `MDBX_WITHOUT_MSVC_CRT=ON` and `MDBX_BUILD_SHARED_LIBRARY=ON`. Minors: @@ -42,13 +62,19 @@ Minors: - Switched to using `MDBX_EPERM` instead of `MDBX_RESULT_TRUE' to indicate that the geometry cannot be updated. - Added `NULL` checking during memory allocation inside `mdbx_chk`. - Resolved all warnings from MinGW while used without CMake. + - Added inheretable `target_include_directories()` to `CMakeLists.txt` for easy integration. + - Added build-time checks and paranoid runtime assertions for the `off_t` arguments of `fcntl()` which are used for locking. + - Added `-Wno-lto-type-mismatch` to avoid false-positive warnings from old GCC during LTO-enabled builds. + - Added checking for TID (system thread id) to avoid hang on 32-bit Bionic/Android within `pthread_mutex_lock()`. + - Reworked `MDBX_BUILD_TARGET` of CMake builds. + - Added `CMAKE_HOST_ARCH` and `CMAKE_HOST_CAN_RUN_EXECUTABLES_BUILT_FOR_TARGET`. -## v0.11.6 (scheduled for 2022-03-24) +## v0.11.6 at 2022-03-24 The stable release with the complete workaround for an incoherence flaw of Linux unified page/buffer cache. Nonetheless the cause for this trouble may be an issue of Intel CPU cache/MESI. -See [issue#269](https://github.com/erthink/libmdbx/issues/269) for more information. +See [issue#269](todo4recovery://erased_by_github/libmdbx/issues/269) for more information. Acknowledgements: @@ -57,8 +83,8 @@ Acknowledgements: Fixes: - - [Added complete workaround](https://github.com/erthink/libmdbx/issues/269) for an incoherence flaw of Linux unified page/buffer cache. - - [Fixed](https://github.com/erthink/libmdbx/issues/272) cursor reusing for read-only transactions. + - [Added complete workaround](todo4recovery://erased_by_github/libmdbx/issues/269) for an incoherence flaw of Linux unified page/buffer cache. + - [Fixed](todo4recovery://erased_by_github/libmdbx/issues/272) cursor reusing for read-only transactions. - Fixed copy&paste typo inside `mdbx::cursor::find_multivalue()`. Minors: @@ -73,7 +99,7 @@ Minors: ## v0.11.5 at 2022-02-23 The release with the temporary hotfix for a flaw of Linux unified page/buffer cache. -See [issue#269](https://github.com/erthink/libmdbx/issues/269) for more information. +See [issue#269](todo4recovery://erased_by_github/libmdbx/issues/269) for more information. Acknowledgements: @@ -83,10 +109,10 @@ Acknowledgements: Fixes: - - [Added hotfix](https://github.com/erthink/libmdbx/issues/269) for a flaw of Linux unified page/buffer cache. - - [Fixed/Reworked](https://github.com/erthink/libmdbx/pull/270) move-assignment operators for "managed" classes of C++ API. + - [Added hotfix](todo4recovery://erased_by_github/libmdbx/issues/269) for a flaw of Linux unified page/buffer cache. + - [Fixed/Reworked](todo4recovery://erased_by_github/libmdbx/pull/270) move-assignment operators for "managed" classes of C++ API. - Fixed potential `SIGSEGV` while open DB with overrided non-default page size. - - [Made](https://github.com/erthink/libmdbx/issues/267) `mdbx_env_open()` idempotence in failure cases. + - [Made](todo4recovery://erased_by_github/libmdbx/issues/267) `mdbx_env_open()` idempotence in failure cases. - Refined/Fixed pages reservation inside `mdbx_update_gc()` to avoid non-reclamation in a rare cases. - Fixed typo in a retained space calculation for the hsr-callback. @@ -119,15 +145,15 @@ New features, extensions and improvements: Fixes: - Fixed handling `MDBX_opt_rp_augment_limit` for GC's records from huge transactions (Erigon/Akula/Ethereum). - - [Fixed](https://github.com/erthink/libmdbx/issues/258) build on Android (avoid including `sys/sem.h`). - - [Fixed](https://github.com/erthink/libmdbx/pull/261) missing copy assignment operator for `mdbx::move_result`. + - [Fixed](todo4recovery://erased_by_github/libmdbx/issues/258) build on Android (avoid including `sys/sem.h`). + - [Fixed](todo4recovery://erased_by_github/libmdbx/pull/261) missing copy assignment operator for `mdbx::move_result`. - Fixed missing `&` for `std::ostream &operator<<()` overloads. - Fixed unexpected `EXDEV` (Cross-device link) error from `mdbx_env_copy()`. - Fixed base64 encoding/decoding bugs in auxillary C++ API. - Fixed overflow of `pgno_t` during checking PNL on 64-bit platforms. - - [Fixed](https://github.com/erthink/libmdbx/issues/260) excessive PNL checking after sort for spilling. + - [Fixed](todo4recovery://erased_by_github/libmdbx/issues/260) excessive PNL checking after sort for spilling. - Reworked checking `MAX_PAGENO` and DB upper-size geometry limit. - - [Fixed](https://github.com/erthink/libmdbx/issues/265) build for some combinations of versions of MSVC and Windows SDK. + - [Fixed](todo4recovery://erased_by_github/libmdbx/issues/265) build for some combinations of versions of MSVC and Windows SDK. Minors: @@ -154,10 +180,10 @@ Acknowledgements: New features, extensions and improvements: - - [Added](https://github.com/erthink/libmdbx/issues/236) `mdbx_cursor_get_batch()`. - - [Added](https://github.com/erthink/libmdbx/issues/250) `MDBX_SET_UPPERBOUND`. + - [Added](todo4recovery://erased_by_github/libmdbx/issues/236) `mdbx_cursor_get_batch()`. + - [Added](todo4recovery://erased_by_github/libmdbx/issues/250) `MDBX_SET_UPPERBOUND`. - C++ API is finalized now. - - The GC update stage has been [significantly speeded](https://github.com/erthink/libmdbx/issues/254) when fixing huge Erigon's transactions (Ethereum ecosystem). + - The GC update stage has been [significantly speeded](todo4recovery://erased_by_github/libmdbx/issues/254) when fixing huge Erigon's transactions (Ethereum ecosystem). Fixes: @@ -168,12 +194,12 @@ Minors: - Fixed returning `MDBX_RESULT_TRUE` (unexpected -1) from `mdbx_env_set_option()`. - Added `mdbx_env_get_syncbytes()` and `mdbx_env_get_syncperiod()`. - - [Clarified](https://github.com/erthink/libmdbx/pull/249) description of `MDBX_INTEGERKEY`. + - [Clarified](todo4recovery://erased_by_github/libmdbx/pull/249) description of `MDBX_INTEGERKEY`. - Reworked/simplified `mdbx_env_sync_internal()`. - - [Fixed](https://github.com/erthink/libmdbx/issues/248) extra assertion inside `mdbx_cursor_put()` for `MDBX_DUPFIXED` cases. + - [Fixed](todo4recovery://erased_by_github/libmdbx/issues/248) extra assertion inside `mdbx_cursor_put()` for `MDBX_DUPFIXED` cases. - Avoiding extra looping inside `mdbx_env_info_ex()`. - Explicitly enabled core dumps from stochastic tests scripts on Linux. - - [Fixed](https://github.com/erthink/libmdbx/issues/253) `mdbx_override_meta()` to avoid false-positive assertions. + - [Fixed](todo4recovery://erased_by_github/libmdbx/issues/253) `mdbx_override_meta()` to avoid false-positive assertions. - For compatibility reverted returning `MDBX_ENODATA`for some cases. @@ -189,10 +215,10 @@ Acknowledgements: Fixes: - - [Fixed compilation](https://github.com/erthink/libmdbx/pull/239) with `devtoolset-9` on CentOS/RHEL 7. - - [Fixed unexpected `MDBX_PROBLEM` error](https://github.com/erthink/libmdbx/issues/242) because of update an obsolete meta-page. - - [Fixed returning `MDBX_NOTFOUND` error](https://github.com/erthink/libmdbx/issues/243) in case an inexact value found for `MDBX_GET_BOTH` operation. - - [Fixed compilation](https://github.com/erthink/libmdbx/issues/245) without kernel/libc-devel headers. + - [Fixed compilation](todo4recovery://erased_by_github/libmdbx/pull/239) with `devtoolset-9` on CentOS/RHEL 7. + - [Fixed unexpected `MDBX_PROBLEM` error](todo4recovery://erased_by_github/libmdbx/issues/242) because of update an obsolete meta-page. + - [Fixed returning `MDBX_NOTFOUND` error](todo4recovery://erased_by_github/libmdbx/issues/243) in case an inexact value found for `MDBX_GET_BOTH` operation. + - [Fixed compilation](todo4recovery://erased_by_github/libmdbx/issues/245) without kernel/libc-devel headers. Minors: @@ -209,7 +235,7 @@ Minors: The database format signature has been changed to prevent forward-interoperability with an previous releases, which may lead to a -[false positive diagnosis of database corruption](https://github.com/erthink/libmdbx/issues/238) +[false positive diagnosis of database corruption](todo4recovery://erased_by_github/libmdbx/issues/238) due to flaws of an old library versions. This change is mostly invisible: @@ -258,7 +284,7 @@ Acknowledgements: Fixes: - Fixed possibility of looping update GC during transaction commit (no public issue since the problem was discovered inside [Positive Technologies](https://www.ptsecurity.ru)). - - Fixed `#pragma pack` to avoid provoking some compilers to generate code with [unaligned access](https://github.com/erthink/libmdbx/issues/235). + - Fixed `#pragma pack` to avoid provoking some compilers to generate code with [unaligned access](todo4recovery://erased_by_github/libmdbx/issues/235). - Fixed `noexcept` for potentially throwing `txn::put()` of C++ API. Minors: @@ -284,7 +310,7 @@ Extensions and improvements: Fixes: - - Always setup `madvise` while opening DB (fixes https://github.com/erthink/libmdbx/issues/231). + - Always setup `madvise` while opening DB (fixes todo4recovery://erased_by_github/libmdbx/issues/231). - Fixed checking legacy `P_DIRTY` flag (`0x10`) for nested/sub-pages. Minors: @@ -305,11 +331,11 @@ Acknowledgements: - [Lionel Debroux](https://github.com/debrouxl) for fuzzing tests and reporting bugs. - [Sergey Fedotov](https://github.com/SergeyFromHell/) for [`node-mdbx` NodeJS bindings](https://www.npmjs.com/package/node-mdbx). - [Kris Zyp](https://github.com/kriszyp) for [`lmdbx-store` NodeJS bindings](https://github.com/kriszyp/lmdbx-store). - - [Noel Kuntze](https://github.com/Thermi) for [draft Python bindings](https://github.com/erthink/libmdbx/commits/python-bindings). + - [Noel Kuntze](https://github.com/Thermi) for [draft Python bindings](todo4recovery://erased_by_github/libmdbx/commits/python-bindings). New features, extensions and improvements: - - [Allow to predefine/override `MDBX_BUILD_TIMESTAMP` for builds reproducibility](https://github.com/erthink/libmdbx/issues/201). + - [Allow to predefine/override `MDBX_BUILD_TIMESTAMP` for builds reproducibility](todo4recovery://erased_by_github/libmdbx/issues/201). - Added options support for `long-stochastic` script. - Avoided `MDBX_TXN_FULL` error for large transactions when possible. - The `MDBX_READERS_LIMIT` increased to `32767`. @@ -317,7 +343,7 @@ New features, extensions and improvements: - Minimized the size of poisoned/unpoisoned regions to avoid Valgrind/ASAN stuck. - Added more workarounds for QEMU for testing builds for 32-bit platforms, Alpha and Sparc architectures. - `mdbx_chk` now skips iteration & checking of DB' records if corresponding page-tree is corrupted (to avoid `SIGSEGV`, ASAN failures, etc). - - Added more checks for [rare/fuzzing corruption cases](https://github.com/erthink/libmdbx/issues/217). + - Added more checks for [rare/fuzzing corruption cases](todo4recovery://erased_by_github/libmdbx/issues/217). Backward compatibility break: @@ -329,18 +355,18 @@ Backward compatibility break: Fixes: - Fixed excess meta-pages checks in case `mdbx_chk` is called to check the DB for a specific meta page and thus could prevent switching to the selected meta page, even if the check passed without errors. - - Fixed [recursive use of SRW-lock on Windows cause by `MDBX_NOTLS` option](https://github.com/erthink/libmdbx/issues/203). - - Fixed [log a warning during a new DB creation](https://github.com/erthink/libmdbx/issues/205). - - Fixed [false-negative `mdbx_cursor_eof()` result](https://github.com/erthink/libmdbx/issues/207). - - Fixed [`make install` with non-GNU `install` utility (OSX, BSD)](https://github.com/erthink/libmdbx/issues/208). - - Fixed [installation by `CMake` in special cases by complete use `GNUInstallDirs`'s variables](https://github.com/erthink/libmdbx/issues/209). - - Fixed [C++ Buffer issue with `std::string` and alignment](https://github.com/erthink/libmdbx/issues/191). + - Fixed [recursive use of SRW-lock on Windows cause by `MDBX_NOTLS` option](todo4recovery://erased_by_github/libmdbx/issues/203). + - Fixed [log a warning during a new DB creation](todo4recovery://erased_by_github/libmdbx/issues/205). + - Fixed [false-negative `mdbx_cursor_eof()` result](todo4recovery://erased_by_github/libmdbx/issues/207). + - Fixed [`make install` with non-GNU `install` utility (OSX, BSD)](todo4recovery://erased_by_github/libmdbx/issues/208). + - Fixed [installation by `CMake` in special cases by complete use `GNUInstallDirs`'s variables](todo4recovery://erased_by_github/libmdbx/issues/209). + - Fixed [C++ Buffer issue with `std::string` and alignment](todo4recovery://erased_by_github/libmdbx/issues/191). - Fixed `safe64_reset()` for platforms without atomic 64-bit compare-and-swap. - Fixed hang/shutdown on big-endian platforms without `__cxa_thread_atexit()`. - - Fixed [using bad meta-pages if DB was partially/recoverable corrupted](https://github.com/erthink/libmdbx/issues/217). + - Fixed [using bad meta-pages if DB was partially/recoverable corrupted](todo4recovery://erased_by_github/libmdbx/issues/217). - Fixed extra `noexcept` for `buffer::&assign_reference()`. - Fixed `bootid` generation on Windows for case of change system' time. - - Fixed [test framework keygen-related issue](https://github.com/erthink/libmdbx/issues/127). + - Fixed [test framework keygen-related issue](todo4recovery://erased_by_github/libmdbx/issues/127). ## v0.10.1 at 2021-06-01 @@ -361,10 +387,10 @@ New features: Fixes: - Fixed minor "foo not used" warnings from modern C++ compilers when building the C++ part of the library. - - Fixed confusing/messy errors when build library from unfit github's archives (https://github.com/erthink/libmdbx/issues/197). + - Fixed confusing/messy errors when build library from unfit github's archives (todo4recovery://erased_by_github/libmdbx/issues/197). - Fixed `#​e​l​s​i​f` typo. - - Fixed rare unexpected `MDBX_PROBLEM` error during altering data in huge transactions due to wrong spilling/oust of dirty pages (https://github.com/erthink/libmdbx/issues/195). - - Re-Fixed WSL1/WSL2 detection with distinguishing (https://github.com/erthink/libmdbx/issues/97). + - Fixed rare unexpected `MDBX_PROBLEM` error during altering data in huge transactions due to wrong spilling/oust of dirty pages (todo4recovery://erased_by_github/libmdbx/issues/195). + - Re-Fixed WSL1/WSL2 detection with distinguishing (todo4recovery://erased_by_github/libmdbx/issues/97). ## v0.10.0 at 2021-05-09 @@ -387,7 +413,7 @@ New features: and conjointly with the `MDBX_ENV_CHECKPID=0` and `MDBX_TXN_CHECKOWNER=0` options can yield up to 30% more performance compared to LMDB. - Using float point (exponential quantized) representation for internal 16-bit values - of grow step and shrink threshold when huge ones (https://github.com/erthink/libmdbx/issues/166). + of grow step and shrink threshold when huge ones (todo4recovery://erased_by_github/libmdbx/issues/166). To minimize the impact on compatibility, only the odd values inside the upper half of the range (i.e. 32769..65533) are used for the new representation. - Added the `mdbx_drop` similar to LMDB command-line tool to purge or delete (sub)database(s). @@ -396,7 +422,7 @@ New features: - The internal node sizes were refined, resulting in a reduction in large/overflow pages in some use cases and a slight increase in limits for a keys size to ≈½ of page size. - Added to `mdbx_chk` output number of keys/items on pages. - - Added explicit `install-strip` and `install-no-strip` targets to the `Makefile` (https://github.com/erthink/libmdbx/pull/180). + - Added explicit `install-strip` and `install-no-strip` targets to the `Makefile` (todo4recovery://erased_by_github/libmdbx/pull/180). - Major rework page splitting (af9b7b560505684249b76730997f9e00614b8113) for - An "auto-appending" feature upon insertion for both ascending and descending key sequences. As a result, the optimality of page filling @@ -404,7 +430,7 @@ New features: inserting ordered sequences of keys, - A "splitting at middle" to make page tree more balanced on average. - Added `mdbx_get_sysraminfo()` to the API. - - Added guessing a reasonable maximum DB size for the default upper limit of geometry (https://github.com/erthink/libmdbx/issues/183). + - Added guessing a reasonable maximum DB size for the default upper limit of geometry (todo4recovery://erased_by_github/libmdbx/issues/183). - Major rework internal labeling of a dirty pages (958fd5b9479f52f2124ab7e83c6b18b04b0e7dda) for a "transparent spilling" feature with the gist to make a dirty pages be ready to spilling (writing to a disk) without further altering ones. @@ -420,7 +446,7 @@ New features: - Support `make help` to list available make targets. - Silently `make`'s build by default. - Preliminary [Python bindings](https://github.com/Thermi/libmdbx/tree/python-bindings) is available now - by [Noel Kuntze](https://github.com/Thermi) (https://github.com/erthink/libmdbx/issues/147). + by [Noel Kuntze](https://github.com/Thermi) (todo4recovery://erased_by_github/libmdbx/issues/147). Backward compatibility break: @@ -435,22 +461,22 @@ Backward compatibility break: Fixes: - - Fixed performance regression due non-optimal C11 atomics usage (https://github.com/erthink/libmdbx/issues/160). - - Fixed "reincarnation" of subDB after it deletion (https://github.com/erthink/libmdbx/issues/168). + - Fixed performance regression due non-optimal C11 atomics usage (todo4recovery://erased_by_github/libmdbx/issues/160). + - Fixed "reincarnation" of subDB after it deletion (todo4recovery://erased_by_github/libmdbx/issues/168). - Fixed (disallowing) implicit subDB deletion via operations on `@MAIN`'s DBI-handle. - - Fixed a crash of `mdbx_env_info_ex()` in case of a call for a non-open environment (https://github.com/erthink/libmdbx/issues/171). - - Fixed the selecting/adjustment values inside `mdbx_env_set_geometry()` for implicit out-of-range cases (https://github.com/erthink/libmdbx/issues/170). - - Fixed `mdbx_env_set_option()` for set initial and limit size of dirty page list ((https://github.com/erthink/libmdbx/issues/179). - - Fixed an unreasonably huge default upper limit for DB geometry (https://github.com/erthink/libmdbx/issues/183). + - Fixed a crash of `mdbx_env_info_ex()` in case of a call for a non-open environment (todo4recovery://erased_by_github/libmdbx/issues/171). + - Fixed the selecting/adjustment values inside `mdbx_env_set_geometry()` for implicit out-of-range cases (todo4recovery://erased_by_github/libmdbx/issues/170). + - Fixed `mdbx_env_set_option()` for set initial and limit size of dirty page list ((todo4recovery://erased_by_github/libmdbx/issues/179). + - Fixed an unreasonably huge default upper limit for DB geometry (todo4recovery://erased_by_github/libmdbx/issues/183). - Fixed `constexpr` specifier for the `slice::invalid()`. - - Fixed (no)readahead auto-handling (https://github.com/erthink/libmdbx/issues/164). + - Fixed (no)readahead auto-handling (todo4recovery://erased_by_github/libmdbx/issues/164). - Fixed non-alloy build for Windows. - Switched to using Heap-functions instead of LocalAlloc/LocalFree on Windows. - - Fixed `mdbx_env_stat_ex()` to returning statistics of the whole environment instead of MainDB only (https://github.com/erthink/libmdbx/issues/190). + - Fixed `mdbx_env_stat_ex()` to returning statistics of the whole environment instead of MainDB only (todo4recovery://erased_by_github/libmdbx/issues/190). - Fixed building by GCC 4.8.5 (added workaround for a preprocessor's bug). - Fixed building C++ part for iOS <= 13.0 (unavailability of `std::filesystem::path`). - Fixed building for Windows target versions prior to Windows Vista (`WIN32_WINNT < 0x0600`). - - Fixed building by MinGW for Windows (https://github.com/erthink/libmdbx/issues/155). + - Fixed building by MinGW for Windows (todo4recovery://erased_by_github/libmdbx/issues/155). ## v0.9.3 at 2021-02-02 @@ -470,7 +496,7 @@ Removed options and features: New features: - Package for FreeBSD is available now by Mahlon E. Smith. - - New API functions to get/set various options (https://github.com/erthink/libmdbx/issues/128): + - New API functions to get/set various options (todo4recovery://erased_by_github/libmdbx/issues/128): - the maximum number of named databases for the environment; - the maximum number of threads/reader slots; - threshold (since the last unsteady commit) to force flush the data buffers to disk; @@ -483,7 +509,7 @@ New features: - maximal part of the dirty pages may be spilled when necessary; - minimal part of the dirty pages should be spilled when necessary; - how much of the parent transaction dirty pages will be spilled while start each child transaction; - - Unlimited/Dynamic size of retired and dirty page lists (https://github.com/erthink/libmdbx/issues/123). + - Unlimited/Dynamic size of retired and dirty page lists (todo4recovery://erased_by_github/libmdbx/issues/123). - Added `-p` option (purge subDB before loading) to `mdbx_load` tool. - Reworked spilling of large transaction and committing of nested transactions: - page spilling code reworked to avoid the flaws and bugs inherited from LMDB; @@ -493,22 +519,22 @@ New features: - Added `MDBX_ENABLE_REFUND` and `MDBX_PNL_ASCENDING` internal/advanced build options. - Added `mdbx_default_pagesize()` function. - Better support architectures with a weak/relaxed memory consistency model (ARM, AARCH64, PPC, MIPS, RISC-V, etc) by means [C11 atomics](https://en.cppreference.com/w/c/atomic). - - Speed up page number lists and dirty page lists (https://github.com/erthink/libmdbx/issues/132). + - Speed up page number lists and dirty page lists (todo4recovery://erased_by_github/libmdbx/issues/132). - Added `LIBMDBX_NO_EXPORTS_LEGACY_API` build option. Fixes: - - Fixed missing cleanup (null assigned) in the C++ commit/abort (https://github.com/erthink/libmdbx/pull/143). + - Fixed missing cleanup (null assigned) in the C++ commit/abort (todo4recovery://erased_by_github/libmdbx/pull/143). - Fixed `mdbx_realloc()` for case of nullptr and `MDBX_WITHOUT_MSVC_CRT=ON` for Windows. - - Fixed the possibility to use invalid and renewed (closed & re-opened, dropped & re-created) DBI-handles (https://github.com/erthink/libmdbx/issues/146). - - Fixed 4-byte aligned access to 64-bit integers, including access to the `bootid` meta-page's field (https://github.com/erthink/libmdbx/issues/153). + - Fixed the possibility to use invalid and renewed (closed & re-opened, dropped & re-created) DBI-handles (todo4recovery://erased_by_github/libmdbx/issues/146). + - Fixed 4-byte aligned access to 64-bit integers, including access to the `bootid` meta-page's field (todo4recovery://erased_by_github/libmdbx/issues/153). - Fixed minor/potential memory leak during page flushing and unspilling. - Fixed handling states of cursors's and subDBs's for nested transactions. - Fixed page leak in extra rare case the list of retired pages changed during update GC on transaction commit. - - Fixed assertions to avoid false-positive UB detection by CLANG/LLVM (https://github.com/erthink/libmdbx/issues/153). - - Fixed `MDBX_TXN_FULL` and regressive `MDBX_KEYEXIST` during large transaction commit with `MDBX_LIFORECLAIM` (https://github.com/erthink/libmdbx/issues/123). + - Fixed assertions to avoid false-positive UB detection by CLANG/LLVM (todo4recovery://erased_by_github/libmdbx/issues/153). + - Fixed `MDBX_TXN_FULL` and regressive `MDBX_KEYEXIST` during large transaction commit with `MDBX_LIFORECLAIM` (todo4recovery://erased_by_github/libmdbx/issues/123). - Fixed auto-recovery (`weak->steady` with the same boot-id) when Database size at last weak checkpoint is large than at last steady checkpoint. - - Fixed operation on systems with unusual small/large page size, including PowerPC (https://github.com/erthink/libmdbx/issues/157). + - Fixed operation on systems with unusual small/large page size, including PowerPC (todo4recovery://erased_by_github/libmdbx/issues/157). ## v0.9.2 at 2020-11-27 @@ -546,11 +572,11 @@ Fixes: - Fixed copy&paste typos. - Fixed minor false-positive GCC warning. - Added workaround for broken `DEFINE_ENUM_FLAG_OPERATORS` from Windows SDK. - - Fixed cursor state after multimap/dupsort repeated deletes (https://github.com/erthink/libmdbx/issues/121). + - Fixed cursor state after multimap/dupsort repeated deletes (todo4recovery://erased_by_github/libmdbx/issues/121). - Added `SIGPIPE` suppression for internal thread during `mdbx_env_copy()`. - - Fixed extra-rare `MDBX_KEY_EXIST` error during `mdbx_commit()` (https://github.com/erthink/libmdbx/issues/131). - - Fixed spilled pages checking (https://github.com/erthink/libmdbx/issues/126). - - Fixed `mdbx_load` for 'plain text' and without `-s name` cases (https://github.com/erthink/libmdbx/issues/136). + - Fixed extra-rare `MDBX_KEY_EXIST` error during `mdbx_commit()` (todo4recovery://erased_by_github/libmdbx/issues/131). + - Fixed spilled pages checking (todo4recovery://erased_by_github/libmdbx/issues/126). + - Fixed `mdbx_load` for 'plain text' and without `-s name` cases (todo4recovery://erased_by_github/libmdbx/issues/136). - Fixed save/restore/commit of cursors for nested transactions. - Fixed cursors state in rare/special cases (move next beyond end-of-data, after deletion and so on). - Added workaround for MSVC 19.28 (Visual Studio 16.8) (but may still hang during compilation). @@ -566,7 +592,7 @@ Fixes: Added features: - Preliminary C++ API with support for C++17 polymorphic allocators. - - [Online C++ API reference](https://erthink.github.io/libmdbx/) by Doxygen. + - [Online C++ API reference](https://erased_by_github_and_to_be_restored.todo/libmdbx/) by Doxygen. - Quick reference for Insert/Update/Delete operations. - Explicit `MDBX_SYNC_DURABLE` to sync modes for API clarity. - Explicit `MDBX_ALLDUPS` and `MDBX_UPSERT` for API clarity. @@ -611,7 +637,7 @@ Fixes: Added features: - - [Online C API reference](https://erthink.github.io/libmdbx/) by Doxygen. + - [Online C API reference](https://erased_by_github_and_to_be_restored.todo/libmdbx/) by Doxygen. - Separated enums for environment, sub-databases, transactions, copying and data-update flags. Deprecated functions and flags: diff --git a/GNUmakefile b/GNUmakefile index f70a3da1d..b768a12cd 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -325,6 +325,7 @@ else .PHONY: build-test build-test-with-valgrind check cross-gcc cross-qemu dist doxygen gcc-analyzer long-test .PHONY: reformat release-assets tags smoke test test-asan smoke-fault test-leak .PHONY: smoke-singleprocess test-singleprocess test-ubsan test-valgrind memcheck +.PHONY: smoke-assertion test-assertion long-test-assertion define uname2osal case "$(UNAME)" in @@ -380,11 +381,18 @@ MDBX_SMOKE_EXTRA ?= check: DESTDIR = $(shell pwd)/@check-install check: test dist install +smoke-assertion: MDBX_BUILD_OPTIONS=-DMDBX_FORCE_ASSERTIONS=1 +smoke-assertion: smoke +test-assertion: MDBX_BUILD_OPTIONS=-DMDBX_FORCE_ASSERTIONS=1 +test-assertion: smoke +long-test-assertion: MDBX_BUILD_OPTIONS=-DMDBX_FORCE_ASSERTIONS=1 +long-test-assertion: smoke + smoke: build-test @echo ' SMOKE `mdbx_test basic`...' $(QUIET)rm -f $(TEST_DB) $(TEST_LOG).gz && (set -o pipefail; \ (./mdbx_test --table=+data.integer --keygen.split=29 --datalen.min=min --datalen.max=max --progress --console=no --repeat=$(TEST_ITER) --pathname=$(TEST_DB) --dont-cleanup-after $(MDBX_SMOKE_EXTRA) basic && \ - ./mdbx_test --mode=-writemap,-nosync-safe,-lifo --progress --console=no --repeat=12 --pathname=$(TEST_DB) --dont-cleanup-after $(MDBX_SMOKE_EXTRA) basic) \ + ./mdbx_test --mode=-writemap,-nosync-safe,-lifo --progress --console=no --repeat=$(TEST_ITER) --pathname=$(TEST_DB) --dont-cleanup-after $(MDBX_SMOKE_EXTRA) basic) \ | tee >(gzip --stdout >$(TEST_LOG).gz) | tail -n 42) \ && ./mdbx_chk -vvn $(TEST_DB) && ./mdbx_chk -vvn $(TEST_DB)-copy diff --git a/Makefile b/Makefile index 183da9c4f..599e47874 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,7 @@ lib libs lib-static lib-shared tools-static \ libmdbx mdbx mdbx_chk mdbx_copy mdbx_drop mdbx_dump mdbx_load mdbx_stat \ check dist memcheck cross-gcc cross-qemu doxygen gcc-analyzer reformat \ release-assets tags test build-test mdbx_test smoke smoke-fault smoke-singleprocess \ +smoke-assertion test-assertion long-test-assertion \ test-asan test-leak test-singleprocess test-ubsan test-valgrind: @CC=$(CC) \ CXX=`if test -n "$(CXX)" && which "$(CXX)" > /dev/null; then echo "$(CXX)"; elif test -n "$(CCC)" && which "$(CCC)" > /dev/null; then echo "$(CCC)"; else echo "c++"; fi` \ diff --git a/README.md b/README.md index 4eec2fd72..b27fadb21 100644 --- a/README.md +++ b/README.md @@ -1,35 +1,46 @@ +### The origin has been migrated to [GitFlic](https://gitflic.ru/project/erthink/libmdbx) +since on 2022-04-15 the Github administration, without any warning +nor explanation, deleted _libmdbx_ along with a lot of other projects, +simultaneously blocking access for many developers. +For the same reason ~~Github~~ is blacklisted forever. + +GitFlic's developers plan to support other languages, +including English 和 中文, in the near future. + +### Основной репозиторий перемещен на [GitFlic](https://gitflic.ru/project/erthink/libmdbx) +так как 15 апреля 2022 администрация Github без предупреждения и +объяснения причин удалила _libmdbx_ вместе с массой других проектов, +одновременно заблокировав доступ многим разработчикам. +По этой же причине ~~Github~~ навсегда занесен в черный список. + +-------------------------------------------------------------------------------- + *The Future will (be) [Positive](https://www.ptsecurity.com). Всё будет хорошо.* -> Please refer to the online [documentation](https://erthink.github.io/libmdbx/) -> with [`C` API description](https://erthink.github.io/libmdbx/group__c__api.html) -> and pay attention to the [`C++` API](https://github.com/erthink/libmdbx/blob/devel/mdbx.h%2B%2B). +> Please refer to the online [documentation](https://libmdbx.website.yandexcloud.net) +> with [`C` API description](https://libmdbx.website.yandexcloud.net/group__c__api.html) +> and pay attention to the [`C++` API](https://gitflic.ru/project/erthink/libmdbx/blob?file=mdbx.h%2B%2B#line-num-1). > Questions, feedback and suggestions are welcome to the [Telegram' group](https://t.me/libmdbx). -> For NEWS take a look to the [ChangeLog](./ChangeLog.md). +> For NEWS take a look to the [ChangeLog](https://gitflic.ru/project/erthink/libmdbx/blob?file=ChangeLog.md). -[![https://t.me/libmdbx](https://raw.githubusercontent.com/wiki/erthink/libmdbx/img/telegram.png)](https://t.me/libmdbx) -[![Version](https://badge.fury.io/gh/erthink%2Flibmdbx.svg)](https://github.com/erthink/libmdbx/releases) -[![GithubCI](https://github.com/erthink/libmdbx/workflows/CI/badge.svg)](https://github.com/erthink/libmdbx/actions?query=workflow%3ACI) -[![AppveyorCI](https://ci.appveyor.com/api/projects/status/ue94mlopn50dqiqg/branch/master?svg=true)](https://ci.appveyor.com/project/leo-yuriev/libmdbx/branch/master) -[![CircleCI](https://circleci.com/gh/erthink/libmdbx/tree/master.svg?style=svg)](https://circleci.com/gh/erthink/libmdbx/tree/master) -[![CirrusCI](https://api.cirrus-ci.com/github/erthink/libmdbx.svg)](https://cirrus-ci.com/github/erthink/libmdbx) -[![Coverity Scan Status](https://scan.coverity.com/projects/12915/badge.svg)](https://scan.coverity.com/projects/reopen-libmdbx) libmdbx ======== -_libmdbx_ is an extremely fast, compact, powerful, embedded, -transactional [key-value database](https://en.wikipedia.org/wiki/Key-value_database), -with [permissive license](./LICENSE). + +_libmdbx_ is an extremely fast, compact, powerful, embedded, transactional +[key-value database](https://en.wikipedia.org/wiki/Key-value_database), +with [permissive license](https://gitflic.ru/project/erthink/libmdbx/blob?file=LICENSE). _libmdbx_ has a specific set of properties and capabilities, focused on creating unique lightweight solutions. 1. Allows **a swarm of multi-threaded processes to -[ACID]((https://en.wikipedia.org/wiki/ACID))ly read and update** several +[ACID](https://en.wikipedia.org/wiki/ACID)ly read and update** several key-value [maps](https://en.wikipedia.org/wiki/Associative_array) and [multimaps](https://en.wikipedia.org/wiki/Multimap) in a locally-shared database. @@ -62,6 +73,7 @@ neglected in favour of write performance. 7. Supports Linux, Windows, MacOS, Android, iOS, FreeBSD, DragonFly, Solaris, OpenSolaris, OpenIndiana, NetBSD, OpenBSD and other systems compliant with **POSIX.1-2008**. + Historically, _libmdbx_ is a deeply revised and extended descendant of the amazing @@ -69,16 +81,19 @@ Historically, _libmdbx_ is a deeply revised and extended descendant of the amazi _libmdbx_ inherits all benefits from _LMDB_, but resolves some issues and adds [a set of improvements](#improvements-beyond-lmdb). + The next version is under active non-public development from scratch and will be -released as _**MithrilDB**_ and `libmithrildb` for libraries & packages. +released as **MithrilDB** and `libmithrildb` for libraries & packages. Admittedly mythical [Mithril](https://en.wikipedia.org/wiki/Mithril) is resembling silver but being stronger and lighter than steel. Therefore _MithrilDB_ is a rightly relevant name. - > _MithrilDB_ will be radically different from _libmdbx_ by the new - > database format and API based on C++17, as well as the [Apache 2.0 - > License](https://www.apache.org/licenses/LICENSE-2.0). The goal of this - > revolution is to provide a clearer and robust API, add more features and - > new valuable properties of the database. + + > _MithrilDB_ will be radically different from _libmdbx_ by the new + > database format and API based on C++17, as well as the [Apache 2.0 + > License](https://www.apache.org/licenses/LICENSE-2.0). The goal of this + > revolution is to provide a clearer and robust API, add more features and + > new valuable properties of the database. + ----- @@ -188,6 +203,7 @@ databases"](https://github.com/coreos/bbolt#comparison-with-other-databases) which is also (mostly) applicable to _libmdbx_. + Improvements beyond LMDB @@ -203,45 +219,52 @@ the user's point of view. ## Added Features 1. Keys could be more than 2 times longer than _LMDB_. - > For DB with default page size _libmdbx_ support keys up to 2022 bytes - > and up to 32742 bytes for 64K page size. _LMDB_ allows key size up to - > 511 bytes and may silently loses data with large values. + + > For DB with default page size _libmdbx_ support keys up to 2022 bytes + > and up to 32742 bytes for 64K page size. _LMDB_ allows key size up to + > 511 bytes and may silently loses data with large values. 2. Up to 30% faster than _LMDB_ in [CRUD](https://en.wikipedia.org/wiki/Create,_read,_update_and_delete) benchmarks. - > Benchmarks of the in-[tmpfs](https://en.wikipedia.org/wiki/Tmpfs) scenarios, - > that tests the speed of the engine itself, showned that _libmdbx_ 10-20% faster than _LMDB_, - > and up to 30% faster when _libmdbx_ compiled with specific build options - > which downgrades several runtime checks to be match with LMDB behaviour. - > - > These and other results could be easily reproduced with [ioArena](https://github.com/pmwkaa/ioarena) just by `make bench-quartet` command, - > including comparisons with [RockDB](https://en.wikipedia.org/wiki/RocksDB) - > and [WiredTiger](https://en.wikipedia.org/wiki/WiredTiger). + + > Benchmarks of the in-[tmpfs](https://en.wikipedia.org/wiki/Tmpfs) scenarios, + > that tests the speed of the engine itself, showned that _libmdbx_ 10-20% faster than _LMDB_, + > and up to 30% faster when _libmdbx_ compiled with specific build options + > which downgrades several runtime checks to be match with LMDB behaviour. + > + > These and other results could be easily reproduced with [ioArena](https://github.com/pmwkaa/ioarena) just by `make bench-quartet` command, + > including comparisons with [RockDB](https://en.wikipedia.org/wiki/RocksDB) + > and [WiredTiger](https://en.wikipedia.org/wiki/WiredTiger). 3. Automatic on-the-fly database size adjustment, both increment and reduction. - > _libmdbx_ manages the database size according to parameters specified - > by `mdbx_env_set_geometry()` function, - > ones include the growth step and the truncation threshold. - > - > Unfortunately, on-the-fly database size adjustment doesn't work under [Wine](https://en.wikipedia.org/wiki/Wine_(software)) - > due to its internal limitations and unimplemented functions, i.e. the `MDBX_UNABLE_EXTEND_MAPSIZE` error will be returned. + + > _libmdbx_ manages the database size according to parameters specified + > by `mdbx_env_set_geometry()` function, + > ones include the growth step and the truncation threshold. + > + > Unfortunately, on-the-fly database size adjustment doesn't work under [Wine](https://en.wikipedia.org/wiki/Wine_(software)) + > due to its internal limitations and unimplemented functions, i.e. the `MDBX_UNABLE_EXTEND_MAPSIZE` error will be returned. 4. Automatic continuous zero-overhead database compactification. - > During each commit _libmdbx_ merges a freeing pages which adjacent with the unallocated area - > at the end of file, and then truncates unused space when a lot enough of. + + > During each commit _libmdbx_ merges a freeing pages which adjacent with the unallocated area + > at the end of file, and then truncates unused space when a lot enough of. 5. The same database format for 32- and 64-bit builds. - > _libmdbx_ database format depends only on the [endianness](https://en.wikipedia.org/wiki/Endianness) but not on the [bitness](https://en.wiktionary.org/wiki/bitness). + + > _libmdbx_ database format depends only on the [endianness](https://en.wikipedia.org/wiki/Endianness) but not on the [bitness](https://en.wiktionary.org/wiki/bitness). 6. LIFO policy for Garbage Collection recycling. This can significantly increase write performance due write-back disk cache up to several times in a best case scenario. - > LIFO means that for reuse will be taken the latest becomes unused pages. - > Therefore the loop of database pages circulation becomes as short as possible. - > In other words, the set of pages, that are (over)written in memory and on disk during a series of write transactions, will be as small as possible. - > Thus creates ideal conditions for the battery-backed or flash-backed disk cache efficiency. + + > LIFO means that for reuse will be taken the latest becomes unused pages. + > Therefore the loop of database pages circulation becomes as short as possible. + > In other words, the set of pages, that are (over)written in memory and on disk during a series of write transactions, will be as small as possible. + > Thus creates ideal conditions for the battery-backed or flash-backed disk cache efficiency. 7. Fast estimation of range query result volume, i.e. how many items can be found between a `KEY1` and a `KEY2`. This is a prerequisite for build and/or optimize query execution plans. - > _libmdbx_ performs a rough estimate based on common B-tree pages of the paths from root to corresponding keys. + + > _libmdbx_ performs a rough estimate based on common B-tree pages of the paths from root to corresponding keys. 8. `mdbx_chk` utility for database integrity check. Since version 0.9.1, the utility supports checking the database using any of the three meta pages and the ability to switch to it. @@ -254,12 +277,14 @@ Since version 0.9.1, the utility supports checking the database using any of the or not, that allows to avoid copy-out before updates. 12. Extended information of whole-database, sub-databases, transactions, readers enumeration. - > _libmdbx_ provides a lot of information, including dirty and leftover pages - > for a write transaction, reading lag and holdover space for read transactions. + + > _libmdbx_ provides a lot of information, including dirty and leftover pages + > for a write transaction, reading lag and holdover space for read transactions. 13. Extended update and delete operations. - > _libmdbx_ allows one _at once_ with getting previous value - > and addressing the particular item from multi-value with the same key. + + > _libmdbx_ allows one _at once_ with getting previous value + > and addressing the particular item from multi-value with the same key. 14. Useful runtime options for tuning engine to application's requirements and use cases specific. @@ -289,9 +314,10 @@ pre-opening is not needed. 4. Returning `MDBX_EMULTIVAL` error in case of ambiguous update or delete. 5. Guarantee of database integrity even in asynchronous unordered write-to-disk mode. - > _libmdbx_ propose additional trade-off by `MDBX_SAFE_NOSYNC` with append-like manner for updates, - > that avoids database corruption after a system crash contrary to LMDB. - > Nevertheless, the `MDBX_UTTERLY_NOSYNC` mode is available to match LMDB's behaviour for `MDB_NOSYNC`. + + > _libmdbx_ propose additional trade-off by `MDBX_SAFE_NOSYNC` with append-like manner for updates, + > that avoids database corruption after a system crash contrary to LMDB. + > Nevertheless, the `MDBX_UTTERLY_NOSYNC` mode is available to match LMDB's behaviour for `MDB_NOSYNC`. 6. On **MacOS & iOS** the `fcntl(F_FULLFSYNC)` syscall is used _by default_ to synchronize data with the disk, as this is [the only way to @@ -318,14 +344,22 @@ named mutexes are used. Historically, _libmdbx_ is a deeply revised and extended descendant of the [Lightning Memory-Mapped Database](https://en.wikipedia.org/wiki/Lightning_Memory-Mapped_Database). At first the development was carried out within the -[ReOpenLDAP](https://github.com/erthink/ReOpenLDAP) project. About a +[ReOpenLDAP](todo4recovery://erased_by_github/ReOpenLDAP) project. About a year later _libmdbx_ was separated into a standalone project, which was [presented at Highload++ 2015 conference](http://www.highload.ru/2015/abstracts/1831.html). -Since 2017 _libmdbx_ is used in [Fast Positive Tables](https://github.com/erthink/libfpta), +Since 2017 _libmdbx_ is used in [Fast Positive Tables](https://gitflic.ru/project/erthink/libfpta), and development is funded by [Positive Technologies](https://www.ptsecurity.com). +On 2022-04-15 the Github administration, without any warning nor +explanation, deleted _libmdbx_ along with a lot of other projects, +simultaneously blocking access for many developers. Therefore on +2022-04-21 we have migrated to a reliable trusted infrastructure. +The origin for now is at [GitFlic](https://gitflic.ru/project/erthink/libmdbx) +with backup at [ABF by ROSA Лаб](https://abf.io/erthink/libmdbx). +For the same reason ~~Github~~ is blacklisted forever. + ## Acknowledgments Howard Chu is the author of LMDB, from which originated the _libmdbx_ in 2015. @@ -341,29 +375,25 @@ Usage ===== + Currently, libmdbx is only available in a [source code](https://en.wikipedia.org/wiki/Source_code) form. Packages support for common Linux distributions is planned in the future, since release the version 1.0. -## Never use tarballs nor zips automatically provided by Github ! - -Please don't use tarballs nor zips which are automatically provided by Github. -These archives do not contain version information and thus are unfit to build _libmdbx_. -Instead of ones just clone the git repository, either download a tarball or zip with the properly amalgamated source core. -Moreover, please vote for [ability of disabling auto-creation such unsuitable archives](https://github.community/t/disable-tarball). - ## Source code embedding _libmdbx_ provides two official ways for integration in source code form: 1. Using the amalgamated source code. - > The amalgamated source code includes all files required to build and - > use _libmdbx_, but not for testing _libmdbx_ itself. + + > The amalgamated source code includes all files required to build and + > use _libmdbx_, but not for testing _libmdbx_ itself. 2. Adding the complete original source code as a `git submodule`. - > This allows you to build as _libmdbx_ and testing tool. - > On the other hand, this way requires you to pull git tags, and use C++11 compiler for test tool. + + > This allows you to build as _libmdbx_ and testing tool. + > On the other hand, this way requires you to pull git tags, and use C++11 compiler for test tool. _**Please, avoid using any other techniques.**_ Otherwise, at least don't ask for support and don't name such chimeras `libmdbx`. @@ -390,8 +420,7 @@ and build options respectively. The only significant specificity is that git' tags are required to build from complete (not amalgamated) source codes. Executing **`git fetch --tags --force --prune`** is enough to get ones, -or `git fetch --unshallow --tags --prune --force` after the Github's -[`actions/checkout@v2`](https://github.com/actions/checkout) either set **`fetch-depth: 0`** for it. +and `--unshallow` or `--update-shallow` is required for shallow cloned case. So just using CMake or GNU Make in your habitual manner and feel free to fill an issue or make pull request in the case something will be @@ -399,10 +428,10 @@ unexpected or broken down. ### Testing The amalgamated source code does not contain any tests for or several reasons. -Please read [the explanation](https://github.com/erthink/libmdbx/issues/214#issuecomment-870717981) and don't ask to alter this. +Please read [the explanation](todo4recovery://erased_by_github/libmdbx/issues/214#issuecomment-870717981) and don't ask to alter this. So for testing _libmdbx_ itself you need a full source code, i.e. the clone of a git repository, there is no option. -The full source code of _libmdbx_ has a [`test` subdirectory](https://github.com/erthink/libmdbx/tree/master/test) with minimalistic test "framework". +The full source code of _libmdbx_ has a [`test` subdirectory](https://gitflic.ru/project/erthink/libmdbx/tree/master/test) with minimalistic test "framework". Actually yonder is a source code of the `mdbx_test` – console utility which has a set of command-line options that allow construct and run a reasonable enough test scenarios. This test utility is intended for _libmdbx_'s developers for testing library itself, but not for use by users. Therefore, only basic information is provided: @@ -413,7 +442,7 @@ Therefore, only basic information is provided: - The `Makefile` provide several self-described targets for testing: `smoke`, `test`, `check`, `memcheck`, `test-valgrind`, `test-asan`, `test-leak`, `test-ubsan`, `cross-gcc`, `cross-qemu`, `gcc-analyzer`, `smoke-fault`, `smoke-singleprocess`, `test-singleprocess`, 'long-test'. Please run `make --help` if doubt. - - In addition to the `mdbx_test` utility, there is the script [`long_stochastic.sh`](https://github.com/erthink/libmdbx/blob/master/test/long_stochastic.sh), + - In addition to the `mdbx_test` utility, there is the script [`long_stochastic.sh`](https://gitflic.ru/project/erthink/libmdbx/blob/master/test/long_stochastic.sh), which calls `mdbx_test` by going through set of modes and options, with gradually increasing the number of operations and the size of transactions. This script is used for mostly of all automatic testing, including `Makefile` targets and Continuous Integration. - Brief information of available command-line options is available by `--help`. @@ -561,7 +590,7 @@ from the [ios-cmake](https://github.com/leetal/ios-cmake) project. ## API description -Please refer to the online [_libmdbx_ API reference](https://erthink.github.io/libmdbx/) +Please refer to the online [_libmdbx_ API reference](https://libmdbx.website.yandexcloud.net/docs) and/or see the [mdbx.h++](mdbx.h%2B%2B) and [mdbx.h](mdbx.h) headers. @@ -581,7 +610,7 @@ Bindings | Rust | [libmdbx-rs](https://github.com/vorot93/libmdbx-rs) | [Artem Vorotnikov](https://github.com/vorot93) | | Rust | [mdbx](https://crates.io/crates/mdbx) | [gcxfd](https://github.com/gcxfd) | | Java | [mdbxjni](https://github.com/castortech/mdbxjni) | [Castor Technologies](https://castortech.com/) | -| Python (draft) | [python-bindings](https://github.com/erthink/libmdbx/commits/python-bindings) branch | [Noel Kuntze](https://github.com/Thermi) +| Python (draft) | [python-bindings](todo4recovery://erased_by_github/libmdbx/commits/python-bindings) branch | [Noel Kuntze](https://github.com/Thermi) | .NET (obsolete) | [mdbx.NET](https://github.com/wangjia184/mdbx.NET) | [Jerry Wang](https://github.com/wangjia184) | @@ -620,7 +649,7 @@ Here showed sum of performance metrics in 3 benchmarks: 2. Performance gap is too high to compare in any meaningful way. -![Comparison #1: Integral Performance](https://raw.githubusercontent.com/wiki/erthink/libmdbx/img/perf-slide-1.png) +![Comparison #1: Integral Performance](https://libmdbx.website.yandexcloud.net/img/perf-slide-1.png) -------------------------------------------------------------------------------- @@ -629,7 +658,7 @@ Here showed sum of performance metrics in 3 benchmarks: Summary performance with concurrent read/search queries in 1-2-4-8 threads on the machine with 4 logical CPUs in HyperThreading mode (i.e. actually 2 physical CPU cores). -![Comparison #2: Read Scalability](https://raw.githubusercontent.com/wiki/erthink/libmdbx/img/perf-slide-2.png) +![Comparison #2: Read Scalability](https://libmdbx.website.yandexcloud.net/img/perf-slide-2.png) -------------------------------------------------------------------------------- @@ -651,7 +680,7 @@ In the benchmark each transaction contains combined CRUD operations (2 inserts, 1 read, 1 update, 1 delete). Benchmark starts on an empty database and after full run the database contains 10,000 small key-value records. -![Comparison #3: Sync-write mode](https://raw.githubusercontent.com/wiki/erthink/libmdbx/img/perf-slide-3.png) +![Comparison #3: Sync-write mode](https://libmdbx.website.yandexcloud.net/img/perf-slide-3.png) -------------------------------------------------------------------------------- @@ -678,7 +707,7 @@ and after full run the database contains 100,000 small key-value records. -![Comparison #4: Lazy-write mode](https://raw.githubusercontent.com/wiki/erthink/libmdbx/img/perf-slide-4.png) +![Comparison #4: Lazy-write mode](https://libmdbx.website.yandexcloud.net/img/perf-slide-4.png) -------------------------------------------------------------------------------- @@ -702,7 +731,7 @@ In the benchmark each transaction contains combined CRUD operations (2 inserts, 1 read, 1 update, 1 delete). Benchmark starts on an empty database and after full run the database contains 10,000 small key-value records. -![Comparison #5: Async-write mode](https://raw.githubusercontent.com/wiki/erthink/libmdbx/img/perf-slide-5.png) +![Comparison #5: Async-write mode](https://libmdbx.website.yandexcloud.net/img/perf-slide-5.png) -------------------------------------------------------------------------------- @@ -726,10 +755,6 @@ All benchmark data is gathered by [getrusage()](http://man7.org/linux/man-pages/man2/getrusage.2.html) syscall and by scanning the data directory. -![Comparison #6: Cost comparison](https://raw.githubusercontent.com/wiki/erthink/libmdbx/img/perf-slide-6.png) +![Comparison #6: Cost comparison](https://libmdbx.website.yandexcloud.net/img/perf-slide-6.png) - --------------------------------------------------------------------------------- - -#### This is a mirror of the origin repository that was moved to [gitflic.ru](https://gitflic.ru/project/erthink/libmdbx) because of discriminatory restrictions for Russian Crimea. diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index ce6ea5e1a..000000000 --- a/appveyor.yml +++ /dev/null @@ -1,113 +0,0 @@ -version: 0.11.6.{build} - -environment: - matrix: - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - CMAKE_GENERATOR: Visual Studio 14 2015 - TOOLSET: 140 - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - CMAKE_GENERATOR: Visual Studio 16 2019 - TOOLSET: 142 - MDBX_BUILD_SHARED_LIBRARY: OFF - MDBX_WITHOUT_MSVC_CRT: OFF - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - CMAKE_GENERATOR: Visual Studio 16 2019 - TOOLSET: 142 - MDBX_BUILD_SHARED_LIBRARY: ON - MDBX_WITHOUT_MSVC_CRT: ON - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - CMAKE_GENERATOR: Visual Studio 16 2019 - TOOLSET: 142 - MDBX_BUILD_SHARED_LIBRARY: OFF - MDBX_WITHOUT_MSVC_CRT: ON - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - CMAKE_GENERATOR: Visual Studio 16 2019 - TOOLSET: 142 - MDBX_BUILD_SHARED_LIBRARY: ON - MDBX_WITHOUT_MSVC_CRT: OFF - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - CMAKE_GENERATOR: Visual Studio 15 2017 - TOOLSET: 141 - -branches: - except: - - coverity_scan - -configuration: -- Debug -# MSVC-2019 hangs during code generation/optimization due to its own internal errors. -# I have found out that the problem occurs because of the /Ob2 option (see https://github.com/erthink/libmdbx/issues/116). -# So the simplest workaround is to using RelWithDebiInfo configuration for testing (cmake will uses /Ob1 option), instead of Release. -# - Release -- RelWithDebInfo - -platform: -- Win32 -- x64 - -# MSVC-2019 may hang up during code generation/optimization due to its own internal errors. -matrix: - allow_failures: - - image: Visual Studio 2019 - configuration: Release - -# Enable RDP for troubleshooting -#init: -# - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) - -before_build: -- git clean -x -f -d -- git submodule sync -- git fetch --tags --prune --force -- git submodule update --init --recursive -- git submodule foreach --recursive git fetch --tags --prune --force -- cmake --version - -build_script: -- ps: | - Write-Output "*******************************************************************************" - Write-Output "Configuration: $env:CONFIGURATION" - Write-Output "Platform: $env:PLATFORM" - Write-Output "Toolchain: $env:CMAKE_GENERATOR v$env:TOOLSET" - Write-Output "Options: MDBX_WITHOUT_MSVC_CRT=$env:MDBX_WITHOUT_MSVC_CRT MDBX_BUILD_SHARED_LIBRARY=$env:MDBX_BUILD_SHARED_LIBRARY" - Write-Output "*******************************************************************************" - - md _build -Force | Out-Null - cd _build - - $generator = $env:CMAKE_GENERATOR - if ($env:TOOLSET -lt 142) { - if ($env:PLATFORM -eq "x64") { - $generator = "$generator Win64" - } - & cmake -G "$generator" -D CMAKE_CONFIGURATION_TYPES="Debug;Release;RelWithDebInfo" -D MDBX_WITHOUT_MSVC_CRT:BOOL=$env:MDBX_WITHOUT_MSVC_CRT -D MDBX_BUILD_SHARED_LIBRARY:BOOL=$env:MDBX_BUILD_SHARED_LIBRARY .. - } else { - & cmake -G "$generator" -A $env:PLATFORM -D CMAKE_CONFIGURATION_TYPES="Debug;Release;RelWithDebInfo" -DMDBX_WITHOUT_MSVC_CRT:BOOL=$env:MDBX_WITHOUT_MSVC_CRT -D MDBX_BUILD_SHARED_LIBRARY:BOOL=$env:MDBX_BUILD_SHARED_LIBRARY .. - } - if ($LastExitCode -ne 0) { - throw "Exec: $ErrorMessage" - } - Write-Output "*******************************************************************************" - - & cmake --build . --config $env:CONFIGURATION - if ($LastExitCode -ne 0) { - throw "Exec: $ErrorMessage" - } - Write-Output "*******************************************************************************" - -test_script: -- ps: | - if (($env:PLATFORM -ne "ARM") -and ($env:PLATFORM -ne "ARM64")) { - & ./$env:CONFIGURATION/mdbx_test.exe --progress --console=no --pathname=test.db --dont-cleanup-after basic > test.log - Get-Content test.log | Select-Object -last 42 - if ($LastExitCode -ne 0) { - throw "Exec: $ErrorMessage" - } else { - & ./$env:CONFIGURATION/mdbx_chk.exe -nvv test.db | Tee-Object -file chk.log | Select-Object -last 42 - } - } - -on_failure: -- ps: Push-AppveyorArtifact \projects\libmdbx\_build\test.log -- ps: Push-AppveyorArtifact \projects\libmdbx\_build\test.db -- ps: Push-AppveyorArtifact \projects\libmdbx\_build\chk.log diff --git a/cmake/compiler.cmake b/cmake/compiler.cmake index ee4878406..17c468b73 100644 --- a/cmake/compiler.cmake +++ b/cmake/compiler.cmake @@ -182,42 +182,118 @@ if(NOT DEFINED CMAKE_TARGET_BITNESS) endif() endif() -if(CMAKE_COMPILER_IS_ELBRUSC OR CMAKE_COMPILER_IS_ELBRUSCXX OR CMAKE_SYSTEM_PROCESSOR MATCHES "e2k.*|E2K.*|elbrus.*|ELBRUS.*") - set(E2K TRUE) - set(CMAKE_SYSTEM_ARCH "Elbrus") -elseif((MSVC64 OR MINGW64) AND CMAKE_TARGET_BITNESS EQUAL 64) - set(X86_64 TRUE) - set(CMAKE_SYSTEM_ARCH "x86_64") -elseif(MINGW OR (MSVC AND NOT CMAKE_CROSSCOMPILING)) - set(X86_32 TRUE) - set(CMAKE_SYSTEM_ARCH "x86") -elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*" AND CMAKE_TARGET_BITNESS EQUAL 64) - set(X86_64 TRUE) - set(CMAKE_SYSTEM_ARCH "x86_64") -elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "i686.*|i386.*|x86.*") - set(X86_32 TRUE) - set(CMAKE_SYSTEM_ARCH "x86") -elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64.*|AARCH64.*|ARM64.*)" AND CMAKE_TARGET_BITNESS EQUAL 64) - set(AARCH64 TRUE) - set(CMAKE_SYSTEM_ARCH "ARM64") -elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm.*|ARM.*)") - set(ARM32 TRUE) - set(CMAKE_SYSTEM_ARCH "ARM") -elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64le.*" AND CMAKE_TARGET_BITNESS EQUAL 64) - set(PPC64LE TRUE) - set(CMAKE_SYSTEM_ARCH "PPC64LE") -elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64.*" AND CMAKE_TARGET_BITNESS EQUAL 64) - set(PPC64 TRUE) - set(CMAKE_SYSTEM_ARCH "PPC64") -elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc).*") - set(PPC32 TRUE) - set(CMAKE_SYSTEM_ARCH "PPC") -elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(mips|MIPS)64.*" AND CMAKE_TARGET_BITNESS EQUAL 64) - set(MIPS64 TRUE) - set(CMAKE_SYSTEM_ARCH "MIPS64") -elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(mips|MIPS).*") - set(MIPS32 TRUE) - set(CMAKE_SYSTEM_ARCH "MIPS") +if(NOT CMAKE_SYSTEM_ARCH) + if(CMAKE_${CMAKE_PRIMARY_LANG}_COMPILER_ARCHITECTURE_ID) + set(CMAKE_SYSTEM_ARCH "${CMAKE_${CMAKE_PRIMARY_LANG}_COMPILER_ARCHITECTURE_ID}") + elseif(CMAKE_ANDROID_ARCH_ABI) + set(CMAKE_SYSTEM_ARCH "${CMAKE_ANDROID_ARCH_ABI}") + elseif(CMAKE_COMPILER_IS_ELBRUSC OR CMAKE_COMPILER_IS_ELBRUSCXX + OR CMAKE_${CMAKE_PRIMARY_LANG}_COMPILER_ID STREQUAL "LCC" + OR CMAKE_SYSTEM_PROCESSOR MATCHES "e2k.*|E2K.*|elbrus.*|ELBRUS.*") + set(E2K TRUE) + set(CMAKE_SYSTEM_ARCH "Elbrus") + elseif(MSVC64 OR MINGW64 OR MINGW OR (MSVC AND NOT CMAKE_CROSSCOMPILING)) + if(CMAKE_TARGET_BITNESS EQUAL 64) + set(X86_64 TRUE) + set(CMAKE_SYSTEM_ARCH "x86_64") + else() + set(X86_32 TRUE) + set(CMAKE_SYSTEM_ARCH "x86") + endif() + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|[xXiI]86_64.*|AMD64.*|[iI][3-6]86.*|[xXiI]86.*") + if(CMAKE_TARGET_BITNESS EQUAL 64) + set(X86_64 TRUE) + set(CMAKE_SYSTEM_ARCH "x86_64") + else() + set(X86_32 TRUE) + set(CMAKE_SYSTEM_ARCH "x86") + endif() + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch.*|AARCH.*|arm.*|ARM.*)") + if(CMAKE_TARGET_BITNESS EQUAL 64) + set(AARCH64 TRUE) + set(CMAKE_SYSTEM_ARCH "ARM64") + else() + set(ARM32 TRUE) + set(CMAKE_SYSTEM_ARCH "ARM") + endif() + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc).*") + if(CMAKE_TARGET_BITNESS EQUAL 64) + set(PPC64 TRUE) + set(CMAKE_SYSTEM_ARCH "PPC64") + else() + set(PPC32 TRUE) + set(CMAKE_SYSTEM_ARCH "PPC") + endif() + elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(mips|MIPS).*") + if(CMAKE_TARGET_BITNESS EQUAL 64) + set(MIPS64 TRUE) + set(CMAKE_SYSTEM_ARCH "MIPS64") + else() + set(MIPS32 TRUE) + set(CMAKE_SYSTEM_ARCH "MIPS") + endif() + endif() +endif() +if(CMAKE_C_COMPILER_LOADED AND NOT CMAKE_C_COMPILER_ARCHITECTURE_ID) + set(CMAKE_C_COMPILER_ARCHITECTURE_ID "${CMAKE_SYSTEM_ARCH}") +endif() +if(CMAKE_CXX_COMPILER_LOADED AND NOT CMAKE_CXX_COMPILER_ARCHITECTURE_ID) + set(CMAKE_CXX_COMPILER_ARCHITECTURE_ID "${CMAKE_SYSTEM_ARCH}") +endif() + +if(NOT CMAKE_HOST_ARCH) + if(CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE) + set(CMAKE_HOST_ARCH "${CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE}") + elseif(CMAKE_HOST_PROCESSOR MATCHES "e2k.*|E2K.*|elbrus.*|ELBRUS.*") + set(CMAKE_HOST_ARCH "Elbrus") + elseif(CMAKE_HOST_PROCESSOR MATCHES "amd64.*|[xXiI]86_64.*|AMD64.*") + set(CMAKE_HOST_ARCH "x86_64") + elseif(CMAKE_HOST_PROCESSOR MATCHES "[iI][3-6]86.*|[xXiI]86.*") + set(CMAKE_HOST_ARCH "x86") + elseif(CMAKE_HOST_PROCESSOR MATCHES "^(aarch64.*|AARCH64.*|ARM64.*)") + set(CMAKE_HOST_ARCH "ARM64") + elseif(CMAKE_HOST_PROCESSOR MATCHES "^(arm.*|ARM.*)") + set(CMAKE_HOST_ARCH "ARM") + elseif(CMAKE_HOST_PROCESSOR MATCHES "^(powerpc|ppc)64.*") + set(CMAKE_HOST_ARCH "PPC64") + elseif(CMAKE_HOST_PROCESSOR MATCHES "^(powerpc|ppc).*") + set(CMAKE_HOST_ARCH "PPC") + elseif(CMAKE_HOST_PROCESSOR MATCHES "^(mips|MIPS)64.*") + set(CMAKE_HOST_ARCH "MIPS64") + elseif(CMAKE_HOST_PROCESSOR MATCHES "^(mips|MIPS).*") + set(CMAKE_HOST_ARCH "MIPS") + else() + set(CMAKE_HOST_ARCH "${CMAKE_HOST_SYSTEM_PROCESSOR}") + endif() +endif() + +if(NOT DEFINED CMAKE_HOST_CAN_RUN_EXECUTABLES_BUILT_FOR_TARGET) + if(CMAKE_CROSSCOMPILING AND CMAKE_CROSSCOMPILING_EMULATOR) + set(CMAKE_HOST_CAN_RUN_EXECUTABLES_BUILT_FOR_TARGET TRUE) + elseif(CMAKE_CROSSCOMPILING AND NOT CMAKE_CROSSCOMPILING_EMULATOR) + set(CMAKE_HOST_CAN_RUN_EXECUTABLES_BUILT_FOR_TARGET FALSE) + elseif(CMAKE_SYSTEM_NAME STREQUAL CMAKE_HOST_SYSTEM_NAME + AND ((CMAKE_SYSTEM_PROCESSOR STREQUAL CMAKE_HOST_PROCESSOR) + OR (CMAKE_SYSTEM_ARCH STREQUAL CMAKE_HOST_ARCH) + OR (WIN32 AND CMAKE_HOST_WIN32 AND X86_32 AND CMAKE_HOST_ARCH STREQUAL "x86_64"))) + set(CMAKE_HOST_CAN_RUN_EXECUTABLES_BUILT_FOR_TARGET TRUE) + message(STATUS + "Assume СAN RUN A BUILT EXECUTABLES," + " since host (${CMAKE_HOST_SYSTEM_NAME}-${CMAKE_HOST_ARCH})" + " match target (${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_ARCH})") + else() + if(CMAKE_C_COMPILER_LOADED) + include(CheckCSourceRuns) + check_c_source_runs("int main(void) { return 0; }" CMAKE_HOST_CAN_RUN_EXECUTABLES_BUILT_FOR_TARGET) + elseif(CMAKE_CXX_COMPILER_LOADED) + include(CheckCXXSourceRuns) + check_cxx_source_runs("int main(void) { return 0; }" CMAKE_HOST_CAN_RUN_EXECUTABLES_BUILT_FOR_TARGET) + endif() + if(NOT CMAKE_HOST_CAN_RUN_EXECUTABLES_BUILT_FOR_TARGET) + message(STATUS "Force CMAKE_CROSSCOMPILING to TRUE") + set(CMAKE_CROSSCOMPILING TRUE) + endif() + endif() endif() if(MSVC) @@ -468,7 +544,7 @@ if(CMAKE_COMPILER_IS_CLANG) AND NOT (CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_SYSTEM_NAME STREQUAL "Linux")) OR APPLE)) - if(ANDROID AND CMAKE_SYSTEM_VERSION VERSION_LESS 22) + if(ANDROID AND CMAKE_${CMAKE_PRIMARY_LANG}_COMPILER_VERSION VERSION_LESS 12) set(CLANG_LTO_AVAILABLE FALSE) message(STATUS "Link-Time Optimization by CLANG/LLVM is available but unusable due https://reviews.llvm.org/D79919") else() @@ -609,6 +685,9 @@ macro(setup_compile_flags) AND CMAKE_${CMAKE_PRIMARY_LANG}_COMPILER_VERSION VERSION_LESS 9) # GCC < 9.x generates false-positive warnings for optimization attributes add_compile_flags("C;CXX" "-Wno-attributes") + if(LTO_ENABLED) + add_compile_flags("C;CXX" "-Wno-lto-type-mismatch") + endif() endif() # In C a global variable without a storage specifier (static/extern) and @@ -834,6 +913,8 @@ macro(probe_libcxx_filesystem) include(CheckCXXSourceCompiles) cmake_push_check_state() set(stdfs_probe_save_libraries ${CMAKE_REQUIRED_LIBRARIES}) + set(stdfs_probe_save_flags ${CMAKE_REQUIRED_FLAGS}) + set(stdfs_probe_save_link_options ${CMAKE_REQUIRED_LINK_OPTIONS}) unset(stdfs_probe_clear_cxx_standard) if(NOT DEFINED CMAKE_CXX_STANDARD) list(FIND CMAKE_CXX_COMPILE_FEATURES cxx_std_14 HAS_CXX14) @@ -848,6 +929,13 @@ macro(probe_libcxx_filesystem) endif() set(stdfs_probe_clear_cxx_standard ON) endif() + if(CMAKE_COMPILER_IS_ELBRUSCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 1.25.23) + if(CMAKE_VERSION VERSION_LESS 3.14) + set(CMAKE_REQUIRED_FLAGS ${stdfs_probe_save_flags} "-Wl,--allow-multiple-definition") + else() + set(CMAKE_REQUIRED_LINK_OPTIONS ${stdfs_probe_save_link_options} "-Wl,--allow-multiple-definition") + endif() + endif() set(stdfs_probe_code [[ #if defined(__SIZEOF_INT128__) && !defined(__GLIBCXX_TYPE_INT_N_0) && defined(__clang__) && __clang_major__ < 4 @@ -915,11 +1003,15 @@ macro(probe_libcxx_filesystem) endif() endif() + set(CMAKE_REQUIRED_LINK_OPTIONS ${stdfs_probe_save_link_options}) + set(CMAKE_REQUIRED_FLAGS ${stdfs_probe_save_flags}) set(CMAKE_REQUIRED_LIBRARIES ${stdfs_probe_save_libraries}) if(stdfs_probe_clear_cxx_standard) unset(CMAKE_CXX_STANDARD) endif() unset(stdfs_probe_clear_cxx_standard) + unset(stdfs_probe_save_link_options) + unset(stdfs_probe_save_flags) unset(stdfs_probe_save_libraries) unset(stdfs_probe_code) unset(stdfs_probe_rc) diff --git a/cmake/utils.cmake b/cmake/utils.cmake index 59320e7d5..a461cc27d 100644 --- a/cmake/utils.cmake +++ b/cmake/utils.cmake @@ -92,15 +92,6 @@ macro(fetch_version name source_root_directory parent_scope) set(${name}_GIT_REVISION 0) set(${name}_GIT_VERSION "") if(GIT AND EXISTS "${source_root_directory}/.git") - execute_process(COMMAND ${GIT} describe --tags --long --dirty=-dirty "--match=v[0-9]*" - OUTPUT_VARIABLE ${name}_GIT_DESCRIBE - OUTPUT_STRIP_TRAILING_WHITESPACE - WORKING_DIRECTORY ${source_root_directory} - RESULT_VARIABLE rc) - if(rc OR "${name}_GIT_DESCRIBE" STREQUAL "") - message(FATAL_ERROR "Please fetch tags and/or install latest version of git ('describe --tags --long --dirty --match=v[0-9]*' failed)") - endif() - execute_process(COMMAND ${GIT} show --no-patch --format=%cI HEAD OUTPUT_VARIABLE ${name}_GIT_TIMESTAMP OUTPUT_STRIP_TRAILING_WHITESPACE @@ -113,7 +104,7 @@ macro(fetch_version name source_root_directory parent_scope) WORKING_DIRECTORY ${source_root_directory} RESULT_VARIABLE rc) if(rc OR "${name}_GIT_TIMESTAMP" STREQUAL "%ci") - message(FATAL_ERROR "Please install latest version of git ('show --no-patch --format=%cI HEAD' failed)") + message(FATAL_ERROR "Please install latest version of git (`show --no-patch --format=%cI HEAD` failed)") endif() endif() @@ -123,7 +114,7 @@ macro(fetch_version name source_root_directory parent_scope) WORKING_DIRECTORY ${source_root_directory} RESULT_VARIABLE rc) if(rc OR "${name}_GIT_TREE" STREQUAL "") - message(FATAL_ERROR "Please install latest version of git ('show --no-patch --format=%T HEAD' failed)") + message(FATAL_ERROR "Please install latest version of git (`show --no-patch --format=%T HEAD` failed)") endif() execute_process(COMMAND ${GIT} show --no-patch --format=%H HEAD @@ -132,58 +123,110 @@ macro(fetch_version name source_root_directory parent_scope) WORKING_DIRECTORY ${source_root_directory} RESULT_VARIABLE rc) if(rc OR "${name}_GIT_COMMIT" STREQUAL "") - message(FATAL_ERROR "Please install latest version of git ('show --no-patch --format=%H HEAD' failed)") + message(FATAL_ERROR "Please install latest version of git (`show --no-patch --format=%H HEAD` failed)") endif() - execute_process(COMMAND ${GIT} describe --tags --abbrev=0 "--match=v[0-9]*" - OUTPUT_VARIABLE last_release_tag + execute_process(COMMAND ${GIT} rev-list --tags --count + OUTPUT_VARIABLE tag_count OUTPUT_STRIP_TRAILING_WHITESPACE WORKING_DIRECTORY ${source_root_directory} RESULT_VARIABLE rc) if(rc) - message(FATAL_ERROR "Please install latest version of git ('describe --tags --abbrev=0 --match=v[0-9]*' failed)") + message(FATAL_ERROR "Please install latest version of git (`git rev-list --tags --count` failed)") endif() - if (last_release_tag) - set(git_revlist_arg "${last_release_tag}..HEAD") - else() - execute_process(COMMAND ${GIT} tag --sort=-version:refname - OUTPUT_VARIABLE tag_list + + if(tag_count EQUAL 0) + execute_process(COMMAND ${GIT} rev-list --all --count + OUTPUT_VARIABLE whole_count OUTPUT_STRIP_TRAILING_WHITESPACE WORKING_DIRECTORY ${source_root_directory} RESULT_VARIABLE rc) if(rc) - message(FATAL_ERROR "Please install latest version of git ('tag --sort=-version:refname' failed)") + message(FATAL_ERROR "Please install latest version of git (`git rev-list --all --count` failed)") + endif() + if(whole_count GREATER 42) + message(FATAL_ERROR "Please fetch tags (no any tags for ${whole_count} commits)") endif() - string(REGEX REPLACE "\n" ";" tag_list "${tag_list}") - set(git_revlist_arg "HEAD") - foreach(tag IN LISTS tag_list) - if(NOT last_release_tag) - string(REGEX MATCH "^v[0-9]+(\.[0-9]+)+" last_release_tag "${tag}") - set(git_revlist_arg "${tag}..HEAD") + set(${name}_GIT_VERSION "0;0;0") + execute_process(COMMAND ${GIT} rev-list --count --all --no-merges + OUTPUT_VARIABLE ${name}_GIT_REVISION + OUTPUT_STRIP_TRAILING_WHITESPACE + WORKING_DIRECTORY ${source_root_directory} + RESULT_VARIABLE rc) + if(rc OR "${name}_GIT_REVISION" STREQUAL "") + message(FATAL_ERROR "Please install latest version of git (`rev-list --count --all --no-merges` failed)") + endif() + else(tag_count EQUAL 0) + execute_process(COMMAND ${GIT} describe --tags --long --dirty=-dirty "--match=v[0-9]*" + OUTPUT_VARIABLE ${name}_GIT_DESCRIBE + OUTPUT_STRIP_TRAILING_WHITESPACE + WORKING_DIRECTORY ${source_root_directory} + RESULT_VARIABLE rc) + if(rc OR "${name}_GIT_DESCRIBE" STREQUAL "") + if(_whole_count GREATER 42) + message(FATAL_ERROR "Please fetch tags (`describe --tags --long --dirty --match=v[0-9]*` failed)") + else() + execute_process(COMMAND ${GIT} describe --all --long --dirty=-dirty + OUTPUT_VARIABLE ${name}_GIT_DESCRIBE + OUTPUT_STRIP_TRAILING_WHITESPACE + WORKING_DIRECTORY ${source_root_directory} + RESULT_VARIABLE rc) + if(rc OR "${name}_GIT_DESCRIBE" STREQUAL "") + message(FATAL_ERROR "Please install latest version of git (`git rev-list --tags --count` and/or `git rev-list --all --count` failed)") + endif() endif() - endforeach(tag) - endif() - execute_process(COMMAND ${GIT} rev-list --count "${git_revlist_arg}" - OUTPUT_VARIABLE ${name}_GIT_REVISION - OUTPUT_STRIP_TRAILING_WHITESPACE - WORKING_DIRECTORY ${source_root_directory} - RESULT_VARIABLE rc) - if(rc OR "${name}_GIT_REVISION" STREQUAL "") - message(FATAL_ERROR "Please install latest version of git ('rev-list --count ${git_revlist_arg}' failed)") - endif() + endif() - string(REGEX MATCH "^(v)?([0-9]+)\\.([0-9]+)\\.([0-9]+)(.*)?" git_version_valid "${${name}_GIT_DESCRIBE}") - if(git_version_valid) - string(REGEX REPLACE "^(v)?([0-9]+)\\.([0-9]+)\\.([0-9]+)(.*)?" "\\2;\\3;\\4" ${name}_GIT_VERSION ${${name}_GIT_DESCRIBE}) - else() - string(REGEX MATCH "^(v)?([0-9]+)\\.([0-9]+)(.*)?" git_version_valid "${${name}_GIT_DESCRIBE}") + execute_process(COMMAND ${GIT} describe --tags --abbrev=0 "--match=v[0-9]*" + OUTPUT_VARIABLE last_release_tag + OUTPUT_STRIP_TRAILING_WHITESPACE + WORKING_DIRECTORY ${source_root_directory} + RESULT_VARIABLE rc) + if(rc) + message(FATAL_ERROR "Please install latest version of git (`describe --tags --abbrev=0 --match=v[0-9]*` failed)") + endif() + if (last_release_tag) + set(git_revlist_arg "${last_release_tag}..HEAD") + else() + execute_process(COMMAND ${GIT} tag --sort=-version:refname + OUTPUT_VARIABLE tag_list + OUTPUT_STRIP_TRAILING_WHITESPACE + WORKING_DIRECTORY ${source_root_directory} + RESULT_VARIABLE rc) + if(rc) + message(FATAL_ERROR "Please install latest version of git (`tag --sort=-version:refname` failed)") + endif() + string(REGEX REPLACE "\n" ";" tag_list "${tag_list}") + set(git_revlist_arg "HEAD") + foreach(tag IN LISTS tag_list) + if(NOT last_release_tag) + string(REGEX MATCH "^v[0-9]+(\.[0-9]+)+" last_release_tag "${tag}") + set(git_revlist_arg "${tag}..HEAD") + endif() + endforeach(tag) + endif() + execute_process(COMMAND ${GIT} rev-list --count "${git_revlist_arg}" + OUTPUT_VARIABLE ${name}_GIT_REVISION + OUTPUT_STRIP_TRAILING_WHITESPACE + WORKING_DIRECTORY ${source_root_directory} + RESULT_VARIABLE rc) + if(rc OR "${name}_GIT_REVISION" STREQUAL "") + message(FATAL_ERROR "Please install latest version of git (`rev-list --count ${git_revlist_arg}` failed)") + endif() + + string(REGEX MATCH "^(v)?([0-9]+)\\.([0-9]+)\\.([0-9]+)(.*)?" git_version_valid "${${name}_GIT_DESCRIBE}") if(git_version_valid) - string(REGEX REPLACE "^(v)?([0-9]+)\\.([0-9]+)(.*)?" "\\2;\\3;0" ${name}_GIT_VERSION ${${name}_GIT_DESCRIBE}) + string(REGEX REPLACE "^(v)?([0-9]+)\\.([0-9]+)\\.([0-9]+)(.*)?" "\\2;\\3;\\4" ${name}_GIT_VERSION ${${name}_GIT_DESCRIBE}) else() - message(AUTHOR_WARNING "Bad ${name} version \"${${name}_GIT_DESCRIBE}\"; falling back to 0.0.0 (have you made an initial release?)") - set(${name}_GIT_VERSION "0;0;0") + string(REGEX MATCH "^(v)?([0-9]+)\\.([0-9]+)(.*)?" git_version_valid "${${name}_GIT_DESCRIBE}") + if(git_version_valid) + string(REGEX REPLACE "^(v)?([0-9]+)\\.([0-9]+)(.*)?" "\\2;\\3;0" ${name}_GIT_VERSION ${${name}_GIT_DESCRIBE}) + else() + message(AUTHOR_WARNING "Bad ${name} version \"${${name}_GIT_DESCRIBE}\"; falling back to 0.0.0 (have you made an initial release?)") + set(${name}_GIT_VERSION "0;0;0") + endif() endif() - endif() + endif(tag_count EQUAL 0) endif() if(NOT ${name}_GIT_VERSION OR NOT ${name}_GIT_TIMESTAMP OR ${name}_GIT_REVISION STREQUAL "") diff --git a/docs/Doxyfile.in b/docs/Doxyfile.in index f2e07219c..e46a8afd8 100644 --- a/docs/Doxyfile.in +++ b/docs/Doxyfile.in @@ -1,4 +1,4 @@ -# Doxyfile 1.8.17 +# Doxyfile 1.9.1 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project. @@ -227,6 +227,14 @@ QT_AUTOBRIEF = NO MULTILINE_CPP_IS_BRIEF = NO +# By default Python docstrings are displayed as preformatted text and doxygen's +# special commands cannot be used. By setting PYTHON_DOCSTRING to NO the +# doxygen's special commands can be used and the contents of the docstring +# documentation blocks is shown as doxygen documentation. +# The default value is: YES. + +PYTHON_DOCSTRING = YES + # If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the # documentation from any documented member that it re-implements. # The default value is: YES. @@ -263,12 +271,6 @@ TAB_SIZE = 4 ALIASES = -# This tag can be used to specify a number of word-keyword mappings (TCL only). -# A mapping has the form "name=value". For example adding "class=itcl::class" -# will allow you to use the command class in the itcl::class meaning. - -TCL_SUBST = - # Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources # only. Doxygen will then generate output that is more tailored for C. For # instance, some of the names that are used will be different. The list of all @@ -310,18 +312,21 @@ OPTIMIZE_OUTPUT_SLICE = NO # extension. Doxygen has a built-in mapping, but you can override or extend it # using this tag. The format is ext=language, where ext is a file extension, and # language is one of the parsers supported by doxygen: IDL, Java, JavaScript, -# Csharp (C#), C, C++, D, PHP, md (Markdown), Objective-C, Python, Slice, +# Csharp (C#), C, C++, D, PHP, md (Markdown), Objective-C, Python, Slice, VHDL, # Fortran (fixed format Fortran: FortranFixed, free formatted Fortran: # FortranFree, unknown formatted Fortran: Fortran. In the later case the parser # tries to guess whether the code is fixed or free formatted code, this is the -# default for Fortran type files), VHDL, tcl. For instance to make doxygen treat -# .inc files as Fortran files (default is PHP), and .f files as C (default is -# Fortran), use: inc=Fortran f=C. +# default for Fortran type files). For instance to make doxygen treat .inc files +# as Fortran files (default is PHP), and .f files as C (default is Fortran), +# use: inc=Fortran f=C. # # Note: For files without extension you can use no_extension as a placeholder. # # Note that for custom extensions you also need to set FILE_PATTERNS otherwise -# the files are not read by doxygen. +# the files are not read by doxygen. When specifying no_extension you should add +# * to the FILE_PATTERNS. +# +# Note see also the list of default file extension mappings. EXTENSION_MAPPING = @@ -455,6 +460,19 @@ TYPEDEF_HIDES_STRUCT = YES LOOKUP_CACHE_SIZE = 0 +# The NUM_PROC_THREADS specifies the number threads doxygen is allowed to use +# during processing. When set to 0 doxygen will based this on the number of +# cores available in the system. You can set it explicitly to a value larger +# than 0 to get more control over the balance between CPU load and processing +# speed. At this moment only the input processing can be done using multiple +# threads. Since this is still an experimental feature the default is set to 1, +# which efficively disables parallel processing. Please report any issues you +# encounter. Generating dot graphs in parallel is controlled by the +# DOT_NUM_THREADS setting. +# Minimum value: 0, maximum value: 32, default value: 1. + +NUM_PROC_THREADS = 1 + #--------------------------------------------------------------------------- # Build related configuration options #--------------------------------------------------------------------------- @@ -518,6 +536,13 @@ EXTRACT_LOCAL_METHODS = NO EXTRACT_ANON_NSPACES = NO +# If this flag is set to YES, the name of an unnamed parameter in a declaration +# will be determined by the corresponding definition. By default unnamed +# parameters remain unnamed in the output. +# The default value is: YES. + +RESOLVE_UNNAMED_PARAMS = YES + # If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all # undocumented members inside documented classes or files. If set to NO these # members will be included in the various overviews, but no documentation @@ -555,11 +580,18 @@ HIDE_IN_BODY_DOCS = NO INTERNAL_DOCS = NO -# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file -# names in lower-case letters. If set to YES, upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# (including Cygwin) ands Mac users are advised to set this option to NO. +# With the correct setting of option CASE_SENSE_NAMES doxygen will better be +# able to match the capabilities of the underlying filesystem. In case the +# filesystem is case sensitive (i.e. it supports files in the same directory +# whose names only differ in casing), the option must be set to YES to properly +# deal with such files in case they appear in the input. For filesystems that +# are not case sensitive the option should be be set to NO to properly deal with +# output files written for symbols that only differ in casing, such as for two +# classes, one named CLASS and the other named Class, and to also support +# references to files without having to specify the exact matching casing. On +# Windows (including Cygwin) and MacOS, users should typically set this option +# to NO, whereas on Linux or other Unix flavors it should typically be set to +# YES. # The default value is: system dependent. CASE_SENSE_NAMES = NO @@ -798,7 +830,10 @@ WARN_IF_DOC_ERROR = YES WARN_NO_PARAMDOC = NO # If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when -# a warning is encountered. +# a warning is encountered. If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS +# then doxygen will continue running as if WARN_AS_ERROR tag is set to NO, but +# at the end of the doxygen process doxygen will return with a non-zero status. +# Possible values are: NO, YES and FAIL_ON_WARNINGS. # The default value is: NO. WARN_AS_ERROR = NO @@ -829,13 +864,19 @@ WARN_LOGFILE = # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # Note: If this tag is empty the current directory is searched. -INPUT = overall.md intro.md usage.md mdbx.h mdbx.h++ options.h ChangeLog.md +INPUT = overall.md \ + intro.md \ + usage.md \ + mdbx.h \ + mdbx.h++ \ + options.h \ + ChangeLog.md # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses # libiconv (or the iconv built into libc) for the transcoding. See the libiconv -# documentation (see: https://www.gnu.org/software/libiconv/) for the list of -# possible encodings. +# documentation (see: +# https://www.gnu.org/software/libiconv/) for the list of possible encodings. # The default value is: UTF-8. INPUT_ENCODING = UTF-8 @@ -848,13 +889,15 @@ INPUT_ENCODING = UTF-8 # need to set EXTENSION_MAPPING for the extension otherwise the files are not # read by doxygen. # +# Note the list of default checked file patterns might differ from the list of +# default file extension mappings. +# # If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, # *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, # *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, # *.m, *.markdown, *.md, *.mm, *.dox (to be provided as doxygen C comment), -# *.doc (to be provided as doxygen C comment), *.txt (to be provided as doxygen -# C comment), *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f, *.for, *.tcl, *.vhd, -# *.vhdl, *.ucf, *.qsf and *.ice. +# *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f18, *.f, *.for, *.vhd, *.vhdl, +# *.ucf, *.qsf and *.ice. FILE_PATTERNS = *.h @@ -1069,16 +1112,22 @@ USE_HTAGS = NO VERBATIM_HEADERS = YES # If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the -# clang parser (see: http://clang.llvm.org/) for more accurate parsing at the -# cost of reduced performance. This can be particularly helpful with template -# rich C++ code for which doxygen's built-in parser lacks the necessary type -# information. +# clang parser (see: +# http://clang.llvm.org/) for more accurate parsing at the cost of reduced +# performance. This can be particularly helpful with template rich C++ code for +# which doxygen's built-in parser lacks the necessary type information. # Note: The availability of this option depends on whether or not doxygen was # generated with the -Duse_libclang=ON option for CMake. # The default value is: NO. CLANG_ASSISTED_PARSING = NO +# If clang assisted parsing is enabled and the CLANG_ADD_INC_PATHS tag is set to +# YES then doxygen will add the directory of each input to the include path. +# The default value is: YES. + +CLANG_ADD_INC_PATHS = YES + # If clang assisted parsing is enabled you can provide the compiler with command # line options that you would normally use when invoking the compiler. Note that # the include paths will already be set by doxygen for the files and directories @@ -1088,10 +1137,13 @@ CLANG_ASSISTED_PARSING = NO CLANG_OPTIONS = # If clang assisted parsing is enabled you can provide the clang parser with the -# path to the compilation database (see: -# http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html) used when the files -# were built. This is equivalent to specifying the "-p" option to a clang tool, -# such as clang-check. These options will then be passed to the parser. +# path to the directory containing a file called compile_commands.json. This +# file is the compilation database (see: +# http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html) containing the +# options used when the source files were built. This is equivalent to +# specifying the -p option to a clang tool, such as clang-check. These options +# will then be passed to the parser. Any options specified with CLANG_OPTIONS +# will be added as well. # Note: The availability of this option depends on whether or not doxygen was # generated with the -Duse_libclang=ON option for CMake. @@ -1108,13 +1160,6 @@ CLANG_DATABASE_PATH = ALPHABETICAL_INDEX = YES -# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in -# which the alphabetical index list will be split. -# Minimum value: 1, maximum value: 20, default value: 5. -# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. - -COLS_IN_ALPHA_INDEX = 5 - # In case all classes in a project start with a common prefix, all classes will # be put under the same header in the alphabetical index. The IGNORE_PREFIX tag # can be used to specify a prefix (or a list of prefixes) that should be ignored @@ -1285,10 +1330,11 @@ HTML_INDEX_NUM_ENTRIES = 100 # If the GENERATE_DOCSET tag is set to YES, additional index files will be # generated that can be used as input for Apple's Xcode 3 integrated development -# environment (see: https://developer.apple.com/xcode/), introduced with OSX -# 10.5 (Leopard). To create a documentation set, doxygen will generate a -# Makefile in the HTML output directory. Running make will produce the docset in -# that directory and running make install will install the docset in +# environment (see: +# https://developer.apple.com/xcode/), introduced with OSX 10.5 (Leopard). To +# create a documentation set, doxygen will generate a Makefile in the HTML +# output directory. Running make will produce the docset in that directory and +# running make install will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at # startup. See https://developer.apple.com/library/archive/featuredarticles/Doxy # genXcode/_index.html for more information. @@ -1330,8 +1376,8 @@ DOCSET_PUBLISHER_NAME = Publisher # If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three # additional HTML index files: index.hhp, index.hhc, and index.hhk. The # index.hhp is a project file that can be read by Microsoft's HTML Help Workshop -# (see: https://www.microsoft.com/en-us/download/details.aspx?id=21138) on -# Windows. +# (see: +# https://www.microsoft.com/en-us/download/details.aspx?id=21138) on Windows. # # The HTML Help Workshop contains a compiler that can convert all HTML output # generated by doxygen into a single compiled HTML file (.chm). Compiled HTML @@ -1361,7 +1407,7 @@ CHM_FILE = HHC_LOCATION = # The GENERATE_CHI flag controls if a separate .chi index file is generated -# (YES) or that it should be included in the master .chm file (NO). +# (YES) or that it should be included in the main .chm file (NO). # The default value is: NO. # This tag requires that the tag GENERATE_HTMLHELP is set to YES. @@ -1406,7 +1452,8 @@ QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help # Project output. For more information please see Qt Help Project / Namespace -# (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace). +# (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace). # The default value is: org.doxygen.Project. # This tag requires that the tag GENERATE_QHP is set to YES. @@ -1414,8 +1461,8 @@ QHP_NAMESPACE = org.doxygen.Project # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt # Help Project output. For more information please see Qt Help Project / Virtual -# Folders (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual- -# folders). +# Folders (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-folders). # The default value is: doc. # This tag requires that the tag GENERATE_QHP is set to YES. @@ -1423,16 +1470,16 @@ QHP_VIRTUAL_FOLDER = doc # If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom # filter to add. For more information please see Qt Help Project / Custom -# Filters (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom- -# filters). +# Filters (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_NAME = # The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the # custom filter to add. For more information please see Qt Help Project / Custom -# Filters (see: https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom- -# filters). +# Filters (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_ATTRS = @@ -1444,9 +1491,9 @@ QHP_CUST_FILTER_ATTRS = QHP_SECT_FILTER_ATTRS = -# The QHG_LOCATION tag can be used to specify the location of Qt's -# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the -# generated .qhp file. +# The QHG_LOCATION tag can be used to specify the location (absolute path +# including file name) of Qt's qhelpgenerator. If non-empty doxygen will try to +# run qhelpgenerator on the generated .qhp file. # This tag requires that the tag GENERATE_QHP is set to YES. QHG_LOCATION = @@ -1523,6 +1570,17 @@ TREEVIEW_WIDTH = 250 EXT_LINKS_IN_WINDOW = NO +# If the HTML_FORMULA_FORMAT option is set to svg, doxygen will use the pdf2svg +# tool (see https://github.com/dawbarton/pdf2svg) or inkscape (see +# https://inkscape.org) to generate formulas as SVG images instead of PNGs for +# the HTML output. These images will generally look nicer at scaled resolutions. +# Possible values are: png (the default) and svg (looks nicer but requires the +# pdf2svg or inkscape tool). +# The default value is: png. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FORMULA_FORMAT = png + # Use this tag to change the font size of LaTeX formulas included as images in # the HTML documentation. When you change the font size after a successful # doxygen run you need to manually remove any form_*.png images from the HTML @@ -1562,7 +1620,7 @@ USE_MATHJAX = YES # When MathJax is enabled you can set the default output format to be used for # the MathJax output. See the MathJax site (see: -# http://docs.mathjax.org/en/latest/output.html) for more details. +# http://docs.mathjax.org/en/v2.7-latest/output.html) for more details. # Possible values are: HTML-CSS (which is slower, but has the best # compatibility), NativeMML (i.e. MathML) and SVG. # The default value is: HTML-CSS. @@ -1578,7 +1636,7 @@ MATHJAX_FORMAT = HTML-CSS # Content Delivery Network so you can quickly see the result without installing # MathJax. However, it is strongly recommended to install a local copy of # MathJax from https://www.mathjax.org before deployment. -# The default value is: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/. +# The default value is: https://cdn.jsdelivr.net/npm/mathjax@2. # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_RELPATH = https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/ @@ -1592,7 +1650,8 @@ MATHJAX_EXTENSIONS = # The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces # of code that will be used on startup of the MathJax code. See the MathJax site -# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an +# (see: +# http://docs.mathjax.org/en/v2.7-latest/output.html) for more details. For an # example see the documentation. # This tag requires that the tag USE_MATHJAX is set to YES. @@ -1639,7 +1698,8 @@ SERVER_BASED_SEARCH = NO # # Doxygen ships with an example indexer (doxyindexer) and search engine # (doxysearch.cgi) which are based on the open source search engine library -# Xapian (see: https://xapian.org/). +# Xapian (see: +# https://xapian.org/). # # See the section "External Indexing and Searching" for details. # The default value is: NO. @@ -1652,8 +1712,9 @@ EXTERNAL_SEARCH = NO # # Doxygen ships with an example indexer (doxyindexer) and search engine # (doxysearch.cgi) which are based on the open source search engine library -# Xapian (see: https://xapian.org/). See the section "External Indexing and -# Searching" for details. +# Xapian (see: +# https://xapian.org/). See the section "External Indexing and Searching" for +# details. # This tag requires that the tag SEARCHENGINE is set to YES. SEARCHENGINE_URL = @@ -1817,9 +1878,11 @@ LATEX_EXTRA_FILES = PDF_HYPERLINKS = YES -# If the USE_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate -# the PDF file directly from the LaTeX files. Set this option to YES, to get a -# higher quality PDF documentation. +# If the USE_PDFLATEX tag is set to YES, doxygen will use the engine as +# specified with LATEX_CMD_NAME to generate the PDF file directly from the LaTeX +# files. Set this option to YES, to get a higher quality PDF documentation. +# +# See also section LATEX_CMD_NAME for selecting the engine. # The default value is: YES. # This tag requires that the tag GENERATE_LATEX is set to YES. @@ -2123,8 +2186,6 @@ MACRO_EXPANSION = YES EXPAND_ONLY_PREDEF = YES -EXPAND_AS_DEFINED = LIBMDBX_INLINE_API - # If the SEARCH_INCLUDES tag is set to YES, the include files in the # INCLUDE_PATH will be searched if a #include is found. # The default value is: YES. @@ -2332,10 +2393,32 @@ UML_LOOK = NO # but if the number exceeds 15, the total amount of fields shown is limited to # 10. # Minimum value: 0, maximum value: 100, default value: 10. -# This tag requires that the tag HAVE_DOT is set to YES. +# This tag requires that the tag UML_LOOK is set to YES. UML_LIMIT_NUM_FIELDS = 10 +# If the DOT_UML_DETAILS tag is set to NO, doxygen will show attributes and +# methods without types and arguments in the UML graphs. If the DOT_UML_DETAILS +# tag is set to YES, doxygen will add type and arguments for attributes and +# methods in the UML graphs. If the DOT_UML_DETAILS tag is set to NONE, doxygen +# will not generate fields with class member information in the UML graphs. The +# class diagrams will look similar to the default class diagrams but using UML +# notation for the relationships. +# Possible values are: NO, YES and NONE. +# The default value is: NO. +# This tag requires that the tag UML_LOOK is set to YES. + +DOT_UML_DETAILS = NO + +# The DOT_WRAP_THRESHOLD tag can be used to set the maximum number of characters +# to display on a single line. If the actual line length exceeds this threshold +# significantly it will wrapped across multiple lines. Some heuristics are apply +# to avoid ugly line breaks. +# Minimum value: 0, maximum value: 1000, default value: 17. +# This tag requires that the tag HAVE_DOT is set to YES. + +DOT_WRAP_THRESHOLD = 17 + # If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and # collaboration graphs will show the relations between templates and their # instances. @@ -2527,9 +2610,11 @@ DOT_MULTI_TARGETS = NO GENERATE_LEGEND = YES -# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate dot +# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate # files that are used to generate the various graphs. +# +# Note: This setting is not only used for dot files but also for msc and +# plantuml temporary files. # The default value is: YES. -# This tag requires that the tag HAVE_DOT is set to YES. DOT_CLEANUP = YES diff --git a/docs/_restrictions.md b/docs/_restrictions.md index f2210a55b..bda43571d 100644 --- a/docs/_restrictions.md +++ b/docs/_restrictions.md @@ -2,118 +2,6 @@ Restrictions & Caveats {#restrictions} ====================== In addition to those listed for some functions. -## Troubleshooting the LCK-file -1. A broken LCK-file can cause sync issues, including appearance of - wrong/inconsistent data for readers. When database opened in the - cooperative read-write mode the LCK-file requires to be mapped to - memory in read-write access. In this case it is always possible for - stray/malfunctioned application could writes thru pointers to - silently corrupt the LCK-file. - - Unfortunately, there is no any portable way to prevent such - corruption, since the LCK-file is updated concurrently by - multiple processes in a lock-free manner and any locking is - unwise due to a large overhead. - - The "next" version of libmdbx (\ref MithrilDB) will solve this issue. - - \note Workaround: Just make all programs using the database close it; - the LCK-file is always reset on first open. - -2. Stale reader transactions left behind by an aborted program cause - further writes to grow the database quickly, and stale locks can - block further operation. - MDBX checks for stale readers while opening environment and before - growth the database. But in some cases, this may not be enough. - - \note Workaround: Check for stale readers periodically, using the - \ref mdbx_reader_check() function or the mdbx_stat tool. - -3. Stale writers will be cleared automatically by MDBX on supported - platforms. But this is platform-specific, especially of - implementation of shared POSIX-mutexes and support for robust - mutexes. For instance there are no known issues on Linux, OSX, - Windows and FreeBSD. - - \note Workaround: Otherwise just make all programs using the database - close it; the LCK-file is always reset on first open of the environment. - - -## Remote filesystems -Do not use MDBX databases on remote filesystems, even between processes -on the same host. This breaks file locks on some platforms, possibly -memory map sync, and certainly sync between programs on different hosts. - -On the other hand, MDBX support the exclusive database operation over -a network, and cooperative read-only access to the database placed on -a read-only network shares. - - -## Child processes -Do not use opened \ref MDBX_env instance(s) in a child processes after `fork()`. -It would be insane to call fork() and any MDBX-functions simultaneously -from multiple threads. The best way is to prevent the presence of open -MDBX-instances during `fork()`. - -The \ref MDBX_ENV_CHECKPID build-time option, which is ON by default on -non-Windows platforms (i.e. where `fork()` is available), enables PID -checking at a few critical points. But this does not give any guarantees, -but only allows you to detect such errors a little sooner. Depending on -the platform, you should expect an application crash and/or database -corruption in such cases. - -On the other hand, MDBX allow calling \ref mdbx_env_close() in such cases to -release resources, but no more and in general this is a wrong way. - -## Read-only mode -There is no pure read-only mode in a normal explicitly way, since -readers need write access to LCK-file to be ones visible for writer. - -So MDBX always tries to open/create LCK-file for read-write, but switches -to without-LCK mode on appropriate errors (`EROFS`, `EACCESS`, `EPERM`) -if the read-only mode was requested by the \ref MDBX_RDONLY flag which is -described below. - -The "next" version of libmdbx (\ref MithrilDB) will solve this issue for the "many -readers without writer" case. - - -## One thread - One transaction - A thread can only use one transaction at a time, plus any nested - read-write transactions in the non-writemap mode. Each transaction - belongs to one thread. The \ref MDBX_NOTLS flag changes this for read-only - transactions. See below. - - Do not start more than one transaction for a one thread. If you think - about this, it's really strange to do something with two data snapshots - at once, which may be different. MDBX checks and preventing this by - returning corresponding error code (\ref MDBX_TXN_OVERLAPPING, \ref MDBX_BAD_RSLOT, - \ref MDBX_BUSY) unless you using \ref MDBX_NOTLS option on the environment. - Nonetheless, with the `MDBX_NOTLS` option, you must know exactly what you - are doing, otherwise you will get deadlocks or reading an alien data. - - -## Do not open twice -Do not have open an MDBX database twice in the same process at the same -time. By default MDBX prevent this in most cases by tracking databases -opening and return \ref MDBX_BUSY if anyone LCK-file is already open. - -The reason for this is that when the "Open file description" locks (aka -OFD-locks) are not available, MDBX uses POSIX locks on files, and these -locks have issues if one process opens a file multiple times. If a single -process opens the same environment multiple times, closing it once will -remove all the locks held on it, and the other instances will be -vulnerable to corruption from other processes. - -For compatibility with LMDB which allows multi-opening, MDBX can be -configured at runtime by `mdbx_setup_debug(MDBX_DBG_LEGACY_MULTIOPEN, ...)` -prior to calling other MDBX functions. In this way MDBX will track -databases opening, detect multi-opening cases and then recover POSIX file -locks as necessary. However, lock recovery can cause unexpected pauses, -such as when another process opened the database in exclusive mode before -the lock was restored - we have to wait until such a process releases the -database, and so on. - ## Long-lived read transactions {#long-lived-read} Avoid long-lived read transactions, especially in the scenarios with a @@ -162,6 +50,7 @@ The "next" version of libmdbx (\ref MithrilDB) will completely solve this. not apply to write transactions if the system clears stale writers, see above. + ## Large data items and huge transactions MDBX allows you to store values up to 1 gigabyte in size, but this is @@ -191,10 +80,123 @@ list of pages to be retired. Both of these issues will be addressed in MithrilDB. + ## Space reservation An MDBX database configuration will often reserve considerable unused memory address space and maybe file size for future growth. This does not use actual memory or disk space, but users may need to understand the difference so they won't be scared off. -\todo To write about the Read/Write Amplification Factors + +## Remote filesystems +Do not use MDBX databases on remote filesystems, even between processes +on the same host. This breaks file locks on some platforms, possibly +memory map sync, and certainly sync between programs on different hosts. + +On the other hand, MDBX support the exclusive database operation over +a network, and cooperative read-only access to the database placed on +a read-only network shares. + + +## Child processes +Do not use opened \ref MDBX_env instance(s) in a child processes after `fork()`. +It would be insane to call fork() and any MDBX-functions simultaneously +from multiple threads. The best way is to prevent the presence of open +MDBX-instances during `fork()`. + +The \ref MDBX_ENV_CHECKPID build-time option, which is ON by default on +non-Windows platforms (i.e. where `fork()` is available), enables PID +checking at a few critical points. But this does not give any guarantees, +but only allows you to detect such errors a little sooner. Depending on +the platform, you should expect an application crash and/or database +corruption in such cases. + +On the other hand, MDBX allow calling \ref mdbx_env_close() in such cases to +release resources, but no more and in general this is a wrong way. + + +## Read-only mode +There is no pure read-only mode in a normal explicitly way, since +readers need write access to LCK-file to be ones visible for writer. + +So MDBX always tries to open/create LCK-file for read-write, but switches +to without-LCK mode on appropriate errors (`EROFS`, `EACCESS`, `EPERM`) +if the read-only mode was requested by the \ref MDBX_RDONLY flag which is +described below. + +The "next" version of libmdbx (\ref MithrilDB) will solve this issue for the "many +readers without writer" case. + + +## Troubleshooting the LCK-file +1. A broken LCK-file can cause sync issues, including appearance of + wrong/inconsistent data for readers. When database opened in the + cooperative read-write mode the LCK-file requires to be mapped to + memory in read-write access. In this case it is always possible for + stray/malfunctioned application could writes thru pointers to + silently corrupt the LCK-file. + + Unfortunately, there is no any portable way to prevent such + corruption, since the LCK-file is updated concurrently by + multiple processes in a lock-free manner and any locking is + unwise due to a large overhead. + + The "next" version of libmdbx (\ref MithrilDB) will solve this issue. + + \note Workaround: Just make all programs using the database close it; + the LCK-file is always reset on first open. + +2. Stale reader transactions left behind by an aborted program cause + further writes to grow the database quickly, and stale locks can + block further operation. + MDBX checks for stale readers while opening environment and before + growth the database. But in some cases, this may not be enough. + + \note Workaround: Check for stale readers periodically, using the + \ref mdbx_reader_check() function or the mdbx_stat tool. + +3. Stale writers will be cleared automatically by MDBX on supported + platforms. But this is platform-specific, especially of + implementation of shared POSIX-mutexes and support for robust + mutexes. For instance there are no known issues on Linux, OSX, + Windows and FreeBSD. + + \note Workaround: Otherwise just make all programs using the database + close it; the LCK-file is always reset on first open of the environment. + + +## One thread - One transaction + A thread can only use one transaction at a time, plus any nested + read-write transactions in the non-writemap mode. Each transaction + belongs to one thread. The \ref MDBX_NOTLS flag changes this for read-only + transactions. See below. + + Do not start more than one transaction for a one thread. If you think + about this, it's really strange to do something with two data snapshots + at once, which may be different. MDBX checks and preventing this by + returning corresponding error code (\ref MDBX_TXN_OVERLAPPING, \ref MDBX_BAD_RSLOT, + \ref MDBX_BUSY) unless you using \ref MDBX_NOTLS option on the environment. + Nonetheless, with the `MDBX_NOTLS` option, you must know exactly what you + are doing, otherwise you will get deadlocks or reading an alien data. + + +## Do not open twice +Do not have open an MDBX database twice in the same process at the same +time. By default MDBX prevent this in most cases by tracking databases +opening and return \ref MDBX_BUSY if anyone LCK-file is already open. + +The reason for this is that when the "Open file description" locks (aka +OFD-locks) are not available, MDBX uses POSIX locks on files, and these +locks have issues if one process opens a file multiple times. If a single +process opens the same environment multiple times, closing it once will +remove all the locks held on it, and the other instances will be +vulnerable to corruption from other processes. + +For compatibility with LMDB which allows multi-opening, MDBX can be +configured at runtime by `mdbx_setup_debug(MDBX_DBG_LEGACY_MULTIOPEN, ...)` +prior to calling other MDBX functions. In this way MDBX will track +databases opening, detect multi-opening cases and then recover POSIX file +locks as necessary. However, lock recovery can cause unexpected pauses, +such as when another process opened the database in exclusive mode before +the lock was restored - we have to wait until such a process releases the +database, and so on. diff --git a/docs/_toc.md b/docs/_toc.md index 97c7afd81..eabd6d66b 100644 --- a/docs/_toc.md +++ b/docs/_toc.md @@ -1,4 +1,3 @@ - _The Future will (be) [Positive](https://www.ptsecurity.com). Всё будет хорошо._ \section toc Table of Contents @@ -23,7 +22,7 @@ each of which is divided into several sections. - The \ref mdbx.h++ header file reference Please do not hesitate to point out errors in the documentation, -including creating [PR](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/proposing-changes-to-your-work-with-pull-requests) with corrections and improvements. +including creating [merge-request](https://gitflic.ru/project/erthink/libmdbx/merge-request) with corrections and improvements. --- diff --git a/mdbx.h b/mdbx.h index 141b4d85e..2fc7e2de0 100644 --- a/mdbx.h +++ b/mdbx.h @@ -14,6 +14,12 @@ break down. _libmdbx_ supports Linux, Windows, MacOS, OSX, iOS, Android, FreeBSD, DragonFly, Solaris, OpenSolaris, OpenIndiana, NetBSD, OpenBSD and other systems compliant with POSIX.1-2008. +The origin has been migrated to +[GitFlic](https://gitflic.ru/project/erthink/libmdbx) since on 2022-04-15 +the Github administration, without any warning nor explanation, deleted libmdbx +along with a lot of other projects, simultaneously blocking access for many +developers. For the same reason ~~Github~~ is blacklisted forever. + _The Future will (be) [Positive](https://www.ptsecurity.com). Всё будет хорошо._ @@ -4826,26 +4832,26 @@ mdbx_get_datacmp(MDBX_db_flags_t flags); /** \brief A callback function used to enumerate the reader lock table. * \ingroup c_statinfo * - * \param [in] ctx An arbitrary context pointer for the callback. - * \param [in] num The serial number during enumeration, - * starting from 1. - * \param [in] slot The reader lock table slot number. - * \param [in] txnid The ID of the transaction being read, - * i.e. the MVCC-snapshot number. - * \param [in] lag The lag from a recent MVCC-snapshot, - * i.e. the number of committed write transactions - * since the current read transaction started. - * \param [in] pid The reader process ID. - * \param [in] thread The reader thread ID. - * \param [in] bytes_used The number of last used page in the MVCC-snapshot - * which being read, - * i.e. database file can't shrinked beyond this. - * \param [in] bytes_retired The total size of the database pages that were - * retired by committed write transactions after - * the reader's MVCC-snapshot, - * i.e. the space which would be freed after - * the Reader releases the MVCC-snapshot - * for reuse by completion read transaction. + * \param [in] ctx An arbitrary context pointer for the callback. + * \param [in] num The serial number during enumeration, + * starting from 1. + * \param [in] slot The reader lock table slot number. + * \param [in] txnid The ID of the transaction being read, + * i.e. the MVCC-snapshot number. + * \param [in] lag The lag from a recent MVCC-snapshot, + * i.e. the number of committed write transactions + * since the current read transaction started. + * \param [in] pid The reader process ID. + * \param [in] thread The reader thread ID. + * \param [in] bytes_used The number of last used page + * in the MVCC-snapshot which being read, + * i.e. database file can't shrinked beyond this. + * \param [in] bytes_retained The total size of the database pages that were + * retired by committed write transactions after + * the reader's MVCC-snapshot, + * i.e. the space which would be freed after + * the Reader releases the MVCC-snapshot + * for reuse by completion read transaction. * * \returns < 0 on failure, >= 0 on success. \see mdbx_reader_list() */ typedef int(MDBX_reader_list_func)(void *ctx, int num, int slot, mdbx_pid_t pid, diff --git a/mdbx.h++ b/mdbx.h++ index 02347afc9..11d209e69 100644 --- a/mdbx.h++ +++ b/mdbx.h++ @@ -13,6 +13,14 @@ /// - AppleClang, but without C++20 concepts. /// +/// +/// The origin has been migrated to https://gitflic.ru/project/erthink/libmdbx +/// since on 2022-04-15 the Github administration, without any warning nor +/// explanation, deleted libmdbx along with a lot of other projects, +/// simultaneously blocking access for many developers. +/// For the same reason Github is blacklisted forever. +/// + #pragma once /* Workaround for modern libstdc++ with CLANG < 4.x */ @@ -201,14 +209,23 @@ #endif #endif /* MDBX_CXX20_UNLIKELY */ -#ifndef MDBX_CXX20_CONCEPT +#ifndef MDBX_HAVE_CXX20_CONCEPTS #if defined(DOXYGEN) || \ (defined(__cpp_concepts) && __cpp_concepts >= 201907L && \ - (!defined(__clang__) || \ - (__clang_major__ >= 12 && !defined(__APPLE__) && \ - !defined(__ANDROID_API__)) || \ - __clang_major__ >= \ - /* Hope Apple will fix concepts in AppleClang 14 */ 14)) + (!defined(__clang__) || __has_include() || \ + (defined(__cpp_lib_concepts) && __cpp_lib_concepts >= 202002L))) +#if __has_include() || \ + (defined(__cpp_lib_concepts) && __cpp_lib_concepts >= 202002L) +#include +#endif /* */ +#define MDBX_HAVE_CXX20_CONCEPTS 1 +#else +#define MDBX_HAVE_CXX20_CONCEPTS 0 +#endif +#endif /* MDBX_HAVE_CXX20_CONCEPTS */ + +#ifndef MDBX_CXX20_CONCEPT +#if MDBX_HAVE_CXX20_CONCEPTS #define MDBX_CXX20_CONCEPT(CONCEPT, NAME) CONCEPT NAME #else #define MDBX_CXX20_CONCEPT(CONCEPT, NAME) typename NAME @@ -216,13 +233,7 @@ #endif /* MDBX_CXX20_CONCEPT */ #ifndef MDBX_ASSERT_CXX20_CONCEPT_SATISFIED -#if defined(DOXYGEN) || \ - (defined(__cpp_concepts) && __cpp_concepts >= 201907L && \ - (!defined(__clang__) || \ - (__clang_major__ >= 12 && !defined(__APPLE__) && \ - !defined(__ANDROID_API__)) || \ - __clang_major__ >= \ - /* Hope Apple will fix concepts in AppleClang 14 */ 14)) +#if MDBX_HAVE_CXX20_CONCEPTS #define MDBX_ASSERT_CXX20_CONCEPT_SATISFIED(CONCEPT, TYPE) \ static_assert(CONCEPT) #else @@ -256,7 +267,7 @@ namespace mdbx { // To enable all kinds of an compiler optimizations we use a byte-like type // that don't presumes aliases for pointers as does the `char` type and its // derivatives/typedefs. -// Please see https://github.com/erthink/libmdbx/issues/263 +// Please see todo4recovery://erased_by_github/libmdbx/issues/263 // for reasoning of the use of `char8_t` type and switching to `__restrict__`. using byte = char8_t; #else @@ -501,13 +512,7 @@ static MDBX_CXX20_CONSTEXPR void *memcpy(void *dest, const void *src, size_t bytes) noexcept; //------------------------------------------------------------------------------ -#if defined(DOXYGEN) || \ - (defined(__cpp_concepts) && __cpp_concepts >= 201907L && \ - (!defined(__clang__) || \ - (__clang_major__ >= 12 && !defined(__APPLE__) && \ - !defined(__ANDROID_API__)) || \ - __clang_major__ >= \ - /* Hope Apple will fix concepts in AppleClang 14 */ 14)) +#if MDBX_HAVE_CXX20_CONCEPTS template concept MutableByteProducer = requires(T a, char array[42]) { @@ -530,7 +535,7 @@ concept SliceTranscoder = ImmutableByteProducer && { a.is_erroneous() } -> std::same_as; }; -#endif /* __cpp_concepts >= 201907L*/ +#endif /* MDBX_HAVE_CXX20_CONCEPTS */ template = 201811L if (::std::is_constant_evaluated()) { @@ -4122,8 +4127,8 @@ static MDBX_CXX14_CONSTEXPR size_t check_length(size_t headroom, return check_length(check_length(headroom) + check_length(payload)); } -static MDBX_CXX14_CONSTEXPR size_t check_length(size_t headroom, size_t payload, - size_t tailroom) { +MDBX_MAYBE_UNUSED static MDBX_CXX14_CONSTEXPR size_t +check_length(size_t headroom, size_t payload, size_t tailroom) { return check_length(check_length(headroom, payload) + check_length(tailroom)); } diff --git a/packages/buildroot/0001-package-libmdbx-new-package-library-database.patch b/packages/buildroot/0001-package-libmdbx-new-package-library-database.patch index 3d4d9dcfe..edda2377c 100644 --- a/packages/buildroot/0001-package-libmdbx-new-package-library-database.patch +++ b/packages/buildroot/0001-package-libmdbx-new-package-library-database.patch @@ -9,7 +9,7 @@ This patch adds libmdbx v0.11.1: focused on creating unique lightweight solutions. - libmdbx surpasses the legendary LMDB (Lightning Memory-Mapped Database) in terms of reliability, features and performance. - - https://github.com/erthink/libmdbx + - https://gitflic.ru/project/erthink/libmdbx Signed-off-by: Leonid Yuriev Signed-off-by: Yann E. MORIN @@ -71,7 +71,7 @@ index 0000000000..d13f73938f + libmdbx surpasses the legendary LMDB in terms of + reliability, features and performance. + -+ https://github.com/erthink/libmdbx ++ https://gitflic.ru/project/erthink/libmdbx + +if BR2_PACKAGE_LIBMDBX + @@ -107,7 +107,7 @@ index 0000000000..c8b50f9ac3 --- /dev/null +++ b/package/libmdbx/libmdbx.hash @@ -0,0 +1,5 @@ -+# Hashes from: https://github.com/erthink/libmdbx/releases/ ++# Hashes from: https://gitflic.ru/project/erthink/libmdbx/releases/ +sha256 f954ba8c9768914a92c2b46aac0d66bec674dbb4d7b0f01e362ea2921746ddaa libmdbx-amalgamated-0.11.1.tar.gz + +# Locally calculated @@ -126,7 +126,7 @@ index 0000000000..02d00b1a5a + +LIBMDBX_VERSION = 0.11.1 +LIBMDBX_SOURCE = libmdbx-amalgamated-$(LIBMDBX_VERSION).tar.gz -+LIBMDBX_SITE = https://github.com/erthink/libmdbx/releases/download/v$(LIBMDBX_VERSION) ++LIBMDBX_SITE = https://gitflic.ru/project/erthink/libmdbx/releases/download/v$(LIBMDBX_VERSION) +LIBMDBX_SUPPORTS_IN_SOURCE_BUILD = NO +LIBMDBX_LICENSE = OLDAP-2.8 +LIBMDBX_LICENSE_FILES = LICENSE diff --git a/src/core.c b/src/core.c index 31a75049d..741a151ce 100644 --- a/src/core.c +++ b/src/core.c @@ -1248,7 +1248,7 @@ static __inline void rthc_lock(void) { #if defined(_WIN32) || defined(_WIN64) EnterCriticalSection(&rthc_critical_section); #else - mdbx_ensure(nullptr, pthread_mutex_lock(&rthc_mutex) == 0); + mdbx_ensure(nullptr, mdbx_pthread_mutex_lock(&rthc_mutex) == 0); #endif } @@ -1596,7 +1596,7 @@ static __inline void lcklist_lock(void) { #if defined(_WIN32) || defined(_WIN64) EnterCriticalSection(&lcklist_critical_section); #else - mdbx_ensure(nullptr, pthread_mutex_lock(&lcklist_mutex) == 0); + mdbx_ensure(nullptr, mdbx_pthread_mutex_lock(&lcklist_mutex) == 0); #endif } @@ -5058,7 +5058,7 @@ static int mdbx_iov_write(MDBX_txn *const txn, struct mdbx_iov_ctx *ctx) { MDBX_page *wp = (MDBX_page *)ctx->iov[i].iov_base; const MDBX_page *rp = pgno2page(txn->mt_env, wp->mp_pgno); /* check with timeout as the workaround - * for https://github.com/erthink/libmdbx/issues/269 */ + * for todo4recovery://erased_by_github/libmdbx/issues/269 */ while (likely(rc == MDBX_SUCCESS) && unlikely(memcmp(wp, rp, ctx->iov[i].iov_len) != 0)) { if (!timestamp) { @@ -6400,7 +6400,7 @@ __hot static struct page_result mdbx_page_alloc(MDBX_cursor *mc, catch-up with itself by growing while trying to save it. */ (mc->mc_flags & C_RECLAIMING) || /* avoid (recursive) search inside empty tree and while tree is - updating, https://github.com/erthink/libmdbx/issues/31 */ + updating, todo4recovery://erased_by_github/libmdbx/issues/31 */ txn->mt_dbs[FREE_DBI].md_entries == 0 || /* If our dirty list is already full, we can't touch GC */ (txn->tw.dirtyroom < txn->mt_dbs[FREE_DBI].md_depth && @@ -6613,7 +6613,8 @@ __hot static struct page_result mdbx_page_alloc(MDBX_cursor *mc, MDBX_PGL_LIMIT)) { /* Stop reclaiming to avoid overflow the page list. * This is a rare case while search for a continuously multi-page region - * in a large database. https://github.com/erthink/libmdbx/issues/123 */ + * in a large database. + * todo4recovery://erased_by_github/libmdbx/issues/123 */ mdbx_notice("stop reclaiming to avoid PNL overflow: %u (current) + %u " "(chunk) -> %u", MDBX_PNL_SIZE(txn->tw.reclaimed_pglist), gc_len, @@ -7586,7 +7587,7 @@ __cold int mdbx_thread_unregister(const MDBX_env *env) { return MDBX_SUCCESS; } -/* check against https://github.com/erthink/libmdbx/issues/269 */ +/* check against todo4recovery://erased_by_github/libmdbx/issues/269 */ static bool meta_checktxnid(const MDBX_env *env, const MDBX_meta *meta, bool report) { const txnid_t meta_txnid = constmeta_txnid(env, meta); @@ -7662,7 +7663,7 @@ static bool meta_checktxnid(const MDBX_env *env, const MDBX_meta *meta, } /* check with timeout as the workaround - * for https://github.com/erthink/libmdbx/issues/269 */ + * for todo4recovery://erased_by_github/libmdbx/issues/269 */ static int meta_waittxnid(const MDBX_env *env, const MDBX_meta *meta, uint64_t *timestamp) { if (likely(meta_checktxnid(env, (const MDBX_meta *)meta, !*timestamp))) @@ -7807,7 +7808,8 @@ static int mdbx_txn_renew0(MDBX_txn *txn, const unsigned flags) { snap == meta_txnid(env, meta) && snap >= atomic_load64(&env->me_lck->mti_oldest_reader, mo_AcquireRelease))) { - /* workaround for https://github.com/erthink/libmdbx/issues/269 */ + /* workaround for todo4recovery://erased_by_github/libmdbx/issues/269 + */ rc = meta_waittxnid(env, (const MDBX_meta *)meta, ×tamp); mdbx_jitter4testing(false); if (likely(rc == MDBX_SUCCESS)) @@ -7895,7 +7897,8 @@ static int mdbx_txn_renew0(MDBX_txn *txn, const unsigned flags) { mdbx_jitter4testing(false); const MDBX_meta *meta = constmeta_prefer_last(env); uint64_t timestamp = 0; - while ("workaround for https://github.com/erthink/libmdbx/issues/269") { + while ( + "workaround for todo4recovery://erased_by_github/libmdbx/issues/269") { rc = meta_waittxnid(env, (const MDBX_meta *)meta, ×tamp); if (likely(rc == MDBX_SUCCESS)) break; @@ -11722,7 +11725,8 @@ mdbx_env_set_geometry(MDBX_env *env, intptr_t size_lower, intptr_t size_now, const MDBX_meta *head = constmeta_prefer_last(env); uint64_t timestamp = 0; - while ("workaround for https://github.com/erthink/libmdbx/issues/269") { + while ("workaround for " + "todo4recovery://erased_by_github/libmdbx/issues/269") { meta = *head; rc = meta_waittxnid(env, &meta, ×tamp); if (likely(rc == MDBX_SUCCESS)) @@ -12985,7 +12989,7 @@ __cold int mdbx_env_open(MDBX_env *env, const char *pathname, } else { #if MDBX_MMAP_INCOHERENT_FILE_WRITE /* Temporary `workaround` for OpenBSD kernel's flaw. - * See https://github.com/erthink/libmdbx/issues/67 */ + * See todo4recovery://erased_by_github/libmdbx/issues/67 */ if ((flags & MDBX_WRITEMAP) == 0) { if (flags & MDBX_ACCEDE) flags |= MDBX_WRITEMAP; @@ -19944,7 +19948,8 @@ __cold static int fetch_envinfo_ex(const MDBX_env *env, const MDBX_txn *txn, const size_t size_before_bootid = offsetof(MDBX_envinfo, mi_bootid); const size_t size_before_pgop_stat = offsetof(MDBX_envinfo, mi_pgop_stat); - /* is the environment open? (https://github.com/erthink/libmdbx/issues/171) */ + /* is the environment open? + * (todo4recovery://erased_by_github/libmdbx/issues/171) */ if (unlikely(!env->me_map)) { /* environment not yet opened */ #if 1 diff --git a/src/internals.h b/src/internals.h index f03359118..d255a9552 100644 --- a/src/internals.h +++ b/src/internals.h @@ -47,7 +47,8 @@ /*----------------------------------------------------------------------------*/ /* Should be defined before any includes */ -#ifndef _FILE_OFFSET_BITS +#if !defined(_FILE_OFFSET_BITS) && !defined(__ANDROID_API__) && \ + !defined(ANDROID) #define _FILE_OFFSET_BITS 64 #endif diff --git a/src/lck-posix.c b/src/lck-posix.c index 60ba6ed6d..5753fdf19 100644 --- a/src/lck-posix.c +++ b/src/lck-posix.c @@ -175,14 +175,35 @@ __cold static void choice_fcntl() { #ifndef OFF_T_MAX #define OFF_T_MAX \ - ((sizeof(off_t) > 4 ? INT64_MAX : INT32_MAX) & ~(size_t)0xffff) + (((sizeof(off_t) > 4) ? INT64_MAX : INT32_MAX) & ~(size_t)0xffff) #endif -static int lck_op(mdbx_filehandle_t fd, int cmd, int lck, off_t offset, - off_t len) { +static int lck_op(const mdbx_filehandle_t fd, int cmd, const int lck, + const off_t offset, off_t len) { + STATIC_ASSERT(sizeof(off_t) >= sizeof(void *) && + sizeof(off_t) >= sizeof(size_t)); +#ifdef __ANDROID_API__ + STATIC_ASSERT_MSG((sizeof(off_t) * 8 == MDBX_WORDBITS), + "The bitness of system `off_t` type is mismatch. Please " + "fix build and/or NDK configuration."); +#endif /* Android */ mdbx_jitter4testing(true); + assert(offset >= 0 && len > 0); + assert((uint64_t)offset < (uint64_t)INT64_MAX && + (uint64_t)len < (uint64_t)INT64_MAX && + (uint64_t)(offset + len) > (uint64_t)offset); + + assert((uint64_t)offset < (uint64_t)OFF_T_MAX && + (uint64_t)len <= (uint64_t)OFF_T_MAX && + (uint64_t)(offset + len) <= (uint64_t)OFF_T_MAX); + + assert((uint64_t)((off_t)((uint64_t)offset + (uint64_t)len)) == + ((uint64_t)offset + (uint64_t)len)); for (;;) { struct flock lock_op; + STATIC_ASSERT(sizeof(off_t) <= sizeof(lock_op.l_start) && + sizeof(off_t) <= sizeof(lock_op.l_len) && + OFF_T_MAX == (off_t)OFF_T_MAX); memset(&lock_op, 0, sizeof(lock_op)); lock_op.l_type = lck; lock_op.l_whence = SEEK_SET; @@ -218,7 +239,7 @@ static int lck_op(mdbx_filehandle_t fd, int cmd, int lck, off_t offset, } #endif /* MDBX_USE_OFDLOCKS */ if (rc != EINTR || cmd == op_setlkw) { - mdbx_assert(nullptr, MDBX_IS_ERROR(rc)); + assert(MDBX_IS_ERROR(rc)); return rc; } } @@ -791,11 +812,32 @@ __cold static int mdbx_ipclock_failed(MDBX_env *env, mdbx_ipclock_t *ipc, return rc; } +#if defined(__ANDROID_API__) || defined(ANDROID) || defined(BIONIC) +MDBX_INTERNAL_FUNC int mdbx_check_tid4bionic(void) { + /* avoid 32-bit Bionic bug/hang with 32-pit TID */ + if (sizeof(pthread_mutex_t) < sizeof(pid_t) + sizeof(unsigned)) { + pid_t tid = gettid(); + if (unlikely(tid > 0xffff)) { + mdbx_fatal("Raise the ENOSYS(%d) error to avoid hang due " + "the 32-bit Bionic/Android bug with tid/thread_id 0x%08x(%i) " + "that don’t fit in 16 bits, see " + "https://android.googlesource.com/platform/bionic/+/master/" + "docs/32-bit-abi.md#is-too-small-for-large-pids", + ENOSYS, tid, tid); + return ENOSYS; + } + } + return 0; +} +#endif /* __ANDROID_API__ || ANDROID) || BIONIC */ + static int mdbx_ipclock_lock(MDBX_env *env, mdbx_ipclock_t *ipc, const bool dont_wait) { #if MDBX_LOCKING == MDBX_LOCKING_POSIX2001 || \ MDBX_LOCKING == MDBX_LOCKING_POSIX2008 - int rc = dont_wait ? pthread_mutex_trylock(ipc) : pthread_mutex_lock(ipc); + int rc = mdbx_check_tid4bionic(); + if (likely(rc == 0)) + rc = dont_wait ? pthread_mutex_trylock(ipc) : pthread_mutex_lock(ipc); rc = (rc == EBUSY && dont_wait) ? MDBX_BUSY : rc; #elif MDBX_LOCKING == MDBX_LOCKING_POSIX1988 int rc = MDBX_SUCCESS; diff --git a/src/lck-windows.c b/src/lck-windows.c index 62500709d..6ba3f3a9b 100644 --- a/src/lck-windows.c +++ b/src/lck-windows.c @@ -72,7 +72,7 @@ static # pragma const_seg(push) # pragma data_seg(push) -# ifdef _WIN64 +# ifndef _M_IX86 /* kick a linker to create the TLS directory if not already done */ # pragma comment(linker, "/INCLUDE:_tls_used") /* Force some symbol references. */ @@ -94,7 +94,7 @@ static # pragma const_seg(pop) #elif defined(__GNUC__) -# ifdef _WIN64 +# ifndef _M_IX86 const # endif PIMAGE_TLS_CALLBACK mdbx_tls_anchor __attribute__((__section__(".CRT$XLB"), used)) = mdbx_module_handler; diff --git a/src/man1/mdbx_chk.1 b/src/man1/mdbx_chk.1 index 923aced84..a4e335d93 100644 --- a/src/man1/mdbx_chk.1 +++ b/src/man1/mdbx_chk.1 @@ -1,6 +1,6 @@ .\" Copyright 2015-2022 Leonid Yuriev . .\" Copying restrictions apply. See COPYRIGHT/LICENSE. -.TH MDBX_CHK 1 "2022-03-24" "MDBX 0.11.6" +.TH MDBX_CHK 1 "2022-04-22" "MDBX 0.11.7" .SH NAME mdbx_chk \- MDBX checking tool .SH SYNOPSIS @@ -96,4 +96,4 @@ if no quiet mode was requested. .BR mdbx_load (1) .BR mdbx_drop (1) .SH AUTHOR -Leonid Yuriev +Leonid Yuriev diff --git a/src/man1/mdbx_copy.1 b/src/man1/mdbx_copy.1 index 368a0891d..e06347f6f 100644 --- a/src/man1/mdbx_copy.1 +++ b/src/man1/mdbx_copy.1 @@ -2,7 +2,7 @@ .\" Copyright 2012-2015 Howard Chu, Symas Corp. All Rights Reserved. .\" Copyright 2015,2016 Peter-Service R&D LLC . .\" Copying restrictions apply. See COPYRIGHT/LICENSE. -.TH MDBX_COPY 1 "2022-03-24" "MDBX 0.11.6" +.TH MDBX_COPY 1 "2022-04-22" "MDBX 0.11.7" .SH NAME mdbx_copy \- MDBX environment copy tool .SH SYNOPSIS @@ -65,4 +65,4 @@ free during copying cannot be reused until the copy is done. .BR mdbx_drop (1) .SH AUTHOR Howard Chu of Symas Corporation , -Leonid Yuriev +Leonid Yuriev diff --git a/src/man1/mdbx_drop.1 b/src/man1/mdbx_drop.1 index f5559124e..b9577fcaf 100644 --- a/src/man1/mdbx_drop.1 +++ b/src/man1/mdbx_drop.1 @@ -1,7 +1,7 @@ .\" Copyright 2021-2022 Leonid Yuriev . .\" Copyright 2014-2021 Howard Chu, Symas Corp. All Rights Reserved. .\" Copying restrictions apply. See COPYRIGHT/LICENSE. -.TH MDBX_DROP 1 "2022-03-24" "MDBX 0.11.6" +.TH MDBX_DROP 1 "2022-04-22" "MDBX 0.11.7" .SH NAME mdbx_drop \- MDBX database delete tool .SH SYNOPSIS diff --git a/src/man1/mdbx_dump.1 b/src/man1/mdbx_dump.1 index e710c3743..469f13b65 100644 --- a/src/man1/mdbx_dump.1 +++ b/src/man1/mdbx_dump.1 @@ -2,7 +2,7 @@ .\" Copyright 2014-2015 Howard Chu, Symas Corp. All Rights Reserved. .\" Copyright 2015,2016 Peter-Service R&D LLC . .\" Copying restrictions apply. See COPYRIGHT/LICENSE. -.TH MDBX_DUMP 1 "2022-03-24" "MDBX 0.11.6" +.TH MDBX_DUMP 1 "2022-04-22" "MDBX 0.11.7" .SH NAME mdbx_dump \- MDBX environment export tool .SH SYNOPSIS @@ -91,4 +91,4 @@ utility to load the database using the correct comparison functions. .BR mdbx_drop (1) .SH AUTHOR Howard Chu of Symas Corporation , -Leonid Yuriev +Leonid Yuriev diff --git a/src/man1/mdbx_load.1 b/src/man1/mdbx_load.1 index c1a45db8c..850d4d1c0 100644 --- a/src/man1/mdbx_load.1 +++ b/src/man1/mdbx_load.1 @@ -2,7 +2,7 @@ .\" Copyright 2014-2015 Howard Chu, Symas Corp. All Rights Reserved. .\" Copyright 2015,2016 Peter-Service R&D LLC . .\" Copying restrictions apply. See COPYRIGHT/LICENSE. -.TH MDBX_LOAD 1 "2022-03-24" "MDBX 0.11.6" +.TH MDBX_LOAD 1 "2022-04-22" "MDBX 0.11.7" .SH NAME mdbx_load \- MDBX environment import tool .SH SYNOPSIS @@ -102,4 +102,4 @@ a diagnostic message being written to standard error. .BR mdbx_drop (1) .SH AUTHOR Howard Chu of Symas Corporation , -Leonid Yuriev +Leonid Yuriev diff --git a/src/man1/mdbx_stat.1 b/src/man1/mdbx_stat.1 index 8aee0c724..8055d6e1d 100644 --- a/src/man1/mdbx_stat.1 +++ b/src/man1/mdbx_stat.1 @@ -2,7 +2,7 @@ .\" Copyright 2012-2015 Howard Chu, Symas Corp. All Rights Reserved. .\" Copyright 2015,2016 Peter-Service R&D LLC . .\" Copying restrictions apply. See COPYRIGHT/LICENSE. -.TH MDBX_STAT 1 "2022-03-24" "MDBX 0.11.6" +.TH MDBX_STAT 1 "2022-04-22" "MDBX 0.11.7" .SH NAME mdbx_stat \- MDBX environment status tool .SH SYNOPSIS @@ -83,4 +83,4 @@ a diagnostic message being written to standard error. .BR mdbx_drop (1) .SH AUTHOR Howard Chu of Symas Corporation , -Leonid Yuriev +Leonid Yuriev diff --git a/src/mdbx_chk.c b/src/mdbx_chk.c index 8dfb24f3e..576b275c6 100644 --- a/src/mdbx_chk.c +++ b/src/mdbx_chk.c @@ -1157,7 +1157,7 @@ int main(int argc, char *argv[]) { envflags &= ~MDBX_RDONLY; #if MDBX_MMAP_INCOHERENT_FILE_WRITE /* Temporary `workaround` for OpenBSD kernel's flaw. - * See https://github.com/erthink/libmdbx/issues/67 */ + * See todo4recovery://erased_by_github/libmdbx/issues/67 */ envflags |= MDBX_WRITEMAP; #endif /* MDBX_MMAP_INCOHERENT_FILE_WRITE */ break; diff --git a/src/osal.c b/src/osal.c index f0cb13b5b..d19c3d362 100644 --- a/src/osal.c +++ b/src/osal.c @@ -437,7 +437,7 @@ MDBX_INTERNAL_FUNC int mdbx_condpair_lock(mdbx_condpair_t *condpair) { DWORD code = WaitForSingleObject(condpair->mutex, INFINITE); return waitstatus2errcode(code); #else - return pthread_mutex_lock(&condpair->mutex); + return mdbx_pthread_mutex_lock(&condpair->mutex); #endif } @@ -507,7 +507,7 @@ MDBX_INTERNAL_FUNC int mdbx_fastmutex_acquire(mdbx_fastmutex_t *fastmutex) { } return MDBX_SUCCESS; #else - return pthread_mutex_lock(fastmutex); + return mdbx_pthread_mutex_lock(fastmutex); #endif } @@ -678,7 +678,7 @@ MDBX_INTERNAL_FUNC int mdbx_openfile(const enum mdbx_openfile_purpose purpose, flags |= O_CLOEXEC; #endif /* O_CLOEXEC */ - /* Safeguard for https://github.com/erthink/libmdbx/issues/144 */ + /* Safeguard for todo4recovery://erased_by_github/libmdbx/issues/144 */ #if STDIN_FILENO == 0 && STDOUT_FILENO == 1 && STDERR_FILENO == 2 int stub_fd0 = -1, stub_fd1 = -1, stub_fd2 = -1; static const char dev_null[] = "/dev/null"; @@ -710,7 +710,7 @@ MDBX_INTERNAL_FUNC int mdbx_openfile(const enum mdbx_openfile_purpose purpose, } #endif /* O_DIRECT */ - /* Safeguard for https://github.com/erthink/libmdbx/issues/144 */ + /* Safeguard for todo4recovery://erased_by_github/libmdbx/issues/144 */ #if STDIN_FILENO == 0 && STDOUT_FILENO == 1 && STDERR_FILENO == 2 if (*fd == STDIN_FILENO) { mdbx_warning("Got STD%s_FILENO/%d, avoid using it by dup(fd)", "IN", @@ -1547,7 +1547,8 @@ MDBX_INTERNAL_FUNC int mdbx_munmap(mdbx_mmap_t *map) { VALGRIND_MAKE_MEM_NOACCESS(map->address, map->current); /* Unpoisoning is required for ASAN to avoid false-positive diagnostic * when this memory will re-used by malloc or another mmapping. - * See https://github.com/erthink/libmdbx/pull/93#issuecomment-613687203 */ + * See todo4recovery://erased_by_github/libmdbx/pull/93#issuecomment-613687203 + */ MDBX_ASAN_UNPOISON_MEMORY_REGION(map->address, (map->filesize && map->filesize < map->limit) ? map->filesize @@ -1623,7 +1624,8 @@ MDBX_INTERNAL_FUNC int mdbx_mresize(const int flags, mdbx_mmap_t *map, /* Unpoisoning is required for ASAN to avoid false-positive diagnostic * when this memory will re-used by malloc or another mmapping. - * See https://github.com/erthink/libmdbx/pull/93#issuecomment-613687203 */ + * See todo4recovery://erased_by_github/libmdbx/pull/93#issuecomment-613687203 + */ MDBX_ASAN_UNPOISON_MEMORY_REGION(map->address, map->limit); status = NtUnmapViewOfSection(GetCurrentProcess(), map->address); if (!NT_SUCCESS(status)) @@ -1888,7 +1890,8 @@ retry_mapview:; VALGRIND_MAKE_MEM_NOACCESS(map->address, map->current); /* Unpoisoning is required for ASAN to avoid false-positive diagnostic * when this memory will re-used by malloc or another mmapping. - * See https://github.com/erthink/libmdbx/pull/93#issuecomment-613687203 + * See + * todo4recovery://erased_by_github/libmdbx/pull/93#issuecomment-613687203 */ MDBX_ASAN_UNPOISON_MEMORY_REGION( map->address, @@ -1908,7 +1911,9 @@ retry_mapview:; VALGRIND_MAKE_MEM_NOACCESS(map->address, map->current); /* Unpoisoning is required for ASAN to avoid false-positive diagnostic * when this memory will re-used by malloc or another mmapping. - * See https://github.com/erthink/libmdbx/pull/93#issuecomment-613687203 */ + * See + * todo4recovery://erased_by_github/libmdbx/pull/93#issuecomment-613687203 + */ MDBX_ASAN_UNPOISON_MEMORY_REGION( map->address, (map->current < map->limit) ? map->current : map->limit); @@ -1940,6 +1945,9 @@ __cold MDBX_INTERNAL_FUNC void mdbx_osal_jitter(bool tiny) { #if defined(_M_IX86) || defined(_M_X64) || defined(__i386__) || \ defined(__x86_64__) const unsigned salt = 277u * (unsigned)__rdtsc(); +#elif (defined(_WIN32) || defined(_WIN64)) && MDBX_WITHOUT_MSVC_CRT + static ULONG state; + const unsigned salt = (unsigned)RtlRandomEx(&state); #else const unsigned salt = rand(); #endif diff --git a/src/osal.h b/src/osal.h index c4bbd7b73..6a7992bb6 100644 --- a/src/osal.h +++ b/src/osal.h @@ -332,6 +332,14 @@ typedef pthread_mutex_t mdbx_fastmutex_t; #define MDBX_WORDBITS 32 #endif /* MDBX_WORDBITS */ +#if defined(__ANDROID_API__) || defined(ANDROID) +#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS != MDBX_WORDBITS +#error "_FILE_OFFSET_BITS != MDBX_WORDBITS" (_FILE_OFFSET_BITS != MDBX_WORDBITS) +#elif defined(__FILE_OFFSET_BITS) && __FILE_OFFSET_BITS != MDBX_WORDBITS +#error "__FILE_OFFSET_BITS != MDBX_WORDBITS" (__FILE_OFFSET_BITS != MDBX_WORDBITS) +#endif +#endif /* Android */ + /*----------------------------------------------------------------------------*/ /* Compiler's includes for builtins/intrinsics */ @@ -722,6 +730,7 @@ MDBX_MAYBE_UNUSED static __inline uint32_t mdbx_getpid(void) { #if defined(_WIN32) || defined(_WIN64) return GetCurrentProcessId(); #else + STATIC_ASSERT(sizeof(pid_t) <= sizeof(uint32_t)); return getpid(); #endif } @@ -737,6 +746,20 @@ MDBX_MAYBE_UNUSED static __inline uintptr_t mdbx_thread_self(void) { return (uintptr_t)thunk; } +#if !defined(_WIN32) && !defined(_WIN64) +#if defined(__ANDROID_API__) || defined(ANDROID) || defined(BIONIC) +MDBX_INTERNAL_FUNC int mdbx_check_tid4bionic(void); +#else +static __inline int mdbx_check_tid4bionic(void) { return 0; } +#endif /* __ANDROID_API__ || ANDROID) || BIONIC */ + +MDBX_MAYBE_UNUSED static __inline int +mdbx_pthread_mutex_lock(pthread_mutex_t *mutex) { + int err = mdbx_check_tid4bionic(); + return unlikely(err) ? err : pthread_mutex_lock(mutex); +} +#endif /* !Windows */ + MDBX_INTERNAL_FUNC uint64_t mdbx_osal_monotime(void); MDBX_INTERNAL_FUNC uint64_t mdbx_osal_16dot16_to_monotime(uint32_t seconds_16dot16); @@ -968,6 +991,8 @@ typedef LSTATUS(WINAPI *MDBX_RegGetValueA)(HKEY hkey, LPCSTR lpSubKey, LPDWORD pcbData); MDBX_INTERNAL_VAR MDBX_RegGetValueA mdbx_RegGetValueA; +NTSYSAPI ULONG RtlRandomEx(PULONG Seed); + #endif /* Windows */ #endif /* !__cplusplus */ diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 53d816a2e..5e7066e16 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -47,7 +47,7 @@ set_target_properties(mdbx_test PROPERTIES target_setup_options(mdbx_test) if(NOT MDBX_BUILD_CXX AND LIBCXX_FILESYSTEM) - if(CMAKE_COMPILER_IS_ELBRUSCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 1.26.0 + if(CMAKE_COMPILER_IS_ELBRUSCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 1.25.23 AND NOT CMAKE_VERSION VERSION_LESS 3.13) target_link_options(mdbx_test PRIVATE "-Wl,--allow-multiple-definition") endif() @@ -64,3 +64,76 @@ if(UNIX AND NOT SUBPROJECT) target_include_directories(pcrf_test PRIVATE "${PROJECT_SOURCE_DIR}") target_link_libraries(pcrf_test ${TOOL_MDBX_LIB}) endif() + +################################################################################ + +if (CMAKE_CROSSCOMPILING AND NOT CMAKE_CROSSCOMPILING_EMULATOR) + message(WARNING "No emulator to run cross-compiled tests") + add_test(NAME fake_since_no_crosscompiling_emulator COMMAND ${CMAKE_COMMAND} -E + echo "No emulator to run cross-compiled tests") +else() + + string(RANDOM LENGTH 9 ALPHABET "1234567890" test_seed) + message(STATUS "The ${test_seed} will be used for seeding tests. Re-run cmake to re-seed it.") + + add_test(NAME smoke COMMAND ${MDBX_OUTPUT_DIR}/mdbx_test + --loglevel=verbose + --keygen.seed=${test_seed} + --progress --console=no --pathname=smoke.db --dont-cleanup-after basic) + set_tests_properties(smoke PROPERTIES + TIMEOUT 600 + RUN_SERIAL OFF) + if(MDBX_BUILD_TOOLS) + add_test(NAME smoke_chk COMMAND ${MDBX_OUTPUT_DIR}/mdbx_chk -nvv smoke.db) + set_tests_properties(smoke_chk PROPERTIES + DEPENDS smoke + TIMEOUT 60 + REQUIRED_FILES smoke.db) + add_test(NAME smoke_chk_copy COMMAND ${MDBX_OUTPUT_DIR}/mdbx_chk -nvv smoke.db-copy) + set_tests_properties(smoke_chk_copy PROPERTIES + DEPENDS smoke + TIMEOUT 60 + REQUIRED_FILES smoke.db-copy) + endif() + + add_test(NAME dupsort_writemap COMMAND ${MDBX_OUTPUT_DIR}/mdbx_test + --loglevel=notice + --keygen.seed=${test_seed} + --table=+data.integer --keygen.split=29 --datalen.min=min --datalen.max=max --progress --console=no + --repeat=2 --pathname=dupsort_writemap.db --dont-cleanup-after basic) + set_tests_properties(dupsort_writemap PROPERTIES + TIMEOUT 600 + RUN_SERIAL OFF) + if(MDBX_BUILD_TOOLS) + add_test(NAME dupsort_writemap_chk COMMAND ${MDBX_OUTPUT_DIR}/mdbx_chk -nvv dupsort_writemap.db) + set_tests_properties(dupsort_writemap_chk PROPERTIES + DEPENDS dupsort_writemap + TIMEOUT 60 + REQUIRED_FILES dupsort_writemap.db) + add_test(NAME dupsort_writemap_chk_copy COMMAND ${MDBX_OUTPUT_DIR}/mdbx_chk -nvv dupsort_writemap.db-copy) + set_tests_properties(dupsort_writemap_chk_copy PROPERTIES + DEPENDS dupsort_writemap + TIMEOUT 60 + REQUIRED_FILES dupsort_writemap.db-copy) + endif() + + add_test(NAME uniq_nested COMMAND ${MDBX_OUTPUT_DIR}/mdbx_test + --loglevel=notice + --mode=-writemap,-nosync-safe,-lifo --progress --console=no --repeat=2 --pathname=uniq_nested.db --dont-cleanup-after basic) + set_tests_properties(uniq_nested PROPERTIES + TIMEOUT 1800 + RUN_SERIAL OFF) + if(MDBX_BUILD_TOOLS) + add_test(NAME uniq_nested_chk COMMAND ${MDBX_OUTPUT_DIR}/mdbx_chk -nvv uniq_nested.db) + set_tests_properties(uniq_nested_chk PROPERTIES + DEPENDS uniq_nested + TIMEOUT 60 + REQUIRED_FILES uniq_nested.db) + add_test(NAME uniq_nested_chk_copy COMMAND ${MDBX_OUTPUT_DIR}/mdbx_chk -nvv uniq_nested.db-copy) + set_tests_properties(uniq_nested_chk_copy PROPERTIES + DEPENDS uniq_nested + TIMEOUT 60 + REQUIRED_FILES uniq_nested.db-copy) + endif() + +endif() diff --git a/test/config.cc b/test/config.cc index 9db481fd1..61b299b4d 100644 --- a/test/config.cc +++ b/test/config.cc @@ -106,7 +106,7 @@ bool parse_option(int argc, char *const argv[], int &narg, while (true) { if (!scan->verb) - failure("Unknown verb '%.*s', for option '==%s'\n", (int)len, list, + failure("Unknown verb '%.*s', for option '--%s'\n", (int)len, list, option); if (strlen(scan->verb) == len && strncmp(list, scan->verb, len) == 0) { mask = strikethrough ? mask & ~scan->mask : mask | scan->mask; @@ -257,6 +257,69 @@ bool parse_option(int argc, char *const argv[], int &narg, const char *option, return false; } +bool parse_option(int argc, char *const argv[], int &narg, const char *option, + logging::loglevel &loglevel) { + const char *value_cstr; + if (!parse_option(argc, argv, narg, option, &value_cstr)) + return false; + + if (strcmp(value_cstr, "min") == 0 || strcmp(value_cstr, "minimal") == 0 || + strcmp(value_cstr, "fatal") == 0) { + loglevel = logging::failure; + return true; + } + + if (strcmp(value_cstr, "error") == 0 || strcmp(value_cstr, "err") == 0) { + loglevel = logging::error; + return true; + } + + if (strcmp(value_cstr, "warning") == 0 || strcmp(value_cstr, "warn") == 0) { + loglevel = logging::error; + return true; + } + + if (strcmp(value_cstr, "default") == 0 || strcmp(value_cstr, "notice") == 0) { + loglevel = logging::notice; + return true; + } + + if (strcmp(value_cstr, "verbose") == 0) { + loglevel = logging::verbose; + return true; + } + + if (strcmp(value_cstr, "debug") == 0) { + loglevel = logging::debug; + return true; + } + + if (strcmp(value_cstr, "trace") == 0) { + loglevel = logging::trace; + return true; + } + + if (strcmp(value_cstr, "max") == 0 || strcmp(value_cstr, "maximal") == 0 || + strcmp(value_cstr, "extra") == 0) { + loglevel = logging::extra; + return true; + } + + char *suffix = nullptr; + unsigned long long raw = strtoull(value_cstr, &suffix, 0); + if ((suffix && *suffix) || errno) { + suffix = nullptr; + errno = 0; + raw = strtoull(value_cstr, &suffix, 10); + } + if ((!suffix || !*suffix) && !errno && raw < 8) { + loglevel = static_cast(raw); + return true; + } + + failure("Unknown log-level '%s', for option '--%s'\n", value_cstr, option); +} + bool parse_option(int argc, char *const argv[], int &narg, const char *option, bool &value) { const char *value_cstr = nullptr; diff --git a/test/config.h b/test/config.h index 27286426c..8c93981e9 100644 --- a/test/config.h +++ b/test/config.h @@ -133,6 +133,8 @@ inline bool parse_option_intptr(int argc, char *const argv[], int &narg, int32_t(maxval), int32_t(default_value)); } +bool parse_option(int argc, char *const argv[], int &narg, const char *option, + logging::loglevel &); //----------------------------------------------------------------------------- struct keygen_params_pod { diff --git a/test/main.cc b/test/main.cc index c201c20ef..b4b8022b0 100644 --- a/test/main.cc +++ b/test/main.cc @@ -24,6 +24,7 @@ MDBX_NORETURN void usage(void) { "usage:\n" " --help or -h Show this text\n" "Common parameters:\n" + " --loglevel=[0-7]|[extra..fatal]" " --pathname=... Path and/or name of database files\n" " --repeat=N Set repeat counter\n" " --threads=N Number of thread (unsupported for now)\n" @@ -319,6 +320,13 @@ int main(int argc, char *const argv[]) { config::duration, 1)) continue; + logging::loglevel loglevel; + if (config::parse_option(argc, argv, narg, "loglevel", loglevel)) { + logging::setup(loglevel, "main"); + params.loglevel = static_cast(loglevel); + continue; + } + const char *value = nullptr; if (config::parse_option(argc, argv, narg, "case", &value)) { fixup4qemu(params); diff --git a/test/utils.h b/test/utils.h index 57e79dcc3..dd52dc003 100644 --- a/test/utils.h +++ b/test/utils.h @@ -50,7 +50,7 @@ #define rot64(v, s) _rotr64(v, s) #define rot32(v, s) _rotr(v, s) -#if defined(_M_ARM64) || defined(_M_X64) || defined(_M_IA64) +#if defined(_M_X64) || defined(_M_IA64) #pragma intrinsic(_umul128) #define mul_64x64_128(a, b, ph) _umul128(a, b, ph) #pragma intrinsic(__umulh) diff --git a/test/valgrind_suppress.txt b/test/valgrind_suppress.txt index 7e707c509..fbaf2bc5e 100644 --- a/test/valgrind_suppress.txt +++ b/test/valgrind_suppress.txt @@ -31,7 +31,7 @@ fun:mdbx_wipe_steady } -# memcmp() inside mdbx_iov_write() as workaround for https://github.com/erthink/libmdbx/issues/269 +# memcmp() inside mdbx_iov_write() as workaround for todo4recovery://erased_by_github/libmdbx/issues/269 { write-page-check-bcmp Memcheck:Cond