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

Add back execution retry for query. #18691

Merged
merged 1 commit into from Nov 2, 2019
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion All.sln.DotSettings
Expand Up @@ -198,6 +198,7 @@ Licensed under the Apache License, Version 2.0. See License.txt in the project r
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002EJavaScript_002ECodeStyle_002ESettingsUpgrade_002EJsWrapperSettingsUpgrader/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002EXml_002ECodeStyle_002EFormatSettingsUpgrade_002EXmlMoveToCommonFormatterSettingsUpgrade/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=annotatable/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=doesnt/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=fallbacks/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=initializers/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=keyless/@EntryIndexedValue">True</s:Boolean>
Expand All @@ -207,10 +208,13 @@ Licensed under the Apache License, Version 2.0. See License.txt in the project r
<s:Boolean x:Key="/Default/UserDictionary/Words/=pushdown/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=remapper/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=requiredness/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=retriable/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=shaper/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=spatialite/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=sproc/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=sqlite/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=subquery/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=unignore/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=fixup/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=attacher/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
<s:Boolean x:Key="/Default/UserDictionary/Words/=attacher/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Xunit/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
Expand Up @@ -222,6 +222,7 @@ public static IEnumerable<string> GetPendingMigrations([NotNull] this DatabaseFa
new RelationalCommandParameterObject(
GetFacadeDependencies(databaseFacade).RelationalConnection,
rawSqlCommand.ParameterValues,
null,
((IDatabaseFacadeDependenciesAccessor)databaseFacade).Context,
logger));
}
Expand Down Expand Up @@ -388,6 +389,7 @@ public static IEnumerable<string> GetPendingMigrations([NotNull] this DatabaseFa
new RelationalCommandParameterObject(
facadeDependencies.RelationalConnection,
rawSqlCommand.ParameterValues,
null,
((IDatabaseFacadeDependenciesAccessor)databaseFacade).Context,
logger),
cancellationToken);
Expand Down Expand Up @@ -504,6 +506,7 @@ public static IEnumerable<string> GetPendingMigrations([NotNull] this DatabaseFa
new RelationalCommandParameterObject(
facadeDependencies.RelationalConnection,
rawSqlCommand.ParameterValues,
null,
((IDatabaseFacadeDependenciesAccessor)databaseFacade).Context,
logger));
}
Expand Down Expand Up @@ -656,6 +659,7 @@ public static IEnumerable<string> GetPendingMigrations([NotNull] this DatabaseFa
new RelationalCommandParameterObject(
facadeDependencies.RelationalConnection,
rawSqlCommand.ParameterValues,
null,
((IDatabaseFacadeDependenciesAccessor)databaseFacade).Context,
logger),
cancellationToken);
Expand Down
10 changes: 7 additions & 3 deletions src/EFCore.Relational/Migrations/HistoryRepository.cs
Expand Up @@ -127,14 +127,15 @@ protected virtual string ProductVersionColumnName
/// <summary>
/// Checks whether or not the history table exists.
/// </summary>
/// <returns> <c>True</c> if the table already exists, <c>false</c> otherwise. </returns>
/// <returns> <c>true</c> if the table already exists, <c>false</c> otherwise. </returns>
public virtual bool Exists()
=> Dependencies.DatabaseCreator.Exists()
&& InterpretExistsResult(
Dependencies.RawSqlCommandBuilder.Build(ExistsSql).ExecuteScalar(
new RelationalCommandParameterObject(
Dependencies.Connection,
null,
null,
Dependencies.CurrentContext.Context,
Dependencies.CommandLogger)));

Expand All @@ -144,7 +145,7 @@ public virtual bool Exists()
/// <param name="cancellationToken">A <see cref="CancellationToken" /> to observe while waiting for the task to complete.</param>
/// <returns>
/// A task that represents the asynchronous operation. The task result contains
/// <c>True</c> if the table already exists, <c>false</c> otherwise.
/// <c>true</c> if the table already exists, <c>false</c> otherwise.
/// </returns>
public virtual async Task<bool> ExistsAsync(CancellationToken cancellationToken = default)
=> await Dependencies.DatabaseCreator.ExistsAsync(cancellationToken)
Expand All @@ -153,14 +154,15 @@ public virtual async Task<bool> ExistsAsync(CancellationToken cancellationToken
new RelationalCommandParameterObject(
Dependencies.Connection,
null,
null,
Dependencies.CurrentContext.Context,
Dependencies.CommandLogger),
cancellationToken));

/// <summary>
/// Interprets the result of executing <see cref="ExistsSql" />.
/// </summary>
/// <returns>true if the table exists; otherwise, false.</returns>
/// <returns><c>true</c> if the table already exists, <c>false</c> otherwise.</returns>
protected abstract bool InterpretExistsResult([NotNull] object value);

/// <summary>
Expand Down Expand Up @@ -217,6 +219,7 @@ public virtual IReadOnlyList<HistoryRow> GetAppliedMigrations()
new RelationalCommandParameterObject(
Dependencies.Connection,
null,
null,
Dependencies.CurrentContext.Context,
Dependencies.CommandLogger)))
{
Expand Down Expand Up @@ -251,6 +254,7 @@ public virtual IReadOnlyList<HistoryRow> GetAppliedMigrations()
new RelationalCommandParameterObject(
Dependencies.Connection,
null,
null,
Dependencies.CurrentContext.Context,
Dependencies.CommandLogger),
cancellationToken))
Expand Down
2 changes: 2 additions & 0 deletions src/EFCore.Relational/Migrations/Internal/Migrator.cs
Expand Up @@ -117,6 +117,7 @@ public virtual void Migrate(string targetMigration = null)
new RelationalCommandParameterObject(
_connection,
null,
null,
_currentContext.Context,
_commandLogger));
}
Expand Down Expand Up @@ -154,6 +155,7 @@ public virtual void Migrate(string targetMigration = null)
new RelationalCommandParameterObject(
_connection,
null,
null,
_currentContext.Context,
_commandLogger),
cancellationToken);
Expand Down
2 changes: 2 additions & 0 deletions src/EFCore.Relational/Migrations/MigrationCommand.cs
Expand Up @@ -64,6 +64,7 @@ public class MigrationCommand
new RelationalCommandParameterObject(
connection,
parameterValues,
null,
_context,
_logger));

Expand All @@ -82,6 +83,7 @@ public class MigrationCommand
new RelationalCommandParameterObject(
connection,
parameterValues,
null,
_context,
_logger),
cancellationToken);
Expand Down