Skip to content

Commit 52d2c18

Browse files
committed
Merged PR 717056: Remove extra constructors in FileSystemContentStore and remove ColdStorage
1 parent a6d0e71 commit 52d2c18

25 files changed

+57
-1113
lines changed

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

+5-5
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ public CachingCentralStorage(
6262
new ContentStoreConfiguration(new MaxSizeQuota(hardExpression: maxRetentionMb + "MB", softExpression: softRetentionMb + "MB")),
6363
ConfigurationSelection.RequireAndUseInProcessConfiguration),
6464
settings: new ContentStoreSettings()
65-
{
66-
TraceFileSystemContentStoreDiagnosticMessages = Configuration.TraceFileSystemContentStoreDiagnosticMessages,
67-
SelfCheckSettings = Configuration.SelfCheckSettings,
68-
UsePhysicalSizeInQuotaKeeper = Configuration.UsePhysicalSizeInQuotaKeeper,
69-
});
65+
{
66+
TraceFileSystemContentStoreDiagnosticMessages = Configuration.TraceFileSystemContentStoreDiagnosticMessages,
67+
SelfCheckSettings = Configuration.SelfCheckSettings,
68+
UsePhysicalSizeInQuotaKeeper = Configuration.UsePhysicalSizeInQuotaKeeper,
69+
});
7070

7171
LinkLifetime(fallbackStorage);
7272
LinkLifetime(PrivateCas);

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

+1-11
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,6 @@ public sealed class LocalLocationStore : StartupShutdownComponentBase
157157

158158
private readonly MachineLocationResolver.Settings _machineListSettings = new();
159159

160-
private readonly ColdStorage? _coldStorage;
161-
162160
private readonly ReadOnlyArray<PartitionId> _evictionPartitions;
163161

164162
private readonly byte[] _machineHash;
@@ -171,8 +169,7 @@ public LocalLocationStore(
171169
LocalLocationStoreConfiguration configuration,
172170
CheckpointManager checkpointManager,
173171
IMasterElectionMechanism masterElectionMechanism,
174-
ClusterStateManager clusterStateManager,
175-
ColdStorage? coldStorage)
172+
ClusterStateManager clusterStateManager)
176173
{
177174
Contract.RequiresNotNull(clock);
178175
Contract.RequiresNotNull(configuration);
@@ -185,7 +182,6 @@ public LocalLocationStore(
185182
ClusterStateManager = clusterStateManager;
186183

187184
_checkpointRegistry = checkpointManager.CheckpointRegistry;
188-
_coldStorage = coldStorage;
189185
_evictionPartitions = PartitionId.GetPartitions(Configuration.Settings.EvictionPartitionCount);
190186

191187
_machineHash = MurmurHash3.Create(Encoding.UTF8.GetBytes(Configuration.PrimaryMachineLocation.Path ?? string.Empty)).ToByteArray();
@@ -624,12 +620,6 @@ async Task<Result<bool>> processStateCoreAsync()
624620

625621
var leadershipState = await MasterElectionMechanism.GetRoleAsync(context).ThrowIfFailureAsync();
626622

627-
if (_coldStorage != null)
628-
{
629-
// We update the ColdStorage consistent-hashing ring on every heartbeat in case the cluster state has changed
630-
_coldStorage.UpdateRingAsync(context, ClusterState).FireAndForget(context);
631-
}
632-
633623
await ProcessStateAsync(context, checkpointState, leadershipState, inline, forceRestore).ThrowIfFailureAsync();
634624

635625
return false;

Public/Src/Cache/ContentStore/Distributed/Services/ContentLocationStoreServices.cs

+1-5
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ public record ContentLocationStoreServicesDependencies
2121
/// <nodoc />
2222
public OptionalServiceDefinition<IGlobalCacheService> GlobalCacheService { get; init; }
2323

24-
/// <nodoc />
25-
public OptionalServiceDefinition<ColdStorage> ColdStorage { get; init; }
26-
2724
/// <nodoc />
2825
public OptionalServiceDefinition<IRoleObserver> RoleObserver { get; init; }
2926

@@ -162,8 +159,7 @@ private LocalLocationStore CreateLocalLocationStore()
162159
Configuration,
163160
CheckpointManager.Instance,
164161
MasterElectionMechanism.Instance,
165-
ClusterStateManager.Instance,
166-
Dependencies?.ColdStorage.InstanceOrDefault());
162+
ClusterStateManager.Instance);
167163
}
168164

