Skip to content

Commit

Permalink
Write in logger to Azure Storage and error handler. (#804)
Browse files Browse the repository at this point in the history
* Write in logger to Azure Storage and error handler.

* Remove spurious error message

* Fix iterator persistence
  • Loading branch information
badrishc authored Mar 16, 2023
1 parent 3d09097 commit 63a9b9d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 11 deletions.
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

0 comments on commit 63a9b9d

Please sign in to comment.