Skip to content

Commit fdee73b

Browse files
author
Ignacio Alonso Battaglia
committed
Merged PR 730058: Remove UsePhysicalSizeInQuotaKeeper
Remove UsePhysicalSizeInQuotaKeeper Related work items: #2086569
1 parent 2667877 commit fdee73b

File tree

10 files changed

+16
-26
lines changed

10 files changed

+16
-26
lines changed

Public/Src/Cache/ContentStore/Distributed/NuCache/CachingCentralStorage.cs

-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ public CachingCentralStorage(
7373
{
7474
TraceFileSystemContentStoreDiagnosticMessages = Configuration.TraceFileSystemContentStoreDiagnosticMessages,
7575
SelfCheckSettings = Configuration.SelfCheckSettings,
76-
UsePhysicalSizeInQuotaKeeper = Configuration.UsePhysicalSizeInQuotaKeeper,
7776
});
7877
}
7978

Public/Src/Cache/ContentStore/Distributed/NuCache/LocalLocationStoreConfiguration.cs

-5
Original file line numberDiff line numberDiff line change
@@ -392,11 +392,6 @@ public record DistributedCentralStoreConfiguration(AbsolutePath CacheRoot)
392392
/// </summary>
393393
public bool InlineCheckpointProactiveCopies { get; set; } = false;
394394

395-
/// <summary>
396-
/// Whether the physical size is used for quota purposes.
397-
/// </summary>
398-
public bool UsePhysicalSizeInQuotaKeeper { get; set; } = false;
399-
400395
/// <summary>
401396
/// Whether to use the primary CAS in the DistributedCentralStorage.
402397
/// </summary>

Public/Src/Cache/ContentStore/DistributedTest/Stores/GrpcCopyContentTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ private async Task RunTestCase(Func<LocalContentServer, AbsolutePath, IContentSe
419419
CopyRequestHandlingCountLimit = _copyToLimit, ProactivePushCountLimit = _proactivePushCountLimit
420420
};
421421

422-
var storeConfig = ContentStoreConfiguration.CreateWithMaxSizeQuotaMB(1);
422+
var storeConfig = ContentStoreConfiguration.CreateWithMaxSizeQuotaMB(7);
423423
Func<AbsolutePath, IContentStore> contentStoreFactory = (path) =>
424424
new FileSystemContentStore(
425425
FileSystem,

Public/Src/Cache/ContentStore/GrpcTest/GrpcDeleteContentTests.cs

+3-1
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,14 @@ public Task SendReceiveDeletion(long size)
7676
var placeResult = await rpcClient.PlaceFileAsync(context, putResult.ContentHash, new AbsolutePath(fileName.Path + "place"), FileAccessMode.None, FileReplacementMode.None, FileRealizationMode.Copy);
7777
placeResult.ShouldBeSuccess();
7878

79+
var clusterSize = FileSystem.GetClusterSize(fileName);
80+
7981
// Delete content
8082
var deleteResult = await rpcClient.DeleteContentAsync(context, putResult.ContentHash, deleteLocalOnly: false);
8183
deleteResult.ShouldBeSuccess();
8284
deleteResult.ContentHash.Equals(putResult.ContentHash).Should().BeTrue();
8385
string.IsNullOrEmpty(deleteResult.ErrorMessage).Should().BeTrue();
84-
deleteResult.ContentSize.Should().Be(size);
86+
deleteResult.ContentSize.Should().Be(ContentFileInfo.GetPhysicalSize(size,clusterSize));
8587

8688
// Fail to place content
8789
var failPlaceResult = await rpcClient.PlaceFileAsync(context, putResult.ContentHash, new AbsolutePath(fileName.Path + "fail"), FileAccessMode.None, FileReplacementMode.None, FileRealizationMode.Copy);

Public/Src/Cache/ContentStore/Library/Stores/ContentStoreSettings.cs

-5
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,6 @@ public sealed class ContentStoreSettings
3131
/// </summary>
3232
public bool UseEmptyContentShortcut { get; set; } = true;
3333

34-
/// <summary>
35-
/// Whether the physical size is used for quota purposes.
36-
/// </summary>
37-
public bool UsePhysicalSizeInQuotaKeeper { get; set; } = false;
38-
3934
/// <summary>
4035
/// A timeout for space reservation operation.
4136
/// </summary>

Public/Src/Cache/ContentStore/Library/Stores/FileSystemContentStoreInternal.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,7 @@ public FileSystemContentStoreInternal(
203203

204204
_settings = settings ?? ContentStoreSettings.DefaultSettings;
205205

206-
// Use logical size in QuotaKeeper is equivalent to use clusterSize = 1
207-
_clusterSize = _settings.UsePhysicalSizeInQuotaKeeper ? FileSystem.GetClusterSize(rootPath) : 1;
206+
_clusterSize = FileSystem.GetClusterSize(rootPath);
208207

209208
// MemoryContentDirectory requires for the root path to exist. Making sure this is the case.
210209
FileSystem.CreateDirectory(RootPath);

Public/Src/Cache/ContentStore/Test/Sessions/ServiceClientContentSessionTestBase.cs

+7-5
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ protected ServiceClientContentStoreConfiguration CreateConfiguration()
3434

3535
protected const int ContentByteCount = 100;
3636
protected const HashType ContentHashType = HashType.Vso0;
37-
private const long DefaultMaxSize = 1 * 1024 * 1024;
37+
protected const long DefaultMaxSize = 1 * 1024 * 1024;
3838
protected static readonly CancellationToken Token = CancellationToken.None;
3939
protected string Scenario;
4040

@@ -65,14 +65,14 @@ protected async Task RunSessionTestAsync(
6565
}
6666
}
6767

68-
protected async Task RunStoreTestAsync(Func<Context, IContentStore, Task> funcAsync, LocalServerConfiguration localContentServerConfiguration = null, TimeSpan? heartbeatOverride = null)
68+
protected async Task RunStoreTestAsync(Func<Context, IContentStore, Task> funcAsync, LocalServerConfiguration localContentServerConfiguration = null, TimeSpan? heartbeatOverride = null, long cacheSize = DefaultMaxSize)
6969
{
7070
var context = new Context(Logger);
7171
// Using unique scenario to avoid flakiness when running the tests in parallel
7272
Scenario += Guid.NewGuid();
7373
using (var directory = new DisposableDirectory(FileSystem))
7474
{
75-
var config = new ContentStoreConfiguration(new MaxSizeQuota($"{DefaultMaxSize}"));
75+
var config = new ContentStoreConfiguration(new MaxSizeQuota($"{cacheSize}"));
7676

7777
using (var store = CreateStore(directory.Path, config, localContentServerConfiguration ?? TestConfigurationHelper.LocalContentServerConfiguration, heartbeatOverride))
7878
{
@@ -92,11 +92,13 @@ protected async Task RunStoreTestAsync(Func<Context, IContentStore, Task> funcAs
9292
protected Task RunSessionTestAsync(
9393
ImplicitPin implicitPin,
9494
Func<Context, IContentSession, Task> funcAsync,
95-
LocalServerConfiguration localContentServerConfiguration = null)
95+
LocalServerConfiguration localContentServerConfiguration = null,
96+
long cacheSize = DefaultMaxSize)
9697
{
9798
return RunStoreTestAsync(
9899
(context, store) => RunSessionTestAsync(context, store, implicitPin, funcAsync),
99-
localContentServerConfiguration);
100+
localContentServerConfiguration,
101+
cacheSize: cacheSize);
100102
}
101103

102104
protected abstract T CreateStore(AbsolutePath rootPath, ContentStoreConfiguration configuration, LocalServerConfiguration localContentServerConfiguration, TimeSpan? heartbeatOverride);

Public/Src/Cache/ContentStore/Test/Sessions/ServiceRequestsWorkAcrossServerRestartTests.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,8 @@ private Task RunManyForStoreAcrossServerRestartAsync(Func<Context, IContentStore
191191

192192
private Task RunManyForSessionAcrossServerRestartAsync(Func<Context, IContentSession, ContentHash, int, Task> requestFunc)
193193
{
194+
// Set the physical size manually because getting it dinamically for each test requires a lot of changes
195+
long cacheSize = DefaultMaxSize * 8;
194196
// Scenario must be unique for different test cases to avoid getting CacheException like:
195197
// BuildXL.Cache.ContentStore.Exceptions.CacheException : Shutdown event name=[InProcessServiceRequestsWorkAcrossServerRestartTestsDEBUGDEBUG] already exists
196198
Scenario += Guid.NewGuid().ToString();
@@ -217,7 +219,8 @@ private Task RunManyForSessionAcrossServerRestartAsync(Func<Context, IContentSes
217219
string failureMessage = string.Join(",", singleException.InnerExceptions.Select(x => x.Message));
218220
Assert.True(false, failureMessage);
219221
}
220-
});
222+
},
223+
cacheSize: cacheSize);
221224
}
222225

