├── .gitignore ├── LEGAL ├── README ├── build_unix └── .IGNORE_ME ├── dist ├── ChangeLog ├── Makefile.in ├── RELEASE ├── aclocal │ ├── clock.m4 │ ├── config.m4 │ ├── cxx.m4 │ ├── gcc.m4 │ ├── libtool.m4 │ ├── ltoptions.m4 │ ├── ltsugar.m4 │ ├── ltversion.m4 │ ├── lt~obsolete.m4 │ ├── mmap.m4 │ ├── mutex.m4 │ ├── options.m4 │ ├── perfmon.m4 │ ├── programs.m4 │ ├── sequence.m4 │ ├── socklen.m4 │ ├── sosuffix.m4 │ ├── tcl.m4 │ ├── tls.m4 │ └── types.m4 ├── api_flags ├── api_flags.c ├── buildpkg ├── bumprel ├── clib_port.in ├── config.guess ├── config.hin ├── config.sub ├── configure ├── configure.ac ├── db_provider.d ├── errno.h ├── events.in ├── gen_inc.awk ├── gen_msg.awk ├── gen_provider.pl ├── gen_rec.awk ├── install-sh ├── ltmain.sh ├── pubdef.in ├── s_all ├── s_apiflags ├── s_config ├── s_crypto ├── s_cscope ├── s_include ├── s_message ├── s_message_id ├── s_perm ├── s_php ├── s_readme ├── s_recover ├── s_sig ├── s_symlink ├── s_tags ├── s_test ├── s_validate ├── srcfiles.in ├── template │ ├── rec_btree │ ├── rec_crdel │ ├── rec_ctemp │ ├── rec_db │ ├── rec_dbreg │ ├── rec_fileops │ ├── rec_hash │ ├── rec_heap │ ├── rec_qam │ ├── rec_repmgr │ ├── rec_txn │ └── rec_utemp └── validate │ ├── README │ ├── s_chk_build_configs │ ├── s_chk_comma │ ├── s_chk_comma.c │ ├── s_chk_copyright │ ├── s_chk_defines │ ├── s_chk_err │ ├── s_chk_ext_method_calls │ ├── s_chk_flags │ ├── s_chk_flags.c │ ├── s_chk_inclconfig │ ├── s_chk_include │ ├── s_chk_logverify │ ├── s_chk_logverify.c │ ├── s_chk_message_id │ ├── s_chk_mutex_print │ ├── s_chk_newline │ ├── s_chk_offt │ ├── s_chk_osdir │ ├── s_chk_proto │ ├── s_chk_pubdef │ ├── s_chk_runrecovery │ ├── s_chk_spell │ ├── s_chk_spell.dict │ ├── s_chk_srcfiles │ ├── s_chk_stats │ └── s_chk_tags ├── docs └── legal │ ├── ASM.txt │ ├── BSD.txt │ ├── CDDL.txt │ ├── HARVARD.txt │ └── SPL.txt ├── examples ├── c │ ├── README │ ├── csv │ │ ├── DbRecord.c │ │ ├── Makefile │ │ ├── README │ │ ├── code.c │ │ ├── csv.h │ │ ├── csv_extern.h │ │ ├── db.c │ │ ├── load.c │ │ ├── load_main.c │ │ ├── query.c │ │ ├── query_main.c │ │ ├── sample.csv │ │ ├── sample.desc │ │ └── util.c │ ├── ex_access.c │ ├── ex_apprec │ │ ├── auto_rebuild │ │ ├── ex_apprec.c │ │ ├── ex_apprec.h │ │ ├── ex_apprec.src │ │ ├── ex_apprec_auto.c │ │ ├── ex_apprec_auto.h │ │ ├── ex_apprec_autop.c │ │ ├── ex_apprec_rec.c │ │ └── ex_apprec_template │ ├── ex_btrec.c │ ├── ex_bulk.c │ ├── ex_env.c │ ├── ex_heap.c │ ├── ex_lock.c │ ├── ex_mpool.c │ ├── ex_rep │ │ ├── README │ │ ├── base │ │ │ ├── rep_base.c │ │ │ ├── rep_base.h │ │ │ ├── rep_msg.c │ │ │ └── rep_net.c │ │ ├── common │ │ │ ├── rep_common.c │ │ │ └── rep_common.h │ │ └── mgr │ │ │ └── rep_mgr.c │ ├── ex_rep_chan │ │ ├── rep_chan.c │ │ ├── rep_chan.h │ │ └── rep_chan_util.c │ ├── ex_sequence.c │ ├── ex_stream.c │ ├── ex_thread.c │ └── ex_tpcb.c ├── cxx │ ├── AccessExample.cpp │ ├── BtRecExample.cpp │ ├── EnvExample.cpp │ ├── LockExample.cpp │ ├── MpoolExample.cpp │ ├── SequenceExample.cpp │ ├── TpcbExample.cpp │ ├── excxx_repquote │ │ ├── RepConfigInfo.cpp │ │ ├── RepConfigInfo.h │ │ ├── RepQuoteExample.cpp │ │ └── dbc_auto.h │ ├── excxx_repquote_gsg │ │ ├── RepConfigInfo.h │ │ ├── RepMgrGSG.cpp │ │ ├── SimpleConfigInfo.h │ │ └── SimpleTxn.cpp │ ├── getting_started │ │ ├── MyDb.cpp │ │ ├── MyDb.hpp │ │ ├── excxx_example_database_load.cpp │ │ ├── excxx_example_database_read.cpp │ │ ├── gettingStartedCommon.hpp │ │ ├── inventory.txt │ │ └── vendors.txt │ └── txn_guide │ │ ├── TxnGuide.cpp │ │ └── TxnGuideInMemory.cpp └── stl │ ├── README │ ├── StlAccessExample.cpp │ ├── StlAdvancedFeatures.cpp │ ├── StlAdvancedFeatures.h │ ├── StlTpcbExample.cpp │ ├── StlTransactionGuideExample.cpp │ └── repquote │ ├── README │ ├── StlRepConfigInfo.cpp │ ├── StlRepConfigInfo.h │ └── StlRepQuoteExample.cpp ├── lang ├── cxx │ ├── cxx_channel.cpp │ ├── cxx_db.cpp │ ├── cxx_dbc.cpp │ ├── cxx_dbt.cpp │ ├── cxx_env.cpp │ ├── cxx_except.cpp │ ├── cxx_lock.cpp │ ├── cxx_logc.cpp │ ├── cxx_mpool.cpp │ ├── cxx_multi.cpp │ ├── cxx_rid.cpp │ ├── cxx_seq.cpp │ ├── cxx_site.cpp │ ├── cxx_txn.cpp │ └── stl │ │ ├── dbstl_base_iterator.h │ │ ├── dbstl_common.in │ │ ├── dbstl_container.cpp │ │ ├── dbstl_container.h │ │ ├── dbstl_dbc.h │ │ ├── dbstl_dbt.h │ │ ├── dbstl_element_ref.h │ │ ├── dbstl_exception.h │ │ ├── dbstl_inner_utility.h │ │ ├── dbstl_map.h │ │ ├── dbstl_resource_manager.cpp │ │ ├── dbstl_resource_manager.h │ │ ├── dbstl_set.h │ │ ├── dbstl_utility.h │ │ └── dbstl_vector.h └── tcl │ ├── docs │ ├── db.html │ ├── env.html │ ├── historic.html │ ├── index.html │ ├── library.html │ ├── lock.html │ ├── log.html │ ├── mpool.html │ ├── rep.html │ ├── sequence.html │ ├── test.html │ └── txn.html │ ├── tcl_compat.c │ ├── tcl_db.c │ ├── tcl_db_pkg.c │ ├── tcl_dbcursor.c │ ├── tcl_env.c │ ├── tcl_internal.c │ ├── tcl_lock.c │ ├── tcl_log.c │ ├── tcl_mp.c │ ├── tcl_mutex.c │ ├── tcl_rep.c │ ├── tcl_seq.c │ ├── tcl_txn.c │ └── tcl_util.c ├── src ├── btree │ ├── bt_compact.c │ ├── bt_compare.c │ ├── bt_compress.c │ ├── bt_conv.c │ ├── bt_curadj.c │ ├── bt_cursor.c │ ├── bt_delete.c │ ├── bt_method.c │ ├── bt_open.c │ ├── bt_put.c │ ├── bt_rec.c │ ├── bt_reclaim.c │ ├── bt_recno.c │ ├── bt_rsearch.c │ ├── bt_search.c │ ├── bt_split.c │ ├── bt_stat.c │ ├── bt_upgrade.c │ ├── bt_verify.c │ ├── btree.src │ ├── btree_auto.c │ └── btree_autop.c ├── clib │ ├── atoi.c │ ├── atol.c │ ├── bsearch.c │ ├── getcwd.c │ ├── getopt.c │ ├── isalpha.c │ ├── isdigit.c │ ├── isprint.c │ ├── isspace.c │ ├── memcmp.c │ ├── memmove.c │ ├── printf.c │ ├── qsort.c │ ├── raise.c │ ├── rand.c │ ├── snprintf.c │ ├── strcasecmp.c │ ├── strcat.c │ ├── strchr.c │ ├── strdup.c │ ├── strerror.c │ ├── strncat.c │ ├── strncmp.c │ ├── strrchr.c │ ├── strsep.c │ ├── strtol.c │ ├── strtoul.c │ └── time.c ├── common │ ├── clock.c │ ├── crypto_stub.c │ ├── db_byteorder.c │ ├── db_compint.c │ ├── db_err.c │ ├── db_getlong.c │ ├── db_idspace.c │ ├── db_log2.c │ ├── db_shash.c │ ├── dbt.c │ ├── mkpath.c │ ├── openflags.c │ ├── os_method.c │ ├── util_arg.c │ ├── util_cache.c │ ├── util_log.c │ ├── util_sig.c │ └── zerofill.c ├── crypto │ ├── aes_method.c │ ├── crypto.c │ ├── crypto.html │ ├── mersenne │ │ └── mt19937db.c │ └── rijndael │ │ ├── rijndael-alg-fst.c │ │ ├── rijndael-alg-fst.h │ │ ├── rijndael-api-fst.c │ │ └── rijndael-api-fst.h ├── db │ ├── crdel.src │ ├── crdel_auto.c │ ├── crdel_autop.c │ ├── crdel_rec.c │ ├── db.c │ ├── db.src │ ├── db_am.c │ ├── db_auto.c │ ├── db_autop.c │ ├── db_backup.c │ ├── db_cam.c │ ├── db_cds.c │ ├── db_compact.c │ ├── db_conv.c │ ├── db_copy.c │ ├── db_dispatch.c │ ├── db_dup.c │ ├── db_iface.c │ ├── db_join.c │ ├── db_meta.c │ ├── db_method.c │ ├── db_open.c │ ├── db_overflow.c │ ├── db_ovfl_vrfy.c │ ├── db_pr.c │ ├── db_rec.c │ ├── db_reclaim.c │ ├── db_remove.c │ ├── db_rename.c │ ├── db_ret.c │ ├── db_setid.c │ ├── db_setlsn.c │ ├── db_sort_multiple.c │ ├── db_stati.c │ ├── db_truncate.c │ ├── db_upg.c │ ├── db_upg_opd.c │ ├── db_vrfy.c │ ├── db_vrfy_stub.c │ ├── db_vrfyutil.c │ └── partition.c ├── dbinc │ ├── atomic.h │ ├── btree.h │ ├── clock.h │ ├── crypto.h │ ├── cxx_int.h │ ├── db.in │ ├── db_185.in │ ├── db_am.h │ ├── db_cxx.in │ ├── db_dispatch.h │ ├── db_int.in │ ├── db_join.h │ ├── db_page.h │ ├── db_swap.h │ ├── db_upgrade.h │ ├── db_verify.h │ ├── debug.h │ ├── fop.h │ ├── globals.h │ ├── hash.h │ ├── heap.h │ ├── hmac.h │ ├── lock.h │ ├── log.h │ ├── log_verify.h │ ├── mp.h │ ├── mutex.h │ ├── mutex_int.h │ ├── os.h │ ├── partition.h │ ├── perfmon.h │ ├── qam.h │ ├── queue.h │ ├── region.h │ ├── rep.h │ ├── repmgr.h │ ├── shqueue.h │ ├── tcl_db.h │ ├── txn.h │ ├── win_db.h │ └── xa.h ├── dbinc_auto │ ├── api_flags.in │ ├── btree_auto.h │ ├── btree_ext.h │ ├── clib_ext.h │ ├── common_ext.h │ ├── crdel_auto.h │ ├── crypto_ext.h │ ├── db_auto.h │ ├── db_ext.h │ ├── dbreg_auto.h │ ├── dbreg_ext.h │ ├── env_ext.h │ ├── ext_185_def.in │ ├── ext_185_prot.in │ ├── ext_def.in │ ├── ext_prot.in │ ├── fileops_auto.h │ ├── fileops_ext.h │ ├── hash_auto.h │ ├── hash_ext.h │ ├── heap_auto.h │ ├── heap_ext.h │ ├── hmac_ext.h │ ├── int_def.in │ ├── lock_ext.h │ ├── log_ext.h │ ├── mp_ext.h │ ├── mutex_ext.h │ ├── os_ext.h │ ├── qam_auto.h │ ├── qam_ext.h │ ├── rep_automsg.h │ ├── rep_ext.h │ ├── repmgr_auto.h │ ├── repmgr_automsg.h │ ├── repmgr_ext.h │ ├── sequence_ext.h │ ├── tcl_ext.h │ ├── txn_auto.h │ ├── txn_ext.h │ └── xa_ext.h ├── dbreg │ ├── dbreg.c │ ├── dbreg.src │ ├── dbreg_auto.c │ ├── dbreg_autop.c │ ├── dbreg_rec.c │ ├── dbreg_stat.c │ └── dbreg_util.c ├── env │ ├── env_alloc.c │ ├── env_backup.c │ ├── env_config.c │ ├── env_failchk.c │ ├── env_file.c │ ├── env_globals.c │ ├── env_method.c │ ├── env_name.c │ ├── env_open.c │ ├── env_recover.c │ ├── env_region.c │ ├── env_register.c │ ├── env_sig.c │ └── env_stat.c ├── fileops │ ├── fileops.src │ ├── fileops_auto.c │ ├── fileops_autop.c │ ├── fop_basic.c │ ├── fop_rec.c │ └── fop_util.c ├── hash │ ├── hash.c │ ├── hash.src │ ├── hash_auto.c │ ├── hash_autop.c │ ├── hash_compact.c │ ├── hash_conv.c │ ├── hash_dup.c │ ├── hash_func.c │ ├── hash_meta.c │ ├── hash_method.c │ ├── hash_open.c │ ├── hash_page.c │ ├── hash_rec.c │ ├── hash_reclaim.c │ ├── hash_stat.c │ ├── hash_stub.c │ ├── hash_upgrade.c │ └── hash_verify.c ├── heap │ ├── heap.c │ ├── heap.src │ ├── heap_auto.c │ ├── heap_autop.c │ ├── heap_backup.c │ ├── heap_conv.c │ ├── heap_method.c │ ├── heap_open.c │ ├── heap_rec.c │ ├── heap_reclaim.c │ ├── heap_stat.c │ ├── heap_stub.c │ └── heap_verify.c ├── hmac │ ├── hmac.c │ └── sha1.c ├── lock │ ├── Design │ ├── lock.c │ ├── lock_alloc.incl │ ├── lock_deadlock.c │ ├── lock_failchk.c │ ├── lock_id.c │ ├── lock_list.c │ ├── lock_method.c │ ├── lock_region.c │ ├── lock_stat.c │ ├── lock_stub.c │ ├── lock_timer.c │ └── lock_util.c ├── log │ ├── log.c │ ├── log_archive.c │ ├── log_compare.c │ ├── log_debug.c │ ├── log_get.c │ ├── log_method.c │ ├── log_print.c │ ├── log_put.c │ ├── log_stat.c │ ├── log_verify.c │ ├── log_verify_auto.c │ ├── log_verify_int.c │ ├── log_verify_stub.c │ └── log_verify_util.c ├── mp │ ├── mp_alloc.c │ ├── mp_backup.c │ ├── mp_bh.c │ ├── mp_fget.c │ ├── mp_fmethod.c │ ├── mp_fopen.c │ ├── mp_fput.c │ ├── mp_fset.c │ ├── mp_method.c │ ├── mp_mvcc.c │ ├── mp_region.c │ ├── mp_register.c │ ├── mp_resize.c │ ├── mp_stat.c │ ├── mp_sync.c │ └── mp_trickle.c ├── mutex │ ├── README │ ├── mut_alloc.c │ ├── mut_failchk.c │ ├── mut_fcntl.c │ ├── mut_method.c │ ├── mut_pthread.c │ ├── mut_region.c │ ├── mut_stat.c │ ├── mut_stub.c │ ├── mut_tas.c │ ├── mut_win32.c │ ├── test_mutex.c │ └── uts4_cc.s ├── os │ ├── os_abort.c │ ├── os_abs.c │ ├── os_addrinfo.c │ ├── os_alloc.c │ ├── os_clock.c │ ├── os_config.c │ ├── os_cpu.c │ ├── os_ctime.c │ ├── os_dir.c │ ├── os_errno.c │ ├── os_fid.c │ ├── os_flock.c │ ├── os_fsync.c │ ├── os_getenv.c │ ├── os_handle.c │ ├── os_map.c │ ├── os_mkdir.c │ ├── os_open.c │ ├── os_path.c │ ├── os_pid.c │ ├── os_rename.c │ ├── os_root.c │ ├── os_rpath.c │ ├── os_rw.c │ ├── os_seek.c │ ├── os_stack.c │ ├── os_stat.c │ ├── os_tmpdir.c │ ├── os_truncate.c │ ├── os_uid.c │ ├── os_unlink.c │ └── os_yield.c ├── qam │ ├── qam.c │ ├── qam.src │ ├── qam_auto.c │ ├── qam_autop.c │ ├── qam_conv.c │ ├── qam_files.c │ ├── qam_method.c │ ├── qam_open.c │ ├── qam_rec.c │ ├── qam_stat.c │ ├── qam_stub.c │ ├── qam_upgrade.c │ └── qam_verify.c ├── rep │ ├── mlease.html │ ├── rep.msg │ ├── rep_automsg.c │ ├── rep_backup.c │ ├── rep_elect.c │ ├── rep_lease.c │ ├── rep_log.c │ ├── rep_method.c │ ├── rep_record.c │ ├── rep_region.c │ ├── rep_stat.c │ ├── rep_stub.c │ ├── rep_util.c │ └── rep_verify.c ├── repmgr │ ├── repmgr.msg │ ├── repmgr.src │ ├── repmgr_auto.c │ ├── repmgr_automsg.c │ ├── repmgr_autop.c │ ├── repmgr_elect.c │ ├── repmgr_method.c │ ├── repmgr_msg.c │ ├── repmgr_net.c │ ├── repmgr_posix.c │ ├── repmgr_queue.c │ ├── repmgr_rec.c │ ├── repmgr_sel.c │ ├── repmgr_stat.c │ ├── repmgr_stub.c │ ├── repmgr_util.c │ └── repmgr_windows.c ├── sequence │ ├── seq_stat.c │ └── sequence.c ├── txn │ ├── txn.c │ ├── txn.src │ ├── txn_auto.c │ ├── txn_autop.c │ ├── txn_chkpt.c │ ├── txn_failchk.c │ ├── txn_method.c │ ├── txn_rec.c │ ├── txn_recover.c │ ├── txn_region.c │ ├── txn_stat.c │ └── txn_util.c └── xa │ ├── xa.c │ └── xa_map.c ├── test ├── 3n1 │ ├── README │ ├── bench3n.cpp │ └── bench3n.h ├── c │ ├── README │ ├── chk.ctests │ ├── common │ │ └── test_util.h │ ├── cutest │ │ ├── CuTest.c │ │ ├── CuTest.h │ │ ├── CuTests.c │ │ ├── Runner.c │ │ ├── gen_tester.sh │ │ └── license.txt │ ├── suites │ │ ├── TestChannel.c │ │ ├── TestDbHotBackup.c │ │ ├── TestDbTuner.c │ │ ├── TestEncryption.c │ │ ├── TestEnvConfig.c │ │ ├── TestEnvMethod.c │ │ ├── TestKeyExistErrorReturn.c │ │ ├── TestPartial.c │ │ └── TestQueue.c │ ├── test_api_methods.c │ └── test_log_verify.c ├── cxx │ ├── README │ ├── TestConstruct01.cpp │ ├── TestConstruct01.testerr │ ├── TestConstruct01.testout │ ├── TestGetSetMethods.cpp │ ├── TestKeyRange.cpp │ ├── TestKeyRange.testin │ ├── TestKeyRange.testout │ ├── TestLogc.cpp │ ├── TestLogc.testout │ ├── TestMulti.cpp │ ├── TestSimpleAccess.cpp │ ├── TestSimpleAccess.testout │ ├── TestTruncate.cpp │ ├── TestTruncate.testout │ ├── chk.cxxtests │ ├── ignore │ ├── testall │ └── testone ├── micro │ ├── README │ ├── configs │ │ ├── run.small │ │ ├── run.std │ │ └── run.workload │ ├── report │ ├── report.awk │ ├── source │ │ ├── LIST │ │ ├── b_curalloc.c │ │ ├── b_curwalk.c │ │ ├── b_del.c │ │ ├── b_get.c │ │ ├── b_inmem.c │ │ ├── b_latch.c │ │ ├── b_load.c │ │ ├── b_open.c │ │ ├── b_put.c │ │ ├── b_recover.c │ │ ├── b_txn.c │ │ ├── b_txn_write.c │ │ ├── b_uname.c │ │ ├── b_util.c │ │ ├── b_workload.c │ │ ├── b_workload.h │ │ ├── bench.h │ │ └── test_micro.c │ └── test_micro ├── tcl │ ├── README │ ├── TESTS │ ├── archive.tcl │ ├── backup.tcl │ ├── bigfile001.tcl │ ├── bigfile002.tcl │ ├── byteorder.tcl │ ├── conscript.tcl │ ├── db_reptest.tcl │ ├── dbm.tcl │ ├── dbscript.tcl │ ├── ddoyscript.tcl │ ├── ddscript.tcl │ ├── dead001.tcl │ ├── dead002.tcl │ ├── dead003.tcl │ ├── dead004.tcl │ ├── dead005.tcl │ ├── dead006.tcl │ ├── dead007.tcl │ ├── dead008.tcl │ ├── dead009.tcl │ ├── dead010.tcl │ ├── dead011.tcl │ ├── env001.tcl │ ├── env002.tcl │ ├── env003.tcl │ ├── env004.tcl │ ├── env005.tcl │ ├── env006.tcl │ ├── env007.tcl │ ├── env007script.tcl │ ├── env008.tcl │ ├── env009.tcl │ ├── env010.tcl │ ├── env011.tcl │ ├── env012.tcl │ ├── env013.tcl │ ├── env014.tcl │ ├── env015.tcl │ ├── env016.tcl │ ├── env017.tcl │ ├── env018.tcl │ ├── env019.tcl │ ├── env019script.tcl │ ├── env020.tcl │ ├── env021.tcl │ ├── envscript.tcl │ ├── fop001.tcl │ ├── fop002.tcl │ ├── fop003.tcl │ ├── fop004.tcl │ ├── fop005.tcl │ ├── fop006.tcl │ ├── fop007.tcl │ ├── fop008.tcl │ ├── fop009.tcl │ ├── fop010.tcl │ ├── fop011.tcl │ ├── fop012.tcl │ ├── fopscript.tcl │ ├── foputils.tcl │ ├── hsearch.tcl │ ├── include.tcl │ ├── join.tcl │ ├── lock001.tcl │ ├── lock002.tcl │ ├── lock003.tcl │ ├── lock004.tcl │ ├── lock005.tcl │ ├── lock006.tcl │ ├── lockscript.tcl │ ├── log001.tcl │ ├── log002.tcl │ ├── log003.tcl │ ├── log004.tcl │ ├── log005.tcl │ ├── log006.tcl │ ├── log007.tcl │ ├── log008.tcl │ ├── log008script.tcl │ ├── log009.tcl │ ├── logtrack.list │ ├── logtrack.tcl │ ├── mdbscript.tcl │ ├── memp001.tcl │ ├── memp002.tcl │ ├── memp003.tcl │ ├── memp004.tcl │ ├── memp005.tcl │ ├── mpoolscript.tcl │ ├── mut001.tcl │ ├── mut002.tcl │ ├── mut002script.tcl │ ├── mut003.tcl │ ├── ndbm.tcl │ ├── parallel.tcl │ ├── plat001.tcl │ ├── portable.tcl │ ├── recd001.tcl │ ├── recd002.tcl │ ├── recd003.tcl │ ├── recd004.tcl │ ├── recd005.tcl │ ├── recd006.tcl │ ├── recd007.tcl │ ├── recd008.tcl │ ├── recd009.tcl │ ├── recd010.tcl │ ├── recd011.tcl │ ├── recd012.tcl │ ├── recd013.tcl │ ├── recd014.tcl │ ├── recd015.tcl │ ├── recd016.tcl │ ├── recd017.tcl │ ├── recd018.tcl │ ├── recd019.tcl │ ├── recd020.tcl │ ├── recd021.tcl │ ├── recd022.tcl │ ├── recd023.tcl │ ├── recd024.tcl │ ├── recd025.tcl │ ├── recd15scr.tcl │ ├── recdscript.tcl │ ├── rep001.tcl │ ├── rep002.tcl │ ├── rep003.tcl │ ├── rep005.tcl │ ├── rep006.tcl │ ├── rep007.tcl │ ├── rep008.tcl │ ├── rep009.tcl │ ├── rep010.tcl │ ├── rep011.tcl │ ├── rep012.tcl │ ├── rep013.tcl │ ├── rep014.tcl │ ├── rep015.tcl │ ├── rep016.tcl │ ├── rep017.tcl │ ├── rep017script.tcl │ ├── rep018.tcl │ ├── rep018script.tcl │ ├── rep019.tcl │ ├── rep020.tcl │ ├── rep021.tcl │ ├── rep022.tcl │ ├── rep023.tcl │ ├── rep024.tcl │ ├── rep025.tcl │ ├── rep026.tcl │ ├── rep027.tcl │ ├── rep028.tcl │ ├── rep029.tcl │ ├── rep030.tcl │ ├── rep031.tcl │ ├── rep032.tcl │ ├── rep033.tcl │ ├── rep034.tcl │ ├── rep035.tcl │ ├── rep035script.tcl │ ├── rep036.tcl │ ├── rep036script.tcl │ ├── rep037.tcl │ ├── rep038.tcl │ ├── rep039.tcl │ ├── rep040.tcl │ ├── rep040script.tcl │ ├── rep041.tcl │ ├── rep042.tcl │ ├── rep042script.tcl │ ├── rep043.tcl │ ├── rep043script.tcl │ ├── rep044.tcl │ ├── rep045.tcl │ ├── rep045script.tcl │ ├── rep046.tcl │ ├── rep047.tcl │ ├── rep048.tcl │ ├── rep048script.tcl │ ├── rep049.tcl │ ├── rep050.tcl │ ├── rep051.tcl │ ├── rep052.tcl │ ├── rep053.tcl │ ├── rep054.tcl │ ├── rep055.tcl │ ├── rep058.tcl │ ├── rep060.tcl │ ├── rep061.tcl │ ├── rep062.tcl │ ├── rep063.tcl │ ├── rep064.tcl │ ├── rep065.tcl │ ├── rep065script.tcl │ ├── rep066.tcl │ ├── rep067.tcl │ ├── rep068.tcl │ ├── rep069.tcl │ ├── rep070.tcl │ ├── rep071.tcl │ ├── rep072.tcl │ ├── rep073.tcl │ ├── rep074.tcl │ ├── rep075.tcl │ ├── rep076.tcl │ ├── rep077.tcl │ ├── rep078.tcl │ ├── rep078script.tcl │ ├── rep079.tcl │ ├── rep080.tcl │ ├── rep081.tcl │ ├── rep082.tcl │ ├── rep083.tcl │ ├── rep084.tcl │ ├── rep085.tcl │ ├── rep086.tcl │ ├── rep087.tcl │ ├── rep088.tcl │ ├── rep089.tcl │ ├── rep090.tcl │ ├── rep091.tcl │ ├── rep092.tcl │ ├── rep092script.tcl │ ├── rep093.tcl │ ├── rep094.tcl │ ├── rep095.tcl │ ├── rep095script.tcl │ ├── rep096.tcl │ ├── rep097.tcl │ ├── rep097script.tcl │ ├── rep098.tcl │ ├── rep099.tcl │ ├── rep100.tcl │ ├── rep101.tcl │ ├── rep102.tcl │ ├── rep102script.tcl │ ├── repmgr001.tcl │ ├── repmgr002.tcl │ ├── repmgr003.tcl │ ├── repmgr007.tcl │ ├── repmgr009.tcl │ ├── repmgr010.tcl │ ├── repmgr011.tcl │ ├── repmgr012.tcl │ ├── repmgr013.tcl │ ├── repmgr017.tcl │ ├── repmgr018.tcl │ ├── repmgr023.tcl │ ├── repmgr024.tcl │ ├── repmgr025.tcl │ ├── repmgr026.tcl │ ├── repmgr027.tcl │ ├── repmgr028.tcl │ ├── repmgr028script.tcl │ ├── repmgr029.tcl │ ├── repmgr029script.tcl │ ├── repmgr029script2.tcl │ ├── repmgr030.tcl │ ├── repmgr031.tcl │ ├── repmgr032.tcl │ ├── repmgr033.tcl │ ├── repmgr034.tcl │ ├── repmgr100.tcl │ ├── repmgr101.tcl │ ├── repmgr102.tcl │ ├── repmgr105.tcl │ ├── repmgr106.tcl │ ├── repmgr107.tcl │ ├── repmgr108.tcl │ ├── repmgr109.tcl │ ├── repmgr110.tcl │ ├── repmgr111.tcl │ ├── repmgr112.tcl │ ├── reputils.tcl │ ├── reputilsnoenv.tcl │ ├── rsrc001.tcl │ ├── rsrc002.tcl │ ├── rsrc003.tcl │ ├── rsrc004.tcl │ ├── sdb001.tcl │ ├── sdb002.tcl │ ├── sdb003.tcl │ ├── sdb004.tcl │ ├── sdb005.tcl │ ├── sdb006.tcl │ ├── sdb007.tcl │ ├── sdb008.tcl │ ├── sdb009.tcl │ ├── sdb010.tcl │ ├── sdb011.tcl │ ├── sdb012.tcl │ ├── sdb013.tcl │ ├── sdb014.tcl │ ├── sdb015.tcl │ ├── sdb016.tcl │ ├── sdb017.tcl │ ├── sdb018.tcl │ ├── sdb019.tcl │ ├── sdb020.tcl │ ├── sdbscript.tcl │ ├── sdbtest001.tcl │ ├── sdbtest002.tcl │ ├── sdbutils.tcl │ ├── sec001.tcl │ ├── sec002.tcl │ ├── shelltest.tcl │ ├── si001.tcl │ ├── si002.tcl │ ├── si003.tcl │ ├── si004.tcl │ ├── si005.tcl │ ├── si006.tcl │ ├── si007.tcl │ ├── si008.tcl │ ├── sijointest.tcl │ ├── siutils.tcl │ ├── sysscript.tcl │ ├── t106script.tcl │ ├── test.tcl │ ├── test001.tcl │ ├── test002.tcl │ ├── test003.tcl │ ├── test004.tcl │ ├── test005.tcl │ ├── test006.tcl │ ├── test007.tcl │ ├── test008.tcl │ ├── test009.tcl │ ├── test010.tcl │ ├── test011.tcl │ ├── test012.tcl │ ├── test013.tcl │ ├── test014.tcl │ ├── test015.tcl │ ├── test016.tcl │ ├── test017.tcl │ ├── test018.tcl │ ├── test019.tcl │ ├── test020.tcl │ ├── test021.tcl │ ├── test022.tcl │ ├── test023.tcl │ ├── test024.tcl │ ├── test025.tcl │ ├── test026.tcl │ ├── test027.tcl │ ├── test028.tcl │ ├── test029.tcl │ ├── test030.tcl │ ├── test031.tcl │ ├── test032.tcl │ ├── test033.tcl │ ├── test034.tcl │ ├── test035.tcl │ ├── test036.tcl │ ├── test037.tcl │ ├── test038.tcl │ ├── test039.tcl │ ├── test040.tcl │ ├── test041.tcl │ ├── test042.tcl │ ├── test043.tcl │ ├── test044.tcl │ ├── test045.tcl │ ├── test046.tcl │ ├── test047.tcl │ ├── test048.tcl │ ├── test049.tcl │ ├── test050.tcl │ ├── test051.tcl │ ├── test052.tcl │ ├── test053.tcl │ ├── test054.tcl │ ├── test055.tcl │ ├── test056.tcl │ ├── test057.tcl │ ├── test058.tcl │ ├── test059.tcl │ ├── test060.tcl │ ├── test061.tcl │ ├── test062.tcl │ ├── test063.tcl │ ├── test064.tcl │ ├── test065.tcl │ ├── test066.tcl │ ├── test067.tcl │ ├── test068.tcl │ ├── test069.tcl │ ├── test070.tcl │ ├── test071.tcl │ ├── test072.tcl │ ├── test073.tcl │ ├── test074.tcl │ ├── test076.tcl │ ├── test077.tcl │ ├── test078.tcl │ ├── test079.tcl │ ├── test081.tcl │ ├── test082.tcl │ ├── test083.tcl │ ├── test084.tcl │ ├── test085.tcl │ ├── test086.tcl │ ├── test087.tcl │ ├── test088.tcl │ ├── test089.tcl │ ├── test090.tcl │ ├── test091.tcl │ ├── test092.tcl │ ├── test093.tcl │ ├── test094.tcl │ ├── test095.tcl │ ├── test096.tcl │ ├── test097.tcl │ ├── test098.tcl │ ├── test099.tcl │ ├── test100.tcl │ ├── test101.tcl │ ├── test102.tcl │ ├── test103.tcl │ ├── test106.tcl │ ├── test107.tcl │ ├── test109.tcl │ ├── test110.tcl │ ├── test111.tcl │ ├── test112.tcl │ ├── test113.tcl │ ├── test114.tcl │ ├── test115.tcl │ ├── test116.tcl │ ├── test117.tcl │ ├── test119.tcl │ ├── test120.tcl │ ├── test121.tcl │ ├── test122.tcl │ ├── test123.tcl │ ├── test124.tcl │ ├── test125.tcl │ ├── test126.tcl │ ├── test127.tcl │ ├── test128.tcl │ ├── test129.tcl │ ├── test130.tcl │ ├── test131.tcl │ ├── test132.tcl │ ├── test133.tcl │ ├── test134.tcl │ ├── test135.tcl │ ├── test136.tcl │ ├── test137.tcl │ ├── test138.tcl │ ├── test139.tcl │ ├── test140.tcl │ ├── test141.tcl │ ├── test142.tcl │ ├── testparams.tcl │ ├── testutils.tcl │ ├── txn001.tcl │ ├── txn002.tcl │ ├── txn003.tcl │ ├── txn004.tcl │ ├── txn005.tcl │ ├── txn006.tcl │ ├── txn007.tcl │ ├── txn008.tcl │ ├── txn009.tcl │ ├── txn010.tcl │ ├── txn011.tcl │ ├── txn012.tcl │ ├── txn012script.tcl │ ├── txn013.tcl │ ├── txn014.tcl │ ├── txnscript.tcl │ ├── update.tcl │ ├── upgrade.tcl │ ├── wordlist │ ├── wrap.tcl │ └── wrap_reptest.tcl ├── tcl_utils │ ├── common_test_utils.tcl │ └── multi_proc_utils.tcl └── xa │ ├── chk.xa │ ├── src1 │ ├── client.c │ ├── datafml.fml │ ├── datafml.h │ ├── hdbrec.h │ ├── htimestampxa.c │ ├── htimestampxa.h │ ├── run.sh │ ├── server.c │ └── tuxconfig.sh │ ├── src2 │ ├── bdb1.c │ ├── bdb2.c │ ├── client.c │ ├── run.sh │ └── tuxconfig.sh │ ├── src3 │ ├── client.c │ ├── run.sh │ ├── server.c │ └── tuxconfig.sh │ ├── src4 │ ├── client.c │ ├── run.sh │ ├── server.c │ └── tuxconfig.sh │ ├── src5 │ ├── DB_CONFIG │ ├── client.c │ ├── run.sh │ └── server.c │ └── utilities │ ├── bdb_xa_util.c │ ├── bdb_xa_util.h │ ├── multi_1thr_tuxconfig.sh │ ├── multi_tuxconfig.sh │ └── tuxconfig.sh └── util ├── db_archive.c ├── db_checkpoint.c ├── db_deadlock.c ├── db_dump.c ├── db_dump185.c ├── db_hotbackup.c ├── db_load.c ├── db_log_verify.c ├── db_printlog.c ├── db_printlog ├── README ├── commit.awk ├── count.awk ├── dbname.awk ├── fileid.awk ├── logstat.awk ├── pgno.awk ├── range.awk ├── rectype.awk ├── status.awk └── txn.awk ├── db_recover.c ├── db_replicate.c ├── db_stat.c ├── db_stat └── dd.sh ├── db_tuner.c ├── db_upgrade.c ├── db_verify.c ├── dtrace ├── apicalls.d ├── apitimes.d ├── apitrace.d ├── cache.d ├── dbdefs.d ├── locktimes.d ├── locktimesid.d ├── mutex.d └── showerror.d └── systemtap ├── apicalls.stp ├── apitimes.stp ├── apitrace.stp ├── cache.stp ├── locktimes.stp ├── locktimesid.stp ├── mutex.stp └── showerror.stp /.gitignore: -------------------------------------------------------------------------------- 1 | build_unix/** 2 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | Berkeley DB 11g Release 2, library version 11.2.5.3.21: (May 11, 2012) 2 | 3 | This is Berkeley DB 11g Release 2 from Oracle. To view release and 4 | installation documentation, load the distribution file docs/index.html 5 | into your web browser. 6 | -------------------------------------------------------------------------------- /build_unix/.IGNORE_ME: -------------------------------------------------------------------------------- 1 | Some combinations of the gzip and tar archive exploders found 2 | on Linux systems ignore directories that don't have any files 3 | (other than symbolic links) in them. So, here's a file. 4 | -------------------------------------------------------------------------------- /dist/RELEASE: -------------------------------------------------------------------------------- 1 | # $Id$ 2 | 3 | DB_VERSION_FAMILY=11 4 | DB_VERSION_LETTER="g" 5 | DB_VERSION_RELEASE=2 6 | DB_VERSION_MAJOR=5 7 | DB_VERSION_MINOR=3 8 | DB_VERSION_PATCH=21 9 | DB_VERSION="$DB_VERSION_MAJOR.$DB_VERSION_MINOR.$DB_VERSION_PATCH" 10 | DB_VERSION_FULL="$DB_VERSION_FAMILY.$DB_VERSION_RELEASE.$DB_VERSION_MAJOR.$DB_VERSION_MINOR.$DB_VERSION_PATCH" 11 | 12 | DB_VERSION_UNIQUE_NAME=`printf "_%d%03d" $DB_VERSION_MAJOR $DB_VERSION_MINOR` 13 | 14 | DB_RELEASE_DATE="May 11, 2012" 15 | DB_VERSION_STRING="Berkeley DB $DB_VERSION: ($DB_RELEASE_DATE)" 16 | DB_VERSION_FULL_STRING="Berkeley DB $DB_VERSION_FAMILY$DB_VERSION_LETTER Release $DB_VERSION_RELEASE, library version $DB_VERSION_FULL: ($DB_RELEASE_DATE)" 17 | -------------------------------------------------------------------------------- /dist/aclocal/config.m4: -------------------------------------------------------------------------------- 1 | # Features we don't test for, but want the #defines to exist for 2 | # other ports. 3 | AH_TEMPLATE(DB_WIN32, 4 | [We use DB_WIN32 much as one would use _WIN32 -- to specify that 5 | we're using an operating system environment that supports Win32 6 | calls and semantics. We don't use _WIN32 because Cygwin/GCC also 7 | defines _WIN32, even though Cygwin/GCC closely emulates the Unix 8 | environment.]) 9 | 10 | AH_TEMPLATE(HAVE_VXWORKS, [Define to 1 if building on VxWorks.]) 11 | 12 | AH_TEMPLATE(HAVE_FILESYSTEM_NOTZERO, 13 | [Define to 1 if allocated filesystem blocks are not zeroed.]) 14 | 15 | AH_TEMPLATE(HAVE_UNLINK_WITH_OPEN_FAILURE, 16 | [Define to 1 if unlink of file with open file descriptors will fail.]) 17 | 18 | AH_TEMPLATE(HAVE_SYSTEM_INCLUDE_FILES, 19 | [Define to 1 if port includes files in the Berkeley DB source code.]) 20 | -------------------------------------------------------------------------------- /dist/aclocal/gcc.m4: -------------------------------------------------------------------------------- 1 | # Version 2.96 of gcc (shipped with RedHat Linux 7.[01] and Mandrake) had 2 | # serious problems. 3 | AC_DEFUN(AC_GCC_CONFIG1, [ 4 | AC_CACHE_CHECK([whether we are using gcc version 2.96], 5 | db_cv_gcc_2_96, [ 6 | db_cv_gcc_2_96=no 7 | if test "$GCC" = "yes"; then 8 | GCC_VERSION=`${MAKEFILE_CC} --version` 9 | case ${GCC_VERSION} in 10 | 2.96*) 11 | db_cv_gcc_2_96=yes;; 12 | esac 13 | fi]) 14 | if test "$db_cv_gcc_2_96" = "yes"; then 15 | CFLAGS=`echo "$CFLAGS" | sed 's/-O2/-O/'` 16 | CXXFLAGS=`echo "$CXXFLAGS" | sed 's/-O2/-O/'` 17 | AC_MSG_WARN([INSTALLED GCC COMPILER HAS SERIOUS BUGS; PLEASE UPGRADE.]) 18 | AC_MSG_WARN([GCC OPTIMIZATION LEVEL SET TO -O.]) 19 | fi]) 20 | -------------------------------------------------------------------------------- /dist/aclocal/ltversion.m4: -------------------------------------------------------------------------------- 1 | # ltversion.m4 -- version numbers -*- Autoconf -*- 2 | # 3 | # Copyright (C) 2004 Free Software Foundation, Inc. 4 | # Written by Scott James Remnant, 2004 5 | # 6 | # This file is free software; the Free Software Foundation gives 7 | # unlimited permission to copy and/or distribute it, with or without 8 | # modifications, as long as this notice is preserved. 9 | 10 | # @configure_input@ 11 | 12 | # serial 3293 ltversion.m4 13 | # This file is part of GNU Libtool 14 | 15 | m4_define([LT_PACKAGE_VERSION], [2.4]) 16 | m4_define([LT_PACKAGE_REVISION], [1.3293]) 17 | 18 | AC_DEFUN([LTVERSION_VERSION], 19 | [macro_version='2.4' 20 | macro_revision='1.3293' 21 | _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) 22 | _LT_DECL(, macro_revision, 0) 23 | ]) 24 | -------------------------------------------------------------------------------- /dist/s_all: -------------------------------------------------------------------------------- 1 | #!/bin/sh - 2 | # $Id$ 3 | 4 | sh s_readme # distribution README file. 5 | 6 | sh s_config # autoconf. 7 | sh s_apiflags # API flags. 8 | sh s_sig # Structure signature. 9 | sh s_recover # logging/recovery files. 10 | sh s_message # replication and repmgr message files. 11 | sh s_message_id # generate message id. 12 | sh s_sql # regenerate sqlite3.c 13 | sh s_php # PHP config files 14 | 15 | ############################################################# 16 | # The following order is important, s_include must run after 17 | # the other source files have been created. 18 | ############################################################# 19 | sh s_include # standard include files. 20 | 21 | sh s_java # Java support. 22 | sh s_csharp # Csharp support. 23 | sh s_test # Test suite support. 24 | #sh s_tags # Tags files. 25 | 26 | ############################################################# 27 | # We only build the Cscope file for releases, it's too big to 28 | # commit into the CVS tree. 29 | ############################################################# 30 | #sh s_cscope # Cscope files. 31 | 32 | ############################################################# 33 | # Create the build environments last, they use files created 34 | # by previous steps. 35 | ############################################################# 36 | sh s_vxworks # VxWorks support. 37 | sh s_windows # Windows support. 38 | sh s_windows_dsp # Windows support: build environment. 39 | sh s_android # Android support: drop-in build environment. 40 | -------------------------------------------------------------------------------- /dist/s_apiflags: -------------------------------------------------------------------------------- 1 | #!/bin/sh - 2 | # $Id$ 3 | # 4 | # Build the automatically generated API flag #defines. 5 | 6 | msgc="/* DO NOT EDIT: automatically built by dist/s_apiflags. */" 7 | 8 | b=/tmp/api_flags_binary 9 | t=/tmp/__db_a 10 | 11 | trap 'rm -f $b $t; exit 0' 0 12 | trap 'rm -f $b $t; exit 1' 1 2 3 13 15 13 | 14 | cc api_flags.c -o $b || { 15 | echo 's_apiflags: unable to compile api_flags.c' 16 | exit 1 17 | } 18 | 19 | (echo "$msgc" 20 | $b < api_flags) > $t 21 | 22 | f=../src/dbinc_auto/api_flags.in 23 | cmp $f $t > /dev/null 2>&1 || 24 | (echo "Building $f" && rm -f $f && cp $t $f) 25 | -------------------------------------------------------------------------------- /dist/s_config: -------------------------------------------------------------------------------- 1 | #!/bin/sh - 2 | # $Id$ 3 | # 4 | # Build the autoconfiguration files. 5 | 6 | trap 'rm -f aclocal.m4 ; exit 0' 0 1 2 3 13 15 7 | 8 | . ./RELEASE 9 | 10 | echo "autoconf: building aclocal.m4..." 11 | cat aclocal/*.m4 aclocal_java/*.m4 > aclocal.m4 12 | 13 | echo "autoconf: running autoheader to build config.hin..." 14 | rm -f config.hin 15 | autoheader 16 | chmod 644 config.hin 17 | 18 | echo "autoconf: running autoconf to build configure" 19 | rm -f configure 20 | autoconf 21 | 22 | # Edit version information we couldn't pre-compute. 23 | sed -e "s/__EDIT_DB_VERSION_FAMILY__/$DB_VERSION_FAMILY/g" \ 24 | -e "s/__EDIT_DB_VERSION_RELEASE__/$DB_VERSION_RELEASE/g" \ 25 | -e "s/__EDIT_DB_VERSION_MAJOR__/$DB_VERSION_MAJOR/g" \ 26 | -e "s/__EDIT_DB_VERSION_MINOR__/$DB_VERSION_MINOR/g" \ 27 | -e "s/__EDIT_DB_VERSION_PATCH__/$DB_VERSION_PATCH/g" \ 28 | -e "s/__EDIT_DB_VERSION_STRING__/$DB_VERSION_STRING/g" \ 29 | -e "s/__EDIT_DB_VERSION_FULL_STRING__/$DB_VERSION_FULL_STRING/g" \ 30 | -e "s/__EDIT_DB_VERSION_UNIQUE_NAME__/$DB_VERSION_UNIQUE_NAME/g" \ 31 | -e "s/__EDIT_DB_VERSION__/$DB_VERSION/g" configure > configure.version 32 | mv configure.version configure 33 | 34 | rm -rf autom4te.cache 35 | chmod 755 configure 36 | 37 | chmod 755 config.guess config.sub install-sh 38 | -------------------------------------------------------------------------------- /dist/s_crypto: -------------------------------------------------------------------------------- 1 | #!/bin/sh - 2 | # $Id$ 3 | 4 | # Remove crypto from the DB source tree. 5 | 6 | d=.. 7 | 8 | t=/tmp/__db_a 9 | trap 'rm -f $t ; exit 0' 0 10 | trap 'rm -f $t ; exit 1' 1 2 3 13 15 11 | 12 | if ! test -d $d/src/crypto; then 13 | echo "s_crypto: no crypto sources found in the source tree." 14 | exit 1 15 | fi 16 | 17 | # Remove the crypto. 18 | rm -rf $d/src/crypto 19 | 20 | # Update the release splash page. 21 | f=$d/docs/index.html 22 | (echo '/DOES/' && 23 | echo 's/DOES/DOES NOT/' && 24 | echo 'w' && 25 | echo 'q') | ed $f 26 | 27 | # Win/32. 28 | f=win_config.in 29 | (echo '/#define.HAVE_CRYPTO/' && 30 | echo 'c' && 31 | echo '/* #undef HAVE_CRYPTO */' 32 | echo '.' && 33 | echo 'w' && 34 | echo 'q') | ed $f 35 | 36 | f=srcfiles.in 37 | r=`egrep crypto/crypto.c $f | awk 'BEGIN { FS="\t*" } { print $2 }'` 38 | (echo 'g/^src\/crypto\//d' && 39 | echo '/crypto_stub\.c/' && 40 | echo "s/\$/ $r/" && 41 | echo 'w' && 42 | echo 'q') | ed $f 43 | 44 | # Change out crypto/crypto.c for common/crypto_stub.c, remove all other 45 | # references to crypto files. 46 | f=win_projects/projects.template.xml 47 | (echo '/crypto\/crypto\.c/' && 48 | echo 'c' && 49 | echo ' ' && 50 | echo '.' && 51 | echo 'g/"src\/crypto\//d' && 52 | echo "s/\$/ $r/" && 53 | echo ',' && 54 | echo 'w' && 55 | echo 'q') | ed $f 56 | 57 | sh ./s_windows 58 | sh ./s_windows_dsp 59 | 60 | # VxWorks 61 | f=vx_config.in 62 | (echo '/#define.HAVE_CRYPTO/' && 63 | echo 'c' && 64 | echo '/* #undef HAVE_CRYPTO */' 65 | echo '.' && 66 | echo 'w' && 67 | echo 'q') | ed $f 68 | 69 | sh ./s_vxworks 70 | -------------------------------------------------------------------------------- /dist/s_cscope: -------------------------------------------------------------------------------- 1 | #!/bin/sh - 2 | # $Id$ 3 | # 4 | # Build cscope files. 5 | 6 | ( 7 | echo ../dbinc/*.in ../dbinc/*.h ../dbinc_auto/*.h; 8 | cat srcfiles.in | 9 | sed -e '/^#/d' \ 10 | -e '/^$/d' \ 11 | -e 's/^/..\//' \ 12 | -e '/\/csv_local.c/d' \ 13 | -e '/\/db_server_clnt.c/d' \ 14 | -e '/\/db_server_svc.c/d' \ 15 | -e '/\/db_server_xdr.c/d' \ 16 | -e '/\/gen_db_server.c/d' | 17 | awk '{print $1}') | cscope -bkUu -i- 2>&1 | sed '/cannot find file/d' 18 | -------------------------------------------------------------------------------- /dist/s_message: -------------------------------------------------------------------------------- 1 | #!/bin/sh - 2 | # $Id$ 3 | # 4 | # Build the automatically generated rep & repmgr message files. 5 | 6 | header=/tmp/__db_a 7 | source=/tmp/__db_b 8 | 9 | trap 'rm -f /tmp/__db_[ab]; exit 1' 1 2 3 13 15 10 | trap 'rm -f /tmp/__db_[ab]; exit 0' 0 11 | 12 | DIR="rep repmgr" 13 | 14 | # Build DB's message marshaling/unmarshaling routines. 15 | for i in $DIR; do 16 | for f in ../src/$i/*.msg; do 17 | subsystem=`basename $f .msg` 18 | awk -f gen_msg.awk \ 19 | -v header_file=$header \ 20 | -v source_file=$source < $f 21 | 22 | f=../src/dbinc_auto/${subsystem}_automsg.h 23 | cmp $header $f > /dev/null 2>&1 || 24 | (echo "Building $f" && 25 | rm -f $f && cp $header $f) 26 | f=../src/$i/${subsystem}_automsg.c 27 | cmp $source $f > /dev/null 2>&1 || 28 | (echo "Building $f" && 29 | rm -f $f && cp $source $f) 30 | done 31 | done 32 | -------------------------------------------------------------------------------- /dist/s_perm: -------------------------------------------------------------------------------- 1 | #!/bin/sh - 2 | # $Id$ 3 | # 4 | # This script is designed to be run while packaging up releases, not during 5 | # other s_all processing. 6 | 7 | d=.. 8 | echo 'Updating Berkeley DB source tree permissions for a release package' 9 | 10 | run() 11 | { 12 | if [ -f "$d/$1" ]; then 13 | chmod "$2" "$d/$1" 14 | else 15 | echo "$d/$1: no such file or directory" 16 | exit 1 17 | fi 18 | } 19 | 20 | # Ensure all files in the package have consistent permissions. 21 | find $d -type d | xargs chmod 775 22 | find $d -type f | xargs chmod 644 23 | 24 | # Assign execute permissions where necessary. 25 | # ODBC and JDBC are only present in release packages. 26 | if [ -d $d/lang/sql/odbc ]; then 27 | chmod 755 $d/lang/sql/odbc/conf* 28 | fi 29 | if [ -d $d/lang/sql/jdbc ]; then 30 | chmod 755 $d/lang/sql/jdbc/conf* 31 | fi 32 | chmod 755 $d/dist/s_* 33 | 34 | run dist/config.guess 755 35 | run dist/config.sub 755 36 | run dist/configure 755 37 | run dist/install-sh 755 38 | run dist/vx_buildcd 755 39 | run lang/perl/BerkeleyDB/dbinfo 755 40 | run lang/perl/BerkeleyDB/mkpod 755 41 | run lang/sql/sqlite/configure 755 42 | 43 | for i in `cd $d && find build_vxworks \ 44 | -name '*.wsp' -o -name '*.cdf' -o -name '*.wpj'`; do 45 | chmod 775 $d/$i 46 | done 47 | 48 | chmod 555 $d/util/dtrace/*.d 49 | chmod 555 $d/util/systemtap/*.stp 50 | -------------------------------------------------------------------------------- /dist/s_php: -------------------------------------------------------------------------------- 1 | #!/bin/sh - 2 | # $Id$ 3 | # 4 | # Build Windows include files. 5 | 6 | . ./RELEASE 7 | 8 | process() 9 | { 10 | src=$1.in 11 | tdest=$1.out 12 | dest=$1 13 | 14 | sed -e "s/@DB_VERSION_MAJOR@/$DB_VERSION_MAJOR/g" \ 15 | -e "s/@DB_VERSION_MINOR@/$DB_VERSION_MINOR/g" < $src > $tdest 16 | 17 | cmp $tdest $dest > /dev/null 2>&1 || 18 | (echo "Building $dest" && rm -f $dest && cp $tdest $dest) 19 | rm -f $tdest 20 | } 21 | 22 | process ../lang/php_db4/config.m4 23 | process ../lang/php_db4/config.w32 24 | -------------------------------------------------------------------------------- /dist/s_readme: -------------------------------------------------------------------------------- 1 | #!/bin/sh - 2 | # $Id$ 3 | # 4 | # Build the README. 5 | 6 | echo 'Updating Berkeley DB README file...' 7 | 8 | d=.. 9 | 10 | t=/tmp/__t 11 | trap 'rm -f $t; exit 0' 0 1 2 3 13 15 12 | 13 | . ./RELEASE 14 | 15 | cat << END_OF_README>$t 16 | $DB_VERSION_FULL_STRING 17 | 18 | This is Berkeley DB $DB_VERSION_FAMILY$DB_VERSION_LETTER Release $DB_VERSION_RELEASE from Oracle. To view release and 19 | installation documentation, load the distribution file docs/index.html 20 | into your web browser. 21 | END_OF_README 22 | 23 | f=../README 24 | cmp $t $f > /dev/null 2>&1 || 25 | (echo "Building $f" && rm -f $f && cp $t $f) 26 | -------------------------------------------------------------------------------- /dist/s_tags: -------------------------------------------------------------------------------- 1 | #!/bin/sh - 2 | # $Id$ 3 | # 4 | # Build tags files. 5 | 6 | cd tagdir 7 | files=`echo ../../src/dbinc/*.h \ 8 | ../../src/dbinc/*.in \ 9 | ../../src/btree/*.[ch] \ 10 | ../../src/clib/*.[ch] \ 11 | ../../src/common/*.[ch] \ 12 | ../../src/crypto/*.[ch] \ 13 | ../../src/crypto/mersenne/*.[ch] \ 14 | ../../src/crypto/rijndael/*.[ch] \ 15 | ../../src/db/*.[ch] \ 16 | ../../lang/db185/*.[ch] \ 17 | ../../lang/dbm/*.[ch] \ 18 | ../../src/dbreg/*.[ch] \ 19 | ../../src/env/*.[ch] \ 20 | ../../src/fileops/*.[ch] \ 21 | ../../src/hash/*.[ch] \ 22 | ../../src/hmac/*.[ch] \ 23 | ../../src/hsearch/*.[ch] \ 24 | ../../src/lock/*.[ch] \ 25 | ../../src/log/*.[ch] \ 26 | ../../src/mp/*.[ch] \ 27 | ../../src/mutex/*.[ch] \ 28 | ../../src/os/*.[ch] \ 29 | ../../src/os_qnx/*.[ch] \ 30 | ../../src/qam/*.[ch] \ 31 | ../../src/rep/*.[ch] \ 32 | ../../src/repmgr/*.[ch] \ 33 | ../../src/sequence/*.[ch] \ 34 | ../../lang/tcl/*.[ch] \ 35 | ../../src/txn/*.[ch] \ 36 | ../../src/xa/*.[ch] \ 37 | ../../lang/cxx/*.cpp \ 38 | ../../lang/java/libdb_java/*.[ch] | sed 's/[^ ]*stub.c//g'` 39 | 40 | f=tags 41 | echo "Building $f" 42 | rm -f $f 43 | 44 | # Figure out what flags this ctags accepts. 45 | flags="" 46 | if ctags -d ../../src/db/db.c 2>/dev/null; then 47 | flags="-d $flags" 48 | fi 49 | if ctags -t ../../src/db/db.c 2>/dev/null; then 50 | flags="-t $flags" 51 | fi 52 | if ctags -w ../../src/db/db.c 2>/dev/null; then 53 | flags="-w $flags" 54 | fi 55 | 56 | ctags $flags $files 2>/dev/null 57 | 58 | for i in test/perf testrrepmgr testrserver; do 59 | test -d ../../$i || continue 60 | 61 | f=../../$i/tags 62 | echo "Building $f" 63 | (cd ../../$i && ctags $flags *.[ch] 2>/dev/null) 64 | done 65 | -------------------------------------------------------------------------------- /dist/template/rec_ctemp: -------------------------------------------------------------------------------- 1 | /* 2 | * PREF_FUNC_recover -- 3 | * Recovery function for FUNC. 4 | * 5 | * PUBLIC: int PREF_FUNC_recover 6 | * PUBLIC: __P((env *, DBT *, DB_LSN *, db_recops, void *)); 7 | */ 8 | int 9 | PREF_FUNC_recover(env, dbtp, lsnp, op, info) 10 | env *env; 11 | DBT *dbtp; 12 | DB_LSN *lsnp; 13 | db_recops op; 14 | void *info; 15 | { 16 | PREF_DUP_args *argp; 17 | DB *file_dbp; 18 | DBC *dbc; 19 | DB_MPOOLFILE *mpf; 20 | DB_THREAD_INFO *ip; 21 | PAGE *pagep; 22 | int cmp_n, cmp_p, modified, ret; 23 | 24 | ip = ((DB_TXNHEAD *)info)->thread_info; 25 | 26 | REC_PRINT(PREF_DUP_print); 27 | REC_INTRO(PREF_DUP_read, ip, 0); 28 | 29 | if ((ret = mpf->get(mpf, &argp->pgno, 0, &pagep)) != 0) 30 | if (DB_REDO(op)) { 31 | if ((ret = mpf->get(mpf, 32 | &argp->pgno, DB_MPOOL_CREATE, &pagep)) != 0) 33 | goto out; 34 | } else { 35 | *lsnp = argp->prev_lsn; 36 | ret = 0; 37 | goto out; 38 | } 39 | 40 | modified = 0; 41 | cmp_n = log_compare(lsnp, &LSN(pagep)); 42 | 43 | /* 44 | * Use this when there is something like "pagelsn" in the argp 45 | * structure. Sometimes, you might need to compare meta-data 46 | * lsn's instead. 47 | * 48 | * cmp_p = log_compare(&LSN(pagep), argp->pagelsn); 49 | */ 50 | if (cmp_p == 0 && DB_REDO(op)) { 51 | /* Need to redo update described. */ 52 | modified = 1; 53 | } else if (cmp_n == 0 && !DB_REDO(op)) { 54 | /* Need to undo update described. */ 55 | modified = 1; 56 | } 57 | if (ret = mpf->put(mpf, pagep, modified ? DB_MPOOL_DIRTY : 0)) 58 | goto out; 59 | 60 | *lsnp = argp->prev_lsn; 61 | ret = 0; 62 | 63 | out: REC_CLOSE; 64 | } 65 | 66 | -------------------------------------------------------------------------------- /dist/validate/README: -------------------------------------------------------------------------------- 1 | All the files in this folder implement test cases that validate some component 2 | of the Berkeley DB system. 3 | 4 | They are driven by script files, that are shell script based. They are not 5 | generally designed to be run outside of the shell. 6 | 7 | There is a "driver" script called s_validate in the dist directory of the 8 | repository that can be used to run all the scripts in this directory. 9 | 10 | Any new script will be automatically run by the s_validate driver. 11 | -------------------------------------------------------------------------------- /dist/validate/s_chk_comma: -------------------------------------------------------------------------------- 1 | #!/bin/sh - 2 | # 3 | # $Id$ 4 | # 5 | # Look for trailing commas in declarations. Some compilers can't handle: 6 | # enum { 7 | # foo, 8 | # bar, 9 | # }; 10 | # mar 2010 added -D_GNU_SOURCE to compile on linux blade server 11 | 12 | d=../.. 13 | [ -f $d/LICENSE ] || { 14 | echo 'FAIL: cannot find source distribution directory.' 15 | exit 1 16 | } 17 | 18 | s=$d/src 19 | if cc -g -Wall -D_GNU_SOURCE $0.c -o t; then 20 | : 21 | else 22 | echo "FAIL: unable to compile test program $0.c" 23 | exit 1 24 | fi 25 | 26 | if ./t $s/*/*.[ch] $s/*/*.in; then 27 | : 28 | else 29 | echo "FAIL: test program failed" 30 | exit 1 31 | fi 32 | 33 | rm -rf t 34 | 35 | exit 0 36 | -------------------------------------------------------------------------------- /dist/validate/s_chk_comma.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 2002, 2012 Oracle and/or its affiliates. All rights reserved. 5 | */ 6 | 7 | #include 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | int 16 | chk(f) 17 | char *f; 18 | { 19 | int ch, l, r; 20 | 21 | if (freopen(f, "r", stdin) == NULL) { 22 | fprintf(stderr, "%s: %s\n", f, strerror(errno)); 23 | exit(EXIT_FAILURE); 24 | } 25 | for (l = 1, r = 0; (ch = getchar()) != EOF;) { 26 | if (ch != ',') 27 | goto next; 28 | do { ch = getchar(); } while (isblank(ch)); 29 | if (ch != '\n') 30 | goto next; 31 | ++l; 32 | do { ch = getchar(); } while (isblank(ch)); 33 | if (ch != '}') 34 | goto next; 35 | r = 1; 36 | printf("%s: line %d\n", f, l); 37 | 38 | next: if (ch == '\n') 39 | ++l; 40 | } 41 | return (r); 42 | } 43 | 44 | int 45 | main(int argc, char *argv[]) 46 | { 47 | int r; 48 | 49 | for (r = 0; *++argv != NULL;) 50 | if (chk(*argv)) 51 | r = 1; 52 | return (r); 53 | } 54 | -------------------------------------------------------------------------------- /dist/validate/s_chk_copyright: -------------------------------------------------------------------------------- 1 | #!/bin/sh - 2 | # 3 | # $Id$ 4 | # 5 | # Check all source files for proper copyright notices. 6 | 7 | d=../.. 8 | [ -f $d/LICENSE ] || { 9 | echo 'FAIL: cannot find source distribution directory.' 10 | exit 1 11 | } 12 | 13 | t1=__1 14 | t2=__2 15 | 16 | # create regex for Copyright notice using current year 17 | COPYEXP='Copyright.*'`date +%C%y`'.*affiliates' 18 | echo $COPYEXP 19 | 20 | (cd $d && find . -name '*.[chys]' -o -name '*.cpp' -o -name '*.tcl' \ 21 | -o -name '*.java' -o -name '*.cs' -o -name '*.hpp' \ 22 | -o -name '*.src' | xargs egrep -l $COPYEXP) > $t1 23 | 24 | # use sed to remove the files we do not care about, these are the ones 25 | # from 3rd parties that are included in our distribution 26 | 27 | (cd $d && find . -name '*.[chys]' -o -name '*.cpp' -o -name '*.tcl' \ 28 | -o -name '*.java' -o -name '*.cs' -o -name '*.hpp') | tee /tmp/o | 29 | sed -e '/crypto\//d' \ 30 | -e '/dbinc_auto\//d' \ 31 | -e '/lang\/csharp\/src\/Internal\//d'\ 32 | -e '/lang\/java\/src\/com\/sleepycat\/db\/internal\//d' \ 33 | -e '/lang\/sql\/generated\//d' \ 34 | -e '/db_csharp_wrap.c$/d' \ 35 | -e '/db_java_wrap.c$/d' \ 36 | -e '/perl\//d' \ 37 | -e '/sha1.c$/d' \ 38 | -e '/sleepycat\/asm\//d' \ 39 | -e '/sqlite\//d' \ 40 | -e '/test\/stl\//d' > $t2 41 | 42 | 43 | if diff $t1 $t2 > /dev/null; then 44 | exit 0 45 | else 46 | echo "<<< source tree >>> missing copyright notices" 47 | diff $t1 $t2 | grep '>' | awk '{print $2}' 48 | exit 1 49 | fi 50 | 51 | rm -f $t1 $t2 52 | 53 | exit 0 54 | -------------------------------------------------------------------------------- /dist/validate/s_chk_err: -------------------------------------------------------------------------------- 1 | #!/bin/sh - 2 | # 3 | # $Id$ 4 | # 5 | # Check to make sure all of the error values have corresponding error 6 | # message strings in db_strerror(). 7 | 8 | d=../.. 9 | [ -f $d/LICENSE ] || { 10 | echo 'FAIL: cannot find source distribution directory.' 11 | exit 1 12 | } 13 | 14 | s=$d/src 15 | t1=__1 16 | t2=__2 17 | 18 | egrep -- "define.*DB_.*-309" $s/dbinc/db.in | awk '{print $2}' > $t1 19 | sed -e '/^db_strerror/,/^}/{' \ 20 | -e '/ case DB_/{' \ 21 | -e 's/:.*//' \ 22 | -e 's/.* //' \ 23 | -e p \ 24 | -e '}' \ 25 | -e '}' \ 26 | -e d \ 27 | < $s/common/db_err.c > $t2 28 | 29 | cmp $t1 $t2 > /dev/null || 30 | (echo "<<< db.h >>> db_strerror" && diff $t1 $t2 && exit 1) 31 | 32 | rm -f $t1 $t2 33 | 34 | exit 0 35 | -------------------------------------------------------------------------------- /dist/validate/s_chk_flags.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 2002, 2012 Oracle and/or its affiliates. All rights reserved. 5 | */ 6 | 7 | #include 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | void 16 | chk(f, str) 17 | char *f, *str; 18 | { 19 | char *s; 20 | int ch, l, ok, pc; 21 | 22 | if (freopen(f, "r", stdin) == NULL) { 23 | fprintf(stderr, "%s: %s\n", f, strerror(errno)); 24 | exit(EXIT_FAILURE); 25 | } 26 | 27 | for (l = 1, ok = 1, s = str; (ch = getchar()) != EOF;) { 28 | if (ch == '\n') 29 | ++l; 30 | if (!ok || ch != *s) { 31 | s = str; 32 | ok = !isalpha(ch) && !isdigit(ch) && ch != '_'; 33 | continue; 34 | } 35 | if (*++s != '\0') 36 | continue; 37 | 38 | /* Match. */ 39 | printf("%s: %d: %s", f, l, str); 40 | for (pc = 1; (ch = getchar()) != EOF;) { 41 | switch (ch) { 42 | case '(': 43 | ++pc; 44 | break; 45 | case ')': 46 | --pc; 47 | break; 48 | case '\n': 49 | ++l; 50 | break; 51 | } 52 | if (ch == '\n') 53 | putchar(' '); 54 | else 55 | putchar(ch); 56 | if (pc <= 0) { 57 | putchar('\n'); 58 | break; 59 | } 60 | } 61 | s = str; 62 | } 63 | } 64 | 65 | int 66 | main(int argc, char *argv[]) 67 | { 68 | int r; 69 | 70 | for (r = 0; *++argv != NULL;) { 71 | chk(*argv, "FLD_CLR("); 72 | chk(*argv, "FLD_ISSET("); 73 | chk(*argv, "FLD_SET("); 74 | chk(*argv, "F_CLR("); 75 | chk(*argv, "F_ISSET("); 76 | chk(*argv, "F_SET("); 77 | } 78 | return (0); 79 | } 80 | -------------------------------------------------------------------------------- /dist/validate/s_chk_inclconfig: -------------------------------------------------------------------------------- 1 | #!/bin/sh - 2 | # 3 | # $Id$ 4 | # 5 | # Check for inclusion of db_config.h after "const" or other includes. 6 | 7 | d=../.. 8 | [ -f $d/LICENSE ] || { 9 | echo 'FAIL: cannot find source distribution directory.' 10 | exit 1 11 | } 12 | 13 | t1=__1 14 | t2=__2 15 | 16 | (cd $d && find . -name '*.[chys]' -o -name '*.cpp' | 17 | xargs egrep -l '#include.*db_config.h') | tee /tmp/o | 18 | sed -e '/dbdemo.c$/d' \ 19 | -e '/db_java_wrap.c$/d' \ 20 | -e '/test\/stl\/base\/test.h$/d' \ 21 | -e '/ex_apprec.c$/d' > $t1 22 | 23 | (for i in `cat $t1`; do 24 | egrep -w 'db_config.h|const' /dev/null $d/$i | head -1 25 | done) > $t2 26 | 27 | if egrep const $t2 > /dev/null; then 28 | echo 'FAIL: found const before include of db_config.h' 29 | egrep const $t2 30 | exit 1 31 | fi 32 | 33 | :> $t2 34 | for i in `cat $t1`; do 35 | egrep -w '#include' /dev/null $d/$i | head -1 >> $t2 36 | done 37 | 38 | if egrep -v db_config.h $t2 > /dev/null; then 39 | echo 'FAIL: found includes before include of db_config.h' 40 | egrep -v db_config.h $t2 41 | exit 1 42 | fi 43 | 44 | rm -f $t1 $t2 45 | 46 | exit 0 47 | -------------------------------------------------------------------------------- /dist/validate/s_chk_include: -------------------------------------------------------------------------------- 1 | #!/bin/sh - 2 | # 3 | # $Id$ 4 | # 5 | # Check for inclusion of files already included in db_int.h. 6 | 7 | d=../.. 8 | [ -f $d/LICENSE ] || { 9 | echo 'FAIL: cannot find source distribution directory.' 10 | exit 1 11 | } 12 | 13 | s=$d/src 14 | t1=__1 15 | t2=__2 16 | 17 | egrep -- '#include[ ]' $s/dbinc/db_int.in | 18 | sed -e '/[ ]db\.h'/d \ 19 | -e 's/^#include.//' \ 20 | -e 's/[<>"]//g' \ 21 | -e 's/[ ].*//' > $t1 22 | 23 | for i in `cat $t1`; do 24 | (cd $s && egrep "^#include[ ].*[<\"]$i[>\"]" */*.[ch]) 25 | done | 26 | sed -e '/^build/d' \ 27 | -e '/^clib\/getopt.c/d' \ 28 | -e '/^dbinc\/mutex_int.h.*/d' \ 29 | -e '/^dbinc\/win_db.h:/d' \ 30 | -e '/^mutex\/tm.c/d' \ 31 | -e '/^os\/os_map.c.*/d' \ 32 | > $t2 33 | 34 | [ -s $t2 ] && { 35 | echo 'FAIL: found extraneous includes in the source' 36 | cat $t2 37 | exit 1 38 | } 39 | 40 | rm -f $t1 $t2 41 | 42 | exit 0 43 | -------------------------------------------------------------------------------- /dist/validate/s_chk_mutex_print: -------------------------------------------------------------------------------- 1 | #!/bin/sh - 2 | # 3 | # $Id$ 4 | # 5 | # Check to make sure __mutex_print_id knows about all of the mutex types. 6 | 7 | d=../.. 8 | [ -f $d/LICENSE ] || { 9 | echo 'FAIL: cannot find source distribution directory.' 10 | exit 1 11 | } 12 | 13 | s=$d/src 14 | t1=__1 15 | t2=__2 16 | 17 | egrep 'case MTX_.*return' $s/mutex/mut_stat.c | 18 | sed -e 's/.*case //' \ 19 | -e 's/:.*//' | 20 | sort > $t1 21 | 22 | egrep '#define.MTX_' $s/dbinc/mutex.h | 23 | sed -e 's/#define.//' \ 24 | -e 's/ .*//' \ 25 | -e '/MTX_MAX_ENTRY/d' | 26 | sort > $t2 27 | 28 | cmp $t1 $t2 > /dev/null || { 29 | echo "<<< mutex/mut_stat.c >>> dbinc/mutex.h" 30 | diff $t1 $t2 31 | exit 1 32 | } 33 | 34 | rm -f $t1 $t2 35 | 36 | exit 0 37 | -------------------------------------------------------------------------------- /dist/validate/s_chk_osdir: -------------------------------------------------------------------------------- 1 | #!/bin/sh - 2 | # 3 | # $Id$ 4 | # 5 | # Check to make sure the @OSDIR@ entries in the Makefile are correct. 6 | 7 | d=../.. 8 | [ -f $d/LICENSE ] || { 9 | echo 'FAIL: cannot find source distribution directory.' 10 | exit 1 11 | } 12 | 13 | s=$d/src 14 | t1=__1 15 | t2=__2 16 | 17 | egrep '/@OSDIR@/' $d/dist/Makefile.in | sed -e 's/@.*/.c/' > $t1 18 | 19 | (cd $s/os_windows && ls os_*.c) > $t2 20 | 21 | cmp $t1 $t2 || { 22 | echo "Makefile @OSDIR@ mismatch with os_windows files" 23 | echo "<<< Makefile >>> os_windows" 24 | diff $t1 $t2 25 | exit 1 26 | } 27 | 28 | rm -f $t1 $t2 29 | 30 | exit 0 31 | -------------------------------------------------------------------------------- /dist/validate/s_chk_proto: -------------------------------------------------------------------------------- 1 | #!/bin/sh - 2 | # 3 | # $Id$ 4 | # 5 | # Check to make sure that prototypes are actually needed. 6 | 7 | d=../.. 8 | [ -f $d/LICENSE ] || { 9 | echo 'FAIL: cannot find source distribution directory.' 10 | exit 1 11 | } 12 | 13 | t1=__1 14 | t2=__2 15 | t3=__3 16 | 17 | egrep '__P' $d/src/dbinc_auto/*.h | 18 | sed -e 's/[ ][ ]*__P.*//' \ 19 | -e 's/^.*[ *]//' \ 20 | -e 's/HANDLER)/HANDLER/' \ 21 | -e '/__db_cprint/d' \ 22 | -e '/__db_lprint/d' \ 23 | -e '/__db_noop_log/d' \ 24 | -e '/__db_prnpage/d' \ 25 | -e '/__db_txnlist_print/d' \ 26 | -e '/__db_util_arg/d' \ 27 | -e '/__ham_func2/d' \ 28 | -e '/__ham_func3/d' \ 29 | -e '/_print$/d' \ 30 | -e '/_read$/d' > $t1 31 | 32 | find $d -name '*.in' -o -name '*.[ch]' -o -name '*.cpp' > $t2 33 | for i in `cat $t1`; do 34 | c=$(egrep -Hlw $i $(cat $t2) | wc -l) 35 | echo "$i: $c" 36 | done | egrep ' 1$' > $t3 37 | 38 | test -s $t3 && { 39 | cat $t3 40 | echo "FAIL: found unnecessary prototypes." 41 | exit 1 42 | } 43 | 44 | rm -f $t1 $t2 $t3 45 | 46 | exit 0 47 | -------------------------------------------------------------------------------- /dist/validate/s_chk_runrecovery: -------------------------------------------------------------------------------- 1 | #!/bin/sh - 2 | # 3 | # $Id$ 4 | # Check for DB_RUNRECOVERY being specified instead of a call to env_panic. 5 | 6 | d=../.. 7 | [ -f $d/LICENSE ] || { 8 | echo 'FAIL: cannot find source distribution directory.' 9 | exit 1 10 | } 11 | 12 | s=$d/src 13 | 14 | t1=__1 15 | 16 | egrep DB_RUNRECOVERY $s/*/*.c | 17 | sed -e '/__env_panic(.*, DB_RUNRECOVERY)/d' \ 18 | -e '/\/php_db4\//d' \ 19 | -e '/case DB_RUNRECOVERY:/d' \ 20 | -e '/db_dispatch.c:.*if (ret == DB_RUNRECOVERY/d' \ 21 | -e '/db_err.c:/d' \ 22 | -e '/env_open.c:.*ret = DB_RUNRECOVERY;/d' \ 23 | -e '/os_errno.c:.*evalue == DB_RUNRECOVERY/d' \ 24 | -e '/mut_fcntl.c:.*return (DB_RUNRECOVERY);/d' \ 25 | -e '/mut_pthread.c:.*return (DB_RUNRECOVERY);/d' \ 26 | -e '/mut_tas.c:.*return (DB_RUNRECOVERY);/d' \ 27 | -e '/mut_tas.c:.*Possibly DB_RUNRECOVERY if/d' \ 28 | -e '/mut_win32.c:.*return (DB_RUNRECOVERY);/d' \ 29 | -e '/mut_win32.c:.*ret = DB_RUNRECOVERY;/d' \ 30 | -e '/rep_backup.c:.*Panic the env and return DB_RUNRECOVERY/d' \ 31 | -e '/rep_backup.c:.*DB_RUNRECOVERY?/d' \ 32 | -e '/txn.c:.* \* DB_RUNRECOVERY and we need to/d' \ 33 | -e '/txn.c:.*returned DB_RUNRECOVERY and we need to/d' \ 34 | -e '/xa.c:.*(ret == DB_RUNRECOVERY)/d' \ 35 | > $t1 36 | [ -s $t1 ] && { 37 | echo "DB_RUNRECOVERY used; should be a call to env_panic." 38 | cat $t1 39 | exit 1 40 | } 41 | 42 | rm -f $t1 43 | 44 | exit 0 45 | -------------------------------------------------------------------------------- /dist/validate/s_chk_spell: -------------------------------------------------------------------------------- 1 | #!/bin/sh - 2 | # 3 | # $Id$ 4 | # 5 | # Check spelling in quoted strings. 6 | 7 | d=../.. 8 | [ -f $d/LICENSE ] || { 9 | echo 'FAIL: cannot find source distribution directory.' 10 | exit 1 11 | } 12 | 13 | t1=__1 14 | 15 | sed -e '/^#include/d' \ 16 | -e '/"/!d' \ 17 | -e 's/^[^"]*//' \ 18 | -e 's/%s/ /g' \ 19 | -e 's/[^"]*$//' \ 20 | -e 's/\\[nt]/ /g' \ 21 | `find $d -name '*.[ch]' -o -name '*.cpp' -o -name '*.java' | 22 | sed -e '/\/perl\//d' -e '/\/test_erlang\//d'` | 23 | spell | sort -u | comm -23 /dev/stdin s_chk_spell.dict > $t1 24 | 25 | test -s $t1 && { 26 | cat $t1 27 | echo "FAIL: found questionable spelling in strings." 28 | exit 1 29 | } 30 | 31 | egrep -h '/\* | \* ' \ 32 | `find $d -name '*.[ch]' -o -name '*.cpp' | sed -e '/\/perl\//d' -e '/\/test_erlang\//d'` | 33 | spell | sort -u | comm -23 /dev/stdin s_chk_spell.dict > $t1 34 | 35 | test -s $t1 && { 36 | cat $t1 37 | echo "FAIL: found questionable spelling in comments." 38 | exit 1 39 | } 40 | 41 | rm -f $t1 42 | 43 | exit 0 44 | -------------------------------------------------------------------------------- /dist/validate/s_chk_srcfiles: -------------------------------------------------------------------------------- 1 | #!/bin/sh - 2 | # 3 | # $Id$ 4 | # 5 | # Check to make sure we haven't forgotten to add any files to the list 6 | # of source files Windows uses to build its dsp files. 7 | # 8 | # ALEXG: This is no longer a reasonable test, Windows uses a different 9 | # mechanism to include files now, and the platforms still using srcfiles.in 10 | # don't support all of the source code. Not sure if there is a reasonable 11 | # alternative check here? 12 | 13 | d=../.. 14 | [ -f $d/LICENSE ] || { 15 | echo 'FAIL: cannot find source distribution directory.' 16 | exit 1 17 | } 18 | 19 | f=$d/dist/srcfiles.in 20 | t1=__1 21 | t2=__2 22 | 23 | sed -e '/^[ #]/d' \ 24 | -e '/^examples\/c\/csv\/csv_local.c/d' \ 25 | -e '/^$/d' < $f | 26 | awk '{print $1}' > $t1 27 | find $d -type f | 28 | sed -e 's/^\.\.\/\.\.\/\.\.\///' \ 29 | -e '/^build[^_]/d' \ 30 | -e '/^dist\//d' \ 31 | -e '/^lang\/java\/libdb_java\/java_stat_auto.c/d' \ 32 | -e '/^lang\/perl\//d' \ 33 | -e '/^lang\/php_db4\//d' \ 34 | -e '/^test\//d' \ 35 | -e '/^test\/erlang/d' \ 36 | -e '/^test\/repmgr/d' \ 37 | -e '/^test\/stl/d' \ 38 | -e '/^test\/server/d' \ 39 | -e '/^test_thread/d' \ 40 | -e '/^test\/vxworks/d' | 41 | egrep '\.c$|\.cpp$|\.def$|\.rc$' | 42 | sort > $t2 43 | 44 | cmp $t1 $t2 > /dev/null || { 45 | echo "<<< srcfiles.in >>> existing files" 46 | diff $t1 $t2 47 | exit 1 48 | } 49 | 50 | rm -f $t1 $t2 51 | 52 | exit 0 53 | -------------------------------------------------------------------------------- /dist/validate/s_chk_tags: -------------------------------------------------------------------------------- 1 | #!/bin/sh - 2 | # 3 | # $Id$ 4 | # 5 | # Check to make sure we don't need any more symbolic links to tags files. 6 | 7 | d=../.. 8 | [ -f $d/LICENSE ] || { 9 | echo 'FAIL: cannot find source distribution directory.' 10 | exit 1 11 | } 12 | 13 | # We are dropping the tags file for 4.8 - test is invalid 14 | # for now exit out 15 | echo "<<< test is no longer valid >>>" 16 | exit 0 17 | 18 | 19 | t1=__1 20 | t2=__2 21 | 22 | (cd $d && ls -F | egrep / | sort | 23 | sed -e 's/\///' \ 24 | -e '/^CVS$/d' \ 25 | -e '/^build_vxworks$/d' \ 26 | -e '/^build_wince$/d' \ 27 | -e '/^build_windows$/d' \ 28 | -e '/^docs$/d' \ 29 | -e '/^docs_book$/d' \ 30 | -e '/^docs_src$/d' \ 31 | -e '/^examples_java$/d' \ 32 | -e '/^java$/d' \ 33 | -e '/^mod_db4$/d' \ 34 | -e '/^perl$/d' \ 35 | -e '/^php_db4$/d' \ 36 | -e '/^test$/d' \ 37 | -e '/^test_cxx$/d' \ 38 | -e '/^test_micro$/d' \ 39 | -e '/^test_purify$/d' \ 40 | -e '/^test_thread$/d' \ 41 | -e '/^test_vxworks$/d') > $t1 42 | 43 | (cd $d && ls */tags | sed 's/\/tags$//' | sort) > $t2 44 | if diff $t1 $t2 > /dev/null; then 45 | exit 0 46 | else 47 | echo "<<< source tree >>> tags files" 48 | diff $t1 $t2 49 | exit 1 50 | fi 51 | -------------------------------------------------------------------------------- /docs/legal/ASM.txt: -------------------------------------------------------------------------------- 1 | ASM: a very small and fast Java bytecode manipulation framework 2 | Copyright (c) 2000-2005 INRIA, France Telecom 3 | All rights reserved. 4 | 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions are met: 7 | 8 | 1. Redistributions of source code must retain the above copyright notice, this 9 | list of conditions and the following disclaimer. 10 | 11 | 2. Redistributions in binary form must reproduce the above copyright notice, 12 | this list of conditions and the following disclaimer in the documentation 13 | and/or other materials provided with the distribution. 14 | 15 | 3. Neither the name of the copyright holders nor the names of its contributors 16 | may be used to endorse or promote products derived from this software 17 | without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 23 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 26 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /docs/legal/BSD.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 1990, 1993, 1994, 1995 2 | The Regents of the University of California. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | 3. Neither the name of the University nor the names of its contributors may be 15 | used to endorse or promote products derived from this software without 16 | specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY 19 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY 22 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 25 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /docs/legal/HARVARD.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 1995, 1996 2 | The President and Fellows of Harvard University. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | 2. Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | 3. Neither the name of the University nor the names of its contributors may be 15 | used to endorse or promote products derived from this software without 16 | specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY HARVARD AND ITS CONTRIBUTORS ``AS IS'' AND ANY 19 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL HARVARD OR ITS CONTRIBUTORS BE LIABLE FOR ANY 22 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 25 | ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /examples/c/README: -------------------------------------------------------------------------------- 1 | # $Id$ 2 | 3 | getting_started/ 4 | Examples from the Getting Started Guide 5 | 6 | ex_access.c Using just the DB access methods. 7 | 8 | ex_apprec/ Application-specific recovery. 9 | 10 | ex_btrec.c Using the BTREE access method with record numbers. 11 | 12 | ex_bulk.c Bulk interfaces. 13 | 14 | ex_dbclient.c Using DB from an RPC client. 15 | 16 | ex_env.c Setting up the DB environment. 17 | 18 | ex_lock.c Locking. 19 | 20 | ex_mpool.c Shared memory buffer pools. 21 | 22 | ex_rep/ Replication. This creates a toy stock quote server 23 | with DB's single-master, multiple-client replication, 24 | with communication over TCP. See ex_rep/README. 25 | 26 | ex_sequence.c Sequences. 27 | 28 | ex_thread.c Threaded application with multiple readers and writers. 29 | 30 | ex_tpcb.c TPC/B. 31 | Ex_tpcb sets up a framework in which to run a TPC/B test. 32 | Database initialization (the -i flag) and running the 33 | benchmark (-n flag) must take place separately (i.e., 34 | first create the database, then run 1 or more copies of 35 | the benchmark). Furthermore, when running more than one 36 | TPCB process, it is necessary to run the deadlock detector 37 | (db_deadlock), since it is possible for concurrent tpcb 38 | processes to deadlock. For performance measurement, it 39 | will also be beneficial to run the db_checkpoint process 40 | as well. 41 | -------------------------------------------------------------------------------- /examples/c/csv/csv_extern.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 2005, 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * $Id$ 7 | */ 8 | 9 | extern DbRecord DbRecord_base; /* Initialized structure. */ 10 | 11 | /* 12 | * Prototypes 13 | */ 14 | extern int DbRecord_discard(DbRecord *); 15 | extern int DbRecord_init(const DBT *, const DBT *, DbRecord *); 16 | extern void DbRecord_print(DbRecord *, FILE *); 17 | extern int DbRecord_read(u_long, DbRecord *); 18 | extern int DbRecord_search_field_name(char *, char *, OPERATOR); 19 | extern int DbRecord_search_field_number(u_int, char *, OPERATOR); 20 | extern int compare_double(DB *, const DBT *, const DBT *); 21 | extern int compare_string(DB *, const DBT *, const DBT *); 22 | extern int compare_ulong(DB *, const DBT *, const DBT *); 23 | extern int csv_env_close(void); 24 | extern int csv_env_open(const char *, int); 25 | extern int csv_secondary_close(void); 26 | extern int csv_secondary_open(void); 27 | extern int entry_print(void *, size_t, u_int32_t); 28 | extern int field_cmp_double(void *, void *, OPERATOR); 29 | extern int field_cmp_re(void *, void *, OPERATOR); 30 | extern int field_cmp_string(void *, void *, OPERATOR); 31 | extern int field_cmp_ulong(void *, void *, OPERATOR); 32 | extern int input_load(input_fmt, u_long); 33 | extern int query(char *, int *); 34 | extern int query_interactive(void); 35 | extern int secondary_callback(DB *, const DBT *, const DBT *, DBT *); 36 | extern int strtod_err(char *, double *); 37 | extern int strtoul_err(char *, u_long *); 38 | -------------------------------------------------------------------------------- /examples/c/csv/sample.csv: -------------------------------------------------------------------------------- 1 | Adams,Bob,01/02/03,green,apple,37 2 | Carter,Denise Ann,04/05/06,blue,banana,38 3 | Eidel,Frank,07/08/09,red,cherry,38 4 | Grabel,Harriet,10/11/12,purple,date,40 5 | Indals,Jason,01/03/05,pink,orange,32 6 | Kilt,Laura,07/09/11,yellow,grape,38 7 | Moreno,Nancy,02/04/06,black,strawberry,38 8 | Octon,Patrick,08/10/12,magenta,kiwi,15 9 | -------------------------------------------------------------------------------- /examples/c/csv/sample.desc: -------------------------------------------------------------------------------- 1 | # $Id$ 2 | 3 | version 1 { 4 | LastName string 5 | FirstName string 6 | BirthDate 7 | Color string index 8 | Fruit string index 9 | Age unsigned_long index 10 | } 11 | -------------------------------------------------------------------------------- /examples/c/ex_apprec/auto_rebuild: -------------------------------------------------------------------------------- 1 | # Script to rebuild automatically generated files for ex_apprec. 2 | 3 | E=../examples/c/ex_apprec 4 | 5 | cd ../../../dist 6 | awk -f gen_rec.awk \ 7 | -v source_file=$E/ex_apprec_auto.c \ 8 | -v header_file=$E/ex_apprec_auto.h \ 9 | -v print_file=$E/ex_apprec_autop.c \ 10 | -v template_file=$E/ex_apprec_template < $E/ex_apprec.src 11 | -------------------------------------------------------------------------------- /examples/c/ex_apprec/ex_apprec.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 2002, 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #ifndef _EX_APPREC_H_ 10 | #define _EX_APPREC_H_ 11 | 12 | #include "ex_apprec_auto.h" 13 | 14 | int ex_apprec_mkdir_print 15 | __P((DB_ENV *, DBT *, DB_LSN *, db_recops)); 16 | int ex_apprec_mkdir_recover 17 | __P((DB_ENV *, DBT *, DB_LSN *, db_recops)); 18 | int ex_apprec_init_print __P((DB_ENV *, DB_DISTAB *)); 19 | 20 | #endif /* !_EX_APPREC_H_ */ 21 | -------------------------------------------------------------------------------- /examples/c/ex_apprec/ex_apprec.src: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 2002, 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * $Id$ 7 | */ 8 | 9 | PREFIX ex_apprec 10 | INCLUDE #include "ex_apprec.h" 11 | 12 | /* 13 | * This is the source file used to generate the application-specific recovery 14 | * functions used by the ex_apprec example. It should be turned into usable 15 | * source code (including a template for the recovery function itself) by 16 | * invoking changing to the dist directory of the DB distribution and 17 | * running the gen_rec.awk script there as follows: 18 | * 19 | * awk -f ./gen_rec.awk \ 20 | * -v source_file=../examples/c/ex_apprec/ex_apprec_auto.c \ 21 | * -v header_file=../examples/c/ex_apprec/ex_apprec_auto.h \ 22 | * -v template_file=../examples/c/ex_apprec/ex_apprec_template \ 23 | * < ../examples/c/ex_apprec/ex_apprec.src 24 | */ 25 | 26 | /* 27 | * mkdir: used to create a directory 28 | * 29 | * dirname: relative or absolute pathname of the directory to be created 30 | */ 31 | BEGIN mkdir 42 10000 32 | DBT dirname DBT s 33 | END 34 | -------------------------------------------------------------------------------- /examples/c/ex_apprec/ex_apprec_auto.c: -------------------------------------------------------------------------------- 1 | /* Do not edit: automatically built by gen_rec.awk. */ 2 | 3 | #include "db_config.h" 4 | #include 5 | #include 6 | #include 7 | #include "db_int.h" 8 | #include "dbinc/db_swap.h" 9 | #include "ex_apprec.h" 10 | DB_LOG_RECSPEC ex_apprec_mkdir_desc[] = { 11 | {LOGREC_DBT, SSZ(ex_apprec_mkdir_args, dirname), "dirname", ""}, 12 | {LOGREC_Done, 0, "", ""} 13 | }; 14 | -------------------------------------------------------------------------------- /examples/c/ex_apprec/ex_apprec_auto.h: -------------------------------------------------------------------------------- 1 | /* Do not edit: automatically built by gen_rec.awk. */ 2 | 3 | #ifndef ex_apprec_AUTO_H 4 | #define ex_apprec_AUTO_H 5 | #define DB_ex_apprec_mkdir 10000 6 | typedef struct _ex_apprec_mkdir_args { 7 | u_int32_t type; 8 | DB_TXN *txnp; 9 | DB_LSN prev_lsn; 10 | DBT dirname; 11 | } ex_apprec_mkdir_args; 12 | 13 | extern __DB_IMPORT DB_LOG_RECSPEC ex_apprec_mkdir_desc[]; 14 | static inline int 15 | ex_apprec_mkdir_log(DB_ENV *dbenv, DB_TXN *txnp, DB_LSN *ret_lsnp, u_int32_t flags, 16 | const DBT *dirname) 17 | { 18 | return (dbenv->log_put_record(dbenv, NULL, txnp, ret_lsnp, 19 | flags, DB_ex_apprec_mkdir, 0, 20 | sizeof(u_int32_t) + sizeof(u_int32_t) + sizeof(DB_LSN) + 21 | LOG_DBT_SIZE(dirname), 22 | ex_apprec_mkdir_desc, 23 | dirname)); 24 | } 25 | 26 | static inline int ex_apprec_mkdir_read(DB_ENV *dbenv, 27 | void *data, ex_apprec_mkdir_args **arg) 28 | { 29 | return (dbenv->log_read_record(dbenv, 30 | NULL, NULL, data, ex_apprec_mkdir_desc, sizeof(ex_apprec_mkdir_args), (void**)arg)); 31 | } 32 | #endif 33 | -------------------------------------------------------------------------------- /examples/c/ex_apprec/ex_apprec_autop.c: -------------------------------------------------------------------------------- 1 | /* Do not edit: automatically built by gen_rec.awk. */ 2 | 3 | #include "db_config.h" 4 | 5 | #include 6 | #include 7 | #include 8 | #include "db_int.h" 9 | #include "dbinc/log.h" 10 | #include "ex_apprec.h" 11 | /* 12 | * PUBLIC: int ex_apprec_mkdir_print __P((DB_ENV *, DBT *, DB_LSN *, 13 | * PUBLIC: db_recops)); 14 | */ 15 | int 16 | ex_apprec_mkdir_print(dbenv, dbtp, lsnp, notused2) 17 | DB_ENV *dbenv; 18 | DBT *dbtp; 19 | DB_LSN *lsnp; 20 | db_recops notused2; 21 | { 22 | notused2 = DB_TXN_PRINT; 23 | 24 | return (__log_print_record(dbenv->env, dbtp, lsnp, "ex_apprec_mkdir", ex_apprec_mkdir_desc, NULL)); 25 | } 26 | 27 | /* 28 | * PUBLIC: int ex_apprec_init_print __P((DB_ENV *, DB_DISTAB *)); 29 | */ 30 | int 31 | ex_apprec_init_print(dbenv, dtabp) 32 | DB_ENV *dbenv; 33 | DB_DISTAB *dtabp; 34 | { 35 | int __db_add_recovery __P((DB_ENV *, DB_DISTAB *, 36 | int (*)(DB_ENV *, DBT *, DB_LSN *, db_recops), u_int32_t)); 37 | int ret; 38 | 39 | if ((ret = __db_add_recovery(dbenv, dtabp, 40 | ex_apprec_mkdir_print, DB_ex_apprec_mkdir)) != 0) 41 | return (ret); 42 | return (0); 43 | } 44 | -------------------------------------------------------------------------------- /examples/c/ex_rep/README: -------------------------------------------------------------------------------- 1 | # $Id$ 2 | 3 | This is the parent directory for the replication example programs. 4 | 5 | The example is a toy stock quote server. There are two versions of 6 | the program: one version uses Berkeley DB's Replication Manager 7 | support, and the other uses the base replication API. 8 | 9 | common/ Contains code to implement the basic functions of the 10 | application, to demonstrate that these are largely 11 | independent of which replication API is used. 12 | 13 | mgr/ Contains the small amount of code necessary to 14 | configure the application to use Replication Manager. 15 | 16 | base/ Contains the sample communications infrastructure, and 17 | other replication support code, to demonstrate some of 18 | the kinds of things that are necessary when using the 19 | base replication API. 20 | -------------------------------------------------------------------------------- /examples/cxx/excxx_repquote/RepConfigInfo.cpp: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 2001, 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #include 10 | #include 11 | 12 | #include "RepConfigInfo.h" 13 | 14 | RepConfigInfo::RepConfigInfo() 15 | { 16 | start_policy = DB_REP_ELECTION; 17 | home = NULL; 18 | got_listen_address = false; 19 | nrsites = 0; 20 | priority = 100; 21 | verbose = false; 22 | this_host.creator = false; 23 | other_hosts = NULL; 24 | ack_policy = DB_REPMGR_ACKS_QUORUM; 25 | bulk = false; 26 | } 27 | 28 | RepConfigInfo::~RepConfigInfo() 29 | { 30 | // release any other_hosts structs. 31 | if (other_hosts != NULL) { 32 | REP_HOST_INFO *CurItem = other_hosts; 33 | while (CurItem->next != NULL) { 34 | REP_HOST_INFO *TmpItem = CurItem->next; 35 | free(CurItem); 36 | CurItem = TmpItem; 37 | } 38 | free(CurItem); 39 | } 40 | other_hosts = NULL; 41 | } 42 | 43 | void RepConfigInfo::addOtherHost(char* host, int port, bool peer) 44 | { 45 | REP_HOST_INFO *newinfo; 46 | newinfo = (REP_HOST_INFO*)malloc(sizeof(REP_HOST_INFO)); 47 | newinfo->host = host; 48 | newinfo->port = port; 49 | newinfo->peer = peer; 50 | if (other_hosts == NULL) { 51 | other_hosts = newinfo; 52 | newinfo->next = NULL; 53 | } else { 54 | newinfo->next = other_hosts; 55 | other_hosts = newinfo; 56 | } 57 | nrsites++; 58 | } 59 | -------------------------------------------------------------------------------- /examples/cxx/excxx_repquote/RepConfigInfo.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 2001, 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * $Id$ 7 | */ 8 | #include 9 | 10 | // Chainable struct used to store host information. 11 | typedef struct RepHostInfoObj{ 12 | bool creator; 13 | char* host; 14 | int port; 15 | bool peer; // only relevant for "other" hosts 16 | RepHostInfoObj* next; // used for chaining multiple "other" hosts. 17 | } REP_HOST_INFO; 18 | 19 | class RepConfigInfo { 20 | public: 21 | RepConfigInfo(); 22 | virtual ~RepConfigInfo(); 23 | 24 | void addOtherHost(char* host, int port, bool peer); 25 | public: 26 | u_int32_t start_policy; 27 | char* home; 28 | bool got_listen_address; 29 | REP_HOST_INFO this_host; 30 | int nrsites; 31 | int priority; 32 | bool verbose; 33 | // used to store a set of optional other hosts. 34 | REP_HOST_INFO *other_hosts; 35 | int ack_policy; 36 | bool bulk; 37 | }; 38 | -------------------------------------------------------------------------------- /examples/cxx/excxx_repquote_gsg/SimpleConfigInfo.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #include 10 | 11 | class SimpleConfigInfo { 12 | public: 13 | SimpleConfigInfo(); 14 | virtual ~SimpleConfigInfo(); 15 | 16 | public: 17 | char* home; 18 | }; 19 | 20 | 21 | SimpleConfigInfo::SimpleConfigInfo() 22 | { 23 | home = NULL; 24 | } 25 | 26 | SimpleConfigInfo::~SimpleConfigInfo() 27 | { 28 | } 29 | 30 | -------------------------------------------------------------------------------- /examples/cxx/getting_started/MyDb.hpp: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 2005, 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * $Id$ 7 | */ 8 | 9 | // File: MyDb.hpp 10 | 11 | #ifndef MYDB_H 12 | #define MYDB_H 13 | 14 | #include 15 | #include 16 | 17 | class MyDb 18 | { 19 | public: 20 | // Constructor requires a path to the database, 21 | // and a database name. 22 | MyDb(std::string &path, std::string &dbName, 23 | bool isSecondary = false); 24 | 25 | // Our destructor just calls our private close method. 26 | ~MyDb() { close(); } 27 | 28 | inline Db &getDb() {return db_;} 29 | 30 | private: 31 | Db db_; 32 | std::string dbFileName_; 33 | u_int32_t cFlags_; 34 | 35 | // Make sure the default constructor is private 36 | // We don't want it used. 37 | MyDb() : db_(NULL, 0) {} 38 | 39 | // We put our database close activity here. 40 | // This is called from our destructor. In 41 | // a more complicated example, we might want 42 | // to make this method public, but a private 43 | // method is more appropriate for this example. 44 | void close(); 45 | }; 46 | #endif 47 | -------------------------------------------------------------------------------- /examples/cxx/getting_started/vendors.txt: -------------------------------------------------------------------------------- 1 | TriCounty Produce#309 S. Main Street#Middle Town#MN#55432#763 555 5761#Mort Dufresne#763 555 5765 2 | Simply Fresh#15612 Bogart Lane#Harrigan#WI#53704#420 333 3912#Cheryl Swedberg#420 333 3952 3 | Off the Vine#133 American Ct.#Centennial#IA#52002#563 121 3800#Bob King#563 121 3800 x54 4 | The Pantry#1206 N. Creek Way#Middle Town#MN#55432#763 555 3391#Sully Beckstrom#763 555 3391 5 | Mom's Kitchen#53 Yerman Ct.#Middle Town#MN#55432#763 554 9200#Maggie Kultgen#763 554 9200 x12 6 | The Baking Pan#1415 53rd Ave.#Dutchin#MN#56304#320 442 2277#Mike Roan#320 442 6879 7 | -------------------------------------------------------------------------------- /examples/stl/README: -------------------------------------------------------------------------------- 1 | # $Id$ 2 | 3 | StlAccessExample.cpp Simple Database Access. 4 | 5 | Exstl_access uses STL simple features based on the DB access methods. 6 | 7 | Build: make exstl_access 8 | 9 | 10 | repquote/ Replication. 11 | 12 | Exstl_repquote creates a toy stock quote server 13 | with DB's single-master, multiple-client replication 14 | with communication over TCP, via STL API. See repquote/README. 15 | 16 | Build: make exstl_repquote 17 | 18 | 19 | StlTransactionGuideExample.cpp Multithreaded DB Access. 20 | 21 | StlTxnGuide runs multiple threads to access databases via STL API. 22 | 23 | Build: make StlTxnGuide 24 | 25 | 26 | StlTpcbExample.cpp TPC/B. 27 | 28 | Exstl_tpcb sets up a framework in which to run a TPC/B test 29 | via the STL API. 30 | 31 | Database initialization (the -i flag) and running the 32 | benchmark (-n flag) must take place separately (i.e., 33 | first create the database, then run 1 or more copies of 34 | the benchmark). Furthermore, when running more than one 35 | TPCB process, it is necessary to run the deadlock detector 36 | (db_deadlock), since it is possible for concurrent tpcb 37 | processes to deadlock. For performance measurement, it 38 | will also be beneficial to run the db_checkpoint process 39 | as well. 40 | 41 | Build: make exstl_tpcb 42 | -------------------------------------------------------------------------------- /examples/stl/repquote/README: -------------------------------------------------------------------------------- 1 | # $Id$ 2 | 3 | This is the directory for the replication example program. 4 | 5 | The example is a toy stock quote server. It uses the replication manager to 6 | make use of DB replication, and uses STL API to acces the database. 7 | 8 | 9 | StlRepQuoteExample.cpp 10 | Contains code to implement the basic functions of the 11 | application, and code necessary to configure the 12 | application to use Replication Manager. 13 | 14 | StlRepConfigInfo.h 15 | StlRepConfigInfo.cpp 16 | Contains code to manage user configurations to this program, 17 | including those to the DB replication manager. 18 | -------------------------------------------------------------------------------- /examples/stl/repquote/StlRepConfigInfo.cpp: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 2001, 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #include "StlRepConfigInfo.h" 10 | 11 | #include 12 | 13 | RepConfigInfo::RepConfigInfo() 14 | { 15 | start_policy = DB_REP_ELECTION; 16 | home = "TESTDIR"; 17 | got_listen_address = false; 18 | nrsites = 0; 19 | priority = 100; 20 | verbose = false; 21 | this_host.creator = false; 22 | other_hosts = NULL; 23 | ack_policy = DB_REPMGR_ACKS_QUORUM; 24 | bulk = false; 25 | } 26 | 27 | RepConfigInfo::~RepConfigInfo() 28 | { 29 | // release any other_hosts structs. 30 | if (other_hosts != NULL) { 31 | REP_HOST_INFO *CurItem = other_hosts; 32 | while (CurItem->next != NULL) 33 | { 34 | REP_HOST_INFO *TmpItem = CurItem->next; 35 | free(CurItem); 36 | CurItem = TmpItem; 37 | } 38 | free(CurItem); 39 | } 40 | other_hosts = NULL; 41 | } 42 | 43 | void RepConfigInfo::addOtherHost(char* host, int port, bool peer) 44 | { 45 | REP_HOST_INFO *newinfo; 46 | newinfo = (REP_HOST_INFO*)malloc(sizeof(REP_HOST_INFO)); 47 | newinfo->host = host; 48 | newinfo->port = port; 49 | newinfo->peer = peer; 50 | if (other_hosts == NULL) { 51 | other_hosts = newinfo; 52 | newinfo->next = NULL; 53 | } else { 54 | newinfo->next = other_hosts; 55 | other_hosts = newinfo; 56 | } 57 | nrsites++; 58 | } 59 | -------------------------------------------------------------------------------- /examples/stl/repquote/StlRepConfigInfo.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 2001, 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * $Id$ 7 | */ 8 | #include 9 | 10 | // Chainable struct used to store host information. 11 | typedef struct RepHostInfoObj{ 12 | bool creator; 13 | char* host; 14 | int port; 15 | bool peer; // only relevant for "other" hosts 16 | RepHostInfoObj* next; // used for chaining multiple "other" hosts. 17 | } REP_HOST_INFO; 18 | 19 | class RepConfigInfo { 20 | public: 21 | RepConfigInfo(); 22 | virtual ~RepConfigInfo(); 23 | 24 | void addOtherHost(char* host, int port, bool peer); 25 | public: 26 | u_int32_t start_policy; 27 | const char* home; 28 | bool got_listen_address; 29 | REP_HOST_INFO this_host; 30 | int nrsites; 31 | int priority; 32 | bool verbose; 33 | // used to store a set of optional other hosts. 34 | REP_HOST_INFO *other_hosts; 35 | int ack_policy; 36 | bool bulk; 37 | }; 38 | -------------------------------------------------------------------------------- /lang/cxx/cxx_dbt.cpp: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 1997, 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #include "db_config.h" 10 | 11 | #include "db_int.h" 12 | 13 | #include "db_cxx.h" 14 | #include "dbinc/cxx_int.h" 15 | 16 | #include "dbinc/db_page.h" 17 | #include "dbinc_auto/db_auto.h" 18 | #include "dbinc_auto/crdel_auto.h" 19 | #include "dbinc/db_dispatch.h" 20 | #include "dbinc_auto/db_ext.h" 21 | #include "dbinc_auto/common_ext.h" 22 | 23 | Dbt::Dbt() 24 | { 25 | DBT *dbt = this; 26 | memset(dbt, 0, sizeof(DBT)); 27 | } 28 | 29 | Dbt::Dbt(void *data_arg, u_int32_t size_arg) 30 | { 31 | DBT *dbt = this; 32 | memset(dbt, 0, sizeof(DBT)); 33 | set_data(data_arg); 34 | set_size(size_arg); 35 | } 36 | 37 | Dbt::~Dbt() 38 | { 39 | } 40 | 41 | Dbt::Dbt(const Dbt &that) 42 | { 43 | const DBT *from = &that; 44 | DBT *to = this; 45 | memcpy(to, from, sizeof(DBT)); 46 | } 47 | 48 | Dbt &Dbt::operator = (const Dbt &that) 49 | { 50 | if (this != &that) { 51 | const DBT *from = &that; 52 | DBT *to = this; 53 | memcpy(to, from, sizeof(DBT)); 54 | } 55 | return (*this); 56 | } 57 | -------------------------------------------------------------------------------- /lang/cxx/cxx_lock.cpp: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 1997, 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #include "db_config.h" 10 | 11 | #include "db_int.h" 12 | 13 | #include "db_cxx.h" 14 | #include "dbinc/cxx_int.h" 15 | 16 | //////////////////////////////////////////////////////////////////////// 17 | // // 18 | // DbLock // 19 | // // 20 | //////////////////////////////////////////////////////////////////////// 21 | 22 | DbLock::DbLock(DB_LOCK value) 23 | : lock_(value) 24 | { 25 | } 26 | 27 | DbLock::DbLock() 28 | { 29 | memset(&lock_, 0, sizeof(DB_LOCK)); 30 | } 31 | 32 | DbLock::DbLock(const DbLock &that) 33 | : lock_(that.lock_) 34 | { 35 | } 36 | 37 | DbLock &DbLock::operator = (const DbLock &that) 38 | { 39 | lock_ = that.lock_; 40 | return (*this); 41 | } 42 | -------------------------------------------------------------------------------- /lang/cxx/cxx_rid.cpp: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #include "db_config.h" 10 | 11 | #include "db_int.h" 12 | 13 | #include "db_cxx.h" 14 | 15 | DbHeapRecordId::DbHeapRecordId() 16 | { 17 | DB_HEAP_RID *rid = this; 18 | memset(rid, 0, sizeof(DB_HEAP_RID)); 19 | } 20 | 21 | DbHeapRecordId::DbHeapRecordId(db_pgno_t pgno_arg, db_indx_t indx_arg) 22 | { 23 | DB_HEAP_RID *rid = this; 24 | memset(rid, 0, sizeof(DB_HEAP_RID)); 25 | set_pgno(pgno_arg); 26 | set_indx(indx_arg); 27 | } 28 | 29 | DbHeapRecordId::~DbHeapRecordId() 30 | { 31 | } 32 | 33 | DbHeapRecordId::DbHeapRecordId(const DbHeapRecordId &that) 34 | { 35 | const DB_HEAP_RID *from = &that; 36 | memcpy((DB_HEAP_RID *)this, from, sizeof(DB_HEAP_RID)); 37 | } 38 | 39 | DbHeapRecordId &DbHeapRecordId::operator = (const DbHeapRecordId &that) 40 | { 41 | if (this != &that) { 42 | const DB_HEAP_RID *from = &that; 43 | memcpy((DB_HEAP_RID *)this, from, sizeof(DB_HEAP_RID)); 44 | } 45 | return (*this); 46 | } 47 | -------------------------------------------------------------------------------- /lang/cxx/stl/dbstl_utility.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berkeleydb/libdb/5b7b02ae052442626af54c176335b67ecc613a30/lang/cxx/stl/dbstl_utility.h -------------------------------------------------------------------------------- /lang/tcl/docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 |