169165
private CentralStreamStorage CreateCentralStorage()

Public/Src/Cache/ContentStore/Distributed/Services/DistributedContentStoreServices.cs

-9
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,6 @@ public class DistributedContentStoreServices : ServicesCreatorBase
7272
/// <nodoc />
7373
public IServiceDefinition<RocksDbContentMetadataStore> RocksDbContentMetadataStore { get; }
7474

75-
/// <nodoc />
76-
public OptionalServiceDefinition<ColdStorage> ColdStorage { get; }
77-
7875
/// <nodoc />
7976
public OptionalServiceDefinition<IRoleObserver> RoleObserver { get; }
8077

@@ -110,11 +107,6 @@ internal DistributedContentStoreServices(DistributedContentStoreServicesArgument
110107

111108
ContentLocationStoreServices = Create(() => ContentLocationStoreFactory.Instance.Services);
112109

113-
ColdStorage = CreateOptional(() => DistributedContentSettings.ColdStorageSettings != null, () =>
114-
{
115-
return new ColdStorage(Arguments.FileSystem, DistributedContentSettings.ColdStorageSettings, Arguments.DistributedContentCopier);
116-
});
117-
118110
ContentLocationStoreFactory = Create(() =>
119111
{
120112
return new ContentLocationStoreFactory(
@@ -126,7 +118,6 @@ internal DistributedContentStoreServices(DistributedContentStoreServicesArgument
126118
Dependencies = new ContentLocationStoreServicesDependencies()
127119
{
128120
GlobalCacheService = GlobalCacheService.UnsafeGetServiceDefinition().AsOptional<IGlobalCacheService>(),
129-
ColdStorage = ColdStorage,
130121
RoleObserver = RoleObserver,
131122
DistributedContentSettings = CreateOptional(() => true, () => DistributedContentSettings),
132123
GlobalCacheCheckpointManager = GlobalCacheCheckpointManager.AsOptional()

Public/Src/Cache/ContentStore/Distributed/Sessions/DistributedContentSession.cs

-27
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,6 @@ internal enum Counters
7777
/// </summary>
7878
internal readonly IContentLocationStore ContentLocationStore;
7979

80-
private readonly ColdStorage _coldStorage;
81-
8280
/// <summary>
8381
/// The machine location for the current cache.
8482
/// </summary>
@@ -120,7 +118,6 @@ public DistributedContentSession(
120118
DistributedContentCopier contentCopier,
121119
DistributedContentStore distributedContentStore,
122120
MachineLocation localMachineLocation,
123-
ColdStorage coldStorage,
124121
DistributedContentStoreSettings settings = default)
125122
: base(name)
126123
{
@@ -139,8 +136,6 @@ public DistributedContentSession(
139136
DistributedCopier = contentCopier;
140137
PutAndPlaceFileGate = new SemaphoreSlim(Settings.MaximumConcurrentPutAndPlaceFileOperations);
141138

142-
_coldStorage = coldStorage;
143-
144139
_buildRingMachinesCache = new ExpiringValue<MachineLocation[]>(
145140
Settings.ProactiveCopyInRingMachineLocationsExpiryCache,
146141
SystemClock.Instance,
@@ -769,28 +764,6 @@ await ContentLocationStore.GetBulkAsync(
769764
reason);
770765
};
771766

772-
// If ColdStorage is ON try to place files from it before use remote locations
773-
if (_coldStorage != null)
774-
{
775-
return Workflows.RunWithFallback(
776-
hashesWithPaths,
777-
initialFunc: async args => { return await _coldStorage.FetchThenPutBulkAsync(context, args, Inner); },
778-
fallbackFunc: initialFunc,
779-
secondFallbackFunc: fallbackFunc,
780-
thirdFallbackFunc: async args =>
781-
{
782-
var coldStorageGetBulkResult = _coldStorage.GetBulkLocations(context, args);
783-
return await FetchFromContentLocationStoreThenPutAsync(
784-
context,
785-
args,
786-
GetBulkOrigin.ColdStorage,
787-
urgencyHint,
788-
coldStorageGetBulkResult,
789-
reason);
790-
},
791-
isSuccessFunc: result => IsPlaceFileSuccess(result));
792-
}
793-
794767
return Workflows.RunWithFallback(
795768
hashesWithPaths,
796769
initialFunc: initialFunc,

0 commit comments

Comments
 (0)