223226
private class MockLogger : IOperationLogger

Public/Src/Cache/DistributedCache.Host/Configuration/DistributedContentSettings.cs

-3
Original file line numberDiff line numberDiff line change
@@ -785,9 +785,6 @@ public bool UseGrpcDotNetForCopies()
785785
[DataMember]
786786
public bool UseRedundantPutFileShortcut { get; set; } = false;
787787

788-
[DataMember]
789-
public bool UsePhysicalSizeInQuotaKeeper { get; set; } = false;
790-
791788
[DataMember]
792789
public bool UsePrimaryCasInDcs { get; set; } = false;
793790

Public/Src/Cache/DistributedCache.Host/Service/Internal/DistributedContentStoreFactory.cs

-2
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,6 @@ private static ContentStoreSettings FromDistributedSettings(DistributedContentSe
477477
SelfCheckSettings = CreateSelfCheckSettings(settings),
478478
OverrideUnixFileAccessMode = settings.OverrideUnixFileAccessMode,
479479
UseRedundantPutFileShortcut = settings.UseRedundantPutFileShortcut,
480-
UsePhysicalSizeInQuotaKeeper = settings.UsePhysicalSizeInQuotaKeeper,
481480
TraceFileSystemContentStoreDiagnosticMessages = settings.TraceFileSystemContentStoreDiagnosticMessages,
482481

483482
SkipTouchAndLockAcquisitionWhenPinningFromHibernation = settings.UseFastHibernationPin,
@@ -614,7 +613,6 @@ private void ApplySecretSettingsForLls(
614613
MaxSimultaneousCopies = _distributedSettings.CentralStorageMaxSimultaneousCopies,
615614
ProactiveCopyCheckpointFiles = _distributedSettings.ProactiveCopyCheckpointFiles,
616615
InlineCheckpointProactiveCopies = _distributedSettings.InlineCheckpointProactiveCopies,
617-
UsePhysicalSizeInQuotaKeeper = _distributedSettings.UsePhysicalSizeInQuotaKeeper,
618616
UsePrimaryCasInDcs = _distributedSettings.UsePrimaryCasInDcs,
619617
};
620618

0 commit comments

Comments
 (0)