11 | Complete Tcl Interface for Berkeley DB

12 | 13 | 17 | 18 | 37 | 38 | 51 | -------------------------------------------------------------------------------- /lang/tcl/docs/library.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 |

10 | Convenience Commands

11 | The convenience commands are provided for ease of use with the DB test 12 | suite. 13 |

> berkdb rand 14 |

This command will invoke the rand function and return the random number. 15 |

16 |


> berkdb random_int low high 17 |

This command will invoke the rand function and return a number between 18 | low 19 | and high. 20 |

21 |


22 |

> berkdb srand seed 23 |

This command will invoke the srand function with the given seed 24 | and return 0. 25 |

26 |


27 | -------------------------------------------------------------------------------- /src/clib/bsearch.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 2010, 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #include "db_config.h" 10 | 11 | #include "db_int.h" 12 | 13 | /* 14 | * bsearch -- 15 | * 16 | * PUBLIC: #ifndef HAVE_BSEARCH 17 | * PUBLIC: void *bsearch __P((const void *, const void *, size_t, 18 | * PUBLIC: size_t, int (*)(const void *, const void *))); 19 | * PUBLIC: #endif 20 | */ 21 | 22 | void *bsearch(key, base, nmemb, size, cmp) 23 | const void *key; 24 | const void *base; 25 | size_t nmemb; 26 | size_t size; 27 | int (*cmp) __P((const void *, const void *)); 28 | { 29 | size_t i; 30 | 31 | /* not doing a binary search, but searching linearly */ 32 | for (i=0; i < nmemb; i++) { 33 | if ((*cmp)(key, (const void *)((char *)base + i * size)) == 0) 34 | return ((void *)((char *)base + i * size)); 35 | } 36 | 37 | return (NULL); 38 | } 39 | -------------------------------------------------------------------------------- /src/clib/isalpha.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 2005, 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #include "db_config.h" 10 | 11 | #include "db_int.h" 12 | 13 | /* 14 | * isalpha -- 15 | * 16 | * PUBLIC: #ifndef HAVE_ISALPHA 17 | * PUBLIC: int isalpha __P((int)); 18 | * PUBLIC: #endif 19 | */ 20 | int 21 | isalpha(c) 22 | int c; 23 | { 24 | /* 25 | * Depends on ASCII-like character ordering. 26 | */ 27 | return ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') ? 1 : 0); 28 | } 29 | -------------------------------------------------------------------------------- /src/clib/isdigit.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 2005, 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #include "db_config.h" 10 | 11 | #include "db_int.h" 12 | 13 | /* 14 | * isdigit -- 15 | * 16 | * PUBLIC: #ifndef HAVE_ISDIGIT 17 | * PUBLIC: int isdigit __P((int)); 18 | * PUBLIC: #endif 19 | */ 20 | int 21 | isdigit(c) 22 | int c; 23 | { 24 | /* 25 | * Depends on ASCII-like character ordering. 26 | */ 27 | return (c >= '0' && c <= '9' ? 1 : 0); 28 | } 29 | -------------------------------------------------------------------------------- /src/clib/isprint.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 2005, 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #include "db_config.h" 10 | 11 | #include "db_int.h" 12 | 13 | /* 14 | * isprint -- 15 | * 16 | * PUBLIC: #ifndef HAVE_ISPRINT 17 | * PUBLIC: int isprint __P((int)); 18 | * PUBLIC: #endif 19 | */ 20 | int 21 | isprint(c) 22 | int c; 23 | { 24 | /* 25 | * Depends on ASCII character values. 26 | */ 27 | return ((c >= ' ' && c <= '~') ? 1 : 0); 28 | } 29 | -------------------------------------------------------------------------------- /src/clib/isspace.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 2005, 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #include "db_config.h" 10 | 11 | #include "db_int.h" 12 | 13 | /* 14 | * isspace -- 15 | * 16 | * PUBLIC: #ifndef HAVE_ISSPACE 17 | * PUBLIC: int isspace __P((int)); 18 | * PUBLIC: #endif 19 | */ 20 | int 21 | isspace(c) 22 | int c; 23 | { 24 | return (c == '\t' || c == '\n' || 25 | c == '\v' || c == '\f' || c == '\r' || c == ' ' ? 1 : 0); 26 | } 27 | -------------------------------------------------------------------------------- /src/clib/raise.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 1997, 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #include "db_config.h" 10 | 11 | #include "db_int.h" 12 | 13 | /* 14 | * raise -- 15 | * Send a signal to the current process. 16 | * 17 | * PUBLIC: #ifndef HAVE_RAISE 18 | * PUBLIC: int raise __P((int)); 19 | * PUBLIC: #endif 20 | */ 21 | int 22 | raise(s) 23 | int s; 24 | { 25 | return (kill(getpid(), s)); 26 | } 27 | -------------------------------------------------------------------------------- /src/clib/rand.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copied from the ANSI C standard 4.10.2.2. 3 | */ 4 | #include "db_config.h" 5 | 6 | #include "db_int.h" 7 | 8 | /* 9 | * rand, srand -- 10 | * 11 | * PUBLIC: #ifndef HAVE_RAND 12 | * PUBLIC: int rand __P((void)); 13 | * PUBLIC: void srand __P((unsigned int)); 14 | * PUBLIC: #endif 15 | */ 16 | int rand(void) /* RAND_MAX assumed to be 32767 */ 17 | { 18 | DB_GLOBAL(rand_next) = DB_GLOBAL(rand_next) * 1103515245 + 12345; 19 | return (unsigned int) (DB_GLOBAL(rand_next)/65536) % 32768; 20 | } 21 | 22 | void srand(unsigned int seed) 23 | { 24 | DB_GLOBAL(rand_next) = seed; 25 | } 26 | -------------------------------------------------------------------------------- /src/clib/time.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 2006, 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #include "db_config.h" 10 | 11 | #include "db_int.h" 12 | 13 | /* 14 | * time -- 15 | * 16 | * PUBLIC: #ifndef HAVE_TIME 17 | * PUBLIC: time_t time __P((time_t *)); 18 | * PUBLIC: #endif 19 | */ 20 | time_t 21 | time(nowp) 22 | time_t *nowp; 23 | { 24 | db_timespec t; 25 | time_t res; 26 | 27 | __os_gettime(NULL, &t, 0); 28 | 29 | res = t.tv_sec + t.tv_nsec / NS_PER_SEC; 30 | 31 | if (nowp != NULL) 32 | *nowp = res; 33 | return (res); 34 | } 35 | -------------------------------------------------------------------------------- /src/common/clock.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #include "db_config.h" 10 | 11 | #include "db_int.h" 12 | /* 13 | * __clock_set_expires -- 14 | * Set the expire time given the time to live. 15 | * 16 | * PUBLIC: void __clock_set_expires __P((ENV *, db_timespec *, db_timeout_t)); 17 | */ 18 | void 19 | __clock_set_expires(env, timespecp, timeout) 20 | ENV *env; 21 | db_timespec *timespecp; 22 | db_timeout_t timeout; 23 | { 24 | db_timespec v; 25 | 26 | /* 27 | * If timespecp is set then it contains "now". This avoids repeated 28 | * system calls to get the time. 29 | */ 30 | if (!timespecisset(timespecp)) 31 | __os_gettime(env, timespecp, 1); 32 | 33 | /* Convert the microsecond timeout argument to a timespec. */ 34 | DB_TIMEOUT_TO_TIMESPEC(timeout, &v); 35 | 36 | /* Add the timeout to "now". */ 37 | timespecadd(timespecp, &v); 38 | } 39 | 40 | /* 41 | * __clock_expired -- determine if a timeout has expired. 42 | * 43 | * PUBLIC: int __clock_expired __P((ENV *, db_timespec *, db_timespec *)); 44 | */ 45 | int 46 | __clock_expired(env, now, timespecp) 47 | ENV *env; 48 | db_timespec *now, *timespecp; 49 | { 50 | if (!timespecisset(timespecp)) 51 | return (0); 52 | 53 | if (!timespecisset(now)) 54 | __os_gettime(env, now, 1); 55 | 56 | return (timespeccmp(now, timespecp, >=)); 57 | } 58 | -------------------------------------------------------------------------------- /src/common/crypto_stub.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #include "db_config.h" 10 | 11 | #include "db_int.h" 12 | 13 | /* 14 | * __crypto_region_init -- 15 | * Initialize crypto. 16 | * 17 | * 18 | * !!! 19 | * We don't put this stub file in the crypto/ directory of the distribution 20 | * because that entire directory is removed for non-crypto distributions. 21 | * 22 | * PUBLIC: int __crypto_region_init __P((ENV *)); 23 | */ 24 | int 25 | __crypto_region_init(env) 26 | ENV *env; 27 | { 28 | REGENV *renv; 29 | REGINFO *infop; 30 | int ret; 31 | 32 | infop = env->reginfo; 33 | renv = infop->primary; 34 | MUTEX_LOCK(env, renv->mtx_regenv); 35 | ret = !(renv->cipher_off == INVALID_ROFF); 36 | MUTEX_UNLOCK(env, renv->mtx_regenv); 37 | 38 | if (ret == 0) 39 | return (0); 40 | 41 | __db_errx(env, DB_STR("0040", 42 | "Encrypted environment: library build did not include cryptography support")); 43 | return (DB_OPNOTSUP); 44 | } 45 | -------------------------------------------------------------------------------- /src/common/db_byteorder.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #include "db_config.h" 10 | 11 | #include "db_int.h" 12 | 13 | /* 14 | * __db_isbigendian -- 15 | * Return 1 if big-endian (Motorola and Sparc), not little-endian 16 | * (Intel and Vax). We do this work at run-time, rather than at 17 | * configuration time so cross-compilation and general embedded 18 | * system support is simpler. 19 | * 20 | * PUBLIC: int __db_isbigendian __P((void)); 21 | */ 22 | int 23 | __db_isbigendian() 24 | { 25 | union { /* From Harbison & Steele. */ 26 | long l; 27 | char c[sizeof(long)]; 28 | } u; 29 | 30 | u.l = 1; 31 | return (u.c[sizeof(long) - 1] == 1); 32 | } 33 | 34 | /* 35 | * __db_byteorder -- 36 | * Return if we need to do byte swapping, checking for illegal 37 | * values. 38 | * 39 | * PUBLIC: int __db_byteorder __P((ENV *, int)); 40 | */ 41 | int 42 | __db_byteorder(env, lorder) 43 | ENV *env; 44 | int lorder; 45 | { 46 | switch (lorder) { 47 | case 0: 48 | break; 49 | case 1234: 50 | if (!F_ISSET(env, ENV_LITTLEENDIAN)) 51 | return (DB_SWAPBYTES); 52 | break; 53 | case 4321: 54 | if (F_ISSET(env, ENV_LITTLEENDIAN)) 55 | return (DB_SWAPBYTES); 56 | break; 57 | default: 58 | __db_errx(env, DB_STR("0041", 59 | "unsupported byte order, only big and little-endian supported")); 60 | return (EINVAL); 61 | } 62 | return (0); 63 | } 64 | -------------------------------------------------------------------------------- /src/common/openflags.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 1997, 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #include "db_config.h" 10 | 11 | #include "db_int.h" 12 | 13 | /* 14 | * __db_openflags -- 15 | * Convert open(2) flags to DB flags. 16 | * 17 | * PUBLIC: u_int32_t __db_openflags __P((int)); 18 | */ 19 | u_int32_t 20 | __db_openflags(oflags) 21 | int oflags; 22 | { 23 | u_int32_t dbflags; 24 | 25 | dbflags = 0; 26 | 27 | if (oflags & O_CREAT) 28 | dbflags |= DB_CREATE; 29 | 30 | if (oflags & O_TRUNC) 31 | dbflags |= DB_TRUNCATE; 32 | 33 | /* 34 | * !!! 35 | * Convert POSIX 1003.1 open(2) mode flags to DB flags. This isn't 36 | * an exact science as few POSIX implementations have a flag value 37 | * for O_RDONLY, it's simply the lack of a write flag. 38 | */ 39 | #ifndef O_ACCMODE 40 | #define O_ACCMODE (O_RDONLY | O_RDWR | O_WRONLY) 41 | #endif 42 | switch (oflags & O_ACCMODE) { 43 | case O_RDWR: 44 | case O_WRONLY: 45 | break; 46 | default: 47 | dbflags |= DB_RDONLY; 48 | break; 49 | } 50 | return (dbflags); 51 | } 52 | -------------------------------------------------------------------------------- /src/common/util_arg.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 2001, 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #include "db_config.h" 10 | 11 | #include "db_int.h" 12 | 13 | #if DB_VERSION_MAJOR < 4 || DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR < 5 14 | /* 15 | * !!! 16 | * We build this file in old versions of Berkeley DB when we're doing test 17 | * runs using the test_micro tool. Without a prototype in place, we get 18 | * warnings, and there's no simple workaround. 19 | */ 20 | char *strsep(); 21 | #endif 22 | 23 | /* 24 | * __db_util_arg -- 25 | * Convert a string into an argc/argv pair. 26 | * 27 | * PUBLIC: int __db_util_arg __P((char *, char *, int *, char ***)); 28 | */ 29 | int 30 | __db_util_arg(arg0, str, argcp, argvp) 31 | char *arg0, *str, ***argvp; 32 | int *argcp; 33 | { 34 | int n, ret; 35 | char **ap, **argv; 36 | 37 | #define MAXARGS 25 38 | if ((ret = 39 | __os_malloc(NULL, (MAXARGS + 1) * sizeof(char **), &argv)) != 0) 40 | return (ret); 41 | 42 | ap = argv; 43 | *ap++ = arg0; 44 | for (n = 1; (*ap = strsep(&str, " \t")) != NULL;) 45 | if (**ap != '\0') { 46 | ++ap; 47 | if (++n == MAXARGS) 48 | break; 49 | } 50 | *ap = NULL; 51 | 52 | *argcp = (int)(ap - argv); 53 | *argvp = argv; 54 | 55 | return (0); 56 | } 57 | -------------------------------------------------------------------------------- /src/common/util_cache.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 2000, 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #include "db_config.h" 10 | 11 | #include "db_int.h" 12 | 13 | /* 14 | * __db_util_cache -- 15 | * Compute if we have enough cache. 16 | * 17 | * PUBLIC: int __db_util_cache __P((DB *, u_int32_t *, int *)); 18 | */ 19 | int 20 | __db_util_cache(dbp, cachep, resizep) 21 | DB *dbp; 22 | u_int32_t *cachep; 23 | int *resizep; 24 | { 25 | u_int32_t pgsize; 26 | int ret; 27 | 28 | /* Get the current page size. */ 29 | if ((ret = dbp->get_pagesize(dbp, &pgsize)) != 0) 30 | return (ret); 31 | 32 | /* 33 | * The current cache size is in cachep. If it's insufficient, set the 34 | * the memory referenced by resizep to 1 and set cachep to the minimum 35 | * size needed. 36 | * 37 | * Make sure our current cache is big enough. We want at least 38 | * DB_MINPAGECACHE pages in the cache. 39 | */ 40 | if ((*cachep / pgsize) < DB_MINPAGECACHE) { 41 | *resizep = 1; 42 | *cachep = pgsize * DB_MINPAGECACHE; 43 | } else 44 | *resizep = 0; 45 | 46 | return (0); 47 | } 48 | -------------------------------------------------------------------------------- /src/common/util_log.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 2000, 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #include "db_config.h" 10 | 11 | #include "db_int.h" 12 | 13 | /* 14 | * __db_util_logset -- 15 | * Log that we're running. 16 | * 17 | * PUBLIC: int __db_util_logset __P((const char *, char *)); 18 | */ 19 | int 20 | __db_util_logset(progname, fname) 21 | const char *progname; 22 | char *fname; 23 | { 24 | pid_t pid; 25 | FILE *fp; 26 | time_t now; 27 | char time_buf[CTIME_BUFLEN]; 28 | 29 | if ((fp = fopen(fname, "w")) == NULL) 30 | goto err; 31 | 32 | (void)time(&now); 33 | 34 | __os_id(NULL, &pid, NULL); 35 | fprintf(fp, 36 | "%s: %lu %s", progname, (u_long)pid, __os_ctime(&now, time_buf)); 37 | 38 | if (fclose(fp) == EOF) 39 | goto err; 40 | 41 | return (0); 42 | 43 | err: fprintf(stderr, "%s: %s: %s\n", progname, fname, strerror(errno)); 44 | return (1); 45 | } 46 | -------------------------------------------------------------------------------- /src/crypto/rijndael/rijndael-alg-fst.h: -------------------------------------------------------------------------------- 1 | /* 2 | * $Id$ 3 | */ 4 | /** 5 | * rijndael-alg-fst.h 6 | * 7 | * @version 3.0 (December 2000) 8 | * 9 | * Optimised ANSI C code for the Rijndael cipher (now AES) 10 | * 11 | * @author Vincent Rijmen 12 | * @author Antoon Bosselaers 13 | * @author Paulo Barreto 14 | * 15 | * This code is hereby placed in the public domain. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS 18 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE 21 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 24 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 25 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 26 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 27 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | #ifndef __RIJNDAEL_ALG_FST_H 30 | #define __RIJNDAEL_ALG_FST_H 31 | 32 | #define MAXKC (256/32) 33 | #define MAXKB (256/8) 34 | #define MAXNR 14 35 | 36 | typedef u_int8_t u8; 37 | typedef u_int16_t u16; 38 | typedef u_int32_t u32; 39 | 40 | #endif /* __RIJNDAEL_ALG_FST_H */ 41 | -------------------------------------------------------------------------------- /src/db/db_copy.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #include "db_config.h" 10 | #include "db_int.h" 11 | #include "dbinc/db_page.h" 12 | #include "dbinc/db_am.h" 13 | 14 | /* 15 | * db_copy -- 16 | * Copy a database file coordinated with mpool. 17 | * This is for backward compatibility to the quick fix in 5.2. 18 | * 19 | * EXTERN: int db_copy __P((DB_ENV *, 20 | * EXTERN: const char *, const char *, const char *)); 21 | */ 22 | int 23 | db_copy(dbenv, dbfile, target, passwd) 24 | DB_ENV *dbenv; 25 | const char *dbfile; 26 | const char *target; 27 | const char *passwd; 28 | { 29 | COMPQUIET(passwd, NULL); 30 | return (__db_dbbackup_pp(dbenv, dbfile, target, 0)); 31 | } 32 | -------------------------------------------------------------------------------- /src/dbinc/db_join.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 1998, 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #ifndef _DB_JOIN_H_ 10 | #define _DB_JOIN_H_ 11 | 12 | #if defined(__cplusplus) 13 | extern "C" { 14 | #endif 15 | 16 | /* 17 | * Joins use a join cursor that is similar to a regular DB cursor except 18 | * that it only supports c_get and c_close functionality. Also, it does 19 | * not support the full range of flags for get. 20 | */ 21 | typedef struct __join_cursor { 22 | u_int8_t *j_exhausted; /* Array of flags; is cursor i exhausted? */ 23 | DBC **j_curslist; /* Array of cursors in the join: constant. */ 24 | DBC **j_fdupcurs; /* Cursors w/ first instances of current dup. */ 25 | DBC **j_workcurs; /* Scratch cursor copies to muck with. */ 26 | DB *j_primary; /* Primary dbp. */ 27 | DBT j_key; /* Used to do lookups. */ 28 | DBT j_rdata; /* Memory used for data return. */ 29 | u_int32_t j_ncurs; /* How many cursors do we have? */ 30 | #define JOIN_RETRY 0x01 /* Error on primary get; re-return same key. */ 31 | u_int32_t flags; 32 | } JOIN_CURSOR; 33 | 34 | #if defined(__cplusplus) 35 | } 36 | #endif 37 | #endif /* !_DB_JOIN_H_ */ 38 | -------------------------------------------------------------------------------- /src/dbinc/fop.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 2001, 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #ifndef _DB_FOP_H_ 10 | #define _DB_FOP_H_ 11 | 12 | #if defined(__cplusplus) 13 | extern "C" { 14 | #endif 15 | 16 | #define MAKE_INMEM(D) do { \ 17 | F_SET((D), DB_AM_INMEM); \ 18 | (void)__memp_set_flags((D)->mpf, DB_MPOOL_NOFILE, 1); \ 19 | } while (0) 20 | 21 | #define CLR_INMEM(D) do { \ 22 | F_CLR((D), DB_AM_INMEM); \ 23 | (void)__memp_set_flags((D)->mpf, DB_MPOOL_NOFILE, 0); \ 24 | } while (0) 25 | 26 | #include "dbinc_auto/fileops_auto.h" 27 | #include "dbinc_auto/fileops_ext.h" 28 | 29 | #if defined(__cplusplus) 30 | } 31 | #endif 32 | #endif /* !_DB_FOP_H_ */ 33 | -------------------------------------------------------------------------------- /src/dbinc/hmac.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #ifndef _DB_HMAC_H_ 10 | #define _DB_HMAC_H_ 11 | 12 | #if defined(__cplusplus) 13 | extern "C" { 14 | #endif 15 | 16 | /* 17 | * Algorithm specific information. 18 | */ 19 | /* 20 | * SHA1 checksumming 21 | */ 22 | typedef struct { 23 | u_int32_t state[5]; 24 | u_int32_t count[2]; 25 | unsigned char buffer[64]; 26 | } SHA1_CTX; 27 | 28 | /* 29 | * AES assumes the SHA1 checksumming (also called MAC) 30 | */ 31 | #define DB_MAC_MAGIC "mac derivation key magic value" 32 | #define DB_ENC_MAGIC "encryption and decryption key value magic" 33 | 34 | #if defined(__cplusplus) 35 | } 36 | #endif 37 | 38 | #include "dbinc_auto/hmac_ext.h" 39 | #endif /* !_DB_HMAC_H_ */ 40 | -------------------------------------------------------------------------------- /src/dbinc/partition.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved. 5 | */ 6 | /* 7 | * $Id$ 8 | */ 9 | #ifndef _DB_PART_H_ 10 | #define _DB_PART_H_ 11 | 12 | #if defined(__cplusplus) 13 | extern "C" { 14 | #endif 15 | 16 | typedef struct __db_partition { 17 | u_int32_t nparts; /* number of partitions. */ 18 | DBT *keys; /* array of range keys. */ 19 | void *data; /* the partition info. */ 20 | const char **dirs; /* locations for partitions. */ 21 | DB **handles; /* array of partition handles. */ 22 | u_int32_t (*callback) (DB *, DBT *); 23 | #define PART_CALLBACK 0x01 24 | #define PART_RANGE 0x02 25 | u_int32_t flags; 26 | } DB_PARTITION; 27 | 28 | /* 29 | * Internal part of a partitioned cursor. 30 | */ 31 | typedef struct __part_internal { 32 | __DBC_INTERNAL 33 | u_int32_t part_id; 34 | DBC *sub_cursor; 35 | } PART_CURSOR; 36 | 37 | #ifdef HAVE_PARTITION 38 | #define PART_NAME "__dbp.%s.%03d" 39 | #define PART_LEN (strlen("__dbp..")+3) 40 | #define PART_PREFIX "__dbp." 41 | #define IS_PARTITION_DB_FILE(name) (strncmp(name, PART_PREFIX, \ 42 | sizeof(PART_PREFIX) - 1) == 0) 43 | 44 | #define DB_IS_PARTITIONED(dbp) \ 45 | (dbp->p_internal != NULL && \ 46 | ((DB_PARTITION *)dbp->p_internal)->handles != NULL) 47 | 48 | #define DBC_PART_REFRESH(dbc) (F_SET(dbc, DBC_PARTITIONED)) 49 | #else 50 | #define DBC_PART_REFRESH(dbc) 51 | #define DB_IS_PARTITIONED(dbp) (0) 52 | #endif 53 | 54 | #if defined(__cplusplus) 55 | } 56 | #endif 57 | #endif 58 | -------------------------------------------------------------------------------- /src/dbinc_auto/dbreg_auto.h: -------------------------------------------------------------------------------- 1 | /* Do not edit: automatically built by gen_rec.awk. */ 2 | 3 | #ifndef __dbreg_AUTO_H 4 | #define __dbreg_AUTO_H 5 | #include "dbinc/log.h" 6 | #define DB___dbreg_register 2 7 | typedef struct ___dbreg_register_args { 8 | u_int32_t type; 9 | DB_TXN *txnp; 10 | DB_LSN prev_lsn; 11 | u_int32_t opcode; 12 | DBT name; 13 | DBT uid; 14 | int32_t fileid; 15 | DBTYPE ftype; 16 | db_pgno_t meta_pgno; 17 | u_int32_t id; 18 | } __dbreg_register_args; 19 | 20 | extern __DB_IMPORT DB_LOG_RECSPEC __dbreg_register_desc[]; 21 | static inline int 22 | __dbreg_register_log(ENV *env, DB_TXN *txnp, DB_LSN *ret_lsnp, u_int32_t flags, 23 | u_int32_t opcode, const DBT *name, const DBT *uid, int32_t fileid, DBTYPE ftype, 24 | db_pgno_t meta_pgno, u_int32_t id) 25 | { 26 | return (__log_put_record(env, NULL, txnp, ret_lsnp, 27 | flags, DB___dbreg_register, 0, 28 | sizeof(u_int32_t) + sizeof(u_int32_t) + sizeof(DB_LSN) + 29 | sizeof(u_int32_t) + LOG_DBT_SIZE(name) + LOG_DBT_SIZE(uid) + 30 | sizeof(u_int32_t) + sizeof(u_int32_t) + sizeof(u_int32_t) + 31 | sizeof(u_int32_t), 32 | __dbreg_register_desc, 33 | opcode, name, uid, fileid, ftype, meta_pgno, id)); 34 | } 35 | 36 | static inline int __dbreg_register_read(ENV *env, 37 | void *data, __dbreg_register_args **arg) 38 | { 39 | *arg = NULL; 40 | return (__log_read_record(env, 41 | NULL, NULL, data, __dbreg_register_desc, sizeof(__dbreg_register_args), (void**)arg)); 42 | } 43 | #endif 44 | -------------------------------------------------------------------------------- /src/dbinc_auto/ext_185_def.in: -------------------------------------------------------------------------------- 1 | 2 | /* DO NOT EDIT: automatically built by dist/s_include. */ 3 | #ifndef _DB_EXT_185_DEF_IN_ 4 | #define _DB_EXT_185_DEF_IN_ 5 | 6 | #ifdef _DB185_INT_H_ 7 | #define __db185_open __db185_open@DB_VERSION_UNIQUE_NAME@ 8 | #else 9 | #define __db185_open __db185_open@DB_VERSION_UNIQUE_NAME@ 10 | #endif 11 | 12 | #endif /* !_DB_EXT_185_DEF_IN_ */ 13 | -------------------------------------------------------------------------------- /src/dbinc_auto/ext_185_prot.in: -------------------------------------------------------------------------------- 1 | 2 | /* DO NOT EDIT: automatically built by dist/s_include. */ 3 | #ifndef _DB_EXT_185_PROT_IN_ 4 | #define _DB_EXT_185_PROT_IN_ 5 | 6 | #if defined(__cplusplus) 7 | extern "C" { 8 | #endif 9 | 10 | #ifdef _DB185_INT_H_ 11 | DB185 *__db185_open __P((const char *, int, int, DBTYPE, const void *)); 12 | #else 13 | DB *__db185_open __P((const char *, int, int, DBTYPE, const void *)); 14 | #endif 15 | 16 | #if defined(__cplusplus) 17 | } 18 | #endif 19 | #endif /* !_DB_EXT_185_PROT_IN_ */ 20 | -------------------------------------------------------------------------------- /src/dbinc_auto/hmac_ext.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT: automatically built by dist/s_include. */ 2 | #ifndef _hmac_ext_h_ 3 | #define _hmac_ext_h_ 4 | 5 | #if defined(__cplusplus) 6 | extern "C" { 7 | #endif 8 | 9 | void __db_chksum __P((void *, u_int8_t *, size_t, u_int8_t *, u_int8_t *)); 10 | void __db_derive_mac __P((u_int8_t *, size_t, u_int8_t *)); 11 | int __db_check_chksum __P((ENV *, void *, DB_CIPHER *, u_int8_t *, void *, size_t, int)); 12 | void __db_SHA1Transform __P((u_int32_t *, unsigned char *)); 13 | void __db_SHA1Init __P((SHA1_CTX *)); 14 | void __db_SHA1Update __P((SHA1_CTX *, unsigned char *, size_t)); 15 | void __db_SHA1Final __P((unsigned char *, SHA1_CTX *)); 16 | 17 | #if defined(__cplusplus) 18 | } 19 | #endif 20 | #endif /* !_hmac_ext_h_ */ 21 | -------------------------------------------------------------------------------- /src/dbinc_auto/repmgr_auto.h: -------------------------------------------------------------------------------- 1 | /* Do not edit: automatically built by gen_rec.awk. */ 2 | 3 | #ifndef __repmgr_AUTO_H 4 | #define __repmgr_AUTO_H 5 | #ifdef HAVE_REPLICATION_THREADS 6 | #include "dbinc/log.h" 7 | #define DB___repmgr_member 200 8 | typedef struct ___repmgr_member_args { 9 | u_int32_t type; 10 | DB_TXN *txnp; 11 | DB_LSN prev_lsn; 12 | u_int32_t version; 13 | u_int32_t prev_status; 14 | u_int32_t status; 15 | DBT host; 16 | u_int32_t port; 17 | } __repmgr_member_args; 18 | 19 | extern __DB_IMPORT DB_LOG_RECSPEC __repmgr_member_desc[]; 20 | static inline int 21 | __repmgr_member_log(ENV *env, DB_TXN *txnp, DB_LSN *ret_lsnp, u_int32_t flags, 22 | u_int32_t version, u_int32_t prev_status, u_int32_t status, const DBT *host, u_int32_t port) 23 | { 24 | return (__log_put_record(env, NULL, txnp, ret_lsnp, 25 | flags, DB___repmgr_member, 0, 26 | sizeof(u_int32_t) + sizeof(u_int32_t) + sizeof(DB_LSN) + 27 | sizeof(u_int32_t) + sizeof(u_int32_t) + sizeof(u_int32_t) + 28 | LOG_DBT_SIZE(host) + sizeof(u_int32_t), 29 | __repmgr_member_desc, 30 | version, prev_status, status, host, port)); 31 | } 32 | 33 | static inline int __repmgr_member_read(ENV *env, 34 | void *data, __repmgr_member_args **arg) 35 | { 36 | *arg = NULL; 37 | return (__log_read_record(env, 38 | NULL, NULL, data, __repmgr_member_desc, sizeof(__repmgr_member_args), (void**)arg)); 39 | } 40 | #endif /* HAVE_REPLICATION_THREADS */ 41 | #endif 42 | -------------------------------------------------------------------------------- /src/dbinc_auto/sequence_ext.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT: automatically built by dist/s_include. */ 2 | #ifndef _sequence_ext_h_ 3 | #define _sequence_ext_h_ 4 | 5 | #if defined(__cplusplus) 6 | extern "C" { 7 | #endif 8 | 9 | int __seq_stat __P((DB_SEQUENCE *, DB_SEQUENCE_STAT **, u_int32_t)); 10 | int __seq_stat_print __P((DB_SEQUENCE *, u_int32_t)); 11 | const FN * __db_get_seq_flags_fn __P((void)); 12 | const FN * __db_get_seq_flags_fn __P((void)); 13 | 14 | #if defined(__cplusplus) 15 | } 16 | #endif 17 | #endif /* !_sequence_ext_h_ */ 18 | -------------------------------------------------------------------------------- /src/dbinc_auto/xa_ext.h: -------------------------------------------------------------------------------- 1 | /* DO NOT EDIT: automatically built by dist/s_include. */ 2 | #ifndef _xa_ext_h_ 3 | #define _xa_ext_h_ 4 | 5 | #if defined(__cplusplus) 6 | extern "C" { 7 | #endif 8 | 9 | int __db_rmid_to_env __P((int, ENV **)); 10 | int __db_xid_to_txn __P((ENV *, XID *, TXN_DETAIL **)); 11 | void __db_map_rmid __P((int, ENV *)); 12 | int __db_unmap_rmid __P((int)); 13 | void __db_unmap_xid __P((ENV *, XID *, size_t)); 14 | 15 | #if defined(__cplusplus) 16 | } 17 | #endif 18 | #endif /* !_xa_ext_h_ */ 19 | -------------------------------------------------------------------------------- /src/dbreg/dbreg.src: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * $Id$ 7 | */ 8 | 9 | DBPRIVATE 10 | PREFIX __dbreg 11 | 12 | INCLUDE #include "db_int.h" 13 | INCLUDE #include "dbinc/crypto.h" 14 | INCLUDE #include "dbinc/db_page.h" 15 | INCLUDE #include "dbinc/db_dispatch.h" 16 | INCLUDE #include "dbinc/db_am.h" 17 | INCLUDE #include "dbinc/txn.h" 18 | INCLUDE 19 | 20 | /* 21 | * Used for registering name/id translations at open or close. 22 | * opcode: register or unregister 23 | * name: file name 24 | * fileid: unique file id 25 | * ftype: file type 26 | * ftype: database type 27 | * id: transaction id of the subtransaction that created the fs object 28 | */ 29 | BEGIN register 42 2 30 | DBOP opcode u_int32_t lu 31 | DBT name DBT s 32 | DBT uid DBT s 33 | ARG fileid int32_t ld 34 | ARG ftype DBTYPE lx 35 | ARG meta_pgno db_pgno_t lu 36 | ARG id u_int32_t lx 37 | END 38 | -------------------------------------------------------------------------------- /src/dbreg/dbreg_auto.c: -------------------------------------------------------------------------------- 1 | /* Do not edit: automatically built by gen_rec.awk. */ 2 | 3 | #include "db_config.h" 4 | #include "db_int.h" 5 | #include "dbinc/crypto.h" 6 | #include "dbinc/db_page.h" 7 | #include "dbinc/db_dispatch.h" 8 | #include "dbinc/db_am.h" 9 | #include "dbinc/txn.h" 10 | 11 | DB_LOG_RECSPEC __dbreg_register_desc[] = { 12 | {LOGREC_DBOP, SSZ(__dbreg_register_args, opcode), "opcode", ""}, 13 | {LOGREC_DBT, SSZ(__dbreg_register_args, name), "name", ""}, 14 | {LOGREC_DBT, SSZ(__dbreg_register_args, uid), "uid", ""}, 15 | {LOGREC_ARG, SSZ(__dbreg_register_args, fileid), "fileid", "%ld"}, 16 | {LOGREC_ARG, SSZ(__dbreg_register_args, ftype), "ftype", "%lx"}, 17 | {LOGREC_ARG, SSZ(__dbreg_register_args, meta_pgno), "meta_pgno", "%lu"}, 18 | {LOGREC_ARG, SSZ(__dbreg_register_args, id), "id", "%lx"}, 19 | {LOGREC_Done, 0, "", ""} 20 | }; 21 | /* 22 | * PUBLIC: int __dbreg_init_recover __P((ENV *, DB_DISTAB *)); 23 | */ 24 | int 25 | __dbreg_init_recover(env, dtabp) 26 | ENV *env; 27 | DB_DISTAB *dtabp; 28 | { 29 | int ret; 30 | 31 | if ((ret = __db_add_recovery_int(env, dtabp, 32 | __dbreg_register_recover, DB___dbreg_register)) != 0) 33 | return (ret); 34 | return (0); 35 | } 36 | -------------------------------------------------------------------------------- /src/dbreg/dbreg_autop.c: -------------------------------------------------------------------------------- 1 | /* Do not edit: automatically built by gen_rec.awk. */ 2 | 3 | #include "db_config.h" 4 | 5 | #include "db_int.h" 6 | #include "dbinc/crypto.h" 7 | #include "dbinc/db_page.h" 8 | #include "dbinc/db_dispatch.h" 9 | #include "dbinc/db_am.h" 10 | #include "dbinc/txn.h" 11 | 12 | /* 13 | * PUBLIC: int __dbreg_register_print __P((ENV *, DBT *, DB_LSN *, 14 | * PUBLIC: db_recops, void *)); 15 | */ 16 | int 17 | __dbreg_register_print(env, dbtp, lsnp, notused2, info) 18 | ENV *env; 19 | DBT *dbtp; 20 | DB_LSN *lsnp; 21 | db_recops notused2; 22 | void *info; 23 | { 24 | COMPQUIET(notused2, DB_TXN_PRINT); 25 | 26 | return (__log_print_record(env, dbtp, lsnp, "__dbreg_register", __dbreg_register_desc, info)); 27 | } 28 | 29 | /* 30 | * PUBLIC: int __dbreg_init_print __P((ENV *, DB_DISTAB *)); 31 | */ 32 | int 33 | __dbreg_init_print(env, dtabp) 34 | ENV *env; 35 | DB_DISTAB *dtabp; 36 | { 37 | int ret; 38 | 39 | if ((ret = __db_add_recovery_int(env, dtabp, 40 | __dbreg_register_print, DB___dbreg_register)) != 0) 41 | return (ret); 42 | return (0); 43 | } 44 | -------------------------------------------------------------------------------- /src/mutex/uts4_cc.s: -------------------------------------------------------------------------------- 1 | / See the file LICENSE for redistribution information. 2 | / 3 | / Copyright (c) 1997, 2012 Oracle and/or its affiliates. All rights reserved. 4 | / 5 | / $Id$ 6 | / 7 | / int uts_lock ( int *p, int i ); 8 | / Update the lock word pointed to by p with the 9 | / value i, using compare-and-swap. 10 | / Returns 0 if update was successful. 11 | / Returns 1 if update failed. 12 | / 13 | entry uts_lock 14 | uts_lock: 15 | using .,r15 16 | st r2,8(sp) / Save R2 17 | l r2,64+0(sp) / R2 -> word to update 18 | slr r0, r0 / R0 = current lock value must be 0 19 | l r1,64+4(sp) / R1 = new lock value 20 | cs r0,r1,0(r2) / Try the update ... 21 | be x / ... Success. Return 0 22 | la r0,1 / ... Failure. Return 1 23 | x: / 24 | l r2,8(sp) / Restore R2 25 | b 2(,r14) / Return to caller 26 | drop r15 27 | -------------------------------------------------------------------------------- /src/os/os_abort.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 2005, 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #include "db_config.h" 10 | 11 | #include "db_int.h" 12 | 13 | /* 14 | * __os_abort -- 15 | * 16 | * PUBLIC: void __os_abort __P((ENV *)); 17 | */ 18 | void 19 | __os_abort(env) 20 | ENV *env; 21 | { 22 | __os_stack(env); /* Try and get a stack trace. */ 23 | 24 | #ifdef HAVE_ABORT 25 | abort(); /* Try and drop core. */ 26 | /* NOTREACHED */ 27 | #endif 28 | #ifdef SIGABRT 29 | (void)raise(SIGABRT); /* Try and drop core. */ 30 | #endif 31 | exit(1); /* Quit anyway. */ 32 | /* NOTREACHED */ 33 | } 34 | -------------------------------------------------------------------------------- /src/os/os_abs.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 1997, 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #include "db_config.h" 10 | 11 | #include "db_int.h" 12 | 13 | /* 14 | * __os_abspath -- 15 | * Return if a path is an absolute path. 16 | * 17 | * PUBLIC: int __os_abspath __P((const char *)); 18 | */ 19 | int 20 | __os_abspath(path) 21 | const char *path; 22 | { 23 | return (path[0] == '/'); 24 | } 25 | -------------------------------------------------------------------------------- /src/os/os_config.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 1998, 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #include "db_config.h" 10 | 11 | #include "db_int.h" 12 | 13 | /* 14 | * __os_fs_notzero -- 15 | * Return 1 if allocated filesystem blocks are not zeroed. 16 | * 17 | * PUBLIC: int __os_fs_notzero __P((void)); 18 | */ 19 | int 20 | __os_fs_notzero() 21 | { 22 | /* Most filesystems zero out implicitly created pages. */ 23 | return (0); 24 | } 25 | 26 | /* 27 | * __os_support_direct_io -- 28 | * Return 1 if we support direct I/O. 29 | * 30 | * PUBLIC: int __os_support_direct_io __P((void)); 31 | */ 32 | int 33 | __os_support_direct_io() 34 | { 35 | int ret; 36 | 37 | ret = 0; 38 | 39 | #ifdef HAVE_O_DIRECT 40 | ret = 1; 41 | #endif 42 | #if defined(HAVE_DIRECTIO) && defined(DIRECTIO_ON) 43 | ret = 1; 44 | #endif 45 | return (ret); 46 | } 47 | 48 | /* 49 | * __os_support_db_register -- 50 | * Return 1 if the system supports DB_REGISTER. 51 | * 52 | * PUBLIC: int __os_support_db_register __P((void)); 53 | */ 54 | int 55 | __os_support_db_register() 56 | { 57 | return (1); 58 | } 59 | 60 | /* 61 | * __os_support_replication -- 62 | * Return 1 if the system supports replication. 63 | * 64 | * PUBLIC: int __os_support_replication __P((void)); 65 | */ 66 | int 67 | __os_support_replication() 68 | { 69 | return (1); 70 | } 71 | -------------------------------------------------------------------------------- /src/os/os_cpu.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 1997, 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #include "db_config.h" 10 | 11 | #include "db_int.h" 12 | 13 | #ifdef HAVE_SYSTEM_INCLUDE_FILES 14 | #if defined(HAVE_PSTAT_GETDYNAMIC) 15 | #include 16 | #endif 17 | #endif 18 | 19 | /* 20 | * __os_cpu_count -- 21 | * Return the number of CPUs. 22 | * 23 | * PUBLIC: u_int32_t __os_cpu_count __P((void)); 24 | */ 25 | u_int32_t 26 | __os_cpu_count() 27 | { 28 | #if defined(HAVE_PSTAT_GETDYNAMIC) 29 | /* 30 | * HP/UX. 31 | */ 32 | struct pst_dynamic psd; 33 | 34 | return ((u_int32_t)pstat_getdynamic(&psd, 35 | sizeof(psd), (size_t)1, 0) == -1 ? 1 : psd.psd_proc_cnt); 36 | #elif defined(HAVE_SYSCONF) && defined(_SC_NPROCESSORS_ONLN) 37 | /* 38 | * Solaris, Linux. 39 | */ 40 | long nproc; 41 | 42 | nproc = sysconf(_SC_NPROCESSORS_ONLN); 43 | return ((u_int32_t)(nproc > 1 ? nproc : 1)); 44 | #else 45 | return (1); 46 | #endif 47 | } 48 | -------------------------------------------------------------------------------- /src/os/os_ctime.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 2001, 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #include "db_config.h" 10 | 11 | #include "db_int.h" 12 | 13 | /* 14 | * __os_ctime -- 15 | * Format a time-stamp. 16 | * 17 | * PUBLIC: char *__os_ctime __P((const time_t *, char *)); 18 | */ 19 | char * 20 | __os_ctime(tod, time_buf) 21 | const time_t *tod; 22 | char *time_buf; 23 | { 24 | time_buf[CTIME_BUFLEN - 1] = '\0'; 25 | 26 | /* 27 | * The ctime_r interface is the POSIX standard, thread-safe version of 28 | * ctime. However, it was implemented in three different ways (with 29 | * and without a buffer length argument, and where the buffer length 30 | * argument was an int vs. a size_t *). Also, you can't depend on a 31 | * return of (char *) from ctime_r, HP-UX 10.XX's version returned an 32 | * int. 33 | */ 34 | #if defined(HAVE_VXWORKS) 35 | { 36 | size_t buflen = CTIME_BUFLEN; 37 | (void)ctime_r(tod, time_buf, &buflen); 38 | } 39 | #elif defined(HAVE_CTIME_R_3ARG) 40 | (void)ctime_r(tod, time_buf, CTIME_BUFLEN); 41 | #elif defined(HAVE_CTIME_R) 42 | (void)ctime_r(tod, time_buf); 43 | #else 44 | (void)strncpy(time_buf, ctime(tod), CTIME_BUFLEN - 1); 45 | #endif 46 | return (time_buf); 47 | } 48 | -------------------------------------------------------------------------------- /src/os/os_getenv.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 1997, 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #include "db_config.h" 10 | 11 | #include "db_int.h" 12 | 13 | /* 14 | * __os_getenv -- 15 | * Retrieve an environment variable. 16 | * 17 | * PUBLIC: int __os_getenv __P((ENV *, const char *, char **, size_t)); 18 | */ 19 | int 20 | __os_getenv(env, name, bpp, buflen) 21 | ENV *env; 22 | const char *name; 23 | char **bpp; 24 | size_t buflen; 25 | { 26 | /* 27 | * If we have getenv, there's a value and the buffer is large enough: 28 | * copy value into the pointer, return 0 29 | * If we have getenv, there's a value and the buffer is too short: 30 | * set pointer to NULL, return EINVAL 31 | * If we have getenv and there's no value: 32 | * set pointer to NULL, return 0 33 | * If we don't have getenv: 34 | * set pointer to NULL, return 0 35 | */ 36 | #ifdef HAVE_GETENV 37 | char *p; 38 | 39 | if ((p = getenv(name)) != NULL) { 40 | if (strlen(p) < buflen) { 41 | (void)strcpy(*bpp, p); 42 | return (0); 43 | } 44 | 45 | *bpp = NULL; 46 | __db_errx(env, DB_STR_A("0157", 47 | "%s: buffer too small to hold environment variable %s", 48 | "%s %s"), name, p); 49 | return (EINVAL); 50 | } 51 | #else 52 | COMPQUIET(env, NULL); 53 | COMPQUIET(name, NULL); 54 | COMPQUIET(buflen, 0); 55 | #endif 56 | *bpp = NULL; 57 | return (0); 58 | } 59 | -------------------------------------------------------------------------------- /src/os/os_mkdir.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 1997, 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #include "db_config.h" 10 | 11 | #include "db_int.h" 12 | 13 | /* 14 | * __os_mkdir -- 15 | * Create a directory. 16 | * 17 | * PUBLIC: int __os_mkdir __P((ENV *, const char *, int)); 18 | */ 19 | int 20 | __os_mkdir(env, name, mode) 21 | ENV *env; 22 | const char *name; 23 | int mode; 24 | { 25 | DB_ENV *dbenv; 26 | int ret; 27 | 28 | dbenv = env == NULL ? NULL : env->dbenv; 29 | if (dbenv != NULL && 30 | FLD_ISSET(dbenv->verbose, DB_VERB_FILEOPS | DB_VERB_FILEOPS_ALL)) 31 | __db_msg(env, DB_STR_A("0129", "fileops: mkdir %s", 32 | "%s"), name); 33 | 34 | /* Make the directory, with paranoid permissions. */ 35 | #if defined(HAVE_VXWORKS) 36 | RETRY_CHK((mkdir(CHAR_STAR_CAST name)), ret); 37 | #else 38 | RETRY_CHK((mkdir(name, DB_MODE_700)), ret); 39 | #endif 40 | if (ret != 0) 41 | return (__os_posix_err(ret)); 42 | 43 | /* Set the absolute permissions, if specified. */ 44 | #if !defined(HAVE_VXWORKS) 45 | if (mode != 0) { 46 | RETRY_CHK((chmod(name, mode)), ret); 47 | if (ret != 0) 48 | ret = __os_posix_err(ret); 49 | } 50 | #endif 51 | return (ret); 52 | } 53 | -------------------------------------------------------------------------------- /src/os/os_path.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 1997, 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #include "db_config.h" 10 | 11 | #include "db_int.h" 12 | /* 13 | * __os_concat_path -- 14 | * Concatenate two elements of a path. 15 | * PUBLIC: int __os_concat_path __P((char *, 16 | * PUBLIC: size_t, const char *, const char *)); 17 | */ 18 | int __os_concat_path(dest, destsize, path, file) 19 | char *dest; 20 | size_t destsize; 21 | const char *path, *file; 22 | { 23 | if ((size_t)snprintf(dest, destsize, 24 | "%s%c%s", path, PATH_SEPARATOR[0], file) >= destsize) 25 | return (EINVAL); 26 | return (0); 27 | } 28 | -------------------------------------------------------------------------------- /src/os/os_pid.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 2001, 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #include "db_config.h" 10 | 11 | #include "db_int.h" 12 | 13 | /* 14 | * __os_id -- 15 | * Return the current process ID. 16 | * 17 | * PUBLIC: void __os_id __P((DB_ENV *, pid_t *, db_threadid_t*)); 18 | */ 19 | void 20 | __os_id(dbenv, pidp, tidp) 21 | DB_ENV *dbenv; 22 | pid_t *pidp; 23 | db_threadid_t *tidp; 24 | { 25 | /* 26 | * We can't depend on dbenv not being NULL, this routine is called 27 | * from places where there's no DB_ENV handle. 28 | * 29 | * We cache the pid in the ENV handle, getting the process ID is a 30 | * fairly slow call on lots of systems. 31 | */ 32 | if (pidp != NULL) { 33 | if (dbenv == NULL) { 34 | #if defined(HAVE_VXWORKS) 35 | *pidp = taskIdSelf(); 36 | #else 37 | *pidp = getpid(); 38 | #endif 39 | } else 40 | *pidp = dbenv->env->pid_cache; 41 | } 42 | 43 | /* 44 | * When building on MinGW, we define both HAVE_PTHREAD_SELF and DB_WIN32, 45 | * and we are using pthreads instead of Windows threads implementation. 46 | * So here, we need to check the thread implementations before checking 47 | * the platform. 48 | */ 49 | if (tidp != NULL) { 50 | #if defined(HAVE_PTHREAD_SELF) 51 | *tidp = pthread_self(); 52 | #elif defined(HAVE_MUTEX_UI_THREADS) 53 | *tidp = thr_self(); 54 | #elif defined(DB_WIN32) 55 | *tidp = GetCurrentThreadId(); 56 | #else 57 | /* 58 | * Default to just getpid. 59 | */ 60 | DB_THREADID_INIT(*tidp); 61 | #endif 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /src/os/os_rename.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 1997, 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #include "db_config.h" 10 | 11 | #include "db_int.h" 12 | 13 | /* 14 | * __os_rename -- 15 | * Rename a file. 16 | * 17 | * PUBLIC: int __os_rename __P((ENV *, 18 | * PUBLIC: const char *, const char *, u_int32_t)); 19 | */ 20 | int 21 | __os_rename(env, oldname, newname, silent) 22 | ENV *env; 23 | const char *oldname, *newname; 24 | u_int32_t silent; 25 | { 26 | DB_ENV *dbenv; 27 | int ret; 28 | 29 | dbenv = env == NULL ? NULL : env->dbenv; 30 | if (dbenv != NULL && 31 | FLD_ISSET(dbenv->verbose, DB_VERB_FILEOPS | DB_VERB_FILEOPS_ALL)) 32 | __db_msg(env, DB_STR_A("0168", "fileops: rename %s to %s", 33 | "%s %s"), oldname, newname); 34 | 35 | LAST_PANIC_CHECK_BEFORE_IO(env); 36 | 37 | if (DB_GLOBAL(j_rename) != NULL) 38 | ret = DB_GLOBAL(j_rename)(oldname, newname); 39 | else 40 | RETRY_CHK((rename(oldname, newname)), ret); 41 | 42 | /* 43 | * If "silent" is not set, then errors are OK and we should not output 44 | * an error message. 45 | */ 46 | if (ret != 0) { 47 | if (!silent) 48 | __db_syserr(env, ret, DB_STR_A("0169", 49 | "rename %s %s", "%s %s"), oldname, newname); 50 | ret = __os_posix_err(ret); 51 | } 52 | return (ret); 53 | } 54 | -------------------------------------------------------------------------------- /src/os/os_root.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 1999, 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #include "db_config.h" 10 | 11 | #include "db_int.h" 12 | 13 | /* 14 | * __os_isroot -- 15 | * Return if user has special permissions. 16 | * 17 | * PUBLIC: int __os_isroot __P((void)); 18 | */ 19 | int 20 | __os_isroot() 21 | { 22 | #ifdef HAVE_GETUID 23 | return (getuid() == 0); 24 | #else 25 | return (0); 26 | #endif 27 | } 28 | -------------------------------------------------------------------------------- /src/os/os_rpath.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 1997, 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #include "db_config.h" 10 | 11 | #include "db_int.h" 12 | 13 | /* 14 | * __db_rpath -- 15 | * Return the last path separator in the path or NULL if none found. 16 | * 17 | * PUBLIC: char *__db_rpath __P((const char *)); 18 | */ 19 | char * 20 | __db_rpath(path) 21 | const char *path; 22 | { 23 | const char *s, *last; 24 | 25 | s = path; 26 | last = NULL; 27 | if (PATH_SEPARATOR[1] != '\0') { 28 | for (; s[0] != '\0'; ++s) 29 | if (strchr(PATH_SEPARATOR, s[0]) != NULL) 30 | last = s; 31 | } else 32 | for (; s[0] != '\0'; ++s) 33 | if (s[0] == PATH_SEPARATOR[0]) 34 | last = s; 35 | return ((char *)last); 36 | } 37 | -------------------------------------------------------------------------------- /src/os/os_seek.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 1997, 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #include "db_config.h" 10 | 11 | #include "db_int.h" 12 | 13 | /* 14 | * __os_seek -- 15 | * Seek to a page/byte offset in the file. 16 | * 17 | * PUBLIC: int __os_seek __P((ENV *, 18 | * PUBLIC: DB_FH *, db_pgno_t, u_int32_t, off_t)); 19 | */ 20 | int 21 | __os_seek(env, fhp, pgno, pgsize, relative) 22 | ENV *env; 23 | DB_FH *fhp; 24 | db_pgno_t pgno; 25 | u_int32_t pgsize; 26 | off_t relative; 27 | { 28 | DB_ENV *dbenv; 29 | off_t offset; 30 | int ret; 31 | 32 | dbenv = env == NULL ? NULL : env->dbenv; 33 | 34 | DB_ASSERT(env, F_ISSET(fhp, DB_FH_OPENED) && fhp->fd != -1); 35 | 36 | #if defined(HAVE_STATISTICS) 37 | ++fhp->seek_count; 38 | #endif 39 | 40 | offset = (off_t)pgsize * pgno + relative; 41 | 42 | if (dbenv != NULL && FLD_ISSET(dbenv->verbose, DB_VERB_FILEOPS_ALL)) 43 | __db_msg(env, DB_STR_A("0170", 44 | "fileops: seek %s to %lu", "%s %lu"), 45 | fhp->name, (u_long)offset); 46 | 47 | if (DB_GLOBAL(j_seek) != NULL) 48 | ret = DB_GLOBAL(j_seek)(fhp->fd, offset, SEEK_SET); 49 | else 50 | RETRY_CHK((lseek( 51 | fhp->fd, offset, SEEK_SET) == -1 ? 1 : 0), ret); 52 | 53 | if (ret == 0) { 54 | fhp->pgsize = pgsize; 55 | fhp->pgno = pgno; 56 | fhp->offset = relative; 57 | } else { 58 | __db_syserr(env, ret, DB_STR_A("0171", 59 | "seek: %lu: (%lu * %lu) + %lu", "%lu %lu %lu %lu"), 60 | (u_long)offset, (u_long)pgno, (u_long)pgsize, 61 | (u_long)relative); 62 | ret = __os_posix_err(ret); 63 | } 64 | 65 | return (ret); 66 | } 67 | -------------------------------------------------------------------------------- /src/os/os_stack.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 2001, 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #include "db_config.h" 10 | 11 | #include "db_int.h" 12 | #if defined(HAVE_SYSTEM_INCLUDE_FILES) && defined(HAVE_BACKTRACE) && \ 13 | defined(HAVE_BACKTRACE_SYMBOLS) && defined(HAVE_EXECINFO_H) 14 | #include 15 | #endif 16 | 17 | /* 18 | * __os_stack -- 19 | * Output a stack trace to the message file handle. 20 | * 21 | * PUBLIC: void __os_stack __P((ENV *)); 22 | */ 23 | void 24 | __os_stack(env) 25 | ENV *env; 26 | { 27 | #if defined(HAVE_BACKTRACE) && defined(HAVE_BACKTRACE_SYMBOLS) 28 | void *array[200]; 29 | size_t i, size; 30 | char **strings; 31 | 32 | /* 33 | * Solaris and the GNU C library support this interface. Solaris 34 | * has additional interfaces (printstack and walkcontext), I don't 35 | * know if they offer any additional value or not. 36 | */ 37 | size = backtrace(array, sizeof(array) / sizeof(array[0])); 38 | strings = backtrace_symbols(array, size); 39 | 40 | for (i = 0; i < size; ++i) 41 | __db_errx(env, "%s", strings[i]); 42 | free(strings); 43 | #endif 44 | COMPQUIET(env, NULL); 45 | } 46 | -------------------------------------------------------------------------------- /src/os/os_truncate.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 2004, 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #include "db_config.h" 10 | 11 | #include "db_int.h" 12 | 13 | /* 14 | * __os_truncate -- 15 | * Truncate the file. 16 | * 17 | * PUBLIC: int __os_truncate __P((ENV *, DB_FH *, db_pgno_t, u_int32_t)); 18 | */ 19 | int 20 | __os_truncate(env, fhp, pgno, pgsize) 21 | ENV *env; 22 | DB_FH *fhp; 23 | db_pgno_t pgno; 24 | u_int32_t pgsize; 25 | { 26 | DB_ENV *dbenv; 27 | off_t offset; 28 | int ret; 29 | 30 | dbenv = env == NULL ? NULL : env->dbenv; 31 | 32 | /* 33 | * Truncate a file so that "pgno" is discarded from the end of the 34 | * file. 35 | */ 36 | offset = (off_t)pgsize * pgno; 37 | 38 | if (dbenv != NULL && 39 | FLD_ISSET(dbenv->verbose, DB_VERB_FILEOPS | DB_VERB_FILEOPS_ALL)) 40 | __db_msg(env, DB_STR_A("0141", 41 | "fileops: truncate %s to %lu", "%s %lu"), 42 | fhp->name, (u_long)offset); 43 | 44 | LAST_PANIC_CHECK_BEFORE_IO(env); 45 | 46 | if (DB_GLOBAL(j_ftruncate) != NULL) 47 | ret = DB_GLOBAL(j_ftruncate)(fhp->fd, offset); 48 | else { 49 | #ifdef HAVE_FTRUNCATE 50 | RETRY_CHK((ftruncate(fhp->fd, offset)), ret); 51 | #else 52 | ret = DB_OPNOTSUP; 53 | #endif 54 | } 55 | 56 | if (ret != 0) { 57 | __db_syserr(env, ret, DB_STR_A("0142", 58 | "ftruncate: %lu", "%lu"), (u_long)offset); 59 | ret = __os_posix_err(ret); 60 | } 61 | 62 | return (ret); 63 | } 64 | -------------------------------------------------------------------------------- /src/os/os_uid.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 2001, 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #include "db_config.h" 10 | 11 | #include "db_int.h" 12 | 13 | /* 14 | * __os_unique_id -- 15 | * Return a unique 32-bit value. 16 | * 17 | * PUBLIC: void __os_unique_id __P((ENV *, u_int32_t *)); 18 | */ 19 | void 20 | __os_unique_id(env, idp) 21 | ENV *env; 22 | u_int32_t *idp; 23 | { 24 | DB_ENV *dbenv; 25 | db_timespec v; 26 | pid_t pid; 27 | u_int32_t id; 28 | 29 | *idp = 0; 30 | 31 | dbenv = env == NULL ? NULL : env->dbenv; 32 | 33 | /* 34 | * Our randomized value is comprised of our process ID, the current 35 | * time of day and a stack address, all XOR'd together. 36 | */ 37 | __os_id(dbenv, &pid, NULL); 38 | __os_gettime(env, &v, 1); 39 | 40 | id = (u_int32_t)pid ^ 41 | (u_int32_t)v.tv_sec ^ (u_int32_t)v.tv_nsec ^ P_TO_UINT32(&pid); 42 | 43 | /* 44 | * We could try and find a reasonable random-number generator, but 45 | * that's not all that easy to do. Seed and use srand()/rand(), if 46 | * we can find them. 47 | */ 48 | if (DB_GLOBAL(uid_init) == 0) { 49 | DB_GLOBAL(uid_init) = 1; 50 | srand((u_int)id); 51 | } 52 | id ^= (u_int)rand(); 53 | 54 | *idp = id; 55 | } 56 | -------------------------------------------------------------------------------- /src/repmgr/repmgr.src: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 2010, 2012 Oracle and/or its affiliates. All rights reserved. 5 | */ 6 | 7 | DBPRIVATE 8 | PREFIX __repmgr 9 | 10 | INCLUDE #include "db_int.h" 11 | INCLUDE #include "dbinc/db_page.h" 12 | INCLUDE #include "dbinc/db_dispatch.h" 13 | INCLUDE #include "dbinc/db_am.h" 14 | INCLUDE #include "dbinc_auto/repmgr_auto.h" 15 | INCLUDE 16 | 17 | BEGIN member 52 200 18 | ARG version u_int32_t lu 19 | ARG prev_status u_int32_t lu 20 | ARG status u_int32_t lu 21 | DBT host DBT s 22 | ARG port u_int32_t lu 23 | END 24 | -------------------------------------------------------------------------------- /src/repmgr/repmgr_auto.c: -------------------------------------------------------------------------------- 1 | /* Do not edit: automatically built by gen_rec.awk. */ 2 | 3 | #include "db_config.h" 4 | #include "db_int.h" 5 | #include "dbinc/db_page.h" 6 | #include "dbinc/db_dispatch.h" 7 | #include "dbinc/db_am.h" 8 | #include "dbinc_auto/repmgr_auto.h" 9 | 10 | DB_LOG_RECSPEC __repmgr_member_desc[] = { 11 | {LOGREC_ARG, SSZ(__repmgr_member_args, version), "version", "%lu"}, 12 | {LOGREC_ARG, SSZ(__repmgr_member_args, prev_status), "prev_status", "%lu"}, 13 | {LOGREC_ARG, SSZ(__repmgr_member_args, status), "status", "%lu"}, 14 | {LOGREC_DBT, SSZ(__repmgr_member_args, host), "host", ""}, 15 | {LOGREC_ARG, SSZ(__repmgr_member_args, port), "port", "%lu"}, 16 | {LOGREC_Done, 0, "", ""} 17 | }; 18 | /* 19 | * PUBLIC: int __repmgr_init_recover __P((ENV *, DB_DISTAB *)); 20 | */ 21 | int 22 | __repmgr_init_recover(env, dtabp) 23 | ENV *env; 24 | DB_DISTAB *dtabp; 25 | { 26 | int ret; 27 | 28 | if ((ret = __db_add_recovery_int(env, dtabp, 29 | __repmgr_member_recover, DB___repmgr_member)) != 0) 30 | return (ret); 31 | return (0); 32 | } 33 | -------------------------------------------------------------------------------- /src/repmgr/repmgr_autop.c: -------------------------------------------------------------------------------- 1 | /* Do not edit: automatically built by gen_rec.awk. */ 2 | 3 | #include "db_config.h" 4 | 5 | #ifdef HAVE_REPLICATION_THREADS 6 | #include "db_int.h" 7 | #include "dbinc/db_page.h" 8 | #include "dbinc/db_dispatch.h" 9 | #include "dbinc/db_am.h" 10 | #include "dbinc_auto/repmgr_auto.h" 11 | 12 | /* 13 | * PUBLIC: int __repmgr_member_print __P((ENV *, DBT *, DB_LSN *, 14 | * PUBLIC: db_recops, void *)); 15 | */ 16 | int 17 | __repmgr_member_print(env, dbtp, lsnp, notused2, info) 18 | ENV *env; 19 | DBT *dbtp; 20 | DB_LSN *lsnp; 21 | db_recops notused2; 22 | void *info; 23 | { 24 | COMPQUIET(notused2, DB_TXN_PRINT); 25 | 26 | return (__log_print_record(env, dbtp, lsnp, "__repmgr_member", __repmgr_member_desc, info)); 27 | } 28 | 29 | /* 30 | * PUBLIC: int __repmgr_init_print __P((ENV *, DB_DISTAB *)); 31 | */ 32 | int 33 | __repmgr_init_print(env, dtabp) 34 | ENV *env; 35 | DB_DISTAB *dtabp; 36 | { 37 | int ret; 38 | 39 | if ((ret = __db_add_recovery_int(env, dtabp, 40 | __repmgr_member_print, DB___repmgr_member)) != 0) 41 | return (ret); 42 | return (0); 43 | } 44 | #endif /* HAVE_REPLICATION_THREADS */ 45 | -------------------------------------------------------------------------------- /src/repmgr/repmgr_rec.c: -------------------------------------------------------------------------------- 1 | #include "db_config.h" 2 | 3 | #include "db_int.h" 4 | #include "dbinc/db_page.h" 5 | #include "dbinc/db_am.h" 6 | #include "dbinc_auto/repmgr_auto.h" 7 | 8 | /* 9 | * __repmgr_member_recover -- 10 | * Recovery function for member. 11 | * 12 | * PUBLIC: int __repmgr_member_recover 13 | * PUBLIC: __P((ENV *, DBT *, DB_LSN *, db_recops, void *)); 14 | */ 15 | int 16 | __repmgr_member_recover(env, dbtp, lsnp, op, info) 17 | ENV *env; 18 | DBT *dbtp; 19 | DB_LSN *lsnp; 20 | db_recops op; 21 | void *info; 22 | { 23 | __repmgr_member_args *argp; 24 | int ret; 25 | 26 | COMPQUIET(info, NULL); 27 | COMPQUIET(op, DB_TXN_APPLY); 28 | 29 | REC_PRINT(__repmgr_member_print); 30 | REC_NOOP_INTRO(__repmgr_member_read); 31 | 32 | /* 33 | * The annotation log record describes the update in enough detail for 34 | * us to be able to optimize our tracking of it at clients sites. 35 | * However, for now we just simply reread the whole (small) database 36 | * each time, since changes happen so seldom (and we need to have the 37 | * code for reading the whole thing anyway, for other cases). 38 | */ 39 | env->rep_handle->gmdb_dirty = TRUE; 40 | 41 | *lsnp = argp->prev_lsn; 42 | ret = 0; 43 | 44 | REC_NOOP_CLOSE; 45 | } 46 | -------------------------------------------------------------------------------- /test/3n1/README: -------------------------------------------------------------------------------- 1 | https://github.com/ddanderson/libdb-3n 2 | 3 | This code implements the 3n+1 benchmark. A description of the benchmark and results is on the libdb blog here: 4 | http://libdb.wordpress.com/2011/01/31/revving-up-a-benchmark-from-626-to-74000-operations-per-second/ 5 | -------------------------------------------------------------------------------- /test/c/chk.ctests: -------------------------------------------------------------------------------- 1 | #!/bin/sh - 2 | # 3 | # $Id$ 4 | # 5 | # Check to make sure we can run DB 1.85 code. 6 | d=../../ 7 | b=./tmp_build/ 8 | s=$d/src 9 | 10 | mkdir -p $b 11 | 12 | [ -f $d/LICENSE ] || { 13 | echo 'FAIL: Test must be run from scr directory.' 14 | exit 1 15 | } 16 | 17 | nocleanup=0 18 | while [ $# -gt 0 ] 19 | do 20 | case "$1" in 21 | -nocleanup) 22 | nocleanup=1; shift;; 23 | *) 24 | echo "Unrecognized option: $1, ignoring" 25 | shift;; 26 | esac 27 | done 28 | 29 | opts="--enable-compat185 --disable-shared" 30 | echo "Building DB library, this can take a while." 31 | (cd $b && ../../../dist/configure $opts > /dev/null && make libdb.a > /dev/null) || { 32 | echo 'FAIL: unable to build libdb.a' 33 | exit 1 34 | } 35 | 36 | # if compiling on linux blade server, add -pthread on cc 37 | CINC="-I$b -I$s -I$s/dbinc" 38 | [ `uname` = "Linux" ] && CINC="$CINC -pthread" 39 | 40 | for i in `ls test_*.c`; do 41 | 42 | echo "=== Running $i ===" | tee -a compile.out 43 | if cc -g -Wall $CINC $i $b/libdb.a -o t >> compile.out 2>&1; then 44 | : 45 | else 46 | echo "FAIL: unable to compile test program $i" 47 | exit 1 48 | fi 49 | 50 | if ./t; then 51 | : 52 | else 53 | echo "FAIL: test program failed" 54 | exit 1 55 | fi 56 | rm -f ./t 57 | done 58 | 59 | # Cleanup. 60 | # TODO: The test should be consistent, so this cleanup isn't so haphazard. 61 | # Alternatively we could build each test in a sub-dir and cleanup after 62 | # individual runs. 63 | rm a.db __db.* output 64 | rm -rf ./TESTDIR 65 | 66 | if [ nocleanup = 0 ]; then 67 | rm -rf compile.out $b 68 | fi 69 | 70 | exit 0 71 | -------------------------------------------------------------------------------- /test/c/cutest/license.txt: -------------------------------------------------------------------------------- 1 | NOTE 2 | 3 | The license is based on the zlib/libpng license. For more details see 4 | http://www.opensource.org/licenses/zlib-license.html. The intent of the 5 | license is to: 6 | 7 | - keep the license as simple as possible 8 | - encourage the use of CuTest in both free and commercial applications 9 | and libraries 10 | - keep the source code together 11 | - give credit to the CuTest contributors for their work 12 | 13 | If you ship CuTest in source form with your source distribution, the 14 | following license document must be included with it in unaltered form. 15 | If you find CuTest useful we would like to hear about it. 16 | 17 | LICENSE 18 | 19 | Copyright (c) 2003 Asim Jalis 20 | 21 | This software is provided 'as-is', without any express or implied 22 | warranty. In no event will the authors be held liable for any damages 23 | arising from the use of this software. 24 | 25 | Permission is granted to anyone to use this software for any purpose, 26 | including commercial applications, and to alter it and redistribute it 27 | freely, subject to the following restrictions: 28 | 29 | 1. The origin of this software must not be misrepresented; you must not 30 | claim that you wrote the original software. If you use this software in 31 | a product, an acknowledgment in the product documentation would be 32 | appreciated but is not required. 33 | 34 | 2. Altered source versions must be plainly marked as such, and must not 35 | be misrepresented as being the original software. 36 | 37 | 3. This notice may not be removed or altered from any source 38 | distribution. 39 | -------------------------------------------------------------------------------- /test/c/suites/TestEnvMethod.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 2010, 2012 Oracle and/or its affiliates. All rights reserved. 5 | * 6 | * $Id$ 7 | */ 8 | 9 | #include "db.h" 10 | #include "CuTest.h" 11 | #include "test_util.h" 12 | 13 | int TestSetThreadCount(CuTest *ct) { /* SKIP */ 14 | /* Run this test only when hash is supported. */ 15 | #ifdef HAVE_HASH 16 | DB_ENV *dbenv; 17 | DB *db; 18 | 19 | CuAssert(ct, "db_env_create", db_env_create(&dbenv, 0) == 0); 20 | 21 | dbenv->set_errpfx(dbenv, "TestSetThreadCount"); 22 | CuAssert(ct, "set_thread_count", dbenv->set_thread_count(dbenv, 2) == 0); 23 | CuAssert(ct, "env->open", dbenv->open(dbenv, ".", 24 | DB_CREATE | DB_INIT_LOCK | DB_INIT_LOG | DB_INIT_MPOOL | 25 | DB_INIT_TXN | DB_PRIVATE | DB_THREAD, 0) == 0); 26 | 27 | CuAssert(ct, "db_create", db_create(&db, dbenv, 0) == 0); 28 | CuAssert(ct, "DB->open", db->open( 29 | db, NULL, NULL, "TestSetThreadCount", DB_HASH, DB_CREATE, 0) == 0); 30 | 31 | db->close(db, 0); 32 | dbenv->close(dbenv, 0); 33 | #else 34 | printf("TestSetThreadCount is not supported by the build.\n"); 35 | #endif /* HAVE_HASH */ 36 | return (0); 37 | } 38 | -------------------------------------------------------------------------------- /test/cxx/TestConstruct01.testerr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/berkeleydb/libdb/5b7b02ae052442626af54c176335b67ecc613a30/test/cxx/TestConstruct01.testerr -------------------------------------------------------------------------------- /test/cxx/TestConstruct01.testout: -------------------------------------------------------------------------------- 1 | (0/1) construct01 running: 2 | Running test 1: 3 | finished. 4 | Running test 2: 5 | finished. 6 | Running test 3: 7 | finished. 8 | Running test 4: 9 | finished. 10 | Running test 5: 11 | finished. 12 | Running test 6: 13 | finished. 14 | Running test 1: 15 | finished. 16 | Running test 2: 17 | finished. 18 | Running test 3: 19 | finished. 20 | Running test 4: 21 | finished. 22 | Running test 5: 23 | finished. 24 | Running test 6: 25 | finished. 26 | 27 | ALL TESTS SUCCESSFUL 28 | -------------------------------------------------------------------------------- /test/cxx/TestKeyRange.testin: -------------------------------------------------------------------------------- 1 | first line is alphabetically somewhere in the middle. 2 | Blah blah 3 | let's have exactly eight lines of input. 4 | stuff 5 | more stuff 6 | and even more stuff 7 | lastly 8 | but not leastly. 9 | -------------------------------------------------------------------------------- /test/cxx/TestKeyRange.testout: -------------------------------------------------------------------------------- 1 | input> 2 | input> 3 | input> 4 | input> 5 | input> 6 | input> 7 | input> 8 | input> 9 | input>less: 0.375000 10 | equal: 0.125000 11 | greater: 0.500000 12 | Blah blah : halb halB 13 | and even more stuff : ffuts erom neve dna 14 | but not leastly. : .yltsael ton tub 15 | first line is alphabetically somewhere in the middle. : .elddim eht ni erehwemos yllacitebahpla si enil tsrif 16 | lastly : yltsal 17 | let's have exactly eight lines of input. : .tupni fo senil thgie yltcaxe evah s'tel 18 | more stuff : ffuts erom 19 | stuff : ffuts 20 | -------------------------------------------------------------------------------- /test/cxx/TestLogc.testout: -------------------------------------------------------------------------------- 1 | TestLogc done. 2 | -------------------------------------------------------------------------------- /test/cxx/TestSimpleAccess.testout: -------------------------------------------------------------------------------- 1 | got data: data 2 | get using bad key: BDB0073 DB_NOTFOUND: No matching key/data pair found 3 | finished test 4 | -------------------------------------------------------------------------------- /test/cxx/TestTruncate.testout: -------------------------------------------------------------------------------- 1 | got data: data 2 | get using bad key: BDB0073 DB_NOTFOUND: No matching key/data pair found 3 | truncating data... 4 | truncate returns 1 5 | after truncate get: BDB0073 DB_NOTFOUND: No matching key/data pair found 6 | finished test 7 | -------------------------------------------------------------------------------- /test/cxx/ignore: -------------------------------------------------------------------------------- 1 | # 2 | # $Id$ 3 | # 4 | # A list of tests to ignore 5 | -------------------------------------------------------------------------------- /test/cxx/testall: -------------------------------------------------------------------------------- 1 | #!/bin/sh - 2 | # $Id$ 3 | # 4 | # Run all the C++ regression tests 5 | 6 | ecode=0 7 | prefixarg="" 8 | stdinarg="" 9 | while : 10 | do 11 | case "$1" in 12 | --prefix=* ) 13 | prefixarg="$1"; shift;; 14 | --stdin ) 15 | stdinarg="$1"; shift;; 16 | * ) 17 | break 18 | esac 19 | done 20 | files="`find . -name \*.cpp -print`" 21 | for file in $files; do 22 | name=`echo $file | sed -e 's:^\./::' -e 's/\.cpp$//'` 23 | if grep $name ignore > /dev/null; then 24 | echo " **** cxx test $name ignored" 25 | else 26 | echo " ==== cxx test $name" 27 | if ! sh ./testone $prefixarg $stdinarg $name; then 28 | ecode=1 29 | fi 30 | fi 31 | done 32 | exit $ecode 33 | -------------------------------------------------------------------------------- /test/micro/report.awk: -------------------------------------------------------------------------------- 1 | # $Id$ 2 | 3 | /^[^#]/ { 4 | total[$1] += $2 5 | sum[$1] += $2 * $2 6 | ++count[$1]; 7 | } 8 | END { 9 | # Compute the average, find the maximum. 10 | for (i in total) { 11 | avg[i] = total[i] / count[i]; 12 | if (max < avg[i]) 13 | max = avg[i] 14 | } 15 | 16 | for (i in total) { 17 | # Calculate variance by raw score method. 18 | var = (sum[i] - ((total[i] * total[i]) / count[i])) / count[i]; 19 | 20 | # The standard deviation is the square root of the variance. 21 | stdv = sqrt(var); 22 | 23 | # Display the release value, the average score, and run count. 24 | printf("%s:%.2f:%d:", i, avg[i], count[i]); 25 | 26 | # If this run wasn't the fastest, display the percent by which 27 | # this run was slower. 28 | if (max != avg[i]) 29 | printf("%.0f%%", ((max - avg[i]) / max) * 100); 30 | 31 | printf(":"); 32 | 33 | # If there was more than a single run, display the relative 34 | # standard deviation. 35 | if (count[i] > 1) 36 | printf("%.0f%%", stdv * 100 / avg[i]); 37 | 38 | printf("\n"); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /test/tcl/bigfile002.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 2001, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # TEST bigfile002 8 | # TEST This one should be faster and not require so much disk space, 9 | # TEST although it doesn't test as extensively. Create an mpool file 10 | # TEST with 1K pages. Dirty page 6000000. Sync. 11 | proc bigfile002 { args } { 12 | source ./include.tcl 13 | global is_fat32 14 | if { $is_fat32 } { 15 | puts "Skipping bigfile002 for FAT32 file system." 16 | return 17 | } 18 | puts "Bigfile002: Creating large, sparse file through mpool..." 19 | flush stdout 20 | 21 | env_cleanup $testdir 22 | 23 | # Create env. 24 | set env [berkdb_env -create -home $testdir] 25 | error_check_good valid_env [is_valid_env $env] TRUE 26 | 27 | # Create the file. 28 | set name big002.file 29 | set file [$env mpool -create -pagesize 1024 $name] 30 | 31 | # Dirty page 6000000 32 | set pg [$file get -create 6000000] 33 | error_check_good pg_init [$pg init A] 0 34 | error_check_good pg_set [$pg is_setto A] 1 35 | 36 | # Put page back. 37 | error_check_good pg_put [$pg put] 0 38 | 39 | # Fsync. 40 | error_check_good fsync [$file fsync] 0 41 | 42 | # Close. 43 | error_check_good fclose [$file close] 0 44 | error_check_good env_close [$env close] 0 45 | } 46 | -------------------------------------------------------------------------------- /test/tcl/byteorder.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # Byte Order Test 8 | # Use existing tests and run with both byte orders. 9 | proc byteorder { method {nentries 1000} } { 10 | source ./include.tcl 11 | puts "Byteorder: $method $nentries" 12 | 13 | eval {test001 $method $nentries 0 0 "001" -lorder 1234} 14 | eval {verify_dir $testdir} 15 | eval {test001 $method $nentries 0 0 "001" -lorder 4321} 16 | eval {verify_dir $testdir} 17 | eval {test003 $method -lorder 1234} 18 | eval {verify_dir $testdir} 19 | eval {test003 $method -lorder 4321} 20 | eval {verify_dir $testdir} 21 | eval {test010 $method $nentries 5 "010" -lorder 1234} 22 | eval {verify_dir $testdir} 23 | eval {test010 $method $nentries 5 "010" -lorder 4321} 24 | eval {verify_dir $testdir} 25 | eval {test011 $method $nentries 5 "011" -lorder 1234} 26 | eval {verify_dir $testdir} 27 | eval {test011 $method $nentries 5 "011" -lorder 4321} 28 | eval {verify_dir $testdir} 29 | eval {test018 $method $nentries -lorder 1234} 30 | eval {verify_dir $testdir} 31 | eval {test018 $method $nentries -lorder 4321} 32 | eval {verify_dir $testdir} 33 | } 34 | -------------------------------------------------------------------------------- /test/tcl/ddscript.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # Deadlock detector script tester. 8 | # Usage: ddscript dir test lockerid objid numprocs 9 | # dir: DBHOME directory 10 | # test: Which test to run 11 | # lockerid: Lock id for this locker 12 | # objid: Object id to lock. 13 | # numprocs: Total number of processes running 14 | 15 | source ./include.tcl 16 | source $test_path/test.tcl 17 | source $test_path/testutils.tcl 18 | 19 | set usage "ddscript dir test lockerid objid numprocs" 20 | 21 | # Verify usage 22 | if { $argc != 5 } { 23 | puts stderr "FAIL:[timestamp] Usage: $usage" 24 | exit 25 | } 26 | 27 | # Initialize arguments 28 | set dir [lindex $argv 0] 29 | set test [ lindex $argv 1 ] 30 | set lockerid [ lindex $argv 2 ] 31 | set objid [ lindex $argv 3 ] 32 | set numprocs [ lindex $argv 4 ] 33 | 34 | set myenv [berkdb_env -lock -home $dir -create -mode 0644 ] 35 | error_check_bad lock_open $myenv NULL 36 | error_check_good lock_open [is_substr $myenv "env"] 1 37 | 38 | puts [eval $test $myenv $lockerid $objid $numprocs] 39 | 40 | error_check_good lock_id_free [$myenv lock_id_free $lockerid] 0 41 | error_check_good envclose [$myenv close] 0 42 | 43 | exit 44 | -------------------------------------------------------------------------------- /test/tcl/dead006.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # TEST dead006 8 | # TEST use timeouts rather than the normal dd algorithm. 9 | proc dead006 { { procs "2 4 10" } {tests "ring clump" } \ 10 | {timeout 1000} {tnum 006} } { 11 | source ./include.tcl 12 | 13 | dead001 $procs $tests $timeout $tnum 14 | dead002 $procs $tests $timeout $tnum 15 | } 16 | -------------------------------------------------------------------------------- /test/tcl/dead007.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # TEST dead007 8 | # TEST Tests for locker and txn id wraparound. 9 | proc dead007 { {tnum "007"} } { 10 | source ./include.tcl 11 | global lock_curid 12 | global lock_maxid 13 | 14 | set save_curid $lock_curid 15 | set save_maxid $lock_maxid 16 | puts "Dead$tnum.a -- wrap around" 17 | set lock_curid [expr $lock_maxid - 2] 18 | dead001 "2 10" "ring clump" "0" $tnum 19 | ## Oldest/youngest breaks when the id wraps 20 | # dead003 "4 10" 21 | dead004 $tnum 22 | 23 | puts "Dead$tnum.b -- extend space" 24 | set lock_maxid [expr $lock_maxid - 3] 25 | set lock_curid [expr $lock_maxid - 1] 26 | dead001 "4 10" "ring clump" "0" $tnum 27 | ## Oldest/youngest breaks when the id wraps 28 | # dead003 "10" 29 | dead004 $tnum 30 | 31 | set lock_curid $save_curid 32 | set lock_maxid $save_maxid 33 | # Return the empty string so we don't return lock_maxid. 34 | return "" 35 | } 36 | -------------------------------------------------------------------------------- /test/tcl/dead008.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # TEST dead008 8 | # TEST Run dead001 deadlock test using priorities 9 | proc dead008 { {tnum "008"} } { 10 | source ./include.tcl 11 | dead001 "2 4 10" "ring clump" "0" $tnum 1 12 | 13 | } 14 | -------------------------------------------------------------------------------- /test/tcl/dead009.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # TEST dead009 8 | # TEST Run dead002 deadlock test using priorities 9 | proc dead009 { {tnum "009"} } { 10 | source ./include.tcl 11 | dead002 "2 4 10" "ring clump" "0" $tnum 1 12 | 13 | } 14 | -------------------------------------------------------------------------------- /test/tcl/dead010.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # TEST dead010 8 | # TEST 9 | # TEST Same test as dead003, except the actual youngest and oldest will have 10 | # TEST higher priorities. Verify that the oldest/youngest of the lower 11 | # TEST priority lockers gets killed. Doesn't apply to 2 procs. 12 | proc dead010 { {procs "4 10"} {tests "ring clump"} {tnum "010"} } { 13 | source ./include.tcl 14 | 15 | dead003 $procs $tests $tnum 1 16 | } 17 | -------------------------------------------------------------------------------- /test/tcl/dead011.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # TEST dead011 8 | # TEST Test out the minlocks, maxlocks, and minwrites options 9 | # TEST to the deadlock detector when priorities are used. 10 | proc dead011 { { procs "4 6 10" } \ 11 | {tests "maxlocks maxwrites minlocks minwrites" } { tnum "011" } } { 12 | source ./include.tcl 13 | 14 | dead005 $procs $tests $tnum 1 15 | } 16 | -------------------------------------------------------------------------------- /test/tcl/env007script.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 2009, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # env007script - for use with env007. 6 | # Usage: configarg configval getter getval 7 | # 8 | 9 | source ./include.tcl 10 | 11 | set usage "env007script configarg configval getter getval" 12 | 13 | # Verify usage 14 | if { $argc != 4 } { 15 | puts stderr "FAIL:[timestamp] Usage: $usage" 16 | exit 17 | } 18 | 19 | # Initialize arguments 20 | set configarg [lindex $argv 0] 21 | set configval [lindex $argv 1] 22 | set getter [lindex $argv 2] 23 | set getval [lindex $argv 3] 24 | 25 | set e "berkdb_env_noerr -create -mode 0644 -home $testdir -txn" 26 | 27 | env007_make_config $configarg $configval 28 | 29 | # Verify using config file 30 | set dbenv [eval $e] 31 | error_check_good envvalid:1 [is_valid_env $dbenv] TRUE 32 | set db [berkdb_open_noerr -create -env $dbenv -btree env007script.db] 33 | error_check_good dbvalid:1 [is_valid_db $db] TRUE 34 | error_check_good dbclose [$db close] 0 35 | error_check_good getter:1 [eval $dbenv $getter] $getval 36 | error_check_good envclose:1 [$dbenv close] 0 37 | 38 | -------------------------------------------------------------------------------- /test/tcl/env010.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 1999, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # TEST env010 8 | # TEST Run recovery in an empty directory, and then make sure we can still 9 | # TEST create a database in that directory. 10 | proc env010 { } { 11 | source ./include.tcl 12 | 13 | puts "Env010: Test of recovery in an empty directory." 14 | 15 | # Create a new directory used only for this test 16 | 17 | if { [file exists $testdir/EMPTYDIR] != 1 } { 18 | file mkdir $testdir/EMPTYDIR 19 | } else { 20 | puts "\nDirectory already exists." 21 | } 22 | 23 | # Do the test twice, for regular recovery and catastrophic 24 | # Open environment and recover, but don't create a database 25 | 26 | foreach rmethod {recover recover_fatal} { 27 | 28 | puts "\tEnv010: Creating env for $rmethod test." 29 | env_cleanup $testdir/EMPTYDIR 30 | set e [berkdb_env \ 31 | -create -home $testdir/EMPTYDIR -txn -$rmethod] 32 | error_check_good dbenv [is_valid_env $e] TRUE 33 | 34 | # Open and close a database 35 | # The method doesn't matter, so picked btree arbitrarily 36 | 37 | set db [eval {berkdb_open -env $e \ 38 | -btree -create -mode 0644} ] 39 | error_check_good dbopen [is_valid_db $db] TRUE 40 | error_check_good db_close [$db close] 0 41 | 42 | # Close environment 43 | 44 | error_check_good envclose [$e close] 0 45 | error_check_good berkdb:envremove \ 46 | [berkdb envremove -home $testdir/EMPTYDIR] 0 47 | } 48 | puts "\tEnv010 complete." 49 | } 50 | -------------------------------------------------------------------------------- /test/tcl/env011.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 1999, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # TEST env011 8 | # TEST Run with region overwrite flag. 9 | proc env011 { } { 10 | source ./include.tcl 11 | 12 | puts "Env011: Test of region overwriting." 13 | env_cleanup $testdir 14 | 15 | puts "\tEnv011: Creating/closing env for open test." 16 | set e [berkdb_env -create -overwrite -home $testdir -txn] 17 | error_check_good dbenv [is_valid_env $e] TRUE 18 | set db [eval \ 19 | {berkdb_open -auto_commit -env $e -btree -create -mode 0644} ] 20 | error_check_good dbopen [is_valid_db $db] TRUE 21 | set ret [eval {$db put} "aaa" "data"] 22 | error_check_good put $ret 0 23 | set ret [eval {$db put} "bbb" "data"] 24 | error_check_good put $ret 0 25 | error_check_good db_close [$db close] 0 26 | error_check_good envclose [$e close] 0 27 | 28 | puts "\tEnv011: Opening the environment with overwrite set." 29 | set e [berkdb_env -create -overwrite -home $testdir -txn -recover] 30 | error_check_good dbenv [is_valid_env $e] TRUE 31 | error_check_good envclose [$e close] 0 32 | 33 | puts "\tEnv011: Removing the environment with overwrite set." 34 | error_check_good berkdb:envremove \ 35 | [berkdb envremove -home $testdir -overwrite] 0 36 | 37 | puts "\tEnv011 complete." 38 | } 39 | -------------------------------------------------------------------------------- /test/tcl/fop007.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 2005, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # TEST fop007 8 | # TEST Test file system operations on named in-memory databases. 9 | # TEST Combine two ops in one transaction. 10 | proc fop007 { method args } { 11 | 12 | # Queue extents are not allowed with in-memory databases. 13 | if { [is_queueext $method] == 1 } { 14 | puts "Skipping fop007 for method $method." 15 | return 16 | } 17 | eval {fop001 $method 1 0} $args 18 | } 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /test/tcl/fop008.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 2005, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # TEST fop008 8 | # TEST Test file system operations on named in-memory databases. 9 | # TEST Combine two ops in one transaction. 10 | proc fop008 { method args } { 11 | eval {fop006 $method 1 0} $args 12 | } 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /test/tcl/fop009.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # TEST fop009 8 | # TEST Test file system operations in child transactions. 9 | # TEST Combine two ops in one child transaction. 10 | proc fop009 { method args } { 11 | 12 | # Run for btree only to cut down on redundant testing. 13 | if { [is_btree $method] == 0 } { 14 | puts "Skipping fop009 for method $method" 15 | return 16 | } 17 | 18 | eval {fop001 $method 0 1} $args 19 | } 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /test/tcl/fop010.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # TEST fop010 8 | # TEST Test file system operations in child transactions. 9 | # TEST Two ops, each in its own child txn. 10 | proc fop010 { method args } { 11 | 12 | # Run for btree only to cut down on redundant testing. 13 | if { [is_btree $method] == 0 } { 14 | puts "Skipping fop010 for method $method" 15 | return 16 | } 17 | 18 | eval {fop006 $method 0 1} $args 19 | } 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /test/tcl/fop011.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # TEST fop011 8 | # TEST Test file system operations in child transactions. 9 | # TEST Combine two ops in one child transaction, with in-emory 10 | # TEST databases. 11 | proc fop011 { method args } { 12 | 13 | # Run for btree only to cut down on redundant testing. 14 | if { [is_btree $method] == 0 } { 15 | puts "Skipping fop011 for method $method" 16 | return 17 | } 18 | 19 | eval {fop001 $method 1 1} $args 20 | } 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /test/tcl/fop012.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # TEST fop012 8 | # TEST Test file system operations in child transactions. 9 | # TEST Two ops, each in its own child txn, with in-memory dbs. 10 | proc fop012 { method args } { 11 | 12 | # Run for btree only to cut down on redundant testing. 13 | if { [is_btree $method] == 0 } { 14 | puts "Skipping fop012 for method $method" 15 | return 16 | } 17 | 18 | eval {fop006 $method 1 1} $args 19 | } 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /test/tcl/hsearch.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # Historic Hsearch interface test. 8 | # Use the first 1000 entries from the dictionary. 9 | # Insert each with self as key and data; retrieve each. 10 | # After all are entered, retrieve all; compare output to original. 11 | # Then reopen the file, re-retrieve everything. 12 | # Finally, delete everything. 13 | proc hsearch { { nentries 1000 } } { 14 | source ./include.tcl 15 | 16 | puts "HSEARCH interfaces test: $nentries" 17 | 18 | # Create the database and open the dictionary 19 | set t1 $testdir/t1 20 | set t2 $testdir/t2 21 | set t3 $testdir/t3 22 | cleanup $testdir NULL 23 | 24 | error_check_good hcreate [berkdb hcreate $nentries] 0 25 | set did [open $dict] 26 | set count 0 27 | 28 | puts "\tHSEARCH.a: put/get loop" 29 | # Here is the loop where we put and get each key/data pair 30 | while { [gets $did str] != -1 && $count < $nentries } { 31 | set ret [berkdb hsearch $str $str enter] 32 | error_check_good hsearch:enter $ret 0 33 | 34 | set d [berkdb hsearch $str 0 find] 35 | error_check_good hsearch:find $d $str 36 | incr count 37 | } 38 | close $did 39 | 40 | puts "\tHSEARCH.b: re-get loop" 41 | set did [open $dict] 42 | # Here is the loop where we retrieve each key 43 | while { [gets $did str] != -1 && $count < $nentries } { 44 | set d [berkdb hsearch $str 0 find] 45 | error_check_good hsearch:find $d $str 46 | incr count 47 | } 48 | close $did 49 | error_check_good hdestroy [berkdb hdestroy] 0 50 | } 51 | -------------------------------------------------------------------------------- /test/tcl/include.tcl: -------------------------------------------------------------------------------- 1 | # Automatically built by dist/s_test; may require local editing. 2 | 3 | set tclsh_path @TCL_TCLSH@ 4 | set tcllib .libs/libdb_tcl-@DB_VERSION_MAJOR@.@DB_VERSION_MINOR@@LIBTSO_MODSUFFIX@ 5 | 6 | set src_root @srcdir@/.. 7 | set test_path @srcdir@/../test/tcl 8 | set je_root @srcdir@/../../je 9 | set tcl_utils @srcdir@/../test/tcl_utils 10 | 11 | global testdir 12 | set testdir ./TESTDIR 13 | 14 | global dict 15 | global util_path 16 | 17 | global is_freebsd_test 18 | global is_hp_test 19 | global is_linux_test 20 | global is_osx_test 21 | global is_qnx_test 22 | global is_sunos_test 23 | global is_windows_test 24 | global is_windows9x_test 25 | 26 | global valid_methods 27 | global checking_valid_methods 28 | global test_recopts 29 | 30 | set KILL "@KILL@" 31 | -------------------------------------------------------------------------------- /test/tcl/lock004.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # TEST lock004 8 | # TEST Test locker ids wraping around. 9 | 10 | proc lock004 {} { 11 | source ./include.tcl 12 | global lock_curid 13 | global lock_maxid 14 | 15 | set save_curid $lock_curid 16 | set save_maxid $lock_maxid 17 | 18 | set lock_curid [expr $lock_maxid - 1] 19 | puts "Lock004: Locker id wraparound test" 20 | puts "\tLock004.a: repeat lock001-lock003 with wraparound lockids" 21 | 22 | lock001 23 | lock002 24 | lock003 25 | 26 | set lock_curid $save_curid 27 | set lock_maxid $save_maxid 28 | } 29 | -------------------------------------------------------------------------------- /test/tcl/log008.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 2005, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # TEST log008 8 | # TEST Test what happens if a txn_ckp record falls into a 9 | # TEST different log file than the DBREG_CKP records generated 10 | # TEST by the same checkpoint. 11 | 12 | proc log008 { { nhandles 100 } args } { 13 | source ./include.tcl 14 | set tnum "008" 15 | 16 | puts "Log$tnum: Checkpoint test with records spanning log files." 17 | env_cleanup $testdir 18 | 19 | # Set up env command for use later. 20 | set envcmd "berkdb_env -create -txn -home $testdir" 21 | 22 | # Start up a child process which will open a bunch of handles 23 | # on a database and write to it, running until it creates a 24 | # checkpoint with records spanning two log files. 25 | puts "\tLog$tnum.a: Spawning child tclsh." 26 | set pid [exec $tclsh_path $test_path/wrap.tcl \ 27 | log008script.tcl $testdir/log008script.log $nhandles &] 28 | 29 | watch_procs $pid 3 30 | 31 | puts "\tLog$tnum.b: Child is done." 32 | 33 | # Join the env with recovery. This ought to work. 34 | puts "\tLog$tnum.c: Join abandoned child env with recovery." 35 | set env [eval $envcmd -recover] 36 | 37 | # Clean up. 38 | error_check_good env_close [$env close] 0 39 | 40 | # Check log file for failures. 41 | set errstrings [eval findfail $testdir/log008script.log] 42 | foreach str $errstrings { 43 | puts "FAIL: error message in log008 log file: $str" 44 | } 45 | } 46 | 47 | -------------------------------------------------------------------------------- /test/tcl/logtrack.list: -------------------------------------------------------------------------------- 1 | PREFIX __crdel 2 | BEGIN metasub 42 142 3 | BEGIN inmem_create 44 138 4 | BEGIN inmem_rename 44 139 5 | BEGIN inmem_remove 44 140 6 | PREFIX __db 7 | BEGIN addrem 50 41 8 | BEGIN big 50 43 9 | BEGIN ovref 42 44 10 | BEGIN debug 42 47 11 | BEGIN noop 42 48 12 | BEGIN pg_alloc 43 49 13 | BEGIN pg_free 43 50 14 | BEGIN cksum 42 51 15 | BEGIN pg_freedata 43 52 16 | BEGIN pg_init 43 60 17 | BEGIN pg_trunc 50 66 18 | BEGIN realloc 50 36 19 | BEGIN relink 44 147 20 | BEGIN merge 47 148 21 | BEGIN pgno 44 149 22 | PREFIX __dbreg 23 | BEGIN register 42 2 24 | PREFIX __bam 25 | BEGIN split 50 62 26 | BEGIN rsplit 42 63 27 | BEGIN adj 42 55 28 | BEGIN cadjust 42 56 29 | BEGIN cdel 42 57 30 | BEGIN repl 42 58 31 | BEGIN irep 50 67 32 | BEGIN root 42 59 33 | BEGIN curadj 42 64 34 | BEGIN rcuradj 42 65 35 | PREFIX __fop 36 | BEGIN create 48 143 37 | BEGIN remove 42 144 38 | BEGIN write 48 145 39 | BEGIN rename 48 146 40 | BEGIN file_remove 42 141 41 | PREFIX __ham 42 | BEGIN insdel 50 21 43 | BEGIN newpage 42 22 44 | BEGIN splitdata 42 24 45 | BEGIN replace 50 25 46 | BEGIN copypage 42 28 47 | BEGIN metagroup 43 29 48 | BEGIN groupalloc 43 32 49 | BEGIN changeslot 50 35 50 | BEGIN contract 50 37 51 | BEGIN curadj 42 33 52 | BEGIN chgpg 42 34 53 | PREFIX __heap 54 | BEGIN addrem 49 151 55 | BEGIN pg_alloc 49 152 56 | PREFIX __qam 57 | BEGIN incfirst 42 84 58 | BEGIN mvptr 42 85 59 | BEGIN del 42 79 60 | BEGIN add 42 80 61 | BEGIN delext 42 83 62 | PREFIX __txn 63 | BEGIN regop 44 10 64 | BEGIN ckp 43 11 65 | BEGIN child 42 12 66 | BEGIN prepare 48 13 67 | BEGIN recycle 42 14 68 | -------------------------------------------------------------------------------- /test/tcl/mut002script.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 2009, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # Mut002script: for use with mut002, a 2-process mutex test. 8 | # Usage: mut002script testdir 9 | # testdir: directory containing the env we are joining. 10 | # mutex: id of mutex 11 | 12 | source ./include.tcl 13 | 14 | set usage "mut002script testdir mutex" 15 | 16 | # Verify usage 17 | if { $argc != 2 } { 18 | puts stderr "FAIL:[timestamp] Usage: $usage" 19 | exit 20 | } 21 | 22 | # Initialize arguments. 23 | set testdir [ lindex $argv 0 ] 24 | set mutex [ lindex $argv 1 ] 25 | 26 | # Open environment. 27 | if {[catch {eval {berkdb_env} -create -home $testdir } dbenv]} { 28 | puts "FAIL: opening env returned $dbenv" 29 | } 30 | error_check_good envopen [is_valid_env $dbenv] TRUE 31 | 32 | # Pause for a while to let the original process block. 33 | tclsleep 10 34 | 35 | # Unlock the mutex and let the original process proceed. 36 | $dbenv mutex_unlock $mutex 37 | 38 | # Clean up. 39 | error_check_good env_close [$dbenv close] 0 40 | -------------------------------------------------------------------------------- /test/tcl/mut003.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 2009, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # TEST mut003 8 | # TEST Try doing mutex operations out of order. Make sure 9 | # TEST we get appropriate errors. 10 | 11 | proc mut003 { } { 12 | source ./include.tcl 13 | env_cleanup $testdir 14 | 15 | puts "Mut003: Out of order mutex operations." 16 | 17 | # Allocate a mutex. Try to unlock it before it's locked. 18 | puts "\tMut003.a: Try to unlock a mutex that's not locked." 19 | set env [berkdb_env_noerr -create -home $testdir] 20 | set mutex [$env mutex] 21 | catch { $env mutex_unlock $mutex } res 22 | error_check_good \ 23 | already_unlocked [is_substr $res "lock already unlocked"] 1 24 | env_cleanup $testdir 25 | 26 | # Allocate and lock a mutex. Try to unlock it twice. 27 | puts "\tMut003.b: Try to unlock a mutex twice." 28 | set env [berkdb_env_noerr -create -home $testdir] 29 | set mutex [$env mutex] 30 | error_check_good mutex_lock [$env mutex_lock $mutex] 0 31 | error_check_good mutex_unlock [$env mutex_unlock $mutex] 0 32 | catch { $env mutex_unlock $mutex } res 33 | error_check_good \ 34 | already_unlocked [is_substr $res "lock already unlocked"] 1 35 | env_cleanup $testdir 36 | 37 | } 38 | 39 | -------------------------------------------------------------------------------- /test/tcl/recdscript.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # Recovery txn prepare script 8 | # Usage: recdscript op dir envcmd dbfile cmd 9 | # op: primary txn operation 10 | # dir: test directory 11 | # envcmd: command to open env 12 | # dbfile: name of database file 13 | # gidf: name of global id file 14 | # cmd: db command to execute 15 | 16 | source ./include.tcl 17 | source $test_path/test.tcl 18 | 19 | set usage "recdscript op dir envcmd dbfile gidfile cmd" 20 | 21 | # Verify usage 22 | if { $argc < 6 } { 23 | puts stderr "FAIL:[timestamp] Usage: $usage" 24 | exit 25 | } 26 | 27 | # Initialize arguments 28 | set op [ lindex $argv 0 ] 29 | set dir [ lindex $argv 1 ] 30 | set envcmd [ lindex $argv 2 ] 31 | set dbfile [ lindex $argv 3 ] 32 | set gidfile [ lindex $argv 4 ] 33 | set cmd [ lindex $argv 5 ] 34 | set args [ lindex $argv 6 ] 35 | 36 | eval {op_recover_prep $op $dir $envcmd $dbfile $gidfile $cmd} $args 37 | flush stdout 38 | -------------------------------------------------------------------------------- /test/tcl/repmgr028script.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 2009, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # Repmgr028 script - subordinate repmgr processes and dynamic role changes 6 | 7 | source ./include.tcl 8 | source $test_path/test.tcl 9 | 10 | # Make sure a subordinate process is not allowed to set the ELECTIONS config. 11 | # 12 | set dbenv [berkdb_env_noerr -thread -home $testdir/SITE_A -txn -rep] 13 | $dbenv repmgr -start elect 14 | set ret [catch {$dbenv rep_config {mgrelections off}} result] 15 | error_check_bad role_chg_attempt $ret 0 16 | $dbenv close 17 | 18 | puts "OK" 19 | -------------------------------------------------------------------------------- /test/tcl/repmgr029script.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 2010, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | 7 | source ./include.tcl 8 | source $test_path/test.tcl 9 | source $test_path/testutils.tcl 10 | source $test_path/reputils.tcl 11 | 12 | set dirC [lindex $argv 0] 13 | set portC [lindex $argv 1] 14 | set rv [lindex $argv 2] 15 | 16 | proc in_sync_state { d } { 17 | global util_path 18 | set stat [exec $util_path/db_stat -N -r -R A -h $d] 19 | puts "stat is $stat" 20 | set in_page [is_substr $stat "SYNC_PAGE"] 21 | puts "value is $in_page" 22 | return $in_page 23 | } 24 | 25 | puts "Start site C" 26 | set envC [berkdb env -create -errpfx C -home $dirC -txn -rep -thread \ 27 | -recover -verbose [list rep $rv]] 28 | $envC repmgr -local [list 127.0.0.1 $portC] -start elect 29 | 30 | puts "Wait until it gets into SYNC_PAGES state" 31 | while {![in_sync_state $dirC]} { 32 | tclsleep 1 33 | } 34 | -------------------------------------------------------------------------------- /test/tcl/repmgr029script2.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | 7 | source ./include.tcl 8 | source $test_path/test.tcl 9 | source $test_path/testutils.tcl 10 | source $test_path/reputils.tcl 11 | 12 | set dirB [lindex $argv 0] 13 | set portB [lindex $argv 1] 14 | set dirA [lindex $argv 2] 15 | set portA [lindex $argv 3] 16 | 17 | puts "Repmgr029script2: Open env of A." 18 | set ma_cmd "berkdb_env -home $dirA -txn -thread" 19 | set envA [eval $ma_cmd] 20 | error_check_good script_env_open [is_valid_env $envA] TRUE 21 | 22 | puts "Repmgr029script2: Wait until there is an active txn" 23 | set maxcount 100 24 | for { set count 0 } { $count < $maxcount } { incr count } { 25 | set active_txn_1 [stat_field $envA txn_stat "Number active txns"] 26 | if { $active_txn_1 > 0 } { 27 | break 28 | } else { 29 | tclsleep 1 30 | } 31 | } 32 | error_check_good a_txn_A_1 $active_txn_1 1 33 | 34 | puts "Repmgr029script2: Start up B. It finishes when the txn has been aborted." 35 | set envB [berkdb env -create -errpfx B -home $dirB -txn -rep -thread] 36 | $envB repmgr -local [list 127.0.0.1 $portB] -remote [list 127.0.0.1 $portA] \ 37 | -start client 38 | await_startup_done $envB 39 | error_check_good a_txn_A_0 [stat_field $envA txn_stat "Number active txns"] 0 40 | 41 | puts "Repmgr029script2: Check gmdb at site B" 42 | error_check_good nsites_B [$envB rep_get_nsites] 2 43 | 44 | error_check_good client_close [$envB close] 0 45 | -------------------------------------------------------------------------------- /test/tcl/rsrc004.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 2001, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # TEST rsrc004 8 | # TEST Recno backing file test for EOF-terminated records. 9 | proc rsrc004 { } { 10 | source ./include.tcl 11 | 12 | foreach isfixed { 0 1 } { 13 | cleanup $testdir NULL 14 | 15 | # Create the backing text file. 16 | set oid1 [open $testdir/rsrc.txt w] 17 | if { $isfixed == 1 } { 18 | puts -nonewline $oid1 "record 1xxx" 19 | puts -nonewline $oid1 "record 2xxx" 20 | } else { 21 | puts $oid1 "record 1xxx" 22 | puts $oid1 "record 2xxx" 23 | } 24 | puts -nonewline $oid1 "record 3" 25 | close $oid1 26 | 27 | set args "-create -mode 0644 -recno -source $testdir/rsrc.txt" 28 | if { $isfixed == 1 } { 29 | append args " -len [string length "record 1xxx"]" 30 | set match "record 3 " 31 | puts "Rsrc004: EOF-terminated recs: fixed length" 32 | } else { 33 | puts "Rsrc004: EOF-terminated recs: variable length" 34 | set match "record 3" 35 | } 36 | 37 | puts "\tRsrc004.a: Read file, verify correctness." 38 | set db [eval berkdb_open $args "$testdir/rsrc004.db"] 39 | error_check_good dbopen [is_valid_db $db] TRUE 40 | 41 | # Read the last record 42 | set dbc [eval {$db cursor} ""] 43 | error_check_good db_cursor [is_valid_cursor $dbc $db] TRUE 44 | 45 | set rec [$dbc get -last] 46 | error_check_good get_last $rec [list [list 3 $match]] 47 | 48 | error_check_good dbc_close [$dbc close] 0 49 | error_check_good db_close [$db close] 0 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /test/tcl/sdbscript.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 1999, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # Usage: subdbscript testfile subdbnumber factor 8 | # testfile: name of DB itself 9 | # subdbnumber: n, subdb indicator, of form sub$n.db 10 | # factor: Delete over factor'th + n'th from my subdb. 11 | # 12 | # I.e. if factor is 10, and n is 0, remove entries, 0, 10, 20, ... 13 | # if factor is 10 and n is 1, remove entries 1, 11, 21, ... 14 | source ./include.tcl 15 | source $test_path/test.tcl 16 | 17 | set usage "subdbscript testfile subdbnumber factor" 18 | 19 | # Verify usage 20 | if { $argc != 3 } { 21 | puts stderr "FAIL:[timestamp] Usage: $usage" 22 | exit 23 | } 24 | 25 | # Initialize arguments 26 | set testfile [lindex $argv 0] 27 | set n [ lindex $argv 1 ] 28 | set factor [ lindex $argv 2 ] 29 | 30 | set db [berkdb_open -unknown $testfile sub$n.db] 31 | error_check_good db_open [is_valid_db $db] TRUE 32 | 33 | set dbc [$db cursor] 34 | error_check_good db_cursor [is_valid_cursor $dbc $db] TRUE 35 | set i 1 36 | for {set d [$dbc get -first]} {[llength $d] != 0} {set d [$dbc get -next]} { 37 | set x [expr $i - $n] 38 | if { $x >= 0 && [expr $x % $factor] == 0 } { 39 | puts "Deleting $d" 40 | error_check_good dbc_del [$dbc del] 0 41 | } 42 | incr i 43 | } 44 | error_check_good db_close [$db close] 0 45 | 46 | exit 47 | -------------------------------------------------------------------------------- /test/tcl/test005.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # TEST test005 8 | # TEST Small keys/medium data 9 | # TEST Put/get per key 10 | # TEST Close, reopen 11 | # TEST Sequential (cursor) get/delete 12 | # TEST 13 | # TEST Check that cursor operations work. Create a database; close 14 | # TEST it and reopen it. Then read through the database sequentially 15 | # TEST using cursors and delete each element. 16 | proc test005 { method {nentries 10000} args } { 17 | eval {test004 $method $nentries "005" 0} $args 18 | } 19 | -------------------------------------------------------------------------------- /test/tcl/test007.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # TEST test007 8 | # TEST Small keys/medium data 9 | # TEST Put/get per key 10 | # TEST Close, reopen 11 | # TEST Keyed delete 12 | # TEST 13 | # TEST Check that delete operations work. Create a database; close 14 | # TEST database and reopen it. Then issues delete by key for each 15 | # TEST entry. (Test006 plus reopen) 16 | proc test007 { method {nentries 10000} {tnum "007"} {ndups 5} args} { 17 | eval {test006 $method $nentries 1 $tnum $ndups} $args 18 | } 19 | -------------------------------------------------------------------------------- /test/tcl/test009.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # TEST test009 8 | # TEST Small keys/large data 9 | # TEST Same as test008; close and reopen database 10 | # TEST 11 | # TEST Check that we reuse overflow pages. Create database with lots of 12 | # TEST big key/data pairs. Go through and delete and add keys back 13 | # TEST randomly. Then close the DB and make sure that we have everything 14 | # TEST we think we should. 15 | proc test009 { method args} { 16 | eval {test008 $method "009" 0} $args 17 | } 18 | -------------------------------------------------------------------------------- /test/tcl/test018.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # TEST test018 8 | # TEST Offpage duplicate test 9 | # TEST Key_{first,last,before,after} offpage duplicates. 10 | # TEST Run duplicates with small page size so that we test off page 11 | # TEST duplicates. 12 | proc test018 { method {nentries 10000} args} { 13 | puts "Test018: Off page duplicate tests" 14 | set pgindex [lsearch -exact $args "-pagesize"] 15 | if { $pgindex != -1 } { 16 | puts "Test018: Skipping for specific pagesizes" 17 | return 18 | } 19 | eval {test011 $method $nentries 19 "018" -pagesize 512} $args 20 | } 21 | -------------------------------------------------------------------------------- /test/tcl/test027.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # TEST test027 8 | # TEST Off-page duplicate test 9 | # TEST Test026 with parameters to force off-page duplicates. 10 | # TEST 11 | # TEST Check that delete operations work. Create a database; close 12 | # TEST database and reopen it. Then issues delete by key for each 13 | # TEST entry. 14 | proc test027 { method {nentries 100} args} { 15 | eval {test026 $method $nentries 100 "027"} $args 16 | } 17 | -------------------------------------------------------------------------------- /test/tcl/test034.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 1998, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # TEST test034 8 | # TEST test032 with off-page or overflow case with non-duplicates 9 | # TEST and duplicates. 10 | # TEST 11 | # TEST DB_GET_BOTH, DB_GET_BOTH_RANGE functionality with off-page 12 | # TEST or overflow case within non-duplicates and duplicates. 13 | proc test034 { method {nentries 10000} args} { 14 | set pgindex [lsearch -exact $args "-pagesize"] 15 | if { $pgindex != -1 } { 16 | puts "Test034: Skipping for specific pagesizes" 17 | return 18 | } 19 | 20 | # Test without duplicate and without overflow. 21 | eval {test032 $method $nentries 1 "034" 0} $args 22 | 23 | # Test without duplicate but with overflows. 24 | eval {test032 $method [expr $nentries / 100] 1 "034" 1} $args 25 | 26 | # Test with off-page duplicates 27 | eval {test032 $method $nentries 20 "034" 0} -pagesize 512 $args 28 | 29 | # Test with multiple pages of off-page duplicates 30 | eval {test032 $method [expr $nentries / 10] 100 "034" 0} -pagesize 512 $args 31 | 32 | # Test with overflow duplicate. 33 | eval {test032 $method [expr $nentries / 100] 5 "034" 1} $args 34 | } 35 | -------------------------------------------------------------------------------- /test/tcl/test035.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # TEST test035 8 | # TEST Test033 with off-page non-duplicates and duplicates 9 | # TEST DB_GET_BOTH functionality with off-page non-duplicates 10 | # TEST and duplicates. 11 | proc test035 { method {nentries 10000} args} { 12 | set pgindex [lsearch -exact $args "-pagesize"] 13 | if { $pgindex != -1 } { 14 | puts "Test035: Skipping for specific pagesizes" 15 | return 16 | } 17 | # Test with off-page duplicates 18 | eval {test033 $method $nentries 20 "035" 0 -pagesize 512} $args 19 | # Test with multiple pages of off-page duplicates 20 | eval {test033 $method [expr $nentries / 10] 100 "035" 0 -pagesize 512} \ 21 | $args 22 | # Test with overflow duplicates 23 | eval {test033 $method [expr $nentries / 100] 20 "035" 1 -pagesize 512} \ 24 | $args 25 | # Test with off-page non-duplicates 26 | eval {test033 $method $nentries 1 "035" 0 -pagesize 512} $args 27 | # Test with overflow non-duplicates 28 | eval {test033 $method [expr $nentries / 100] 1 "035" 1 -pagesize 512} \ 29 | $args 30 | } 31 | -------------------------------------------------------------------------------- /test/tcl/test040.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 1998, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # TEST test040 8 | # TEST Test038 with off-page duplicates 9 | # TEST DB_GET_BOTH functionality with off-page duplicates. 10 | proc test040 { method {nentries 10000} args} { 11 | set pgindex [lsearch -exact $args "-pagesize"] 12 | if { $pgindex != -1 } { 13 | puts "Test040: skipping for specific pagesizes" 14 | return 15 | } 16 | # Test with off-page duplicates 17 | eval {test038 $method $nentries 20 "040" -pagesize 512} $args 18 | 19 | # Test with multiple pages of off-page duplicates 20 | eval {test038 $method [expr $nentries / 10] 100 "040" -pagesize 512} \ 21 | $args 22 | } 23 | -------------------------------------------------------------------------------- /test/tcl/test041.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # TEST test041 8 | # TEST Test039 with off-page duplicates 9 | # TEST DB_GET_BOTH functionality with off-page duplicates. 10 | proc test041 { method {nentries 10000} args} { 11 | # Test with off-page duplicates 12 | eval {test039 $method $nentries 20 "041" -pagesize 512} $args 13 | 14 | # Test with multiple pages of off-page duplicates 15 | eval {test039 $method [expr $nentries / 10] 100 "041" -pagesize 512} \ 16 | $args 17 | } 18 | -------------------------------------------------------------------------------- /test/tcl/test069.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 1999, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # TEST test069 8 | # TEST Test of DB_CURRENT partial puts without duplicates-- test067 w/ 9 | # TEST small ndups to ensure that partial puts to DB_CURRENT work 10 | # TEST correctly in the absence of duplicate pages. 11 | proc test069 { method {ndups 50} {tnum "069"} args } { 12 | eval test067 $method $ndups $tnum $args 13 | } 14 | -------------------------------------------------------------------------------- /test/tcl/test071.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 1999, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # TEST test071 8 | # TEST Test of DB_CONSUME (One consumer, 10000 items.) 9 | # TEST This is DB Test 70, with one consumer, one producers, and 10000 items. 10 | proc test071 { method {nconsumers 1} {nproducers 1} {nitems 10000} \ 11 | {mode CONSUME} {start 0 } {txn -txn} {tnum "071"} args } { 12 | 13 | eval test070 $method \ 14 | $nconsumers $nproducers $nitems $mode $start $txn $tnum $args 15 | } 16 | -------------------------------------------------------------------------------- /test/tcl/test079.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 2000, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # TEST test079 8 | # TEST Test of deletes in large trees. (test006 w/ sm. pagesize). 9 | # TEST 10 | # TEST Check that delete operations work in large btrees. 10000 entries 11 | # TEST and a pagesize of 512 push this out to a four-level btree, with a 12 | # TEST small fraction of the entries going on overflow pages. 13 | proc test079 { method {nentries 10000} {pagesize 512} {tnum "079"} \ 14 | {ndups 20} args} { 15 | if { [ is_queueext $method ] == 1 } { 16 | set method "queue"; 17 | lappend args "-extent" "20" 18 | } 19 | 20 | set pgindex [lsearch -exact $args "-pagesize"] 21 | if { $pgindex != -1 } { 22 | puts "Test$tnum: skipping for specific pagesizes" 23 | return 24 | } 25 | 26 | eval {test006 $method $nentries 1 $tnum $ndups -pagesize \ 27 | $pagesize} $args 28 | } 29 | -------------------------------------------------------------------------------- /test/tcl/test081.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 1999, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # TEST test081 8 | # TEST Test off-page duplicates and overflow pages together with 9 | # TEST very large keys (key/data as file contents). 10 | proc test081 { method {ndups 13} {tnum "081"} args} { 11 | source ./include.tcl 12 | 13 | eval {test017 $method 1 $ndups $tnum} $args 14 | } 15 | -------------------------------------------------------------------------------- /test/tcl/test082.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 2000, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # TEST test082 8 | # TEST Test of DB_PREV_NODUP (uses test074). 9 | proc test082 { method {dir -prevnodup} {nitems 100} {tnum "082"} args} { 10 | source ./include.tcl 11 | 12 | eval {test074 $method $dir $nitems $tnum} $args 13 | } 14 | -------------------------------------------------------------------------------- /test/tcl/test084.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 2000, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # TEST test084 8 | # TEST Basic sanity test (test001) with large (64K) pages. 9 | proc test084 { method {nentries 10000} {tnum "084"} {pagesize 65536} args} { 10 | source ./include.tcl 11 | 12 | set txnenv 0 13 | set eindex [lsearch -exact $args "-env"] 14 | # 15 | # If we are using an env, then testfile should just be the db name. 16 | # Otherwise it is the test directory and the name. 17 | if { $eindex == -1 } { 18 | set testfile $testdir/test$tnum-empty.db 19 | set env NULL 20 | } else { 21 | set testfile test$tnum-empty.db 22 | incr eindex 23 | set env [lindex $args $eindex] 24 | set txnenv [is_txnenv $env] 25 | if { $txnenv == 1 } { 26 | append args " -auto_commit " 27 | } 28 | set testdir [get_home $env] 29 | } 30 | 31 | set pgindex [lsearch -exact $args "-pagesize"] 32 | if { $pgindex != -1 } { 33 | puts "Test084: skipping for specific pagesizes" 34 | return 35 | } 36 | 37 | cleanup $testdir $env 38 | 39 | set args "-pagesize $pagesize $args" 40 | 41 | eval {test001 $method $nentries 0 0 $tnum} $args 42 | 43 | set omethod [convert_method $method] 44 | set args [convert_args $method $args] 45 | 46 | # For good measure, create a second database that's empty 47 | # with the large page size. (There was a verifier bug that 48 | # choked on empty 64K pages. [#2408]) 49 | set db [eval {berkdb_open -create -mode 0644} $args $omethod $testfile] 50 | error_check_good empty_db [is_valid_db $db] TRUE 51 | error_check_good empty_db_close [$db close] 0 52 | } 53 | -------------------------------------------------------------------------------- /test/tcl/test090.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 2000, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # TEST test090 8 | # TEST Test for functionality near the end of the queue using test001. 9 | proc test090 { method {nentries 10000} {tnum "090"} args} { 10 | if { [is_queueext $method ] == 0 } { 11 | puts "Skipping test$tnum for $method." 12 | return; 13 | } 14 | eval {test001 $method $nentries 4294967000 0 $tnum} $args 15 | } 16 | -------------------------------------------------------------------------------- /test/tcl/test091.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 2000, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # TEST test091 8 | # TEST Test of DB_CONSUME_WAIT. 9 | proc test091 { method {nconsumers 4} \ 10 | {nproducers 2} {nitems 1000} {start 0 } {tnum "091"} args} { 11 | if { [is_queue $method ] == 0 } { 12 | puts "Skipping test0$tnum for $method." 13 | return; 14 | } 15 | eval {test070 $method \ 16 | $nconsumers $nproducers $nitems WAIT $start -txn $tnum } $args 17 | eval {test070 $method \ 18 | $nconsumers $nproducers $nitems WAIT $start -cdb $tnum } $args 19 | } 20 | -------------------------------------------------------------------------------- /test/tcl/test100.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 2000, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # TEST test100 8 | # TEST Test for functionality near the end of the queue 9 | # TEST using test025 (DB_APPEND). 10 | proc test100 { method {nentries 10000} {tnum "100"} args} { 11 | if { [is_queueext $method ] == 0 } { 12 | puts "Skipping test$tnum for $method." 13 | return; 14 | } 15 | eval {test025 $method $nentries 4294967000 $tnum} $args 16 | } 17 | -------------------------------------------------------------------------------- /test/tcl/test101.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 2000, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # TEST test101 8 | # TEST Test for functionality near the end of the queue 9 | # TEST using test070 (DB_CONSUME). 10 | proc test101 { method {nentries 1000} {txn -txn} {tnum "101"} args} { 11 | if { [is_queueext $method ] == 0 } { 12 | puts "Skipping test$tnum for $method." 13 | return; 14 | } 15 | eval {test070 $method 4 2 $nentries WAIT 4294967000 $txn $tnum} $args 16 | } 17 | -------------------------------------------------------------------------------- /test/tcl/test128.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 2010, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # TEST test128 8 | # TEST Test database bulk update for non-duplicate databases, with different 9 | # TEST configurations. 10 | # TEST 11 | # TEST This is essentially test126 with the following configurations: 12 | # TEST * sub database. 13 | # TEST * secondary database. 14 | # TEST * bulk buffer pre-sort. 15 | 16 | proc test128 {method { nentries 10000 } {callback 1} args } { 17 | source ./include.tcl 18 | 19 | if { [is_partition_callback $args] == 1 } { 20 | set nodump 1 21 | } else { 22 | set nodump 0 23 | } 24 | # Test using sub database 25 | eval {test126 $method $nentries "128" $callback 1 0 0} $args 26 | eval {verify_dir $testdir "" 1 0 $nodump} 27 | eval {salvage_dir $testdir "" 1} 28 | 29 | # Test using secondary database 30 | eval {test126 $method $nentries "128" $callback 0 1 0} $args 31 | eval {verify_dir $testdir "" 1 0 $nodump} 32 | eval {salvage_dir $testdir "" 1} 33 | 34 | # Test with -sort_multiple 35 | eval {test126 $method $nentries "128" $callback 0 0 1} $args 36 | eval {verify_dir $testdir "" 1 0 $nodump} 37 | eval {salvage_dir $testdir "" 1} 38 | 39 | # Test using both sub database and secondary database, 40 | # and with -sort_multiple 41 | eval {test126 $method $nentries "128" $callback 1 1 1} $args 42 | 43 | } 44 | 45 | 46 | -------------------------------------------------------------------------------- /test/tcl/test129.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 2010, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # TEST test129 8 | # TEST Test database bulk update for duplicate database, with different 9 | # TEST configurations. 10 | # TEST 11 | # TEST This is essentially test127 with the following configurations: 12 | # TEST * sub database. 13 | # TEST * bulk buffer pre-sort. 14 | 15 | proc test129 {method { nentries 10000 } { ndups 5} args } { 16 | source ./include.tcl 17 | 18 | if { [is_partition_callback $args] == 1 } { 19 | set nodump 1 20 | } else { 21 | set nodump 0 22 | } 23 | 24 | # Test using sub database. 25 | eval {test127 $method $nentries $ndups "129" 1 0} $args 26 | eval {verify_dir $testdir "" 1 0 $nodump} 27 | eval {salvage_dir $testdir "" 1} 28 | 29 | # Test with -sort_multiple. 30 | eval {test127 $method $nentries $ndups "129" 0 1} $args 31 | eval {verify_dir $testdir "" 1 0 $nodump} 32 | eval {salvage_dir $testdir "" 1} 33 | 34 | # Test using sub database, and with -sort_multiple. 35 | eval {test127 $method $nentries $ndups "129" 1 1} $args 36 | 37 | } 38 | 39 | 40 | -------------------------------------------------------------------------------- /test/tcl/test132.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # TEST test132 8 | # TEST Test foreign database operations on sub databases and 9 | # TEST in-memory databases. 10 | 11 | proc test132 {method {nentries 1000} {ndups 5} args } { 12 | source ./include.tcl 13 | 14 | if { [is_partition_callback $args] == 1 } { 15 | set nodump 1 16 | } else { 17 | set nodump 0 18 | } 19 | 20 | # Test using on-disk sub databases. 21 | eval {test131 $method $nentries "132" $ndups 1 0} $args 22 | eval {verify_dir $testdir "" 1 0 $nodump} 23 | eval {salvage_dir $testdir "" 1} 24 | 25 | # Test using in-memory databases. 26 | eval {test131 $method $nentries "132" $ndups 0 1} $args 27 | 28 | } 29 | 30 | -------------------------------------------------------------------------------- /test/tcl/test134.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # TEST test134 8 | # TEST Test cursor cleanup for sub databases. 9 | 10 | proc test134 {method {nentries 1000} args} { 11 | source ./include.tcl 12 | 13 | eval {test133 $method $nentries "134" 1} $args 14 | 15 | } 16 | -------------------------------------------------------------------------------- /test/tcl/test136.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # TEST test136 8 | # TEST Test operations on similar overflow records. [#20329] 9 | # TEST Here, we use subdatabases. 10 | 11 | proc test136 {method {keycnt 10} {datacnt 10} args} { 12 | source ./include.tcl 13 | 14 | eval {test135 $method $keycnt $datacnt 1 "136"} $args 15 | } 16 | 17 | -------------------------------------------------------------------------------- /test/tcl/test138.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # TEST test138 8 | # TEST Test Automatic Resource Management. [#16188][#20281] 9 | # TEST Here, we test the following cases: 10 | # TEST Non-encrypt for cds 11 | # TEST Non-encrypt for tds 12 | # TEST Encrypt for ds 13 | # TEST Encrypt for cds 14 | # TEST Encrypt for tds 15 | 16 | proc test138 { method {nentries 1000} {start 0} {skip 0} args } { 17 | source ./include.tcl 18 | 19 | eval {test137 $method $nentries $start $skip 0 "138" "cds"} $args 20 | eval {test137 $method $nentries $start $skip 0 "138" "tds"} $args 21 | eval {test137 $method $nentries $start $skip 1 "138" "ds"} $args 22 | eval {test137 $method $nentries $start $skip 1 "138" "cds"} $args 23 | eval {test137 $method $nentries $start $skip 1 "138" "tds"} $args 24 | } 25 | -------------------------------------------------------------------------------- /test/tcl/txn006.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | #TEST txn006 8 | #TEST Test dump/load in transactional environment. 9 | proc txn006 { { iter 50 } } { 10 | source ./include.tcl 11 | set testfile txn006.db 12 | 13 | puts "Txn006: Test dump/load in transaction environment" 14 | env_cleanup $testdir 15 | 16 | puts "\tTxn006.a: Create environment and database" 17 | # Open/create the txn region 18 | set e [berkdb_env -create -home $testdir -txn] 19 | error_check_good env_open [is_valid_env $e] TRUE 20 | 21 | # Open/create database 22 | set db [berkdb_open -auto_commit -env $e \ 23 | -create -btree -dup $testfile] 24 | error_check_good db_open [is_valid_db $db] TRUE 25 | 26 | # Start a transaction 27 | set txn [$e txn] 28 | error_check_good txn [is_valid_txn $txn $e] TRUE 29 | 30 | puts "\tTxn006.b: Put data" 31 | # Put some data 32 | for { set i 1 } { $i < $iter } { incr i } { 33 | error_check_good put [$db put -txn $txn key$i data$i] 0 34 | } 35 | 36 | # End transaction, close db 37 | error_check_good txn_commit [$txn commit] 0 38 | error_check_good db_close [$db close] 0 39 | error_check_good env_close [$e close] 0 40 | 41 | puts "\tTxn006.c: dump/load" 42 | # Dump and load 43 | exec $util_path/db_dump -p -h $testdir $testfile | \ 44 | $util_path/db_load -h $testdir $testfile 45 | } 46 | -------------------------------------------------------------------------------- /test/tcl/txn008.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # TEST txn008 8 | # TEST Test of wraparound txnids (txn002) 9 | proc txn008 { } { 10 | source ./include.tcl 11 | global txn_curid 12 | global txn_maxid 13 | 14 | set orig_curid $txn_curid 15 | set orig_maxid $txn_maxid 16 | puts "\tTxn008.1: wraparound txnids" 17 | set txn_curid [expr $txn_maxid - 2] 18 | txn002 "008.1" 19 | puts "\tTxn008.2: closer wraparound txnids" 20 | set txn_curid [expr $txn_maxid - 3] 21 | set txn_maxid [expr $txn_maxid - 2] 22 | txn002 "008.2" 23 | 24 | puts "\tTxn008.3: test wraparound txnids" 25 | txn_idwrap_check $testdir 26 | set txn_curid $orig_curid 27 | set txn_maxid $orig_maxid 28 | return 29 | } 30 | 31 | -------------------------------------------------------------------------------- /test/tcl/txn009.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 1996, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # TEST txn009 8 | # TEST Test of wraparound txnids (txn003) 9 | proc txn009 { } { 10 | source ./include.tcl 11 | global txn_curid 12 | global txn_maxid 13 | 14 | set orig_curid $txn_curid 15 | set orig_maxid $txn_maxid 16 | puts "\tTxn009.1: wraparound txnids" 17 | set txn_curid [expr $txn_maxid - 2] 18 | txn003 "009.1" 19 | puts "\tTxn009.2: closer wraparound txnids" 20 | set txn_curid [expr $txn_maxid - 3] 21 | set txn_maxid [expr $txn_maxid - 2] 22 | txn003 "009.2" 23 | 24 | puts "\tTxn009.3: test wraparound txnids" 25 | txn_idwrap_check $testdir 26 | set txn_curid $orig_curid 27 | set txn_maxid $orig_maxid 28 | return 29 | } 30 | 31 | -------------------------------------------------------------------------------- /test/tcl/txn012script.tcl: -------------------------------------------------------------------------------- 1 | # See the file LICENSE for redistribution information. 2 | # 3 | # Copyright (c) 2005, 2012 Oracle and/or its affiliates. All rights reserved. 4 | # 5 | # $Id$ 6 | # 7 | # Script to check that txn names can be seen across processes. 8 | # Names over 50 characters will be truncated. 9 | # 10 | # Usage: txn012script dir txnname longtxnname 11 | 12 | source ./include.tcl 13 | source $test_path/test.tcl 14 | 15 | set usage "txn012script dir txnname longtxnname" 16 | 17 | # Verify usage 18 | if { $argc != 3 } { 19 | puts stderr "FAIL:[timestamp] Usage: $usage" 20 | exit 21 | } 22 | 23 | # Initialize arguments 24 | set dir [ lindex $argv 0 ] 25 | set txnname [ lindex $argv 1 ] 26 | set longtxnname [ lindex $argv 2 ] 27 | 28 | # Run db_stat to view txn names. 29 | set stat [exec $util_path/db_stat -h $dir -t] 30 | error_check_good txnname [is_substr $stat $txnname] 1 31 | error_check_good longtxnname [is_substr $stat $longtxnname] 0 32 | set truncname [string range $longtxnname 0 49] 33 | error_check_good truncname [is_substr $stat $truncname] 1 34 | -------------------------------------------------------------------------------- /test/xa/src1/datafml.fml: -------------------------------------------------------------------------------- 1 | # datafml.fml was generated by tuxdev on 12/18/98 @ 12:15:33 ***** DO NOT EDIT ***** 2 | 3 | SEQ_NO 401 long - 4 | TS_SEC 402 long - 5 | TS_USEC 403 long - 6 | -------------------------------------------------------------------------------- /test/xa/src1/datafml.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved. 5 | */ 6 | 7 | /* fname fldid */ 8 | /* ----- ----- */ 9 | #define SEQ_NO ((FLDID32)33554833) /* number: 401 type: long */ 10 | #define TS_SEC ((FLDID32)33554834) /* number: 402 type: long */ 11 | #define TS_USEC ((FLDID32)33554835) /* number: 403 type: long */ 12 | -------------------------------------------------------------------------------- /test/xa/src1/hdbrec.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved. 5 | */ 6 | 7 | #ifndef HDBREC_H 8 | #define HDBREC_H 9 | 10 | #include "htimestampxa.h" 11 | 12 | /* 13 | * DB record 14 | */ 15 | typedef struct __HDbRec { 16 | long SeqNo; 17 | HTimestampData Ts; 18 | char Msg[10]; 19 | } HDbRec; 20 | #endif 21 | -------------------------------------------------------------------------------- /test/xa/src1/htimestampxa.c: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved. 5 | */ 6 | 7 | #include 8 | #include 9 | 10 | #include "htimestampxa.h" 11 | 12 | void 13 | GetTime(HTimestampData *ts) 14 | { 15 | struct timeval timeNow; 16 | 17 | (void)gettimeofday(&timeNow, 0); 18 | ts->Sec = timeNow.tv_sec; 19 | ts->Usec = timeNow.tv_usec; 20 | } 21 | -------------------------------------------------------------------------------- /test/xa/src1/htimestampxa.h: -------------------------------------------------------------------------------- 1 | /*- 2 | * See the file LICENSE for redistribution information. 3 | * 4 | * Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved. 5 | */ 6 | 7 | #ifndef HTIMESTAMPXA_H 8 | #define HTIMESTAMPXA_H 9 | 10 | /* 11 | * Timestamp with microseconds precision 12 | */ 13 | typedef struct __HTimestampData { 14 | time_t Sec; 15 | time_t Usec; 16 | } HTimestampData; 17 | 18 | void GetTime(HTimestampData *); 19 | #endif 20 | -------------------------------------------------------------------------------- /test/xa/src1/tuxconfig.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # 3 | # Build the configuration file for test 1 -- 4 | # We do this work in the shell script because we have to fill in 5 | # lots of shell variables. 6 | 7 | MACHINE_NAME=`uname -n` 8 | cat > $RUN/config/ubb.cfg << END_OF_UBB_FILE 9 | *RESOURCES 10 | IPCKEY 200103 11 | DOMAINID domain3 12 | MASTER cluster3 13 | MAXACCESSERS 10 14 | MAXSERVERS 5 15 | MAXSERVICES 10 16 | MODEL SHM 17 | LDBAL N 18 | 19 | *MACHINES 20 | DEFAULT: 21 | APPDIR="$APPDIR" 22 | TUXCONFIG="$TUXCONFIG" 23 | TLOGDEVICE="$TLOGDEVICE" 24 | TUXDIR="$TUXDIR" 25 | # Machine name is 30 characters max 26 | "$MACHINE_NAME" LMID=cluster3 27 | 28 | *GROUPS 29 | # Group name is 30 characters max 30 | group_tm LMID=cluster3 GRPNO=1 TMSNAME=DBRM TMSCOUNT=2 OPENINFO="BERKELEY-DB:$RUN/data" 31 | 32 | *SERVERS 33 | DEFAULT: 34 | CLOPT="-A" 35 | 36 | # Server name is 78 characters max (same for any pathname) 37 | server1 SRVGRP=group_tm SRVID=1 MAXGEN=3 RESTART=Y 38 | server2 SRVGRP=group_tm SRVID=2 MAXGEN=3 RESTART=Y 39 | 40 | *SERVICES 41 | # Service name is 15 characters max 42 | # server1 43 | TestTxn1 44 | # server2 45 | TestTxn2 46 | END_OF_UBB_FILE 47 | tmloadcf -y $RUN/config/ubb.cfg 48 | -------------------------------------------------------------------------------- /test/xa/src2/tuxconfig.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # 3 | # Build the configuration file for test 2 -- 4 | # We do this work in the shell script because we have to fill in 5 | # 6 | cat > $RUN/config/ubb.cfg << END_OF_UBB_FILE 7 | *RESOURCES 8 | IPCKEY 261110 9 | 10 | DOMAINID BDBapp 11 | MASTER L1 12 | MAXACCESSERS 100 13 | MAXSERVERS 50 14 | MAXSERVICES 200 15 | MODEL SHM 16 | LDBAL Y 17 | 18 | *MACHINES 19 | 20 | "$MACHINE_NAME" LMID=L1 21 | TUXDIR="$TUXDIR" 22 | APPDIR="$APPDIR" 23 | TUXCONFIG="$TUXCONFIG" 24 | TLOGDEVICE="$TLOGDEVICE" 25 | TLOGNAME="$TLOGNAME" 26 | TYPE="machine1" 27 | 28 | *GROUPS 29 | BDBG 30 | LMID=L1 GRPNO=1 TMSNAME=TMS_BDB TMSCOUNT=3 31 | OPENINFO="BERKELEY-DB:$RUN/data" 32 | 33 | LMSG LMID=L1 GRPNO=2 34 | 35 | *SERVERS 36 | DEFAULT: 37 | CLOPT="-A" 38 | 39 | bdb1 SRVGRP=BDBG SRVID=1 40 | MIN=2 MAX=2 41 | #RQADDR="BDB1.QUEUE" REPLYQ=Y CLOPT="-A -- -t 1" 42 | RQADDR="BDB1.QUEUE" REPLYQ=Y CLOPT="-A -p L10,10:100,10 -- -t 1" 43 | 44 | bdb2 SRVGRP=BDBG SRVID=11 45 | MIN=1 MAX=1 RQADDR="BDB2.QUEUE" REPLYQ=Y 46 | 47 | #LMS SRVGRP=LMSG SRVID= 1 CLOPT="-A -- -l$MACHINE_NAME:8080/tsam" 48 | 49 | *SERVICES 50 | DEFAULT: 51 | SVCTIMEOUT=30 52 | END_OF_UBB_FILE 53 | tmloadcf -y $RUN/config/ubb.cfg 54 | -------------------------------------------------------------------------------- /test/xa/src3/tuxconfig.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # 3 | # Build the configuration file for test 3 -- 4 | # We do this work in the shell script because we have to fill in 5 | # lots of shell variables. 6 | 7 | if [ $1 == 1 ]; then 8 | IPCKEY=200104 9 | else 10 | IPCKEY=200105 11 | fi 12 | MACHINE_NAME=`uname -n` 13 | cat > $RUN/config/ubb.cfg << END_OF_UBB_FILE 14 | *RESOURCES 15 | IPCKEY $IPCKEY 16 | DOMAINID domain3 17 | MASTER cluster3 18 | MAXACCESSERS 16 19 | MAXSERVERS 6 20 | MAXSERVICES 16 21 | MODEL SHM 22 | LDBAL N 23 | 24 | *MACHINES 25 | DEFAULT: 26 | APPDIR="$APPDIR" 27 | TUXCONFIG="$TUXCONFIG" 28 | TLOGDEVICE="$TLOGDEVICE" 29 | TUXDIR="$TUXDIR" 30 | # Machine name is 30 characters max 31 | "$MACHINE_NAME" LMID=cluster3 32 | 33 | *GROUPS 34 | # Group name is 30 characters max 35 | group_tm LMID=cluster3 GRPNO=1 TMSNAME=DBRM TMSCOUNT=2 OPENINFO="BERKELEY-DB:$RUN/data" 36 | 37 | *SERVERS 38 | DEFAULT: 39 | CLOPT="-A" 40 | MINDISPATCHTHREADS=1 41 | MAXDISPATCHTHREADS=8 42 | 43 | # Server name is 78 characters max (same for any pathname) 44 | server1 SRVGRP=group_tm SRVID=1 MAXGEN=4 RESTART=Y 45 | server2 SRVGRP=group_tm SRVID=2 MAXGEN=4 RESTART=Y 46 | 47 | *SERVICES 48 | DEFAULT: 49 | SVCTIMEOUT=20 50 | # Service name is 15 characters max 51 | # server1 52 | TestThread1 53 | # server2 54 | TestThread2 55 | END_OF_UBB_FILE 56 | tmloadcf -y $RUN/config/ubb.cfg 57 | -------------------------------------------------------------------------------- /test/xa/src4/tuxconfig.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # 3 | # Build the configuration file for test 4 -- 4 | # We do this work in the shell script because we have to fill in 5 | # lots of shell variables. 6 | 7 | MACHINE_NAME=`uname -n` 8 | cat > $RUN/config/ubb.cfg << END_OF_UBB_FILE 9 | *RESOURCES 10 | IPCKEY 200103 11 | DOMAINID domain3 12 | MASTER cluster3 13 | MAXACCESSERS 10 14 | MAXSERVERS 5 15 | MAXSERVICES 10 16 | MODEL SHM 17 | LDBAL N 18 | 19 | *MACHINES 20 | DEFAULT: 21 | APPDIR="$APPDIR" 22 | TUXCONFIG="$TUXCONFIG" 23 | TLOGDEVICE="$TLOGDEVICE" 24 | TUXDIR="$TUXDIR" 25 | # Machine name is 30 characters max 26 | "$MACHINE_NAME" LMID=cluster3 27 | 28 | *GROUPS 29 | # Group name is 30 characters max 30 | group_tm LMID=cluster3 GRPNO=1 TMSNAME=DBRM TMSCOUNT=2 OPENINFO="BERKELEY-DB:$RUN/data" 31 | 32 | *SERVERS 33 | DEFAULT: 34 | CLOPT="-A" 35 | 36 | # Server name is 78 characters max (same for any pathname) 37 | server1 SRVGRP=group_tm SRVID=1 MAXGEN=3 RESTART=Y 38 | server2 SRVGRP=group_tm SRVID=2 MAXGEN=3 RESTART=Y 39 | 40 | *SERVICES 41 | # Service name is 15 characters max 42 | # server1 43 | TestTxn1 44 | # server2 45 | TestTxn2 46 | END_OF_UBB_FILE 47 | tmloadcf -y $RUN/config/ubb.cfg 48 | -------------------------------------------------------------------------------- /test/xa/src5/DB_CONFIG: -------------------------------------------------------------------------------- 1 | set_flags DB_MULTIVERSION 2 | set_flags DB_TXN_SNAPSHOT 3 | 4 | -------------------------------------------------------------------------------- /test/xa/utilities/multi_1thr_tuxconfig.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # 3 | # Build the configuration file for multithreaded tests -- 4 | # We do this work in the shell script because we have to fill in 5 | # lots of shell variables. 6 | # 7 | # Usage: ./multi_tuxconfig.sh 8 | 9 | if test $# -ne 1; then 10 | echo "Usage: ./multi_1thr_tuxconfig.sh \n" 11 | exit 1 12 | fi 13 | 14 | 15 | IPCKEY=$1 16 | MACHINE_NAME=`uname -n` 17 | cat > $RUN/config/ubb.cfg << END_OF_UBB_FILE 18 | *RESOURCES 19 | IPCKEY $IPCKEY 20 | DOMAINID domain3 21 | MASTER cluster3 22 | MAXACCESSERS 16 23 | MAXSERVERS 6 24 | MAXSERVICES 16 25 | MODEL SHM 26 | LDBAL N 27 | 28 | *MACHINES 29 | DEFAULT: 30 | APPDIR="$APPDIR" 31 | TUXCONFIG="$TUXCONFIG" 32 | TLOGDEVICE="$TLOGDEVICE" 33 | TUXDIR="$TUXDIR" 34 | # Machine name is 30 characters max 35 | "$MACHINE_NAME" LMID=cluster3 36 | 37 | *GROUPS 38 | # Group name is 30 characters max 39 | group_tm LMID=cluster3 GRPNO=1 TMSNAME=DBRM TMSCOUNT=2 OPENINFO="BERKELEY-DB:$RUN/data" 40 | 41 | *SERVERS 42 | DEFAULT: 43 | CLOPT="-A" 44 | MINDISPATCHTHREADS=1 45 | MAXDISPATCHTHREADS=8 46 | 47 | # Server name is 78 characters max (same for any pathname) 48 | server1 SRVGRP=group_tm SRVID=1 MAXGEN=3 RESTART=Y 49 | 50 | *SERVICES 51 | DEFAULT: 52 | SVCTIMEOUT=20 53 | # Service name is 15 characters max 54 | # server1 55 | read_db1 56 | write_db1 57 | 58 | END_OF_UBB_FILE 59 | tmloadcf -y $RUN/config/ubb.cfg 60 | -------------------------------------------------------------------------------- /test/xa/utilities/multi_tuxconfig.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # 3 | # Build the configuration file for multithreaded tests -- 4 | # We do this work in the shell script because we have to fill in 5 | # lots of shell variables. 6 | # 7 | # Usage: ./multi_tuxconfig.sh 8 | 9 | if test $# -ne 1; then 10 | echo "Usage: ./multi_tuxconfig.sh \n" 11 | exit 1 12 | fi 13 | 14 | 15 | IPCKEY=$1 16 | MACHINE_NAME=`uname -n` 17 | cat > $RUN/config/ubb.cfg << END_OF_UBB_FILE 18 | *RESOURCES 19 | IPCKEY $IPCKEY 20 | DOMAINID domain3 21 | MASTER cluster3 22 | MAXACCESSERS 16 23 | MAXSERVERS 6 24 | MAXSERVICES 16 25 | MODEL SHM 26 | LDBAL N 27 | 28 | *MACHINES 29 | DEFAULT: 30 | APPDIR="$APPDIR" 31 | TUXCONFIG="$TUXCONFIG" 32 | TLOGDEVICE="$TLOGDEVICE" 33 | TUXDIR="$TUXDIR" 34 | # Machine name is 30 characters max 35 | "$MACHINE_NAME" LMID=cluster3 36 | 37 | *GROUPS 38 | # Group name is 30 characters max 39 | group_tm LMID=cluster3 GRPNO=1 TMSNAME=DBRM TMSCOUNT=2 OPENINFO="BERKELEY-DB:$RUN/data" 40 | 41 | *SERVERS 42 | DEFAULT: 43 | CLOPT="-A" 44 | MINDISPATCHTHREADS=1 45 | MAXDISPATCHTHREADS=8 46 | 47 | # Server name is 78 characters max (same for any pathname) 48 | server1 SRVGRP=group_tm SRVID=1 MAXGEN=3 RESTART=Y 49 | server2 SRVGRP=group_tm SRVID=2 MAXGEN=3 RESTART=Y 50 | 51 | *SERVICES 52 | DEFAULT: 53 | SVCTIMEOUT=20 54 | # Service name is 15 characters max 55 | # server1 56 | TestThread1 57 | # server2 58 | TestThread2 59 | END_OF_UBB_FILE 60 | tmloadcf -y $RUN/config/ubb.cfg 61 | -------------------------------------------------------------------------------- /test/xa/utilities/tuxconfig.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # 3 | # Build the configuration file for single thread tests -- 4 | # We do this work in the shell script because we have to fill in 5 | # lots of shell variables. 6 | # 7 | # Usage: ./tuxconfig.sh 8 | 9 | if test $# -ne 1; then 10 | echo "Usage: ./tuxconfig.sh \n" 11 | exit 1 12 | fi 13 | IPCKEY=$1 14 | MACHINE_NAME=`uname -n` 15 | cat > $RUN/config/ubb.cfg << END_OF_UBB_FILE 16 | *RESOURCES 17 | IPCKEY $IPCKEY 18 | DOMAINID domain3 19 | MASTER cluster3 20 | MAXACCESSERS 10 21 | MAXSERVERS 5 22 | MAXSERVICES 10 23 | MODEL SHM 24 | LDBAL N 25 | 26 | *MACHINES 27 | DEFAULT: 28 | APPDIR="$APPDIR" 29 | TUXCONFIG="$TUXCONFIG" 30 | TLOGDEVICE="$TLOGDEVICE" 31 | TUXDIR="$TUXDIR" 32 | # Machine name is 30 characters max 33 | "$MACHINE_NAME" LMID=cluster3 34 | 35 | *GROUPS 36 | # Group name is 30 characters max 37 | group_tm LMID=cluster3 GRPNO=1 TMSNAME=DBRM TMSCOUNT=2 OPENINFO="BERKELEY-DB:$RUN/data" 38 | 39 | *SERVERS 40 | DEFAULT: 41 | CLOPT="-A" 42 | 43 | # Server name is 78 characters max (same for any pathname) 44 | server1 SRVGRP=group_tm SRVID=1 MAXGEN=3 RESTART=Y 45 | server2 SRVGRP=group_tm SRVID=2 MAXGEN=3 RESTART=Y 46 | 47 | *SERVICES 48 | # Service name is 15 characters max 49 | # server1 50 | TestTxn1 51 | # server2 52 | TestTxn2 53 | END_OF_UBB_FILE 54 | tmloadcf -y $RUN/config/ubb.cfg 55 | -------------------------------------------------------------------------------- /util/db_printlog/README: -------------------------------------------------------------------------------- 1 | # $Id$ 2 | 3 | Berkeley DB log dump utility. This utility dumps out a DB log in human 4 | readable form, a record at a time, to assist in recovery and transaction 5 | abort debugging. 6 | 7 | =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= 8 | commit.awk Output transaction ID of committed transactions. 9 | 10 | count.awk Print out the number of log records for transactions 11 | that we encountered. 12 | 13 | dbname.awk Take a comma-separated list of database names and spit 14 | out all the log records that affect those databases. 15 | 16 | fileid.awk Take a comma-separated list of file numbers and spit out 17 | all the log records that affect those file numbers. 18 | 19 | logstat.awk Display log record count/size statistics. 20 | 21 | pgno.awk Take a comma-separated list of page numbers and spit 22 | out all the log records that affect those page numbers. 23 | 24 | range.awk Print out a range of the log. 25 | 26 | rectype.awk Print out a range of the log -- command line should 27 | set RECTYPE to the a comma separated list of the 28 | rectypes (or partial strings of rectypes) sought. 29 | 30 | status.awk Read through db_printlog output and list the transactions 31 | encountered, and whether they committed or aborted. 32 | 33 | txn.awk Print out all the records for a comma-separated list of 34 | transaction IDs. 35 | -------------------------------------------------------------------------------- /util/db_printlog/commit.awk: -------------------------------------------------------------------------------- 1 | # $Id$ 2 | # 3 | # Output tid of committed transactions. 4 | 5 | /txn_regop/ { 6 | print $5 7 | } 8 | -------------------------------------------------------------------------------- /util/db_printlog/count.awk: -------------------------------------------------------------------------------- 1 | # $Id$ 2 | # 3 | # Print out the number of log records for transactions that we 4 | # encountered. 5 | 6 | /^\[/{ 7 | if ($5 != 0) 8 | print $5 9 | } 10 | -------------------------------------------------------------------------------- /util/db_printlog/fileid.awk: -------------------------------------------------------------------------------- 1 | # $Id$ 2 | # 3 | # Take a comma-separated list of file numbers and spit out all the 4 | # log records that affect those file numbers. 5 | 6 | NR == 1 { 7 | nfiles = 0 8 | while ((ndx = index(FILEID, ",")) != 0) { 9 | files[nfiles] = substr(FILEID, 1, ndx - 1); 10 | FILEID = substr(FILEID, ndx + 1, length(FILEID) - ndx); 11 | nfiles++ 12 | } 13 | files[nfiles] = FILEID; 14 | } 15 | 16 | /^\[/{ 17 | if (printme == 1) { 18 | printf("%s\n", rec); 19 | printme = 0 20 | } 21 | rec = ""; 22 | 23 | rec = $0 24 | } 25 | /^ /{ 26 | if (length(rec) + length($0) < 2040) 27 | rec = sprintf("%s\n%s", rec, $0); 28 | } 29 | /fileid/{ 30 | for (i = 0; i <= nfiles; i++) 31 | if ($2 == files[i]) 32 | printme = 1 33 | } 34 | 35 | END { 36 | if (printme == 1) 37 | printf("%s\n", rec); 38 | } 39 | -------------------------------------------------------------------------------- /util/db_printlog/logstat.awk: -------------------------------------------------------------------------------- 1 | # $Id$ 2 | # 3 | # Output accumulated log record count/size statistics. 4 | BEGIN { 5 | l_file = 0; 6 | l_offset = 0; 7 | } 8 | 9 | /^\[/{ 10 | gsub("[][: ]", " ", $1) 11 | split($1, a) 12 | 13 | if (a[1] == l_file) { 14 | l[a[3]] += a[2] - l_offset 15 | ++n[a[3]] 16 | } else 17 | ++s[a[3]] 18 | 19 | l_file = a[1] 20 | l_offset = a[2] 21 | } 22 | 23 | END { 24 | # We can't figure out the size of the first record in each log file, 25 | # use the average for other records we found as an estimate. 26 | for (i in s) 27 | if (s[i] != 0 && n[i] != 0) { 28 | l[i] += s[i] * (l[i]/n[i]) 29 | n[i] += s[i] 30 | delete s[i] 31 | } 32 | for (i in l) 33 | printf "%s: %d (n: %d, avg: %.2f)\n", i, l[i], n[i], l[i]/n[i] 34 | for (i in s) 35 | printf "%s: unknown (n: %d, unknown)\n", i, s[i] 36 | } 37 | -------------------------------------------------------------------------------- /util/db_printlog/pgno.awk: -------------------------------------------------------------------------------- 1 | # $Id$ 2 | # 3 | # Take a comma-separated list of page numbers and spit out all the 4 | # log records that affect those page numbers. 5 | 6 | BEGIN { 7 | INDX = -1 8 | } 9 | NR == 1 { 10 | npages = 0 11 | while ((ndx = index(PGNO, ",")) != 0) { 12 | pgno[npages] = substr(PGNO, 1, ndx - 1); 13 | PGNO = substr(PGNO, ndx + 1, length(PGNO) - ndx); 14 | npages++ 15 | } 16 | pgno[npages] = PGNO; 17 | } 18 | 19 | /^\[/{ 20 | if (printme == 1) { 21 | printf("%s\n", rec); 22 | printme = 0 23 | } 24 | rec = ""; 25 | 26 | rec = $0 27 | } 28 | /^ /{ 29 | if (length(rec) + length($0) < 2040) 30 | rec = sprintf("%s\n%s", rec, $0); 31 | } 32 | /pgno/{ 33 | for (i = 0; i <= npages; i++) 34 | if ($2 == pgno[i]) 35 | printme = 1 36 | } 37 | /right/{ 38 | for (i = 0; i <= npages; i++) 39 | if ($2 == pgno[i]) 40 | printme = 1 41 | } 42 | /left/{ 43 | for (i = 0; i <= npages; i++) 44 | if ($2 == pgno[i]) 45 | printme = 1 46 | } 47 | /indx/{ 48 | if (printme == 1 && INDX != -1) 49 | if(INDX != $2) 50 | printme = 0; 51 | } 52 | 53 | END { 54 | if (printme == 1) 55 | printf("%s\n", rec); 56 | } 57 | -------------------------------------------------------------------------------- /util/db_printlog/range.awk: -------------------------------------------------------------------------------- 1 | # $Id$ 2 | # 3 | # Print out a range of the log 4 | 5 | /^\[/{ 6 | l = length($1) - 1; 7 | i = index($1, "]"); 8 | file = substr($1, 2, i - 2); 9 | file += 0; 10 | start = i + 2; 11 | offset = substr($1, start, l - start + 1); 12 | i = index(offset, "]"); 13 | offset = substr($1, start, i - 1); 14 | offset += 0; 15 | 16 | if ((file == START_FILE && offset >= START_OFFSET || file > START_FILE)\ 17 | && (file < END_FILE || (file == END_FILE && offset < END_OFFSET))) 18 | printme = 1 19 | else if (file == END_FILE && offset > END_OFFSET || file > END_FILE) 20 | exit 21 | else 22 | printme = 0 23 | } 24 | { 25 | if (printme == 1) 26 | print $0 27 | } 28 | -------------------------------------------------------------------------------- /util/db_printlog/rectype.awk: -------------------------------------------------------------------------------- 1 | # $Id$ 2 | # 3 | # Print out a range of the log. 4 | # Command line should set RECTYPE to a comma separated list 5 | # of the rectypes (or partial strings of rectypes) sought. 6 | NR == 1 { 7 | ntypes = 0 8 | while ((ndx = index(RECTYPE, ",")) != 0) { 9 | types[ntypes] = substr(RECTYPE, 1, ndx - 1); 10 | RECTYPE = substr(RECTYPE, ndx + 1, length(RECTYPE) - ndx); 11 | ntypes++ 12 | } 13 | types[ntypes] = RECTYPE; 14 | } 15 | 16 | /^\[/{ 17 | printme = 0 18 | for (i = 0; i <= ntypes; i++) 19 | if (index($1, types[i]) != 0) { 20 | printme = 1 21 | break; 22 | } 23 | } 24 | { 25 | if (printme == 1) 26 | print $0 27 | } 28 | -------------------------------------------------------------------------------- /util/db_printlog/status.awk: -------------------------------------------------------------------------------- 1 | # $Id$ 2 | # 3 | # Read through db_printlog output and list all the transactions encountered 4 | # and whether they committed or aborted. 5 | # 6 | # 1 = started 7 | # 2 = committed 8 | # 3 = explicitly aborted 9 | # 4 = other 10 | BEGIN { 11 | cur_txn = 0 12 | } 13 | /^\[.*]\[/{ 14 | in_regop = 0 15 | if (status[$5] == 0) { 16 | status[$5] = 1; 17 | txns[cur_txn] = $5; 18 | cur_txn++; 19 | } 20 | } 21 | / child:/ { 22 | txnid = substr($2, 3); 23 | status[txnid] = 2; 24 | } 25 | /txn_regop/ { 26 | txnid = $5 27 | in_regop = 1 28 | } 29 | /opcode:/ { 30 | if (in_regop == 1) { 31 | if ($2 == 1) 32 | status[txnid] = 2 33 | else if ($2 == 3) 34 | status[txnid] = 3 35 | else 36 | status[txnid] = 4 37 | } 38 | } 39 | END { 40 | for (i = 0; i < cur_txn; i++) { 41 | if (status[txns[i]] == 1) 42 | printf("%s\tABORT\n", txns[i]); 43 | else if (status[txns[i]] == 2) 44 | printf("%s\tCOMMIT\n", txns[i]); 45 | else if (status[txns[i]] == 3) 46 | printf("%s\tABORT\n", txns[i]); 47 | else if (status[txns[i]] == 4) 48 | printf("%s\tOTHER\n", txns[i]); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /util/db_printlog/txn.awk: -------------------------------------------------------------------------------- 1 | # $Id$ 2 | # 3 | # Print out all the records for a comma-separated list of transaction ids. 4 | NR == 1 { 5 | ntxns = 0 6 | while ((ndx = index(TXN, ",")) != 0) { 7 | txn[ntxns] = substr(TXN, 1, ndx - 1); 8 | TXN = substr(TXN, ndx + 1, length(TXN) - ndx); 9 | ntxns++ 10 | } 11 | txn[ntxns] = TXN; 12 | } 13 | 14 | /^\[/{ 15 | if (printme == 1) { 16 | printf("%s\n", rec); 17 | printme = 0 18 | } 19 | rec = ""; 20 | 21 | for (i = 0; i <= ntxns; i++) 22 | if (txn[i] == $5) { 23 | rec = $0 24 | printme = 1 25 | } 26 | } 27 | /^ /{ 28 | if (length(rec) + length($0) < 2040) 29 | rec = sprintf("%s\n%s", rec, $0); 30 | } 31 | 32 | END { 33 | if (printme == 1) 34 | printf("%s\n", rec); 35 | } 36 | -------------------------------------------------------------------------------- /util/dtrace/apicalls.d: -------------------------------------------------------------------------------- 1 | #!/usr/sbin/dtrace -qs 2 | /* 3 | * Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved. 4 | * 5 | * apicalls.d - Summarize DB API function calls 6 | * 7 | * This script graphs the count of the main API calls grouped by thread. 8 | * 9 | * The optional integer maxcount parameter directs the script to exit once 10 | * that many functions calls have been accumulated. 11 | * 12 | * usage: apicalls.d { -p | -c " [ 0 ? $1 : -1; 19 | functioncount = 0; 20 | printf("DB API call counts of process %d; interrupt to display summary\n", $target); 21 | } 22 | 23 | pid$target::db*_create:return, 24 | pid$target::__*_pp:return 25 | { 26 | @calls[tid, probefunc] = count(); 27 | functioncount++; 28 | } 29 | 30 | pid$target::db*_create:return, 31 | pid$target::__*_pp:return 32 | /functioncount == maxcount/ 33 | { 34 | exit(0); 35 | } 36 | -------------------------------------------------------------------------------- /util/dtrace/apitimes.d: -------------------------------------------------------------------------------- 1 | #!/usr/sbin/dtrace -qs 2 | /* 3 | * Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved. 4 | * 5 | * apitimes.d - Summarize time spent in DB API functions 6 | * 7 | * This script graphs the time spent in the main API calls, grouped by thread. 8 | * 9 | * The optional integer maxcount parameter directs the script to exit after 10 | * that many functions have been accumulated. 11 | * 12 | * usage: apitimes.d { -p | -c " [ 0 ? $1 : -1; 22 | functioncount = 0; 23 | printf("DB API times of process %d grouped by function; ", $target); 24 | printf("interrupt to display summary\n"); 25 | } 26 | 27 | pid$target::db*_create:entry, 28 | pid$target::__*_pp:entry 29 | { 30 | self->start = timestamp; 31 | } 32 | 33 | pid$target::db*_create:return, 34 | pid$target::__*_pp:return 35 | /self->start != 0/ 36 | { 37 | @calltimes[tid, probefunc] = quantize(timestamp - self->start); 38 | self->start = 0; 39 | functioncount++; 40 | } 41 | 42 | pid$target::db*_create:return, 43 | pid$target::__*_pp:return 44 | /functioncount == maxcount/ 45 | { 46 | exit(0); 47 | } 48 | 49 | dtrace:::END 50 | { 51 | printf("\n"); 52 | printa("Times that thread %x spent in %s in nanoseconds %@a", @calltimes); 53 | } 54 | -------------------------------------------------------------------------------- /util/systemtap/apicalls.stp: -------------------------------------------------------------------------------- 1 | #!/usr/bin/stap 2 | /* 3 | * Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved. 4 | * 5 | * apicalls - Summarize DB API call count grouped by thread. 6 | * 7 | * This summarizes the count of DB apicalls grouped by thread or process. 8 | * 9 | * The path to the DB library is required to be the first argument. 10 | * 11 | * To limit tracing to a particular process use one of the stap options: 12 | * -x or 13 | * -c " [..]" 14 | * 15 | */ 16 | 17 | global calls 18 | 19 | probe begin 20 | { 21 | printf("DB API call counts of "); 22 | if (target() == 0) 23 | printf("processes using \"%s\"", @1) 24 | else 25 | printf("process %d", target()); 26 | printf("; interrupt to display summary\n") 27 | } 28 | 29 | probe process(@1).function("db_*create").call, 30 | process(@1).function("__*pp").call 31 | { 32 | calls[(target() == 0 ? pid() : tid()), probefunc()] <<< 1; 33 | } 34 | 35 | probe end 36 | { 37 | any_seen = 0; 38 | /* Display counts grouped by process, or by thread. */ 39 | if (target() == 0) 40 | printf("%-20s %7s %9s\n", 41 | "Function", "process", "callcount") 42 | else 43 | printf("%-20s %7s %9s for process %d\n", 44 | "Function", "thread", "callcount", target()); 45 | foreach ([a,b] in calls+) { 46 | printf("%-20s %7d %9d\n", b, a, @count(calls[a,b])); 47 | any_seen = 1; 48 | } 49 | if (!any_seen) 50 | printf("No probes were triggered in %s; it might not be the correct library\n", @1); 51 | } 52 | -------------------------------------------------------------------------------- /util/systemtap/apitimes.stp: -------------------------------------------------------------------------------- 1 | #!/usr/bin/stap 2 | /* 3 | * Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved. 4 | * 5 | * apitimes - Graph the time spent in DB API calls grouped by thread or processid 6 | * 7 | * The path to the DB library is required to be the first argument. 8 | * 9 | * To limit tracing to a particular process use one of the stap options: 10 | * -x or 11 | * -c " [..]" 12 | * 13 | */ 14 | 15 | global functioncount, maxcount, starts, times; 16 | 17 | probe begin 18 | { 19 | functioncount = 0; 20 | maxcount = -1; 21 | %( $# >= 2 %? maxcount = $2 %) 22 | printf("DB API times of "); 23 | if (target() == 0) 24 | printf("processes using \"%s\"", @1) 25 | else 26 | printf("process %d", target()); 27 | printf(" grouped by function; interrupt to display summary\n"); 28 | } 29 | 30 | probe process(@1).function("db*_create").call, 31 | process(@1).function("__*_pp").call 32 | { 33 | starts[tid(), probefunc()] = gettimeofday_ns(); 34 | } 35 | 36 | 37 | probe process(@1).function("db*_create").return, 38 | process(@1).function("__*_pp").return 39 | { 40 | if ((start = starts[tid(), probefunc()]) != 0) { 41 | times[tid(), probefunc()] <<< gettimeofday_ns() - start; 42 | if (++functioncount == maxcount) 43 | exit(); 44 | } 45 | } 46 | 47 | probe end 48 | { 49 | foreach ([tid, func] in times) { 50 | printf("Times that thread %x spent in %s in nanoseconds\n", 51 | tid, func); 52 | print(@hist_log(times[tid, func])); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /util/systemtap/apitrace.stp: -------------------------------------------------------------------------------- 1 | #!/usr/bin/stap 2 | /* 3 | * Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved. 4 | * 5 | * apitrace - Display DB API calls and return values 6 | * 7 | * The path to the DB library is required to be the first argument. 8 | * 9 | * To limit tracing to a particular process use one of the stap options: 10 | * -x or 11 | * -c " [..]" 12 | * 13 | */ 14 | 15 | global tracecount, maxlimit; 16 | 17 | probe begin 18 | { 19 | printf("DB API call trace of "); 20 | if (target() == 0) 21 | printf("processes using \"%s\"\n", @1); 22 | else 23 | printf("process %d\n", target()); 24 | printf("Interrupt to display summary\n"); 25 | maxlimit = -1; 26 | %( $# >= 2 %? maxlimit = $2 %) 27 | tracecount = 0; 28 | } 29 | 30 | probe process(@1).function("db_*create").call, 31 | process(@1).function("__*_*pp").call 32 | { 33 | printf("%s -> %s called with (%s)\n", 34 | thread_indent(1), probefunc(), $$parms); 35 | 36 | } 37 | 38 | probe process(@1).function("db*_create").return, 39 | process(@1).function("__*_*pp").return 40 | { 41 | printf("%s <- %s returns %d\n", thread_indent(-1), 42 | probefunc(), $return) 43 | if (++tracecount == maxlimit) 44 | exit(); 45 | } 46 | --------------------------------------------------------------------------------