diff --git a/storage/TelemetryVFS.cpp b/storage/BaseVFS.cpp similarity index 98% rename from storage/TelemetryVFS.cpp rename to storage/BaseVFS.cpp index bb5cd6d847aa..1f0ed486b07a 100644 --- a/storage/TelemetryVFS.cpp +++ b/storage/BaseVFS.cpp @@ -479,11 +479,11 @@ static const char* xNextSystemCall(sqlite3_vfs* vfs, const char* zName) { namespace mozilla { namespace storage { -const char* GetTelemetryVFSName(bool exclusive) { - return exclusive ? "telemetry-vfs-excl" : "telemetry-vfs"; +const char* GetBaseVFSName(bool exclusive) { + return exclusive ? "base-vfs-excl" : "base-vfs"; } -UniquePtr ConstructTelemetryVFS(bool exclusive) { +UniquePtr ConstructBaseVFS(bool exclusive) { #if defined(XP_WIN) # define EXPECTED_VFS "win32" # define EXPECTED_VFS_EXCL "win32" @@ -516,7 +516,7 @@ UniquePtr ConstructTelemetryVFS(bool exclusive) { tvfs->szOsFile = sizeof(telemetry_file) - sizeof(sqlite3_file) + vfs->szOsFile; tvfs->mxPathname = vfs->mxPathname; - tvfs->zName = GetTelemetryVFSName(exclusive); + tvfs->zName = GetBaseVFSName(exclusive); tvfs->pAppData = vfs; tvfs->xOpen = xOpen; tvfs->xDelete = xDelete; diff --git a/storage/moz.build b/storage/moz.build index c961b816c696..9cefe26ec0c8 100644 --- a/storage/moz.build +++ b/storage/moz.build @@ -56,6 +56,7 @@ EXPORTS.mozilla.storage += [ # SEE ABOVE NOTE! UNIFIED_SOURCES += [ + "BaseVFS.cpp", "FileSystemModule.cpp", "mozStorageArgValueArray.cpp", "mozStorageAsyncStatement.cpp", @@ -78,7 +79,6 @@ UNIFIED_SOURCES += [ "ReadOnlyNoLockVFS.cpp", "SQLCollations.cpp", "StorageBaseStatementInternal.cpp", - "TelemetryVFS.cpp", "VacuumManager.cpp", "Variant.cpp", ] diff --git a/storage/mozStorageConnection.cpp b/storage/mozStorageConnection.cpp index f1c84e9fb2d1..059b9a3f72fb 100644 --- a/storage/mozStorageConnection.cpp +++ b/storage/mozStorageConnection.cpp @@ -74,7 +74,7 @@ using mozilla::Telemetry::AccumulateCategoricalKeyed; using mozilla::Telemetry::LABELS_SQLITE_STORE_OPEN; using mozilla::Telemetry::LABELS_SQLITE_STORE_QUERY; -const char* GetTelemetryVFSName(bool); +const char* GetBaseVFSName(bool); const char* GetQuotaVFSName(); const char* GetObfuscatingVFSName(); @@ -825,8 +825,8 @@ nsresult Connection::initialize(const nsACString& aStorageKey, mTelemetryFilename.AssignLiteral(":memory:"); - int srv = ::sqlite3_open_v2(path.get(), &mDBConn, mFlags, - GetTelemetryVFSName(true)); + int srv = + ::sqlite3_open_v2(path.get(), &mDBConn, mFlags, GetBaseVFSName(true)); if (srv != SQLITE_OK) { mDBConn = nullptr; nsresult rv = convertResultCode(srv); @@ -874,12 +874,12 @@ nsresult Connection::initialize(nsIFile* aDatabaseFile) { "readonly-immutable-nolock"); } else { srv = ::sqlite3_open_v2(NS_ConvertUTF16toUTF8(path).get(), &mDBConn, mFlags, - GetTelemetryVFSName(exclusive)); + GetBaseVFSName(exclusive)); if (exclusive && (srv == SQLITE_LOCKED || srv == SQLITE_BUSY)) { // Retry without trying to get an exclusive lock. exclusive = false; srv = ::sqlite3_open_v2(NS_ConvertUTF16toUTF8(path).get(), &mDBConn, - mFlags, GetTelemetryVFSName(false)); + mFlags, GetBaseVFSName(false)); } } if (srv != SQLITE_OK) { @@ -897,7 +897,7 @@ nsresult Connection::initialize(nsIFile* aDatabaseFile) { // first query execution. When initializeInternal fails it closes the // connection, so we can try to restart it in non-exclusive mode. srv = ::sqlite3_open_v2(NS_ConvertUTF16toUTF8(path).get(), &mDBConn, mFlags, - GetTelemetryVFSName(false)); + GetBaseVFSName(false)); if (srv == SQLITE_OK) { rv = initializeInternal(); } @@ -960,7 +960,7 @@ nsresult Connection::initialize(nsIFileURL* aFileURL, const char* const vfs = hasKey ? GetObfuscatingVFSName() : hasDirectoryLockId ? GetQuotaVFSName() - : GetTelemetryVFSName(exclusive); + : GetBaseVFSName(exclusive); int srv = ::sqlite3_open_v2(spec.get(), &mDBConn, mFlags, vfs); if (srv != SQLITE_OK) { @@ -2545,7 +2545,7 @@ Connection::EnableModule(const nsACString& aModuleName) { return NS_ERROR_FAILURE; } -// Implemented in TelemetryVFS.cpp +// Implemented in QuotaVFS.cpp already_AddRefed GetQuotaObjectForFile(sqlite3_file* pFile); NS_IMETHODIMP diff --git a/storage/mozStorageService.cpp b/storage/mozStorageService.cpp index e31fd5a85095..d73a1680ac78 100644 --- a/storage/mozStorageService.cpp +++ b/storage/mozStorageService.cpp @@ -305,8 +305,8 @@ void Service::minimizeMemory() { } } -UniquePtr ConstructTelemetryVFS(bool); -const char* GetTelemetryVFSName(bool); +UniquePtr ConstructBaseVFS(bool); +const char* GetBaseVFSName(bool); UniquePtr ConstructQuotaVFS(const char* aBaseVFSName); const char* GetQuotaVFSName(); @@ -339,25 +339,25 @@ nsresult Service::initialize() { * / \ * / \ * / \ - * telemetry-vfs-excl telemetry-vfs + * base-vfs-excl base-vfs * / \ / \ * / \ / \ * / \ / \ * unix-excl win32 unix win32 */ - rc = mTelemetrySqliteVFS.Init(ConstructTelemetryVFS(false)); + rc = mBaseSqliteVFS.Init(ConstructBaseVFS(false)); if (rc != SQLITE_OK) { return convertResultCode(rc); } - rc = mTelemetryExclSqliteVFS.Init(ConstructTelemetryVFS(true)); + rc = mBaseExclSqliteVFS.Init(ConstructBaseVFS(true)); if (rc != SQLITE_OK) { return convertResultCode(rc); } - rc = mQuotaSqliteVFS.Init(ConstructQuotaVFS(GetTelemetryVFSName( - StaticPrefs::storage_sqlite_exclusiveLock_enabled()))); + rc = mQuotaSqliteVFS.Init(ConstructQuotaVFS( + GetBaseVFSName(StaticPrefs::storage_sqlite_exclusiveLock_enabled()))); if (rc != SQLITE_OK) { return convertResultCode(rc); } diff --git a/storage/mozStorageService.h b/storage/mozStorageService.h index fe98e6bd74d5..194b280dc226 100644 --- a/storage/mozStorageService.h +++ b/storage/mozStorageService.h @@ -129,8 +129,8 @@ class Service : public mozIStorageService, // The order of these members should match the order of Init calls in // initialize(), to ensure that the unregistration takes place in the reverse // order. - AutoVFSRegistration mTelemetrySqliteVFS; - AutoVFSRegistration mTelemetryExclSqliteVFS; + AutoVFSRegistration mBaseSqliteVFS; + AutoVFSRegistration mBaseExclSqliteVFS; AutoVFSRegistration mQuotaSqliteVFS; AutoVFSRegistration mObfuscatingSqliteVFS; AutoVFSRegistration mReadOnlyNoLockSqliteVFS; diff --git a/storage/test/unit/test_telemetry_vfs.js b/storage/test/unit/test_base_vfs.js similarity index 100% rename from storage/test/unit/test_telemetry_vfs.js rename to storage/test/unit/test_base_vfs.js diff --git a/storage/test/unit/xpcshell.ini b/storage/test/unit/xpcshell.ini index 481d1e375256..575fec9c0663 100644 --- a/storage/test/unit/xpcshell.ini +++ b/storage/test/unit/xpcshell.ini @@ -8,7 +8,7 @@ support-files = locale_collation.txt VacuumParticipant.sys.mjs -[test_retry_on_busy.js] +[test_base_vfs.js] [test_bug-365166.js] [test_bug-393952.js] [test_bug-429521.js] @@ -33,6 +33,7 @@ skip-if = debug [test_minimizeMemory.js] [test_page_size_is_32k.js] [test_readonly-immutable-nolock_vfs.js] +[test_retry_on_busy.js] [test_sqlite_secure_delete.js] [test_statement_executeAsync.js] [test_statement_wrapper_automatically.js] @@ -49,6 +50,3 @@ fail-if = os == "android" [test_storage_value_array.js] [test_unicode.js] [test_vacuum.js] -[test_telemetry_vfs.js] -# Bug 676981: test fails consistently on Android -# fail-if = os == "android"