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

#3422 SQL persistence providers: Data reader SequentialAccess #3429

Merged
merged 2 commits into from
May 10, 2018
Merged

#3422 SQL persistence providers: Data reader SequentialAccess #3429

merged 2 commits into from
May 10, 2018

Conversation

TietoOliverKurowski
Copy link
Contributor

Configuration option for SQL persistence providers: Data readers can use Sequential access, which improves reading speed for large payloads.

  • Added for Snapshot query
  • Added for journal queries

This change is not backwards compatible.

As far as I can see there are no tests for the Akka.Persistence.SQL.Common project, so I didn't add any new test.
I also prepared a change for the SQL Server provider, but I wanted to wait for your review comments before publishing it.
Please let me know of any thinks I still need to do. This is my first pull request, so everything is quite new ;)

/// <summary>
/// Uses the CommandBehavior.SequentialAccess when creating the command, providing a performance improvement for reading large BLOBS.
/// </summary>
public readonly bool UseSequentialAccess;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use auto-get properties.

Copy link
Contributor

@Horusiath Horusiath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution. There are minor style comments. We could probably use some tests for this feature, but this doesn't have to be a must have at the moment.

using (var reader = await command.ExecuteReaderAsync(cancellationToken))
var commandBehavior = CommandBehavior.Default;

if (Configuration.UseSequentialAccess)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use if/else just to avoid double assignment and preserve intent.

using (var reader = await command.ExecuteReaderAsync(cancellationToken))
var commandBehavior = CommandBehavior.Default;

if (Configuration.UseSequentialAccess)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use if/else just to avoid double assignment and preserve intent.

/// <summary>
/// Uses the CommandBehavior.SequentialAccess when creating the command, providing a performance improvement for reading large BLOBS.
/// </summary>
public readonly bool UseSequentialAccess;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use auto-get property.


var commandBehavior = CommandBehavior.Default;

if (Configuration.UseSequentialAccess)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use if/else just to avoid double assignment and preserve intent.

@TietoOliverKurowski
Copy link
Contributor Author

Thanks @Horusiath for the quick code review. I updated according to you suggestions.

…s can use Sequential access, which improves reading speed for large payloads.

- Added for Snapshot query
- Added for journal queries
This change is not backwards compatible
@Aaronontheweb
Copy link
Member

Related issue: #3422

Copy link
Member

@Aaronontheweb Aaronontheweb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change looks good, but need to document its existence for affected users and be clear on what the default setting value is. It's ambiguous at the moment.

@@ -147,6 +154,7 @@ public class QueryConfiguration
SerializerIdColumnName = serializerIdColumnName;
Timeout = timeout;
DefaultSerializer = defaultSerializer;
UseSequentialAccess = useSequentialAccess;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the default value of this? Is it left up to the plugin implementation? Should we add it to some of the built-in HOCON files?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the late response.
Default value is false = current behavior
As the configuration is read by the plugin implementations it is basically up to the plugins. Therefore I'm not sure if it makes sense to put into some HOCO file on Akka level.
So I'm not sure if further changes are needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the late response.
Default value is false = current behavior
As the configuration is read by the plugin implementations it is basically up to the plugins. Therefore I'm not sure if it makes sense to put into some HOCO file on Akka level.
So I'm not sure if further changes are needed.

@Aaronontheweb
Copy link
Member

@TietoOliverKurowski did you see my comments?

@Aaronontheweb
Copy link
Member

Ok, got it - so this is a breaking change from an API perspective and will require us to re-compile any Akka.Persistence plugins that use SQL. Not the end of the world. We'll go ahead and do that.

@Aaronontheweb Aaronontheweb merged commit 07567ae into akkadotnet:dev May 10, 2018
@TietoOliverKurowski
Copy link
Contributor Author

Great, thanks a lot!

@TietoOliverKurowski TietoOliverKurowski deleted the 3422-use-sequential-access branch May 14, 2018 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants