зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1546752 - Stop creating, writing, and reading the .metadata file in QuotaManager except the upgrades; r=janv
The main goal of this issue is to reduce IO during the storage initialization and stop creating .metadata file since we already have .metadata-v2 file to track the information for the origin directory. Therefore, this patch only stop create, write, and read the .metadata file. And, leaving the work for removing it to the next minor upgrade. Differential Revision: https://phabricator.services.mozilla.com/D28824 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
d51f25b15e
Коммит
390ed47019
|
@ -2253,28 +2253,6 @@ nsresult CreateDirectoryMetadata2(nsIFile* aDirectory, int64_t aTimestamp,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult CreateDirectoryMetadataFiles(nsIFile* aDirectory, bool aPersisted,
|
||||
const nsACString& aSuffix,
|
||||
const nsACString& aGroup,
|
||||
const nsACString& aOrigin,
|
||||
int64_t aTimestamp) {
|
||||
AssertIsOnIOThread();
|
||||
|
||||
nsresult rv =
|
||||
CreateDirectoryMetadata(aDirectory, aTimestamp, aSuffix, aGroup, aOrigin);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
rv = CreateDirectoryMetadata2(aDirectory, aTimestamp, aPersisted, aSuffix,
|
||||
aGroup, aOrigin);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult GetBinaryInputStream(nsIFile* aDirectory, const nsAString& aFilename,
|
||||
nsIBinaryInputStream** aStream) {
|
||||
MOZ_ASSERT(!NS_IsMainThread());
|
||||
|
@ -3986,12 +3964,7 @@ nsresult QuotaManager::GetDirectoryMetadata2(
|
|||
if (group != upToDateGroup) {
|
||||
group = upToDateGroup;
|
||||
|
||||
rv =
|
||||
CreateDirectoryMetadata(aDirectory, timestamp, suffix, group, origin);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
// Only creating .metadata-v2 to reduce IO.
|
||||
rv = CreateDirectoryMetadata2(aDirectory, timestamp, persisted, suffix,
|
||||
group, origin);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
|
@ -5773,9 +5746,10 @@ nsresult QuotaManager::EnsureOriginIsInitializedInternal(
|
|||
if (created) {
|
||||
timestamp = PR_Now();
|
||||
|
||||
rv = CreateDirectoryMetadataFiles(directory,
|
||||
/* aPersisted */ true, aSuffix, aGroup,
|
||||
aOrigin, timestamp);
|
||||
// Only creating .metadata-v2 to reduce IO.
|
||||
rv = CreateDirectoryMetadata2(directory, timestamp,
|
||||
/* aPersisted */ true, aSuffix, aGroup,
|
||||
aOrigin);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -5799,9 +5773,10 @@ nsresult QuotaManager::EnsureOriginIsInitializedInternal(
|
|||
NoteOriginDirectoryCreated(aPersistenceType, aGroup, aOrigin,
|
||||
/* aPersisted */ false, timestamp);
|
||||
|
||||
rv = CreateDirectoryMetadataFiles(directory,
|
||||
/* aPersisted */ false, aSuffix, aGroup,
|
||||
aOrigin, timestamp);
|
||||
// Only creating .metadata-v2 to reduce IO.
|
||||
rv = CreateDirectoryMetadata2(directory, timestamp,
|
||||
/* aPersisted */ false, aSuffix, aGroup,
|
||||
aOrigin);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
@ -8593,9 +8568,8 @@ nsresult PersistOp::DoDirectoryWork(QuotaManager* aQuotaManager) {
|
|||
timestamp = PR_Now();
|
||||
}
|
||||
|
||||
rv = CreateDirectoryMetadataFiles(directory,
|
||||
/* aPersisted */ true, mSuffix, mGroup,
|
||||
mOriginScope.GetOrigin(), timestamp);
|
||||
rv = CreateDirectoryMetadata2(directory, timestamp, /* aPersisted */ true,
|
||||
mSuffix, mGroup, mOriginScope.GetOrigin());
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -12,22 +12,22 @@ function* testSteps()
|
|||
const metadataFiles = [
|
||||
{
|
||||
path: "storage/permanent/chrome/.metadata",
|
||||
tmp: false
|
||||
shouldExistAfterInit: false
|
||||
},
|
||||
|
||||
{
|
||||
path: "storage/permanent/chrome/.metadata-tmp",
|
||||
tmp: true
|
||||
shouldExistAfterInit: false
|
||||
},
|
||||
|
||||
{
|
||||
path: "storage/permanent/chrome/.metadata-v2",
|
||||
tmp: false
|
||||
shouldExistAfterInit: true
|
||||
},
|
||||
|
||||
{
|
||||
path: "storage/permanent/chrome/.metadata-v2-tmp",
|
||||
tmp: true
|
||||
shouldExistAfterInit: false
|
||||
}
|
||||
]
|
||||
|
||||
|
@ -94,10 +94,10 @@ function* testSteps()
|
|||
|
||||
exists = file.exists();
|
||||
|
||||
if (metadataFile.tmp) {
|
||||
ok(!exists, "Metadata file doesn't exist");
|
||||
} else {
|
||||
if (metadataFile.shouldExistAfterInit) {
|
||||
ok(exists, "Metadata file does exist");
|
||||
} else {
|
||||
ok(!exists, "Metadata file doesn't exist");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче