diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2015-02-17 17:25:57 +0000 |
---|---|---|
committer | <> | 2015-03-17 16:26:24 +0000 |
commit | 780b92ada9afcf1d58085a83a0b9e6bc982203d1 (patch) | |
tree | 598f8b9fa431b228d29897e798de4ac0c1d3d970 /lang/csharp/src/DatabaseEnvironment.cs | |
parent | 7a2660ba9cc2dc03a69ddfcfd95369395cc87444 (diff) | |
download | berkeleydb-master.tar.gz |
Diffstat (limited to 'lang/csharp/src/DatabaseEnvironment.cs')
-rw-r--r-- | lang/csharp/src/DatabaseEnvironment.cs | 835 |
1 files changed, 615 insertions, 220 deletions
diff --git a/lang/csharp/src/DatabaseEnvironment.cs b/lang/csharp/src/DatabaseEnvironment.cs index 8c5828e9..47f03749 100644 --- a/lang/csharp/src/DatabaseEnvironment.cs +++ b/lang/csharp/src/DatabaseEnvironment.cs @@ -1,7 +1,7 @@ /*- * See the file LICENSE for redistribution information. * - * Copyright (c) 2009, 2012 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2015 Oracle and/or its affiliates. All rights reserved. * */ using System; @@ -24,7 +24,9 @@ namespace BerkeleyDB { private ThreadIsAliveDelegate isAliveHandler; private EventNotifyDelegate notifyHandler; private MessageDispatchDelegate messageDispatchHandler; + private MessageFeedbackDelegate msgFeedbackHandler; private ReplicationTransportDelegate transportHandler; + private ReplicationViewDelegate replicationViewHandler; private SetThreadIDDelegate threadIDHandler; private SetThreadNameDelegate threadNameHandler; private string _pfx; @@ -37,6 +39,8 @@ namespace BerkeleyDB { private BDB_EventNotifyDelegate doNotifyRef; private BDB_IsAliveDelegate doIsAliveRef; private BDB_MessageDispatchDelegate doMessageDispatchRef; + private BDB_MsgcallDelegate doMsgFeedbackRef; + private BDB_ReplicationViewDelegate doRepViewRef; private BDB_RepTransportDelegate doRepTransportRef; private BDB_ThreadIDDelegate doThreadIDRef; private BDB_ThreadNameDelegate doThreadNameRef; @@ -87,6 +91,10 @@ namespace BerkeleyDB { dbenv.api2_internal.errFeedbackHandler( dbenv.api2_internal._pfx, msg); } + private static void doMsgFeedback(IntPtr env, string msg) { + DB_ENV dbenv = new DB_ENV(env, false); + dbenv.api2_internal.msgFeedbackHandler(msg); + } private static void doFeedback(IntPtr env, int opcode, int percent) { DB_ENV dbenv = new DB_ENV(env, false); dbenv.api2_internal.feedbackHandler( @@ -113,6 +121,12 @@ namespace BerkeleyDB { dbenv.api2_internal.messageDispatchHandler( dbchannel, ref requests, out nrequest, need_response); } + private static int doRepView(IntPtr envp, + string name, ref int result, uint flags) { + DB_ENV dbenv = new DB_ENV(envp, false); + return dbenv.api2_internal.replicationViewHandler(name, + ref result, flags); + } private static int doRepTransport(IntPtr envp, IntPtr controlp, IntPtr recp, IntPtr lsnp, int envid, uint flags) { DB_ENV dbenv = new DB_ENV(envp, false); @@ -129,7 +143,7 @@ namespace BerkeleyDB { DbThreadID id = dbenv.api2_internal.threadIDHandler(); /* - * Sometimes the library doesn't care about either pid or tid + * Sometimes the library does not care about either pid or tid * (usually tid) and will pass NULL instead of a valid pointer. */ if (pid != IntPtr.Zero) @@ -177,6 +191,10 @@ namespace BerkeleyDB { //Alpha by dbenv function call foreach (string dirname in cfg.DataDirs) dbenv.add_data_dir(dirname); + if (cfg.BlobDir != null) + dbenv.set_blob_dir(cfg.BlobDir); + if (cfg.blobThresholdIsSet) + dbenv.set_blob_threshold(cfg.BlobThreshold, 0); if (cfg.CreationDir != null) dbenv.set_create_dir(cfg.CreationDir); if (cfg.encryptionIsSet) @@ -330,6 +348,14 @@ namespace BerkeleyDB { RepNSites = cfg.RepSystemCfg.NSites; for (int i = 0; i < cfg.RepSystemCfg.RepmgrSitesConfig.Count; i++) RepMgrSiteConfig(cfg.RepSystemCfg.RepmgrSitesConfig[i]); + if (cfg.RepSystemCfg.repViewIsSet) { + ReplicationView = cfg.RepSystemCfg.ReplicationView; + if (ReplicationView == null) + doRepViewRef = null; + else + doRepViewRef = new BDB_ReplicationViewDelegate(doRepView); + dbenv.rep_set_view(doRepViewRef); + } if (cfg.RepSystemCfg.priorityIsSet) RepPriority = cfg.RepSystemCfg.Priority; if (cfg.RepSystemCfg.RepMgrAckPolicy != null) @@ -344,10 +370,18 @@ namespace BerkeleyDB { RepSetTransmitLimit( cfg.RepSystemCfg.TransmitLimitGBytes, cfg.RepSystemCfg.TransmitLimitBytes); + if (cfg.RepSystemCfg.repmgrIncomingQueueMaxIsSet) + RepmgrSetIncomingQueueMax( + cfg.RepSystemCfg.RepmgrIncomingQueueMaxGBytes, + cfg.RepSystemCfg.RepmgrIncomingQueueMaxBytes); if (cfg.RepSystemCfg.UseMasterLeases) RepUseMasterLeases = true; if (!cfg.RepSystemCfg.Elections) RepMgrRunElections = false; + if (cfg.RepSystemCfg.PrefmasMaster) + RepPrefmasMaster = true; + if (cfg.RepSystemCfg.PrefmasClient) + RepPrefmasClient = true; } } @@ -356,7 +390,7 @@ namespace BerkeleyDB { /// <summary> /// If true, database operations for which no explicit transaction /// handle was specified, and which modify databases in the database - /// environment, will be automatically enclosed within a transaction. + /// environment, are automatically enclosed within a transaction. /// </summary> public bool AutoCommit { get { @@ -477,7 +511,44 @@ namespace BerkeleyDB { } /// <summary> - /// The size of the shared memory buffer pool -- that is, the cache. + /// The path of the directory where blobs are stored. + /// </summary> + public string BlobDir { + get { + string dir; + dbenv.get_blob_dir(out dir); + return dir; + } + } + /// <summary> + /// The size in bytes which is used to determine when a data item + /// is stored as a blob. + /// <para> + /// Any data item that is equal to or larger in size than the + /// threshold value is automatically stored as a blob. + /// </para> + /// <para> + /// If the threshold value is 0, databases opened in the environment + /// default to never using blob support. + /// </para> + /// <para> + /// It is illegal to enable blob support if replication is enabled for the + /// environment. + /// </para> + /// </summary> + public uint BlobThreshold { + get { + uint ret = 0; + dbenv.get_blob_threshold(ref ret); + return ret; + } + set { + dbenv.set_blob_threshold(value, 0); + } + } + + /// <summary> + /// The size of the shared memory buffer pool (the cache). /// </summary> /// <remarks> /// <para> @@ -492,7 +563,7 @@ namespace BerkeleyDB { /// by 25% to account for buffer pool overhead; cache sizes larger than /// 500MB are used as specified. The maximum size of a single cache is /// 4GB on 32-bit systems and 10TB on 64-bit systems. (All sizes are in - /// powers-of-two, that is, 256KB is 2^18 not 256,000.) For information + /// powers-of-two, 256KB is 2^18 not 256,000.) For information /// on tuning the Berkeley DB cache size, see Selecting a cache size in /// the Programmer's Reference Guide. /// </para> @@ -512,7 +583,7 @@ namespace BerkeleyDB { } } /// <summary> - /// If true, Berkeley DB Concurrent Data Store applications will perform + /// If true, Berkeley DB Concurrent Data Store applications perform /// locking on an environment-wide basis rather than on a per-database /// basis. /// </summary> @@ -524,7 +595,7 @@ namespace BerkeleyDB { } } /// <summary> - /// If true, Berkeley DB subsystems will create any underlying files, as + /// If true, Berkeley DB subsystems create any underlying files, as /// necessary. /// </summary> public bool Create { @@ -540,10 +611,10 @@ namespace BerkeleyDB { public List<string> DataDirs { get { return dbenv.get_data_dirs(); } } /// <summary> - /// The deadlock detector configuration, specifying what lock request(s) + /// The deadlock detector configuration, specifying which lock request(s) /// should be rejected. As transactions acquire locks on behalf of a /// single locker ID, rejecting a lock request associated with a - /// transaction normally requires the transaction be aborted. + /// transaction normally requires the transaction to be aborted. /// </summary> public DeadlockPolicy DeadlockResolution { get { @@ -578,24 +649,24 @@ namespace BerkeleyDB { /// <para> /// When an error occurs in the Berkeley DB library, a /// <see cref="DatabaseException"/>, or subclass of DatabaseException, - /// is thrown. In some cases, however, the exception may be insufficient + /// is thrown. In some cases the exception may be insufficient /// to completely describe the cause of the error, especially during /// initial application debugging. /// </para> - /// <para> - /// In some cases, when an error occurs, Berkeley DB will call the given + /// <para> + /// In some cases, when an error occurs, Berkeley DB calls the given /// delegate with additional error information. It is up to the delegate /// to display the error message in an appropriate manner. /// </para> - /// <para> + /// <para> /// Setting ErrorFeedback to NULL unconfigures the callback interface. /// </para> - /// <para> + /// <para> /// This error-logging enhancement does not slow performance or /// significantly increase application size, and may be run during /// normal operation as well as during application debugging. /// </para> - /// </remarks> + /// </remarks> public ErrorFeedbackDelegate ErrorFeedback { get { return errFeedbackHandler; } set { @@ -610,6 +681,38 @@ namespace BerkeleyDB { } } /// <summary> + /// The mechanism for reporting detailed statistic messages to the + /// application. + /// </summary> + /// <remarks> + /// <para> + /// There are interfaces in the Berkeley DB library which either + /// directly output informational messages or statistical + /// information, or configure the library to output such messages + /// when performing other operations. + /// </para> + /// <para> + /// Berkeley DB calls the given delegate with each message. It is up + /// to the delegate to display the message in an appropriate manner. + /// </para> + /// <para> + /// Setting MessageFeedback to NULL resets the callback interface. + /// </para> + /// </remarks> + public MessageFeedbackDelegate messageFeedback { + get { return msgFeedbackHandler; } + set { + if (value == null) + dbenv.set_msgcall(null); + else if (msgFeedbackHandler == null) { + if (doMsgFeedbackRef == null) + doMsgFeedbackRef = new BDB_MsgcallDelegate(doMsgFeedback); + dbenv.set_msgcall(doMsgFeedbackRef); + } + msgFeedbackHandler = value; + } + } + /// <summary> /// The prefix string that appears before error messages issued by /// Berkeley DB. /// </summary> @@ -619,7 +722,7 @@ namespace BerkeleyDB { /// ErrorPrefix affects the entire environment and is equivalent to /// setting <see cref="DatabaseEnvironment.ErrorPrefix"/>. /// </para> - /// <para> + /// <para> /// Setting ErrorPrefix configures operations performed using the /// specified object, not all operations performed on the underlying /// database. @@ -654,10 +757,9 @@ namespace BerkeleyDB { /// <remarks> /// <para> /// Some operations performed by the Berkeley DB library can take - /// non-trivial amounts of time. The Feedback delegate can be used by - /// applications to monitor progress within these operations. When an - /// operation is likely to take a long time, Berkeley DB will call the - /// specified delegate with progress information. + /// non-trivial amounts of time. When an operation + /// is likely to take a long time, Berkeley DB calls the + /// the Feedback delegate to monitor progress within these operations. /// </para> /// <para> /// It is up to the delegate to display this information in an @@ -685,7 +787,7 @@ namespace BerkeleyDB { /// <remarks> /// This flag may result in inaccurate file modification times and other /// file-level information for Berkeley DB database files. This flag - /// will almost certainly result in a performance decrease on most + /// almost certainly results in a performance decrease on most /// systems. /// </remarks> public bool ForceFlush { @@ -828,7 +930,7 @@ namespace BerkeleyDB { } } /// <summary> - /// If true, Berkeley DB will page-fault shared regions into memory when + /// If true, Berkeley DB page-faults shared regions into memory when /// initially creating or joining a Berkeley DB environment. /// </summary> /// <remarks> @@ -839,7 +941,7 @@ namespace BerkeleyDB { /// convoy, and overall throughput may decrease.) /// </para> /// <para> - /// In addition to page-faulting, Berkeley DB will write the shared + /// In addition to page-faulting, Berkeley DB writes the shared /// regions when creating an environment, forcing the underlying virtual /// memory and filesystems to instantiate both the necessary memory and /// the necessary disk space. This can also avoid out-of-disk space @@ -952,6 +1054,20 @@ namespace BerkeleyDB { } } /// <summary> + /// If true, enables full logging of blob data. + /// Required if using HA or the hotbackup utility. + /// </summary> + public bool LogBlobContent { + get { + int onoff = 0; + dbenv.log_get_config(DbConstants.DB_LOG_BLOB, ref onoff); + return (onoff != 0); + } + set { + dbenv.log_set_config(DbConstants.DB_LOG_BLOB, value ? 1 : 0); + } + } + /// <summary> /// The size of the in-memory log buffer, in bytes /// </summary> public uint LogBufferSize { @@ -966,7 +1082,7 @@ namespace BerkeleyDB { } /// <summary> /// The path of a directory to be used as the location of logging files. - /// Log files created by the Log Manager subsystem will be created in + /// Log files created by the Log Manager subsystem are created in /// this directory. /// </summary> public string LogDir { @@ -986,7 +1102,7 @@ namespace BerkeleyDB { /// </summary> /// <remarks> /// Normally, if Berkeley DB applications set their umask appropriately, - /// all processes in the application suite will have read permission on + /// all processes in the application suite obtain read permission on /// the log files created by any process in the application suite. /// However, if the Berkeley DB application is a library, a process /// using the library might set its umask to a value preventing other @@ -1019,7 +1135,7 @@ namespace BerkeleyDB { } } /// <summary> - /// If true, Berkeley DB will flush log writes to the backing disk + /// If true, Berkeley DB flushes log writes to the backing disk /// before returning from the write system call, rather than flushing /// log writes explicitly in a separate system call, as necessary. /// </summary> @@ -1034,7 +1150,7 @@ namespace BerkeleyDB { } } /// <summary> - /// If true, Berkeley DB will automatically remove log files that are no + /// If true, Berkeley DB automatically removes log files that are no /// longer needed. /// </summary> public bool LogAutoRemove { @@ -1049,7 +1165,22 @@ namespace BerkeleyDB { } } /// <summary> - /// If true, transaction logs are maintained in memory rather than on + /// If true, Berkeley DB avoids the fsync() call when the log files are + /// flushed. + /// </summary> + public bool LogNoSync { + get { + int onoff = 0; + dbenv.log_get_config(DbConstants.DB_LOG_NOSYNC, ref onoff); + return (onoff != 0); + } + set { + dbenv.log_set_config( + DbConstants.DB_LOG_NOSYNC, value ? 1 : 0); + } + } + /// <summary> + /// If true, transaction logs are maintained in-memory rather than on /// disk. This means that transactions exhibit the ACI (atomicity, /// consistency, and isolation) properties, but not D (durability). /// </summary> @@ -1120,7 +1251,7 @@ namespace BerkeleyDB { /// group, and those members may be configured to store log records /// on-disk.) When choosing log buffer and file sizes for in-memory /// logs, applications should ensure the in-memory log buffer size is - /// large enough that no transaction will ever span the entire buffer, + /// large enough that no transaction ever spans the entire buffer, /// and avoid a state where the in-memory buffer is full and no space /// can be freed because a transaction that started in the first log /// "file" is still active. @@ -1131,8 +1262,8 @@ namespace BerkeleyDB { /// </para> /// <para> /// If no size is specified by the application, the size last specified - /// for the database region will be used, or if no database region - /// previously existed, the default will be used. + /// for the database region is used, or if no database region + /// previously existed, the default is used. /// </para> /// </remarks> public uint MaxLogFileSize { @@ -1200,7 +1331,7 @@ namespace BerkeleyDB { } } /// <summary> - /// The number of file descriptors the library will open concurrently + /// The number of file descriptors the library opens concurrently /// when flushing dirty pages from the cache. /// </summary> public int MaxOpenFiles { @@ -1236,12 +1367,11 @@ namespace BerkeleyDB { /// Transactions that update multiversion databases are not freed until /// the last page version that the transaction created is flushed from /// cache. This means that applications using multi-version concurrency - /// control may need a transaction for each page in cache, in the - /// extreme case. + /// control may need in the extreme case a transaction for each page in cache. /// </para> /// <para> /// When all of the memory available in the database environment for - /// transactions is in use, calls to <see cref="BeginTransaction"/> will + /// transactions is in use, calls to <see cref="BeginTransaction"/> /// fail (until some active transactions complete). If MaxTransactions /// is never set, the database environment is configured to support at /// least 100 active transactions. @@ -1305,6 +1435,18 @@ namespace BerkeleyDB { } } /// <summary> + /// The message file. + /// </summary> + public string Msgfile { + set { + int ret = 0; + ret = dbenv.set_msgfile(value); + if(ret != 0) { + throw new Exception("Set message file fails."); + } + } + } + /// <summary> /// The mutex alignment, in bytes. /// </summary> public uint MutexAlignment { @@ -1345,7 +1487,7 @@ namespace BerkeleyDB { } } /// <summary> - /// If true, Berkeley DB will grant all requested mutual exclusion + /// If true, Berkeley DB grants all requested mutual exclusion /// mutexes and database locks without regard for their actual /// availability. This functionality should never be used for purposes /// other than debugging. @@ -1361,7 +1503,7 @@ namespace BerkeleyDB { } } /// <summary> - /// If true, Berkeley DB will copy read-only database files into the + /// If true, Berkeley DB copies read-only database files into the /// local cache instead of potentially mapping them into process memory. /// </summary> /// <seealso cref="MMapSize"/> @@ -1376,7 +1518,7 @@ namespace BerkeleyDB { } } /// <summary> - /// If true, Berkeley DB will ignore any panic state in the database + /// If true, Berkeley DB ignores any panic state in the database /// environment. (Database environments in a panic state normally refuse /// all attempts to call Berkeley DB functions, throwing /// <see cref="RunRecoveryException"/>.) This functionality should never @@ -1413,9 +1555,9 @@ namespace BerkeleyDB { /// </summary> /// <remarks> /// Berkeley DB overwrites files using alternating 0xff, 0x00 and 0xff - /// byte patterns. For file overwriting to be effective, the underlying + /// byte patterns. For an effective overwrite, the underlying /// file must be stored on a fixed-block filesystem. Systems with - /// journaling or logging filesystems will require operating system + /// journaling or logging filesystems require operating system /// support and probably modification of the Berkeley DB sources. /// </remarks> public bool Overwrite { @@ -1429,6 +1571,19 @@ namespace BerkeleyDB { } } /// <summary> + /// The function used to create a replication view that determines + /// whether a database file is replicated to the local site. + /// </summary> + /// <remarks> + /// If it is null, the replication view is a full view and all database + /// files are replicated to the local site. Otherwise it is a partial + /// view and only some database files are replicated to the local site. + /// </remarks> + public ReplicationViewDelegate ReplicationView { + get { return replicationViewHandler; } + private set { replicationViewHandler = value;} + } + /// <summary> /// If true, allocate region memory from the heap instead of from memory /// backed by the filesystem or system shared memory. /// </summary> @@ -1478,17 +1633,17 @@ namespace BerkeleyDB { /// </summary> /// <param name="GBytes"> /// The number of gigabytes to allocate for the main memory region. - /// The gigabytes allocated will be added to the bytes input. + /// The gigabytes allocated are added to the bytes input. /// </param> /// <param name="Bytes"> /// The number of gigabytes to allocate for the main memory region. - /// The bytes allocated will be added to the gigabytes input. + /// The bytes allocated are added to the gigabytes input. /// </param> public void RegionSetMemoryLimit(uint GBytes, uint Bytes) { dbenv.set_memory_max(GBytes, Bytes); } /// <summary> - /// If true, Berkeley DB will have checked to see if recovery needed to + /// If true, Berkeley DB checks if recovery is needed to /// be performed before opening the database environment. /// </summary> public bool Register { @@ -1523,16 +1678,14 @@ namespace BerkeleyDB { } } /// <summary> - /// The amount of time a master site will delay between completing a + /// The amount of time a master site delays between completing a /// checkpoint and writing a checkpoint record into the log. /// </summary> /// <remarks> /// This delay allows clients to complete their own checkpoints before /// the master requires completion of them. The default is 30 seconds. - /// If all databases in the environment, and the environment's - /// transaction log, are configured to reside in memory (never preserved - /// to disk), then, although checkpoints are still necessary, the delay - /// is not useful and should be set to 0. + /// Delay should be set to 0 if all databases in the environment and the + /// environment's transaction log are configured to reside in-memory. /// </remarks> public uint RepCheckpointDelay { get { return getRepTimeout(DbConstants.DB_REP_CHECKPOINT_DELAY); } @@ -1602,7 +1755,7 @@ namespace BerkeleyDB { dbenv.rep_set_clockskew(fast, slow); } /// <summary> - /// The amount of time the replication manager will wait before trying + /// The amount of time the replication manager waits before trying /// to re-establish a connection to another site after a communication /// failure. The default wait time is 30 seconds. /// </summary> @@ -1615,7 +1768,7 @@ namespace BerkeleyDB { } /// <summary> /// If true, the client should delay synchronizing to a newly declared - /// master (defaults to false). Clients configured in this way will remain + /// master (defaults to false). Clients configured in this way remain /// unsynchronized until the application calls <see cref="RepSync"/>. /// </summary> public bool RepDelayClientSync { @@ -1626,7 +1779,7 @@ namespace BerkeleyDB { } } /// <summary> - /// Configure the amount of time the replication manager will wait + /// Configure the amount of time the replication manager waits /// before retrying a failed election. The default wait time is 10 /// seconds. /// </summary> @@ -1681,7 +1834,7 @@ namespace BerkeleyDB { /// <summary> /// The frequency at which the replication manager, running at a master /// site, broadcasts a heartbeat message in an otherwise idle system. - /// When 0 (the default), no heartbeat messages will be sent. + /// When 0 (the default), no heartbeat messages are sent. /// </summary> public uint RepHeartbeatSend { get { return getRepTimeout(DbConstants.DB_REP_HEARTBEAT_SEND); } @@ -1739,7 +1892,7 @@ namespace BerkeleyDB { } } /// <summary> - /// Specify how master and client sites will handle acknowledgment of + /// Specify how master and client sites handle acknowledgment of /// replication messages which are necessary for "permanent" records. /// The current implementation requires all sites in a replication group /// configure the same acknowledgement policy. @@ -1754,6 +1907,30 @@ namespace BerkeleyDB { set { dbenv.repmgr_set_ack_policy(value.Policy); } } /// <summary> + /// The gigabytes component of the maximum amount of dynamic memory + /// used by the Replication Manager incoming queue. + /// </summary> + public uint RepmgrIncomingQueueMaxGBytes { + get { + uint gb = 0; + uint b = 0; + dbenv.repmgr_get_incoming_queue_max(ref gb, ref b); + return gb; + } + } + /// <summary> + /// The bytes component of the maximum amount of dynamic memory + /// used by the Replication Manager incoming queue. + /// </summary> + public uint RepmgrIncomingQueueMaxBytes { + get { + uint gb = 0; + uint b = 0; + dbenv.repmgr_get_incoming_queue_max(ref gb, ref b); + return b; + } + } + /// <summary> /// Create DbChannel with given eid. /// </summary> /// <param name="eid"> @@ -1767,8 +1944,7 @@ namespace BerkeleyDB { } /// <summary> /// If true, Replication Manager automatically runs elections to - /// choose a new master when the old master appears to - /// have become disconnected (defaults to true). + /// choose a new master when the old master disconnects (defaults to true). /// </summary> public bool RepMgrRunElections { get { return getRepConfig(DbConstants.DB_REPMGR_CONF_ELECTIONS); } @@ -1800,7 +1976,7 @@ namespace BerkeleyDB { get { return dbenv.repmgr_site_list(); } } /// <summary> - /// If true, the replication master will automatically re-initialize + /// If true, the replication master automatically re-initializes /// outdated clients (defaults to true). /// </summary> public bool RepAutoInit { @@ -1811,9 +1987,9 @@ namespace BerkeleyDB { } } /// <summary> - /// If true, Berkeley DB method calls that would normally block while - /// clients are in recovery will return errors immediately (defaults to - /// false). + /// If true, errors are returned immediately for Berkeley DB method calls + /// that would normally block while clients are in recovery + /// (defaults to false). /// </summary> public bool RepNoBlocking { get { return getRepConfig(DbConstants.DB_REP_CONF_NOWAIT); } @@ -1893,17 +2069,16 @@ namespace BerkeleyDB { /// maximum threshold of <paramref name="max"/> microseconds. /// </para> /// <para> - /// These values are thresholds only. Since Berkeley DB has no thread - /// available in the library as a timer, the threshold is only checked + /// These values are only thresholds. Since Berkeley DB has no thread + /// available as a timer in the library, the threshold is only checked /// when a thread enters the Berkeley DB library to process an incoming - /// replication message. Any amount of time may have passed since the - /// last message arrived and Berkeley DB only checks whether the amount + /// replication message. Berkeley DB checks whether the amount /// of time since a request was made is beyond the threshold value or /// not. /// </para> /// <para> - /// By default the minimum is 40000 and the maximum is 1280000 (1.28 - /// seconds). These defaults are fairly arbitrary and the application + /// By default the minimum is 40000 and the maximum is 1280000 microseconds + /// (1.28 seconds). These defaults are fairly arbitrary and the application /// likely needs to adjust these. The values should be based on expected /// load and performance characteristics of the master and client host /// platforms and transport infrastructure as well as round-trip message @@ -1922,8 +2097,8 @@ namespace BerkeleyDB { } /// <summary> /// Replication Manager observes the strict "majority" rule in managing - /// elections, even in a group with only 2 sites. This means the client - /// in a 2-site group will be unable to take over as master if the + /// elections, even in a group with only 2 sites. The client + /// in a 2-site group is unable to take over as master if the /// original master fails or becomes disconnected. (See the Elections /// section in the Berkeley DB Reference Guide for more information.) /// Both sites in the replication group should have the same value for @@ -1939,8 +2114,39 @@ namespace BerkeleyDB { } } /// <summary> + /// This flag is used to specify the preferred master site in a + /// replication group operating in preferred master mode. A preferred + /// master replication group must contain only two sites, with one site + /// specified as the preferred master site and the other site specified + /// as the client site. The preferred master site operates as the + /// master site whenever possible. + /// </summary> + public bool RepPrefmasMaster { + get { return getRepConfig(DbConstants.DB_REPMGR_CONF_PREFMAS_MASTER); } + set { + dbenv.rep_set_config( + DbConstants.DB_REPMGR_CONF_PREFMAS_MASTER, value ? 1 : 0); + } + } + /// <summary> + /// This flag is used to specify the client site in a replication group + /// operating in preferred master mode. A preferred master replication + /// group must contain only two sites, with one site specified as the + /// preferred master site and the other site specified as the client + /// site. The client site in a preferred master replication group takes + /// over temporarily as master when the preferred master site is + /// unavailable. + /// </summary> + public bool RepPrefmasClient { + get { return getRepConfig(DbConstants.DB_REPMGR_CONF_PREFMAS_CLIENT); } + set { + dbenv.rep_set_config( + DbConstants.DB_REPMGR_CONF_PREFMAS_CLIENT, value ? 1 : 0); + } + } + /// <summary> /// The gigabytes component of the byte-count limit on the amount of - /// data that will be transmitted from a site in response to a single + /// data that is transmitted from a site in response to a single /// message processed by <see cref="RepProcessMessage"/>. /// </summary> public uint RepTransmitLimitGBytes { @@ -1953,7 +2159,7 @@ namespace BerkeleyDB { } /// <summary> /// The bytes component of the byte-count limit on the amount of data - /// that will be transmitted from a site in response to a single + /// that is transmitted from a site in response to a single /// message processed by <see cref="RepProcessMessage"/>. /// </summary> public uint RepTransmitLimitBytes { @@ -1965,7 +2171,7 @@ namespace BerkeleyDB { } } /// <summary> - /// Set a byte-count limit on the amount of data that will be + /// Set a byte-count limit on the amount of data that is /// transmitted from a site in response to a single message processed by /// <see cref="RepProcessMessage"/>. The limit is not a hard limit, and /// the record that exceeds the limit is the last record to be sent. @@ -1983,18 +2189,46 @@ namespace BerkeleyDB { /// <param name="GBytes"> /// The number of gigabytes which, when added to /// <paramref name="Bytes"/>, specifies the maximum number of bytes that - /// will be sent in a single call to <see cref="RepProcessMessage"/>. + /// are sent in a single call to <see cref="RepProcessMessage"/>. /// </param> /// <param name="Bytes"> /// The number of bytes which, when added to /// <paramref name="GBytes"/>, specifies the maximum number of bytes - /// that will be sent in a single call to + /// that are sent in a single call to /// <see cref="RepProcessMessage"/>. /// </param> public void RepSetTransmitLimit(uint GBytes, uint Bytes) { dbenv.rep_set_limit(GBytes, Bytes); } /// <summary> + /// Set a byte-count limit on the maximum amount of dynamic memory + /// used by the Replication Manager incoming queue. + /// </summary> + /// <remarks> + /// <para> + /// By default, the Replication Manager incoming queue size has a + /// limit of 100MB. + /// </para> + /// <para> + /// If both <paramref name="GBytes"/> and <paramref name="Bytes"/> are + /// zero, then the Replication Manager incoming queue size is limited + /// by available heap memory. + /// </para> + /// </remarks> + /// <param name="GBytes"> + /// The number of gigabytes which, when added to + /// <paramref name="Bytes"/>, specifies the maximum amount of dynamic + /// memory used by the Replication Manager incoming queue. + /// </param> + /// <param name="Bytes"> + /// The number of bytes which, when added to + /// <paramref name="GBytes"/>, specifies the maximum amount of dynamic + /// memory used by the Replication Manager incoming queue. + /// </param> + public void RepmgrSetIncomingQueueMax(uint GBytes, uint Bytes) { + dbenv.repmgr_set_incoming_queue_max(GBytes, Bytes); + } + /// <summary> /// The delegate used to transmit data using the replication /// application's communication infrastructure. /// </summary> @@ -2034,7 +2268,7 @@ namespace BerkeleyDB { transportHandler = transport; } /// <summary> - /// If true, master leases will be used for this site (defaults to + /// If true, master leases are used for this site (defaults to /// false). /// </summary> /// <remarks> @@ -2072,7 +2306,7 @@ namespace BerkeleyDB { } } /// <summary> - /// The number of microseconds the thread of control will pause before + /// The number of microseconds the thread of control pauses before /// scheduling further write operations. /// </summary> public uint SequentialWritePause { @@ -2135,12 +2369,12 @@ namespace BerkeleyDB { } } /// <summary> - /// The path of a directory to be used as the location of temporary + /// The path of a directory to be used as the location for temporary /// files. /// </summary> /// <remarks> /// <para> - /// The files created to back in-memory access method databases will be + /// The files created to back in-memory access method databases are /// created relative to this path. These temporary files can be quite /// large, depending on the size of the database. /// </para> @@ -2205,13 +2439,12 @@ namespace BerkeleyDB { } /// <summary> /// If true, database calls timing out based on lock or transaction - /// timeout values will throw <see cref="LockNotGrantedException"/> + /// timeout values throw <see cref="LockNotGrantedException"/> /// instead of <see cref="DeadlockException"/>. /// </summary> /// <remarks> - /// If true, this allows applications to distinguish between operations - /// which have deadlocked and operations which have exceeded their time - /// limits. + /// If true, allows applications to distinguish between deadlocked operations + /// and operations that have exceeded their time limits. /// </remarks> public bool TimeNotGranted { get { @@ -2224,13 +2457,13 @@ namespace BerkeleyDB { } } /// <summary> - /// If true, Berkeley DB will not write or synchronously flush the log + /// If true, Berkeley DB does not write or synchronously flush the log /// on transaction commit. /// </summary> /// <remarks> /// This means that transactions exhibit the ACI (atomicity, - /// consistency, and isolation) properties, but not D (durability); that - /// is, database integrity will be maintained, but if the application or + /// consistency, and isolation) properties, but not D (durability); + /// database integrity is maintained, but if the application or /// system fails, it is possible some number of the most recently /// committed transactions may be undone during recovery. The number of /// transactions at risk is governed by how many log updates can fit @@ -2261,10 +2494,10 @@ namespace BerkeleyDB { set { dbenv.set_flags(DbConstants.DB_TXN_NOWAIT, value ? 1 : 0); } } /// <summary> - /// If true, all transactions in the environment will be started as if + /// If true, all transactions in the environment are started as if /// <see cref="TransactionConfig.Snapshot"/> was passed to /// <see cref="BeginTransaction"/>, and all non-transactional cursors - /// will be opened as if <see cref="CursorConfig.SnapshotIsolation"/> + /// are opened as if <see cref="CursorConfig.SnapshotIsolation"/> /// was passed to <see cref="BaseDatabase.Cursor"/>. /// </summary> public bool TxnSnapshot { @@ -2281,10 +2514,8 @@ namespace BerkeleyDB { /// <remarks> /// <para> /// All timeouts are checked whenever a thread of control blocks on a - /// lock or when deadlock detection is performed. As timeouts are only - /// checked when the lock request first blocks or when deadlock - /// detection is performed, the accuracy of the timeout depends on how - /// often deadlock detection is performed. + /// lock or when deadlock detection is performed. The accuracy of the + /// timeout depends on how often deadlock detection is performed. /// </para> /// <para> /// Timeout values specified for the database environment may be @@ -2322,15 +2553,15 @@ namespace BerkeleyDB { } } /// <summary> - /// If true, Berkeley DB will write, but will not synchronously flush, + /// If true, Berkeley DB writes, but does not synchronously flush, /// the log on transaction commit. /// </summary> /// <remarks> /// This means that transactions exhibit the ACI (atomicity, - /// consistency, and isolation) properties, but not D (durability); that - /// is, database integrity will be maintained, but if the system fails, - /// it is possible some number of the most recently committed - /// transactions may be undone during recovery. The number of + /// consistency, and isolation) properties, but not D (durability); database + /// integrity is maintained, but if the application or + /// system fails, it is possible that some number of the most recently + /// committed transactions may be undone during recovery. The number of /// transactions at risk is governed by how often the system flushes /// dirty buffers to disk and how often the log is checkpointed. /// </remarks> @@ -2345,11 +2576,11 @@ namespace BerkeleyDB { } } /// <summary> - /// If true, all databases in the environment will be opened as if + /// If true, all databases in the environment are opened as if /// <see cref="DatabaseConfig.UseMVCC"/> was set. /// </summary> /// <remarks> - /// This flag will be ignored for queue databases for which MVCC is not + /// This flag is ignored for queue databases for which MVCC is not /// supported. /// </remarks> public bool UseMVCC { @@ -2439,7 +2670,7 @@ namespace BerkeleyDB { } } /// <summary> - /// If true, Berkeley DB will yield the processor immediately after each + /// If true, Berkeley DB yields the processor immediately after each /// page or mutex acquisition. /// </summary> /// <remarks> @@ -2489,7 +2720,7 @@ namespace BerkeleyDB { /// <para> /// If there are processes that have called <see cref="Open"/> without /// calling <see cref="Close"/> (that is, there are processes currently - /// using the environment), Remove will fail without further action. + /// using the environment), Remove fails without further action. /// </para> /// <para> /// Calling Remove should not be necessary for most applications because @@ -2530,13 +2761,12 @@ namespace BerkeleyDB { /// The result of attempting to forcibly destroy the environment when it /// is in use is unspecified. Processes using an environment often /// maintain open file descriptors for shared regions within it. On UNIX - /// systems, the environment removal will usually succeed, and processes - /// that have already joined the region will continue to run in that + /// systems, the environment removal usually succeeds, and processes + /// that have already joined the region continue to run in that /// region without change. However, processes attempting to join the - /// environment will either fail or create new regions. On other systems - /// in which the unlink(2) system call will fail if any process has an - /// open file descriptor for the file (for example Windows/NT), the - /// region removal will fail. + /// environment either fail or create new regions. On non-UNIX systems, + /// region removal is not possible because the unlink(2) system call fails + /// if any process has an open file descriptor for the file. /// </para> /// </remarks> /// <param name="db_home"> @@ -2572,7 +2802,7 @@ namespace BerkeleyDB { /// </para> /// <para> /// By default, data directories and the log directory specified - /// relative to the home directory will be recreated relative to the + /// relative to the home directory are recreated relative to the /// target directory. If absolute path names are used, then use the /// <see cref="BackupOptions.SingleDir"/> method. /// </para> @@ -2601,15 +2831,15 @@ namespace BerkeleyDB { /// </para> /// </summary> /// <param name="target">Identifies the directory in which the back up - /// will be placed. Any subdirectories required to contain the back up - /// must be placed relative to this directory. Note that if an + /// is placed. Any subdirectories required to contain the back up + /// must be placed relative to this directory. If an /// <see cref="IBackup"/> is configured for the environment, then the /// value specified to this parameter is passed on to the /// <see cref="IBackup.Open"/> method. If this parameter is null, then /// the target must be specified to the <see cref="IBackup.Open"/> /// method. /// <para> - /// This directory, and any required subdirectories, will be created for + /// This directory, and any required subdirectories, are created for /// you if you specify <see cref="CreatePolicy.IF_NEEDED"/> or /// <see cref="CreatePolicy.ALWAYS"/> for the /// <see cref="BackupOptions.Creation"/> property. @@ -2638,7 +2868,7 @@ namespace BerkeleyDB { /// </para> /// </summary> /// <param name="target">Identifies the directory in which the back up - /// will be placed.</param> + /// is placed.</param> /// <param name="database">The database file that you want to back up. /// </param> /// <param name="must_create">If true, then if the target file exists, @@ -2661,7 +2891,7 @@ namespace BerkeleyDB { /// <param name="nsites"> /// The number of replication sites expected to participate in the /// election. Once the current site has election information from that - /// many sites, it will short-circuit the election and immediately cast + /// many sites, it short-circuits the election and immediately casts /// its vote for a new master. If an application is using master leases, /// then the value must be 0 and <see cref="RepNSites"/> must be used. /// </param> @@ -2680,7 +2910,7 @@ namespace BerkeleyDB { /// framework. /// </para> /// <para> - /// If the election is successful, Berkeley DB will notify the + /// If the election is successful, Berkeley DB notifies the /// application of the results of the election by means of either the /// <see cref="NotificationEvent.REP_ELECTED"/> or /// <see cref="NotificationEvent.REP_NEWMASTER"/> events (see @@ -2703,7 +2933,7 @@ namespace BerkeleyDB { /// <param name="nsites"> /// The number of replication sites expected to participate in the /// election. Once the current site has election information from that - /// many sites, it will short-circuit the election and immediately cast + /// many sites, it short-circuits the election and immediately casts /// its vote for a new master. This parameter must be no less than /// <paramref name="nvotes"/>, or 0 if the election should use /// <see cref="RepNSites"/>. If an application is using master leases, @@ -2711,7 +2941,7 @@ namespace BerkeleyDB { /// </param> /// <param name="nvotes"> /// The minimum number of replication sites from which the current site - /// must have election information, before the current site will cast a + /// must have election information, before the current site casts a /// vote for a new master. This parameter must be no greater than /// <paramref name="nsites"/>, or 0 if the election should use the value /// ((<paramref name="nsites"/> / 2) + 1). @@ -3081,8 +3311,8 @@ namespace BerkeleyDB { /// </para> /// <para> /// If an application has configured delayed master synchronization, the - /// application must synchronize explicitly (otherwise the client will - /// remain out-of-date and will ignore all database changes forwarded + /// application must synchronize explicitly (otherwise the client + /// remains out-of-date and ignores database changes forwarded /// from the replication group master). RepSync may be called any time /// after the client application learns that the new master has been /// established (by receiving @@ -3120,9 +3350,9 @@ namespace BerkeleyDB { /// file in which transactions are being logged or aborted.) /// </para> /// <para> - /// When Replication Manager is in use, log archiving will be performed + /// When Replication Manager is in use, log archiving is performed /// in a replication group-aware manner such that the log file status of - /// other sites in the group will be considered to determine if a log + /// other sites in the group are examined to determine if a log /// file could be in use. /// </para> /// <para> @@ -3144,17 +3374,17 @@ namespace BerkeleyDB { } /// <summary> /// The database files that need to be archived in order to recover the - /// database from catastrophic failure. If any of the database files - /// have not been accessed during the lifetime of the current log files, - /// they will not included in this list. It is also possible that some + /// database from catastrophic failure. Database files that have not been + /// accessed during the lifetime of the current log files + /// are not included in this list. It is also possible that some /// of the files referred to by the log have since been deleted from the /// system. /// </summary> /// <remarks> /// <para> - /// When Replication Manager is in use, log archiving will be performed + /// When Replication Manager is in use, log archiving is performed /// in a replication group-aware manner such that the log file status of - /// other sites in the group will be considered to determine if a log + /// other sites in the group are examined to determine if a log /// file could be in use. /// </para> /// <para> @@ -3217,9 +3447,9 @@ namespace BerkeleyDB { /// </summary> /// <remarks> /// <para> - /// When Replication Manager is in use, log archiving will be performed + /// When Replication Manager is in use, log archiving is performed /// in a replication group-aware manner such that the log file status of - /// other sites in the group will be considered to determine if a log + /// other sites in the group are examined to determine if a log /// file could be in use. /// </para> /// </remarks> @@ -3233,7 +3463,7 @@ namespace BerkeleyDB { /// </summary> /// <remarks> /// <para> - /// Calling <see cref="Transaction.Commit"/> will discard the allocated + /// Calling <see cref="Transaction.Commit"/> discards the allocated /// locker ID. /// </para> /// <para> @@ -3280,7 +3510,7 @@ namespace BerkeleyDB { /// The configuration properties for the transaction /// </param> /// <param name="parent"> - /// If the non-null, the new transaction will be a nested transaction, + /// If non-null, the new transaction is a nested transaction, /// with <paramref name="parent"/> as the new transaction's parent. /// Transactions may be nested to any level. /// </param> @@ -3314,11 +3544,11 @@ namespace BerkeleyDB { /// checkpoint record to the log, and then flush the log. /// </summary> /// <param name="kbytesWritten"> - /// A checkpoint will be done if more than kbytesWritten kilobytes of + /// A checkpoint is performed if more than kbytesWritten kilobytes of /// log data have been written since the last checkpoint. /// </param> /// <param name="minutesElapsed"> - /// A checkpoint will be done if more than minutesElapsed minutes have + /// A checkpoint is performed if more than minutesElapsed minutes have /// passed since the last checkpoint. /// </param> public void Checkpoint(uint kbytesWritten, uint minutesElapsed) { @@ -3349,8 +3579,8 @@ namespace BerkeleyDB { /// with depending on this semantic is that aborting an unresolved /// transaction involving database operations requires a database /// handle. Because the database handles should have been closed before - /// calling CloseForceSync, it will not be possible to abort the - /// transaction, and recovery will have to be run on the Berkeley DB + /// calling CloseForceSync, it is not possible to abort the + /// transaction, and recovery should be run on the Berkeley DB /// environment before further operations are done. /// </para> /// <para> @@ -3372,9 +3602,9 @@ namespace BerkeleyDB { /// to it is not yet closed; for example, database environment handles /// must not be closed while transactions in the environment have /// not yet been committed or aborted. If there are open database - /// handles, they are all closed, and each of them will be synced on + /// handles, they are all closed, and each of them is synced on /// close. The first error in the close operations, if any, is - /// returned at last, and the environment close procedures will + /// returned at last, and the environment close procedures /// carry on anyway. /// </para> /// <para> @@ -3386,8 +3616,8 @@ namespace BerkeleyDB { /// with depending on this semantic is that aborting an unresolved /// transaction involving database operations requires a database /// handle. Because the database handles should have been closed before - /// calling CloseForceSync, it will not be possible to abort the - /// transaction, and recovery will have to be run on the Berkeley DB + /// calling CloseForceSync, it is not possible to abort the + /// transaction, and recovery should be run on the Berkeley DB /// environment before further operations are done. /// </para> /// <para> @@ -3395,9 +3625,43 @@ namespace BerkeleyDB { /// CloseForceSync. /// </para> /// </remarks> - public void CloseForceSync() { - dbenv.close(DbConstants.DB_FORCESYNC); - } + public void CloseForceSync() { + dbenv.close(DbConstants.DB_FORCESYNC); + } + + /// <summary> + /// Close the Berkeley DB environment, freeing any allocated resources, + /// closing any open databases as well as underlying subsystems. + /// </summary> + /// <remarks> + /// <para> + /// The object should not be closed while any other handle that refers + /// to it is not yet closed; for example, database environment handles + /// must not be closed while transactions in the environment have + /// not yet been committed or aborted. Calling CloseForceSyncEnv flushes + /// all memory mapped environment regions before closing the environment. + /// </para> + /// </remarks> + public void CloseForceSyncEnv() { + dbenv.close(DbConstants.DB_FORCESYNCENV); + } + + /// <summary> + /// Close the Berkeley DB environment, freeing any allocated resources, + /// closing any open databases as well as underlying subsystems. + /// </summary> + /// <remarks> + /// <para> + /// The object should not be closed while any other handle that refers + /// to it is not yet closed; for example, database environment handles + /// must not be closed while transactions in the environment have + /// not yet been committed or aborted. Calling CloseForceSyncAndForceSyncEnv + /// has the effect of both CloseForceSync and CloseForceSyncEnv. See + /// CloseForceSync and CloseForceSyncEnv documentation for more details. + /// </remarks> + public void CloseForceSyncAndForceSyncEnv() { + dbenv.close(DbConstants.DB_FORCESYNC | DbConstants.DB_FORCESYNCENV); + } /// <summary> /// Run one iteration of the deadlock detector. The deadlock detector @@ -3435,14 +3699,14 @@ namespace BerkeleyDB { /// </para> /// <para> /// If FailCheck determines a thread of control exited while holding - /// database read locks, it will release those locks. If FailCheck + /// database read locks, it releases those locks. If FailCheck /// determines a thread of control exited with an unresolved - /// transaction, the transaction will be aborted. In either of these - /// cases, FailCheck will return successfully and the application may + /// transaction, the transaction aborts. In either of these + /// cases, FailCheck returns successfully and the application may /// continue to use the database environment. /// </para> /// <para> - /// In either of these cases, FailCheck will also report the process and + /// In either of these cases, FailCheck also reports the process and /// thread IDs associated with any released locks or aborted /// transactions. The information is printed to a specified output /// channel (see <see cref="Verbosity"/> for more information), or @@ -3451,7 +3715,7 @@ namespace BerkeleyDB { /// </para> /// <para> /// If FailCheck determines a thread of control has exited such that - /// database environment recovery is required, it will throw + /// database environment recovery is required, it throws /// <see cref="RunRecoveryException"/>. In this case, the application /// should not continue to use the database environment. For a further /// description as to the actions the application should take when this @@ -3483,11 +3747,11 @@ namespace BerkeleyDB { /// <returns> /// This method returns TransactionAppliedStatus.APPLIED to indicate that the specified /// transaction has indeed been applied at the local site. TransactionAppliedStatus.TIMEOUT - /// will be returned if the specified transaction has not yet arrived at the calling site, - /// but can be expected to arrive soon. TransactionAppliedStatus.NOTFOUND will be returned + /// returns if the specified transaction has not yet arrived at the calling site, + /// but can be expected to arrive soon. TransactionAppliedStatus.NOTFOUND is returned /// if the transaction has not been applied at the local site, and it can be determined that /// the transaction has been rolled back due to a master takeover, and is therefore never - /// expected to arrive. TransactionAppliedStatus.EMPTY_TRANSACTION will be return if the specified + /// expected to arrive. TransactionAppliedStatus.EMPTY_TRANSACTION returns if the specified /// token was generated by a transaction that did not modify the database environment /// (e.g., a read-only transaction). /// </returns> @@ -3651,8 +3915,8 @@ namespace BerkeleyDB { /// <param name="file">The physical file to be removed.</param> /// <param name="autoCommit"> /// If true, enclose RemoveDB within a transaction. If the call - /// succeeds, changes made by the operation will be recoverable. If the - /// call fails, the operation will have made no changes. + /// succeeds, changes made by the operation are recoverable. If the + /// call fails, the operation has made no changes. /// </param> public void RemoveDB(string file, bool autoCommit) { RemoveDB(file, null, autoCommit, null); @@ -3669,8 +3933,8 @@ namespace BerkeleyDB { /// <param name="database">The database to be removed.</param> /// <param name="autoCommit"> /// If true, enclose RemoveDB within a transaction. If the call - /// succeeds, changes made by the operation will be recoverable. If the - /// call fails, the operation will have made no changes. + /// succeeds, changes made by the operation are recoverable. If the + /// call fails, the operation has made no changes. /// </param> public void RemoveDB(string file, string database, bool autoCommit) { RemoveDB(file, database, autoCommit, null); @@ -3682,8 +3946,8 @@ namespace BerkeleyDB { /// <param name="file">The physical file to be removed.</param> /// <param name="autoCommit"> /// If true, enclose RemoveDB within a transaction. If the call - /// succeeds, changes made by the operation will be recoverable. If the - /// call fails, the operation will have made no changes. + /// succeeds, changes made by the operation are recoverable. If the + /// call fails, the operation has made no changes. /// </param> /// <param name="txn"> /// If the operation is part of an application-specified transaction, @@ -3693,7 +3957,7 @@ namespace BerkeleyDB { /// <paramref name="txn"/> is a handle returned from /// <see cref="DatabaseEnvironment.BeginCDSGroup"/>; otherwise null. If /// null, but <paramref name="autoCommit"/> or <see cref="AutoCommit"/> - /// is true, the operation will be implicitly transaction protected. + /// is true, the operation is implicitly transaction protected. /// </param> public void RemoveDB(string file, bool autoCommit, Transaction txn) { RemoveDB(file, null, autoCommit, txn); @@ -3710,8 +3974,8 @@ namespace BerkeleyDB { /// <param name="database">The database to be removed.</param> /// <param name="autoCommit"> /// If true, enclose RemoveDB within a transaction. If the call - /// succeeds, changes made by the operation will be recoverable. If the - /// call fails, the operation will have made no changes. + /// succeeds, changes made by the operation are recoverable. If the + /// call fails, the operation has made no changes. /// </param> /// <param name="txn"> /// If the operation is part of an application-specified transaction, @@ -3721,7 +3985,7 @@ namespace BerkeleyDB { /// <paramref name="txn"/> is a handle returned from /// <see cref="DatabaseEnvironment.BeginCDSGroup"/>; otherwise null. If /// null, but <paramref name="autoCommit"/> or <see cref="AutoCommit"/> - /// is true, the operation will be implicitly transaction protected. + /// is true, the operation is implicitly transaction protected. /// </param> public void RemoveDB( string file, string database, bool autoCommit, Transaction txn) { @@ -3738,8 +4002,8 @@ namespace BerkeleyDB { /// <param name="newname">The new name of the database or file.</param> /// <param name="autoCommit"> /// If true, enclose RenameDB within a transaction. If the call - /// succeeds, changes made by the operation will be recoverable. If the - /// call fails, the operation will have made no changes. + /// succeeds, changes made by the operation are recoverable. If the + /// call fails, the operation has made no changes. /// </param> public void RenameDB(string file, string newname, bool autoCommit) { RenameDB(file, null, newname, autoCommit, null); @@ -3759,8 +4023,8 @@ namespace BerkeleyDB { /// <param name="newname">The new name of the database or file.</param> /// <param name="autoCommit"> /// If true, enclose RenameDB within a transaction. If the call - /// succeeds, changes made by the operation will be recoverable. If the - /// call fails, the operation will have made no changes. + /// succeeds, changes made by the operation are recoverable. If the + /// call fails, the operation has made no changes. /// </param> public void RenameDB( string file, string database, string newname, bool autoCommit) { @@ -3775,8 +4039,8 @@ namespace BerkeleyDB { /// <param name="newname">The new name of the database or file.</param> /// <param name="autoCommit"> /// If true, enclose RenameDB within a transaction. If the call - /// succeeds, changes made by the operation will be recoverable. If the - /// call fails, the operation will have made no changes. + /// succeeds, changes made by the operation are recoverable. If the + /// call fails, the operation has made no changes. /// </param> /// <param name="txn"> /// If the operation is part of an application-specified transaction, @@ -3786,7 +4050,7 @@ namespace BerkeleyDB { /// <paramref name="txn"/> is a handle returned from /// <see cref="DatabaseEnvironment.BeginCDSGroup"/>; otherwise null. If /// null, but <paramref name="autoCommit"/> or <see cref="AutoCommit"/> - /// is true, the operation will be implicitly transaction protected. + /// is true, the operation is implicitly transaction protected. /// </param> public void RenameDB(string file, string newname, bool autoCommit, Transaction txn) { @@ -3807,8 +4071,8 @@ namespace BerkeleyDB { /// <param name="newname">The new name of the database or file.</param> /// <param name="autoCommit"> /// If true, enclose RenameDB within a transaction. If the call - /// succeeds, changes made by the operation will be recoverable. If the - /// call fails, the operation will have made no changes. + /// succeeds, changes made by the operation are recoverable. If the + /// call fails, the operation has made no changes. /// </param> /// <param name="txn"> /// If the operation is part of an application-specified transaction, @@ -3818,7 +4082,7 @@ namespace BerkeleyDB { /// <paramref name="txn"/> is a handle returned from /// <see cref="DatabaseEnvironment.BeginCDSGroup"/>; otherwise null. If /// null, but <paramref name="autoCommit"/> or <see cref="AutoCommit"/> - /// is true, the operation will be implicitly transaction protected. + /// is true, the operation is implicitly transaction protected. /// </param> public void RenameDB(string file, string database, string newname, bool autoCommit, Transaction txn) { @@ -3827,8 +4091,8 @@ namespace BerkeleyDB { } /// <summary> - /// Allow database files to be copied, and then the copy used in the - /// same database environment as the original. + /// Allow database files to be copied and used in the same database + /// environment as the original. /// </summary> /// <remarks> /// <para> @@ -3847,7 +4111,7 @@ namespace BerkeleyDB { /// The name of the physical file in which new file IDs are to be created. /// </param> /// <param name="encrypted"> - /// If true, he file contains encrypted databases. + /// If true, the file contains encrypted databases. /// </param> public void ResetFileID(string file, bool encrypted) { dbenv.fileid_reset(file, encrypted ? DbConstants.DB_ENCRYPT : 0); @@ -3866,7 +4130,7 @@ namespace BerkeleyDB { /// result in data corruption if the LSNs are not first cleared. /// </para> /// <para> - /// Note that LSNs should be reset before moving or copying the database + /// LSNs should be reset before moving or copying the database /// file into a new database environment, rather than moving or copying /// the database file and then resetting the LSNs. Berkeley DB has /// consistency checks that may be triggered if an application calls @@ -4136,29 +4400,30 @@ namespace BerkeleyDB { /// by <see cref="LockStats"/>. /// </summary> public void PrintLockingSystemStats() { - PrintLockingSystemStats(false, false, false, false, false, false); + PrintLockingSystemStats + (false, false, false, false, false, false, false); } /// <summary> /// Display the locking subsystem statistical information, as described /// by <see cref="LockStats"/>. /// </summary> /// <param name="PrintAll"> - /// If true, display all available information. - /// </param> + /// If true, display all available information. + /// </param> /// <param name="ClearStats"> /// If true, reset statistics after displaying their values. /// </param> public void PrintLockingSystemStats(bool PrintAll, bool ClearStats) { PrintLockingSystemStats( - PrintAll, ClearStats, false, false, false, false); + PrintAll, ClearStats, false, false, false, false, false); } /// <summary> /// Display the locking subsystem statistical information, as described /// by <see cref="LockStats"/>. /// </summary> /// <param name="PrintAll"> - /// If true, display all available information. - /// </param> + /// If true, display all available information. + /// </param> /// <param name="ClearStats"> /// If true, reset statistics after displaying their values. /// </param> @@ -4166,7 +4431,7 @@ namespace BerkeleyDB { /// If true, display the lock conflict matrix. /// </param> /// <param name="Lockers"> - /// If true, Display the lockers within hash chains. + /// If true, display the lockers within hash chains. /// </param> /// <param name="Objects"> /// If true, display the lock objects within hash chains. @@ -4176,6 +4441,37 @@ namespace BerkeleyDB { /// </param> public void PrintLockingSystemStats(bool PrintAll, bool ClearStats, bool ConflictMatrix, bool Lockers, bool Objects, bool Parameters) { + PrintLockingSystemStats(PrintAll, ClearStats, ConflictMatrix, + Lockers, Objects, Parameters, false); + } + /// <summary> + /// Display the locking subsystem statistical information, as described + /// by <see cref="LockStats"/>. + /// </summary> + /// <param name="PrintAll"> + /// If true, display all available information. + /// </param> + /// <param name="ClearStats"> + /// If true, reset statistics after displaying their values. + /// </param> + /// <param name="ConflictMatrix"> + /// If true, display the lock conflict matrix. + /// </param> + /// <param name="Lockers"> + /// If true, display the lockers within hash chains. + /// </param> + /// <param name="Objects"> + /// If true, display the lock objects within hash chains. + /// </param> + /// <param name="Parameters"> + /// If true, display the locking subsystem parameters. + /// </param> + /// <param name="PrintAlloc"> + /// If true, display allocation information. + /// </param> + public void PrintLockingSystemStats(bool PrintAll, bool ClearStats, + bool ConflictMatrix, bool Lockers, bool Objects, bool Parameters, + bool PrintAlloc) { uint flags = 0; flags |= PrintAll ? DbConstants.DB_STAT_ALL : 0; flags |= ClearStats ? DbConstants.DB_STAT_CLEAR : 0; @@ -4183,6 +4479,7 @@ namespace BerkeleyDB { flags |= Lockers ? DbConstants.DB_STAT_LOCK_LOCKERS : 0; flags |= Objects ? DbConstants.DB_STAT_LOCK_OBJECTS : 0; flags |= Parameters ? DbConstants.DB_STAT_LOCK_PARAMS : 0; + flags |= PrintAlloc ? DbConstants.DB_STAT_ALLOC : 0; dbenv.lock_stat_print(flags); } @@ -4192,48 +4489,66 @@ namespace BerkeleyDB { /// by <see cref="LogStats"/>. /// </summary> public void PrintLoggingSystemStats() { - PrintLoggingSystemStats(false, false); + PrintLoggingSystemStats(false, false, false); } /// <summary> /// Display the logging subsystem statistical information, as described /// by <see cref="LogStats"/>. /// </summary> /// <param name="PrintAll"> - /// If true, display all available information. - /// </param> + /// If true, display all available information. + /// </param> /// <param name="ClearStats"> /// If true, reset statistics after displaying their values. /// </param> public void PrintLoggingSystemStats(bool PrintAll, bool ClearStats) { + PrintLoggingSystemStats(PrintAll, ClearStats, false); + } + /// <summary> + /// Display the logging subsystem statistical information, as described + /// by <see cref="LogStats"/>. + /// </summary> + /// <param name="PrintAll"> + /// If true, display all available information. + /// </param> + /// <param name="ClearStats"> + /// If true, reset statistics after displaying their values. + /// </param> + /// <param name="PrintAlloc"> + /// If true, display allocation information. + /// </param> + public void PrintLoggingSystemStats(bool PrintAll, bool ClearStats, + bool PrintAlloc) { uint flags = 0; flags |= PrintAll ? DbConstants.DB_STAT_ALL : 0; flags |= ClearStats ? DbConstants.DB_STAT_CLEAR : 0; + flags |= PrintAlloc ? DbConstants.DB_STAT_ALLOC : 0; dbenv.log_stat_print(flags); } /// <summary> - /// Display the memory pool (that is, buffer cache) subsystem + /// Display the memory pool (buffer cache) subsystem /// statistical information, as described by <see cref="MPoolStats"/>. /// </summary> public void PrintMPoolSystemStats() { - PrintMPoolSystemStats(false, false, false); + PrintMPoolSystemStats(false, false, false, false); } /// <summary> - /// Display the memory pool (that is, buffer cache) subsystem + /// Display the memory pool (buffer cache) subsystem /// statistical information, as described by <see cref="MPoolStats"/>. /// </summary> /// <param name="PrintAll"> - /// If true, display all available information. - /// </param> + /// If true, display all available information. + /// </param> /// <param name="ClearStats"> /// If true, reset statistics after displaying their values. /// </param> public void PrintMPoolSystemStats(bool PrintAll, bool ClearStats) { - PrintMPoolSystemStats(PrintAll, ClearStats, false); + PrintMPoolSystemStats(PrintAll, ClearStats, false, false); } /// <summary> - /// Display the memory pool (that is, buffer cache) subsystem + /// Display the memory pool (buffer cache) subsystem /// statistical information, as described by <see cref="MPoolStats"/>. /// </summary> /// <param name="PrintAll"> @@ -4247,10 +4562,31 @@ namespace BerkeleyDB { /// </param> public void PrintMPoolSystemStats( bool PrintAll, bool ClearStats, bool HashChains) { + PrintMPoolSystemStats(PrintAll, ClearStats, HashChains, false); + } + /// <summary> + /// Display the memory pool (that is, buffer cache) subsystem + /// statistical information, as described by <see cref="MPoolStats"/>. + /// </summary> + /// <param name="PrintAll"> + /// If true, display all available information. + /// </param> + /// <param name="PrintAlloc"> + /// If true, display allocation information. + /// </param> + /// <param name="ClearStats"> + /// If true, reset statistics after displaying their values. + /// </param> + /// <param name="HashChains"> + /// If true, display the buffers with hash chains. + /// </param> + public void PrintMPoolSystemStats( + bool PrintAll, bool ClearStats, bool HashChains, bool PrintAlloc) { uint flags = 0; flags |= PrintAll ? DbConstants.DB_STAT_ALL : 0; flags |= ClearStats ? DbConstants.DB_STAT_CLEAR : 0; flags |= HashChains ? DbConstants.DB_STAT_MEMP_HASH : 0; + flags |= PrintAlloc ? DbConstants.DB_STAT_ALLOC : 0; dbenv.memp_stat_print(flags); } @@ -4260,22 +4596,40 @@ namespace BerkeleyDB { /// by <see cref="MutexStats"/>. /// </summary> public void PrintMutexSystemStats() { - PrintMutexSystemStats(false, false); + PrintMutexSystemStats(false, false, false); } /// <summary> /// Display the mutex subsystem statistical information, as described /// by <see cref="MutexStats"/>. /// </summary> /// <param name="PrintAll"> - /// If true, display all available information. - /// </param> + /// If true, display all available information. + /// </param> /// <param name="ClearStats"> /// If true, reset statistics after displaying their values. /// </param> public void PrintMutexSystemStats(bool PrintAll, bool ClearStats) { + PrintMutexSystemStats(PrintAll, ClearStats, false); + } + /// <summary> + /// Display the mutex subsystem statistical information, as described + /// by <see cref="MutexStats"/>. + /// </summary> + /// <param name="PrintAll"> + /// If true, display all available information. + /// </param> + /// <param name="PrintAlloc"> + /// If true, display allocation information. + /// </param> + /// <param name="ClearStats"> + /// If true, reset statistics after displaying their values. + /// </param> + public void PrintMutexSystemStats(bool PrintAll, bool ClearStats, + bool PrintAlloc) { uint flags = 0; flags |= PrintAll ? DbConstants.DB_STAT_ALL : 0; flags |= ClearStats ? DbConstants.DB_STAT_CLEAR : 0; + flags |= PrintAlloc ? DbConstants.DB_STAT_ALLOC : 0; dbenv.mutex_stat_print(flags); } @@ -4292,8 +4646,8 @@ namespace BerkeleyDB { /// described by <see cref="RepMgrStats"/>. /// </summary> /// <param name="PrintAll"> - /// If true, display all available information. - /// </param> + /// If true, display all available information. + /// </param> /// <param name="ClearStats"> /// If true, reset statistics after displaying their values. /// </param> @@ -4317,8 +4671,8 @@ namespace BerkeleyDB { /// described by <see cref="ReplicationStats"/>. /// </summary> /// <param name="PrintAll"> - /// If true, display all available information. - /// </param> + /// If true, display all available information. + /// </param> /// <param name="ClearStats"> /// If true, reset statistics after displaying their values. /// </param> @@ -4332,54 +4686,78 @@ namespace BerkeleyDB { } /// <summary> - /// Display the locking subsystem statistical information, as described - /// by <see cref="LockStats"/>. + /// Display the default statistical information. /// </summary> public void PrintStats() { - PrintStats(false, false, false); + PrintStats(false, false, false, false); } /// <summary> - /// Display the locking subsystem statistical information, as described - /// by <see cref="LockStats"/>. + /// Display the default statistical information. /// </summary> /// <param name="PrintAll"> - /// If true, display all available information. - /// </param> + /// If true, display all available information. + /// </param> /// <param name="ClearStats"> /// If true, reset statistics after displaying their values. /// </param> public void PrintStats(bool PrintAll, bool ClearStats) { - PrintStats(PrintAll, ClearStats, false); + PrintStats(PrintAll, ClearStats, false, false); } /// <summary> - /// Display the locking subsystem statistical information, as described - /// by <see cref="LockStats"/>. + /// Display the default subsystem statistical information. /// </summary> public void PrintSubsystemStats() { - PrintStats(false, false, true); + PrintStats(false, false, true, false); } /// <summary> - /// Display the locking subsystem statistical information, as described - /// by <see cref="LockStats"/>. + /// Display the default subsystem statistical information. /// </summary> /// <param name="PrintAll"> - /// If true, display all available information. - /// </param> + /// If true, display all available information. + /// </param> /// <param name="ClearStats"> /// If true, reset statistics after displaying their values. /// </param> public void PrintSubsystemStats(bool PrintAll, bool ClearStats) { - PrintStats(PrintAll, ClearStats, true); + PrintStats(PrintAll, ClearStats, true, false); } /// <summary> - /// Display the locking subsystem statistical information, as described - /// by <see cref="LockStats"/>. + /// Display the default statistical information. + /// </summary> + /// <param name="PrintAll"> + /// If true, display all available information. + /// </param> + /// <param name="ClearStats"> + /// If true, reset statistics after displaying their values. + /// </param> + /// <param name="PrintSubs"> + /// If true, display subsystem statistical information. + /// </param> + private void PrintStats(bool PrintAll, bool ClearStats, bool PrintSubs) { + PrintStats(PrintAll, ClearStats, PrintSubs, false); + } + /// <summary> + /// Display the default statistical information. /// </summary> - private void PrintStats(bool all, bool clear, bool subs) { + /// <param name="PrintAll"> + /// If true, display all available information. + /// </param> + /// <param name="ClearStats"> + /// If true, reset statistics after displaying their values. + /// </param> + /// <param name="PrintSubs"> + /// If true, display subsystem statistical information. + /// </param> + /// <param name="PrintAlloc"> + /// If true, display allocation information. + /// </param> + private void PrintStats(bool PrintAll, bool ClearStats, bool PrintSubs, + bool PrintAlloc) { uint flags = 0; - flags |= all ? DbConstants.DB_STAT_ALL : 0; - flags |= clear ? DbConstants.DB_STAT_CLEAR : 0; - flags |= subs ? DbConstants.DB_STAT_SUBSYSTEM : 0; + flags |= PrintAll ? DbConstants.DB_STAT_ALL : 0; + flags |= ClearStats ? DbConstants.DB_STAT_CLEAR : 0; + flags |= PrintSubs ? DbConstants.DB_STAT_SUBSYSTEM : 0; + flags |= PrintAlloc ? DbConstants.DB_STAT_ALLOC : 0; dbenv.stat_print(flags); } @@ -4388,23 +4766,40 @@ namespace BerkeleyDB { /// described by <see cref="TransactionStats"/>. /// </summary> public void PrintTransactionSystemStats() { - PrintTransactionSystemStats(false, false); + PrintTransactionSystemStats(false, false, false); } /// <summary> /// Display the transaction subsystem statistical information, as /// described by <see cref="TransactionStats"/>. /// </summary> /// <param name="PrintAll"> - /// If true, display all available information. - /// </param> + /// If true, display all available information. + /// </param> /// <param name="ClearStats"> /// If true, reset statistics after displaying their values. /// </param> - public void - PrintTransactionSystemStats(bool PrintAll, bool ClearStats) { + public void PrintTransactionSystemStats(bool PrintAll, bool ClearStats) { + PrintTransactionSystemStats(PrintAll, ClearStats, false); + } + /// <summary> + /// Display the transaction subsystem statistical information, as + /// described by <see cref="TransactionStats"/>. + /// </summary> + /// <param name="PrintAll"> + /// If true, display all available information. + /// </param> + /// <param name="ClearStats"> + /// If true, reset statistics after displaying their values. + /// </param> + /// <param name="PrintAlloc"> + /// If true, display allocation information. + /// </param> + public void PrintTransactionSystemStats(bool PrintAll, bool ClearStats, + bool PrintAlloc) { uint flags = 0; flags |= PrintAll ? DbConstants.DB_STAT_ALL : 0; flags |= ClearStats ? DbConstants.DB_STAT_CLEAR : 0; + flags |= PrintAlloc ? DbConstants.DB_STAT_ALLOC : 0; dbenv.txn_stat_print(flags); } |