Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write in logger to Azure Storage and error handler. #804

Merged
merged 3 commits into from
Mar 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion cs/src/core/FasterLog/FasterLogRecoveryInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,8 @@ public void CommitIterators(ConcurrentDictionary<string, FasterLogScanIterator>
{
foreach (var kvp in Iterators)
{
persistedIterators[kvp.Key].UpdateCompletedUntilAddress(kvp.Value);
if (persistedIterators.TryGetValue(kvp.Key, out FasterLogScanIterator iterator))
iterator.UpdateCompletedUntilAddress(kvp.Value);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using FASTER.core;
using Microsoft.Extensions.Logging;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
Expand All @@ -13,23 +14,27 @@ public class AzureStorageNamedDeviceFactory : INamedDeviceFactory
readonly BlobUtilsV12.ServiceClients pageBlobAccount;
BlobUtilsV12.ContainerClients pageBlobContainer;
BlobUtilsV12.BlobDirectory pageBlobDirectory;
readonly ILogger logger;

/// <summary>
/// Create instance of factory for Azure devices
/// </summary>
/// <param name="connectionString"></param>
public AzureStorageNamedDeviceFactory(string connectionString)
: this(BlobUtilsV12.GetServiceClients(connectionString))
/// <param name="logger"></param>
public AzureStorageNamedDeviceFactory(string connectionString, ILogger logger = null)
: this(BlobUtilsV12.GetServiceClients(connectionString), logger)
{
}

/// <summary>
/// Create instance of factory for Azure devices
/// </summary>
/// <param name="pageBlobAccount"></param>
AzureStorageNamedDeviceFactory(BlobUtilsV12.ServiceClients pageBlobAccount)
/// <param name="logger"></param>
AzureStorageNamedDeviceFactory(BlobUtilsV12.ServiceClients pageBlobAccount, ILogger logger = null)
{
this.pageBlobAccount = pageBlobAccount;
this.logger = logger;
}

/// <inheritdoc />
Expand Down Expand Up @@ -76,7 +81,7 @@ public void Delete(FileDescriptor fileInfo)
/// <inheritdoc />
public IDevice Get(FileDescriptor fileInfo)
{
return new AzureStorageDevice(fileInfo.fileName, pageBlobDirectory.GetSubDirectory(fileInfo.directoryName), null, false);
return new AzureStorageDevice(fileInfo.fileName, pageBlobDirectory.GetSubDirectory(fileInfo.directoryName), null, false, false, logger);
}

/// <inheritdoc />
Expand Down
5 changes: 0 additions & 5 deletions cs/src/devices/AzureStorageDevice/BlobEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,6 @@ public BlobEntry(AzureStorageDevice azureStorageDevice)
/// <param name="pageBlob">The page blob to create</param>
public async Task CreateAsync(long size, BlobUtilsV12.PageBlobClients pageBlob)
{
if (this.waitingCount != 0)
{
this.azureStorageDevice.BlobManager?.HandleStorageError(nameof(CreateAsync), "expect to be called on blobs that don't already exist and exactly once", pageBlob.Default?.Name, null, false, false);
}

await this.azureStorageDevice.BlobManager.PerformWithRetriesAsync(
this.azureStorageDevice.BlobManager.AsynchronousStorageReadMaxConcurrency,
true,
Expand Down
2 changes: 1 addition & 1 deletion cs/src/devices/AzureStorageDevice/BlobManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ internal BlobManager(
this.leaseBlobDirectory = leaseBlobDirectory;
this.LeaseBlobName = leaseBlobName ?? LeaseBlobName;
this.TraceHelper = new FasterTraceHelper(logger, logLevelLimit, performanceLogger);
this.StorageErrorHandler = errorHandler ?? new StorageErrorHandler(null, logLevelLimit, null, null);
this.StorageErrorHandler = errorHandler ?? new StorageErrorHandler(logger, logLevelLimit, null, null);
this.shutDownOrTermination = errorHandler == null ?
new CancellationTokenSource() :
CancellationTokenSource.CreateLinkedTokenSource(errorHandler.Token);
Expand Down