From 48e0e3c35072afa3fa76e5bacc2aaa8b6d3d6a00 Mon Sep 17 00:00:00 2001 From: Pasin Suriyentrakorn Date: Tue, 15 Oct 2024 22:37:41 -0700 Subject: [PATCH] Remove macOS guardrails --- include/cbl/CBLDatabase.h | 10 +++------- src/CBLDatabase_Internal.hh | 4 ---- test/DatabaseTest.cc | 11 ++--------- 3 files changed, 5 insertions(+), 20 deletions(-) diff --git a/include/cbl/CBLDatabase.h b/include/cbl/CBLDatabase.h index 3d38381c..394db684 100644 --- a/include/cbl/CBLDatabase.h +++ b/include/cbl/CBLDatabase.h @@ -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. */ diff --git a/src/CBLDatabase_Internal.hh b/src/CBLDatabase_Internal.hh index f5c524da..c3633acb 100644 --- a/src/CBLDatabase_Internal.hh +++ b/src/CBLDatabase_Internal.hh @@ -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; } @@ -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); diff --git a/test/DatabaseTest.cc b/test/DatabaseTest.cc index 0f4136f2..6d2f610c 100644 --- a/test/DatabaseTest.cc +++ b/test/DatabaseTest.cc @@ -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 */ @@ -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. @@ -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. @@ -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") {