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
RavenDB-21956 Add azure queue storage etl #18293
base: v6.0
Are you sure you want to change the base?
Conversation
{ | ||
public EntraId EntraId { get; set; } | ||
public string ConnectionString { get; set; } | ||
public bool Passwordless { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why those aren't directly part of AzureQueueStorageConnectionSettings
? Do we need AzureQueueStorageConnectionSettings.Authentication
field?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
(I followed how we did for Elasticsearch, but maybe there also should be directly part of connection settings).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case of ElasticSearchConnectionString
it was a bit different because we provide node's URLs separately and then the authentication. Here we don't have such separation
@@ -31,6 +33,12 @@ protected override void ValidateImpl(ref List<string> errors) | |||
errors.Add($"{nameof(RabbitMqConnectionSettings)} has no valid setting."); | |||
} | |||
break; | |||
case QueueBrokerType.AzureQueueStorage: | |||
if (AzureQueueStorageConnectionSettings?.Authentication == null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just checking if it's not null is enough? I think we should rather verify that what was provided there is correct. For example that there is just one auth option provided and that is has all fields / properties filled correctly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
src/Raven.Client/Documents/Operations/ETL/Queue/AzureQueueStorageConnectionSettings.cs
Show resolved
Hide resolved
src/Raven.Client/Documents/Operations/ETL/Queue/QueueEtlConfiguration.cs
Show resolved
Hide resolved
@@ -216,7 +216,9 @@ public bool CanAutoRenewLetsEncryptCertificate | |||
|
|||
public bool HasElasticSearchEtl => Enabled(LicenseAttribute.ElasticSearchEtl); | |||
|
|||
public bool HasQueueEtl => Enabled(LicenseAttribute.QueueEtl); | |||
//public bool HasQueueEtl => Enabled(LicenseAttribute.QueueEtl); | |||
public bool HasQueueEtl => true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make sure it will be reverted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
try | ||
{ | ||
string authenticationJson = await new StreamReader(HttpContext.Request.Body).ReadToEndAsync(); | ||
Authentication authentication = JsonConvert.DeserializeObject<Authentication>(authenticationJson); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why just Authentication
instead of entire connection string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
} | ||
else | ||
{ | ||
throw new NotSupportedException("Provided authentication method is not supported"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make sure it will be validate much earlier - on attempt to put a connection string. We should never get here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just removed this part. You can not create auth option that doesn't exist in AzureQueueStorageConnectionSettings
src/Raven.Server/Raven.Server.csproj
Outdated
@@ -155,7 +155,12 @@ | |||
<PackageReference Include="AWSSDK.Core" Version="3.7.302.16" /> | |||
<PackageReference Include="AWSSDK.Glacier" Version="3.7.300.55" /> | |||
<PackageReference Include="AWSSDK.S3" Version="3.7.305.31" /> | |||
<PackageReference Include="AWSSDK.Core" Version="3.7.302.9" /> | |||
<PackageReference Include="AWSSDK.Glacier" Version="3.7.300.49" /> | |||
<PackageReference Include="AWSSDK.S3" Version="3.7.305.25" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems like a merge conflict - see duplicated AWSSDK references
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
||
namespace SlowTests.Server.Documents.ETL.Queue; | ||
|
||
public class AzureQueueStorageEtlTests : AzureQueueStorageEtlTestBase |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we need to do any cleanup of queues at the end of each test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I achieved it in this way:
https://github.com/djordjedjukic/ravendb/blob/051ba2272c0ec20d347b3bfd07d9a518a432a845/test/SlowTests/Server/Documents/ETL/Queue/AzureQueueStorageEtlTestBase.cs#L91-L96
Should I change it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was rather thinking about deleting queues during the dispose of tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you shut down azurite everything is deleted.
Do you think we need to delete queues explicitly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In our case we'll rather have Azurite emulator always running (in docker) so the cleanup after tests is necessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
|
||
Assert.Empty(record.QueueEtls); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have tests which intentionally try to push too big messages?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
} | ||
|
||
[RavenFact(RavenTestCategory.BackupExportImport | RavenTestCategory.Sharding | RavenTestCategory.Etl)] | ||
public async Task ShouldSkipUnsupportedFeaturesInShardingOnImport_RabbitMqEtl() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public async Task ShouldSkipUnsupportedFeaturesInShardingOnImport_RabbitMqEtl() | |
public async Task ShouldSkipUnsupportedFeaturesInShardingOnImport_AzureQueueStorage() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
b376de7
to
38c7e30
Compare
src/Raven.Client/Documents/Operations/ETL/Queue/AzureQueueStorageConnectionSettings.cs
Show resolved
Hide resolved
public TimeSetting AzureQueueStorageTimeToLive{ get; set; } | ||
|
||
[Description("How long a message is hidden after being retrieved but not deleted")] | ||
[DefaultValue(0)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's also the default value in Azure right?
Please do the rebase and solve the conflicts |
24c3a93
to
6143c8b
Compare
@djordjedjukic Was there any c# conflicts? If no maybe @kalczur can rebase again? @kalczur It looks like conflict with pinning you were adding last time. I assume we need to apply same changes in this PR. |
sure, I'll fix it |
0726454
to
88c7708
Compare
RavenDB-21956 Allow to pin responsible node in azure queue storage etl
88c7708
to
dd04b8b
Compare
<PackageReference Include="AWSSDK.Core" Version="3.7.302.16" /> | ||
<PackageReference Include="AWSSDK.Glacier" Version="3.7.300.55" /> | ||
<PackageReference Include="AWSSDK.S3" Version="3.7.305.31" /> | ||
<PackageReference Include="Azure.Identity" Version="1.10.4" /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant AWSSDK.*
- because it's duplicated
{ | ||
var parts = connectionString.Split(';') | ||
.Select(p => p.Split('=')) | ||
.ToDictionary(p => p[0], p => p.Length > 1 ? p[1] : ""); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you could use SqlConnectionStringParser.GetConnectionStringValue()
here
return storageAccountName; | ||
} | ||
|
||
private void HandleConnectionStringError(string message) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Handle" doesn't suggest this method will throw. Rename do ThrowConnectionStringError()
maybe?
return $"https://{storageAccountName}.queue.core.windows.net/"; | ||
} | ||
|
||
private string GetUrlFromConnectionString(string connectionString) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have unit tests for method? So we'll know that we properly deal with connection strings (it can be handled with the usage of a public GetStorageUrl()
method)
args.Length == 2 ? args[1].AsObject() : null); | ||
} | ||
|
||
private JsValue LoadToFunctionTranslatorWithAttributesInternal(string name, ObjectInstance obj, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we do something about that?
CreateQueueIfNotExists(queueClient); | ||
|
||
foreach (AzureQueueStorageItem queueItem in queue.Items) | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should have CancellationToken.ThrowIfCancellationRequested();
here in order to stop processing if the cancellation was requested
|
||
public bool IsValid() | ||
{ | ||
return !string.IsNullOrWhiteSpace(StorageAccountName) && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return !string.IsNullOrWhiteSpace(StorageAccountName) && | |
return string.IsNullOrWhiteSpace(StorageAccountName) == false && |
improves readability, same goes for lines below
|
||
public bool IsValid() | ||
{ | ||
return !string.IsNullOrWhiteSpace(StorageAccountName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return !string.IsNullOrWhiteSpace(StorageAccountName); | |
return string.IsNullOrWhiteSpace(StorageAccountName) == false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
newest Arek's comments mostly reflect also my thoughts
Issue link
https://issues.hibernatingrhinos.com/issue/RavenDB-21956/ETL-to-Azure-Queue-Storage
Additional description
Expanding Queue ETL with Azure Queue Storage provider.
Type of change
How risky is the change?
Backward compatibility
Is it platform specific issue?
Documentation update
Documentation Required
tag.Testing by Contributor
Testing by RavenDB QA team
QA Required
tag.Is there any existing behavior change of other features due to this change?
UI work
Studio Required
tag.