Skip to content

Commit

Permalink
Remove macOS guardrails
Browse files Browse the repository at this point in the history
  • Loading branch information
pasin committed Oct 16, 2024
1 parent 6ffaef5 commit 48e0e3c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 20 deletions.
10 changes: 3 additions & 7 deletions include/cbl/CBLDatabase.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,12 @@ typedef struct {
is very safe but it is also dramatically slower. */
bool fullSync;

#if !defined(TARGET_OS_OSX) || (TARGET_OS_OSX == 0)
/**
Disable memory-mapped I/O. By default, memory-mapped
I/O is enabled. Disabling it may affect database performance.
Typically, there is no need to modify this setting.
Disable memory-mapped I/O. By default, memory-mapped I/O is enabled.
Disabling it may affect database performance. Typically, there is no need to modify this setting.
@note Memory-mapped I/O is always disabled on macOS to prevent database corruption,
so this configuration is not supported on the macOS platform. */
so setting mmapDisabled value has no effect on the macOS platform. */
bool mmapDisabled;
#endif
} CBLDatabaseConfiguration;

/** Returns the default database configuration. */
Expand Down
4 changes: 0 additions & 4 deletions src/CBLDatabase_Internal.hh
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,7 @@ public:
config.encryptionKey = asCBLKey(c4config.encryptionKey);
#endif
config.fullSync = (c4config.flags & kC4DB_DiskSyncFull) == kC4DB_DiskSyncFull;
#if !defined(TARGET_OS_OSX) || (TARGET_OS_OSX == 0)
config.mmapDisabled = (c4config.flags & kC4DB_MmapDisabled) == kC4DB_MmapDisabled;
#endif
return config;
}

Expand Down Expand Up @@ -329,11 +327,9 @@ private:
if (config->fullSync) {
c4Config.flags |= kC4DB_DiskSyncFull;
}
#if !defined(TARGET_OS_OSX) || (TARGET_OS_OSX == 0)
if (config->mmapDisabled) {
c4Config.flags |= kC4DB_MmapDisabled;
}
#endif

#ifdef COUCHBASE_ENTERPRISE
c4Config.encryptionKey = asC4Key(&config->encryptionKey);
Expand Down
11 changes: 2 additions & 9 deletions test/DatabaseTest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -417,8 +417,6 @@ TEST_CASE_METHOD(DatabaseTest, "TestDBWithFullSync") {

#pragma mark - MMap:

#if !defined(TARGET_OS_OSX) || (TARGET_OS_OSX == 0)

/** Test Spec for Database MMap Configuration
https://github.com/couchbaselabs/couchbase-lite-api/blob/master/spec/tests/T0006-MMap-Config.md
v. 1.0.0 */
Expand All @@ -428,10 +426,7 @@ TEST_CASE_METHOD(DatabaseTest, "TestDBWithFullSync") {
#### Description
Test that the mmapEnabled default value is as expected and that it's setter and getter work.
For macOS, an unsupported arugment or equivalent exception should be thrown
when accessing the mmapEnabled property.
#### Steps
1. Create a DatabaseConfiguration object.
2. Get and check that the value of the mmapEnabled property is true.
Expand All @@ -453,7 +448,7 @@ TEST_CASE_METHOD(DatabaseTest, "TestDefaultMMapConfig") {
### 2. TestDatabaseWithConfiguredMMap
#### Description
Test that a Database respects the mmapEnabled property. This test is not applicable for macOS.
Test that a Database respects the mmapEnabled property.
#### Steps
1. Create a DatabaseConfiguration object and set mmapEnabled to false.
Expand Down Expand Up @@ -494,8 +489,6 @@ TEST_CASE_METHOD(DatabaseTest, "TestDatabaseWithConfiguredMMap") {
CBLDatabase_Release(mmapDB);
}

#endif

#pragma mark - Save Document:

TEST_CASE_METHOD(DatabaseTest, "Save Document into Different DB Instance") {
Expand Down

0 comments on commit 48e0e3c

Please sign in to comment.