You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -49,22 +49,22 @@ public LightningEnvironment(string path, EnvironmentConfiguration configuration
49
49
50
50
/// <summary>
51
51
/// Gets or Sets the size of the memory map to use for this environment.
52
-
/// The size of the memory map is also the maximum size of the database.
53
-
/// The size should be a multiple of the OS page size.
54
-
/// The default is 10485760 bytes.
52
+
/// The size of the memory map is also the maximum size of the database.
53
+
/// The size should be a multiple of the OS page size.
54
+
/// The default is 10485760 bytes.
55
55
/// </summary>
56
56
/// <remarks>
57
-
/// The value should be chosen as large as possible, to accommodate future growth of the database.
57
+
/// The value should be chosen as large as possible, to accommodate future growth of the database.
58
58
/// This function may only be called before the environment is opened.
59
-
/// The size may be changed by closing and reopening the environment.
60
-
/// Any attempt to set a size smaller than the space already consumed by the environment will be silently changed to the current size of the used space.
59
+
/// The size may be changed by closing and reopening the environment.
60
+
/// Any attempt to set a size smaller than the space already consumed by the environment will be silently changed to the current size of the used space.
/// Gets the maximum size of keys and MDB_DUPSORT data we can write.
162
176
/// </summary>
@@ -211,12 +225,12 @@ public void Open(EnvironmentOpenFlags openFlags = EnvironmentOpenFlags.None, Uni
211
225
/// Cursors may not span transactions; each cursor must be opened and closed within a single transaction.
212
226
/// </summary>
213
227
/// <param name="parent">
214
-
/// If this parameter is non-NULL, the new transaction will be a nested transaction, with the transaction indicated by parent as its parent.
215
-
/// Transactions may be nested to any level.
228
+
/// If this parameter is non-NULL, the new transaction will be a nested transaction, with the transaction indicated by parent as its parent.
229
+
/// Transactions may be nested to any level.
216
230
/// A parent transaction may not issue any other operations besides BeginTransaction, Abort, or Commit while it has active child transactions.
217
231
/// </param>
218
232
/// <param name="beginFlags">
219
-
/// Special options for this transaction.
233
+
/// Special options for this transaction.
220
234
/// </param>
221
235
/// <returns>
222
236
/// New LightningTransaction
@@ -237,7 +251,7 @@ public LightningTransaction BeginTransaction(LightningTransaction parent = null,
237
251
/// Cursors may not span transactions; each cursor must be opened and closed within a single transaction.
238
252
/// </summary>
239
253
/// <param name="beginFlags">
240
-
/// Special options for this transaction.
254
+
/// Special options for this transaction.
241
255
/// </param>
242
256
/// <returns>
243
257
/// New LightningTransaction
@@ -253,28 +267,56 @@ public LightningTransaction BeginTransaction(TransactionBeginFlags beginFlags)
253
267
/// </summary>
254
268
/// <param name="path">The directory in which the copy will reside. This directory must already exist and be writable but must otherwise be empty.</param>
255
269
/// <param name="compact">Omit empty pages when copying.</param>
270
+
/// <remarks>
271
+
/// This call can trigger a significant file size growth if run in parallel with write transactions,
272
+
/// because it employs a read-only transaction. If the environment has a large proportion of
273
+
/// free pages, this can cause the backup to be larger than the actual data set.
274
+
///
275
+
/// It is possible to run this function with writeable transactions in progress. The copy will be
276
+
/// a consistent snapshot of the environment at the time the copy is made, using a read-only transaction.
277
+
///
278
+
/// When the compact parameter is true (using the MDB_CP_COMPACT flag), the copy will omit free pages
279
+
/// and use smaller page sizes when possible, resulting in a smaller data file.
/// Data is always written to disk when LightningTransaction.Commit is called, but the operating system may keep it buffered.
293
+
/// Flush the data buffers to disk.
294
+
/// Data is always written to disk when LightningTransaction.Commit is called, but the operating system may keep it buffered.
270
295
/// MDB always flushes the OS buffers upon commit as well, unless the environment was opened with EnvironmentOpenFlags.NoSync or in part EnvironmentOpenFlags.NoMetaSync.
271
296
/// </summary>
272
297
/// <param name="force">If true, force a synchronous flush. Otherwise if the environment has the EnvironmentOpenFlags.NoSync flag set the flushes will be omitted, and with MDB_MAPASYNC they will be asynchronous.</param>
298
+
/// <remarks>
299
+
/// This call is not needed if your code does not care if/when data is physically written to the disk.
300
+
/// It is the application's responsibility to ensure the persistence of critical data. The
301
+
/// actual decision to use synchronous or asynchronous flushes typically depends on:
302
+
///
303
+
/// - Safety: Synchronous flushes guarantee that data has been written to disk before continuing.
304
+
/// - Performance: Asynchronous flushes allow the OS to schedule disk writes optimally, which can be much faster.
305
+
///
306
+
/// If your environment was opened with <see cref="EnvironmentOpenFlags.NoSync"/>, calling Flush(false) will have no effect,
307
+
/// while Flush(true) will still force a synchronous flush.
308
+
///
309
+
/// If your environment was opened with <see cref="EnvironmentOpenFlags.MapAsync"/>, calling Flush(false) will perform an
310
+
/// asynchronous flush, while Flush(true) will still force a synchronous flush.
311
+
///
312
+
/// Even when this method is not called, the data will be persisted to disk when the OS flushes
313
+
/// its buffers or when the environment is closed properly.
314
+
/// </remarks>
273
315
publicMDBResultCodeFlush(boolforce)
274
316
{
275
317
returnmdb_env_sync(_handle,force);
276
318
}
277
-
319
+
278
320
/// <summary>
279
321
/// Gets or sets the environment flags.
280
322
/// When setting flags, they will be either set or cleared based on the value.
@@ -301,35 +343,47 @@ public EnvironmentOpenFlags Flags
0 commit comments