This commit is contained in:
Jared Moore 2018-02-15 17:07:17 -08:00
Родитель 505f34e4d4 991fd4dcaa
Коммит 15c1cf3337
93 изменённых файлов: 8095 добавлений и 25657 удалений

13
.gitignore поставляемый
Просмотреть файл

@ -1,7 +1,10 @@
# Nuget restore
packages
project.lock.json
# Build folders
bin
FakesAssemblies
packages
obj
# Other misc build output
@ -18,3 +21,11 @@ TestResults
*.GhostDoc.xml
*.suo
*.pd_
# Visual studio
.vs/
.vscode/
# Build output
*.dll
*.exe

1
.vs/restore.dg Normal file
Просмотреть файл

@ -0,0 +1 @@
#:C:\Users\antho\Documents\Visual Studio 2015\Projects\elastic-db-tools\Test\ElasticScale.ShardManagement.UnitTests\ElasticScale.ShardManagement.UnitTests.Core.xproj

Просмотреть файл

@ -1,27 +1,15 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.31101.0
# Visual Studio 15
VisualStudioVersion = 15.0.26730.10
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ElasticScale.Client", "Src\ElasticScale.Client\ElasticScale.Client.csproj", "{663D22BB-483A-46B0-A504-861C5335DAD1}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Azure.SqlDatabase.ElasticScale.Client", "Src\ElasticScale.Client\Microsoft.Azure.SqlDatabase.ElasticScale.Client.csproj", "{4C3B3EC4-5702-469E-800E-313FB27A0A2B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ElasticScale.ClientTestCommon", "Test\ElasticScale.ClientTestCommon\ElasticScale.ClientTestCommon.csproj", "{13200C7C-8606-47B8-A004-570B56E3A9A8}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Azure.SqlDatabase.ElasticScale.ClientTestCommon", "Test\ElasticScale.ClientTestCommon\Microsoft.Azure.SqlDatabase.ElasticScale.ClientTestCommon.csproj", "{9336E9E7-19BF-49AC-92E3-19FA6B98921E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ElasticScale.Query.UnitTests", "Test\ElasticScale.Query.UnitTests\ElasticScale.Query.UnitTests.csproj", "{56DDEC7E-0B14-4636-B287-DB38DEC55192}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement.UnitTests", "Test\ElasticScale.ShardManagement.UnitTests\Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement.UnitTests.csproj", "{BEA6F911-BA98-462C-99AF-3B0595DE2307}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ElasticScale.ShardManagement.LoadTests", "Test\ElasticScale.ShardManagement.LoadTests\ElasticScale.ShardManagement.LoadTests.csproj", "{6C6E8D75-DF7B-4841-A254-D0D54746B417}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ElasticScale.ShardManagement.UnitTests", "Test\ElasticScale.ShardManagement.UnitTests\ElasticScale.ShardManagement.UnitTests.csproj", "{EA7DA8D7-6B11-4AF7-9C24-6FEEBDA7E188}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ElasticScaleStarterKit", "Samples\ElasticScaleStarterKit\ElasticScaleStarterKit.csproj", "{115A0283-AC42-4D37-97F2-106D168E04D2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EntityFrameworkCodeFirst", "Samples\EFCodeFirst\EntityFrameworkCodeFirst.csproj", "{904469F9-427C-4B9F-A30D-B63E53BEB489}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShardSqlCmd", "Samples\ShardSqlCmd\ShardSqlCmd.csproj", "{A95C04CC-3CEE-42ED-BB17-2B9850E374FB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EntityFrameworkMultiTenant", "Samples\EFMultiTenant\EntityFrameworkMultiTenant.csproj", "{9AD1DDF3-213C-47B1-B136-733C9FFF9FD1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ElasticDapper", "Samples\Dapper\ElasticDapper.csproj", "{7B67F0A1-A5A9-477B-9B7E-FA2E16ED34DE}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Azure.SqlDatabase.ElasticScale.Query.UnitTests", "Test\ElasticScale.Query.UnitTests\Microsoft.Azure.SqlDatabase.ElasticScale.Query.UnitTests.csproj", "{74CEE77F-D2C7-4B8B-9411-8F97F4E803FA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -30,68 +18,35 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{663D22BB-483A-46B0-A504-861C5335DAD1}.Cover|Any CPU.ActiveCfg = Release|Any CPU
{663D22BB-483A-46B0-A504-861C5335DAD1}.Cover|Any CPU.Build.0 = Release|Any CPU
{663D22BB-483A-46B0-A504-861C5335DAD1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{663D22BB-483A-46B0-A504-861C5335DAD1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{663D22BB-483A-46B0-A504-861C5335DAD1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{663D22BB-483A-46B0-A504-861C5335DAD1}.Release|Any CPU.Build.0 = Release|Any CPU
{13200C7C-8606-47B8-A004-570B56E3A9A8}.Cover|Any CPU.ActiveCfg = Release|Any CPU
{13200C7C-8606-47B8-A004-570B56E3A9A8}.Cover|Any CPU.Build.0 = Release|Any CPU
{13200C7C-8606-47B8-A004-570B56E3A9A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{13200C7C-8606-47B8-A004-570B56E3A9A8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{13200C7C-8606-47B8-A004-570B56E3A9A8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{13200C7C-8606-47B8-A004-570B56E3A9A8}.Release|Any CPU.Build.0 = Release|Any CPU
{56DDEC7E-0B14-4636-B287-DB38DEC55192}.Cover|Any CPU.ActiveCfg = Release|Any CPU
{56DDEC7E-0B14-4636-B287-DB38DEC55192}.Cover|Any CPU.Build.0 = Release|Any CPU
{56DDEC7E-0B14-4636-B287-DB38DEC55192}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{56DDEC7E-0B14-4636-B287-DB38DEC55192}.Debug|Any CPU.Build.0 = Debug|Any CPU
{56DDEC7E-0B14-4636-B287-DB38DEC55192}.Release|Any CPU.ActiveCfg = Release|Any CPU
{56DDEC7E-0B14-4636-B287-DB38DEC55192}.Release|Any CPU.Build.0 = Release|Any CPU
{6C6E8D75-DF7B-4841-A254-D0D54746B417}.Cover|Any CPU.ActiveCfg = Release|Any CPU
{6C6E8D75-DF7B-4841-A254-D0D54746B417}.Cover|Any CPU.Build.0 = Release|Any CPU
{6C6E8D75-DF7B-4841-A254-D0D54746B417}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6C6E8D75-DF7B-4841-A254-D0D54746B417}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6C6E8D75-DF7B-4841-A254-D0D54746B417}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6C6E8D75-DF7B-4841-A254-D0D54746B417}.Release|Any CPU.Build.0 = Release|Any CPU
{EA7DA8D7-6B11-4AF7-9C24-6FEEBDA7E188}.Cover|Any CPU.ActiveCfg = Release|Any CPU
{EA7DA8D7-6B11-4AF7-9C24-6FEEBDA7E188}.Cover|Any CPU.Build.0 = Release|Any CPU
{EA7DA8D7-6B11-4AF7-9C24-6FEEBDA7E188}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EA7DA8D7-6B11-4AF7-9C24-6FEEBDA7E188}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EA7DA8D7-6B11-4AF7-9C24-6FEEBDA7E188}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EA7DA8D7-6B11-4AF7-9C24-6FEEBDA7E188}.Release|Any CPU.Build.0 = Release|Any CPU
{115A0283-AC42-4D37-97F2-106D168E04D2}.Cover|Any CPU.ActiveCfg = Cover|Any CPU
{115A0283-AC42-4D37-97F2-106D168E04D2}.Cover|Any CPU.Build.0 = Cover|Any CPU
{115A0283-AC42-4D37-97F2-106D168E04D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{115A0283-AC42-4D37-97F2-106D168E04D2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{115A0283-AC42-4D37-97F2-106D168E04D2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{115A0283-AC42-4D37-97F2-106D168E04D2}.Release|Any CPU.Build.0 = Release|Any CPU
{904469F9-427C-4B9F-A30D-B63E53BEB489}.Cover|Any CPU.ActiveCfg = Cover|Any CPU
{904469F9-427C-4B9F-A30D-B63E53BEB489}.Cover|Any CPU.Build.0 = Cover|Any CPU
{904469F9-427C-4B9F-A30D-B63E53BEB489}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{904469F9-427C-4B9F-A30D-B63E53BEB489}.Debug|Any CPU.Build.0 = Debug|Any CPU
{904469F9-427C-4B9F-A30D-B63E53BEB489}.Release|Any CPU.ActiveCfg = Release|Any CPU
{904469F9-427C-4B9F-A30D-B63E53BEB489}.Release|Any CPU.Build.0 = Release|Any CPU
{A95C04CC-3CEE-42ED-BB17-2B9850E374FB}.Cover|Any CPU.ActiveCfg = Cover|Any CPU
{A95C04CC-3CEE-42ED-BB17-2B9850E374FB}.Cover|Any CPU.Build.0 = Cover|Any CPU
{A95C04CC-3CEE-42ED-BB17-2B9850E374FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A95C04CC-3CEE-42ED-BB17-2B9850E374FB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A95C04CC-3CEE-42ED-BB17-2B9850E374FB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A95C04CC-3CEE-42ED-BB17-2B9850E374FB}.Release|Any CPU.Build.0 = Release|Any CPU
{9AD1DDF3-213C-47B1-B136-733C9FFF9FD1}.Cover|Any CPU.ActiveCfg = Cover|Any CPU
{9AD1DDF3-213C-47B1-B136-733C9FFF9FD1}.Cover|Any CPU.Build.0 = Cover|Any CPU
{9AD1DDF3-213C-47B1-B136-733C9FFF9FD1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9AD1DDF3-213C-47B1-B136-733C9FFF9FD1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9AD1DDF3-213C-47B1-B136-733C9FFF9FD1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9AD1DDF3-213C-47B1-B136-733C9FFF9FD1}.Release|Any CPU.Build.0 = Release|Any CPU
{7B67F0A1-A5A9-477B-9B7E-FA2E16ED34DE}.Cover|Any CPU.ActiveCfg = Cover|Any CPU
{7B67F0A1-A5A9-477B-9B7E-FA2E16ED34DE}.Cover|Any CPU.Build.0 = Cover|Any CPU
{7B67F0A1-A5A9-477B-9B7E-FA2E16ED34DE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7B67F0A1-A5A9-477B-9B7E-FA2E16ED34DE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7B67F0A1-A5A9-477B-9B7E-FA2E16ED34DE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7B67F0A1-A5A9-477B-9B7E-FA2E16ED34DE}.Release|Any CPU.Build.0 = Release|Any CPU
{4C3B3EC4-5702-469E-800E-313FB27A0A2B}.Cover|Any CPU.ActiveCfg = Debug|Any CPU
{4C3B3EC4-5702-469E-800E-313FB27A0A2B}.Cover|Any CPU.Build.0 = Debug|Any CPU
{4C3B3EC4-5702-469E-800E-313FB27A0A2B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4C3B3EC4-5702-469E-800E-313FB27A0A2B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4C3B3EC4-5702-469E-800E-313FB27A0A2B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4C3B3EC4-5702-469E-800E-313FB27A0A2B}.Release|Any CPU.Build.0 = Release|Any CPU
{9336E9E7-19BF-49AC-92E3-19FA6B98921E}.Cover|Any CPU.ActiveCfg = Debug|Any CPU
{9336E9E7-19BF-49AC-92E3-19FA6B98921E}.Cover|Any CPU.Build.0 = Debug|Any CPU
{9336E9E7-19BF-49AC-92E3-19FA6B98921E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9336E9E7-19BF-49AC-92E3-19FA6B98921E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9336E9E7-19BF-49AC-92E3-19FA6B98921E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9336E9E7-19BF-49AC-92E3-19FA6B98921E}.Release|Any CPU.Build.0 = Release|Any CPU
{BEA6F911-BA98-462C-99AF-3B0595DE2307}.Cover|Any CPU.ActiveCfg = Debug|Any CPU
{BEA6F911-BA98-462C-99AF-3B0595DE2307}.Cover|Any CPU.Build.0 = Debug|Any CPU
{BEA6F911-BA98-462C-99AF-3B0595DE2307}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BEA6F911-BA98-462C-99AF-3B0595DE2307}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BEA6F911-BA98-462C-99AF-3B0595DE2307}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BEA6F911-BA98-462C-99AF-3B0595DE2307}.Release|Any CPU.Build.0 = Release|Any CPU
{74CEE77F-D2C7-4B8B-9411-8F97F4E803FA}.Cover|Any CPU.ActiveCfg = Debug|Any CPU
{74CEE77F-D2C7-4B8B-9411-8F97F4E803FA}.Cover|Any CPU.Build.0 = Debug|Any CPU
{74CEE77F-D2C7-4B8B-9411-8F97F4E803FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{74CEE77F-D2C7-4B8B-9411-8F97F4E803FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{74CEE77F-D2C7-4B8B-9411-8F97F4E803FA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{74CEE77F-D2C7-4B8B-9411-8F97F4E803FA}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {24237160-521B-4CD0-87AB-8994A5E50BE2}
EndGlobalSection
EndGlobal

Просмотреть файл

@ -2,7 +2,7 @@
<RuleSet ToolsVersion="10.0"
Name="Template for custom ruleset"
Description="This template includes everything (including SDL ruleset, if enabled) but the rules that are explicitly disabled.">
<!--
To use: copy template to a location of the tree, and,
for a build.props, add this to the build.props:
@ -10,18 +10,18 @@
for a leaf msbuild project, add this to the project file:
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)CodeAnalysis.ruleset</CodeAnalysisRuleSet>
-->
<!-- this node ensures all rules (including SDL ones if CodeAnalysisUseFxCopForSdl is set to true) are imported -->
<IncludeAll Action="Warning" />
<Rules AnalyzerId="Microsoft.Analyzers.ManagedCodeAnalysis" RuleNamespace="Microsoft.Rules.Managed">
<!--
These are examples of disabled rules
<!--
These are examples of disabled rules
The pro of implicitly importing all and explicitly silencing some rules is auto-getting new rules when setting
properties (such as CodeAnalysisUseFxCopForSdl to true) and picking up new versions of the code analysis tools.
-->
<Rule Id="CA1014" Action="None" /> <!-- MarkAssembliesWithClsCompliant -->
<Rule Id="CA1026" Action="None" /> <!-- DefaultParametersShouldNotBeUsed -->
<Rule Id="CA1303" Action="None" /> <!-- DoNotPassLiteralsAsLocalizedParameters -->

Просмотреть файл

@ -8,7 +8,6 @@
<AssemblyName>ElasticDapper</AssemblyName>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Build.props))\Build.props" />
<!--
BUILD PROCESS FOR SAMPLES GALLERY
-->
@ -19,9 +18,9 @@
<SamplesGallerySolutionInput Include="ElasticDapper.sln.SamplesGallery" />
</ItemGroup>
<Import Project="..\SamplesGallery.targets" />
<!--
<!--
Any changes below must be copied to ShardSqlCmd.csproj.SamplesGallery, except:
- $(NugetPack) must be replaced with ..\packages
- $(NugetPack) must be replaced with ..\packages
-->
<ItemGroup>
<Reference Include="$(NugetPack)\EnterpriseLibrary.TransientFaultHandling.6.0.1304.0\lib\portable-net45+win+wp8\Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling.dll">

Просмотреть файл

@ -10,7 +10,6 @@
<!-- Disable FxCop - fixing these warnings is low priority -->
<RunCodeAnalysis>false</RunCodeAnalysis>
</PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Build.props))\Build.props" />
<!--
BUILD PROCESS FOR SAMPLES GALLERY
-->
@ -21,7 +20,7 @@
<SamplesGallerySolutionInput Include="EntityFrameworkCodeFirst.sln.SamplesGallery" />
</ItemGroup>
<Import Project="..\SamplesGallery.targets" />
<!--
<!--
Any changes below must be copied to EntityFrameworkCodeFirst.csproj.SamplesGallery, except:
- $(NugetPack) must be replaced with ..\packages
-->

Просмотреть файл

@ -10,7 +10,6 @@
<!-- Disable FxCop - fixing these warnings is low priority -->
<RunCodeAnalysis>false</RunCodeAnalysis>
</PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Build.props))\Build.props" />
<!--
BUILD PROCESS FOR SAMPLES GALLERY
-->
@ -21,7 +20,7 @@
<SamplesGallerySolutionInput Include="EntityFrameworkMultiTenant.sln.SamplesGallery" />
</ItemGroup>
<Import Project="..\SamplesGallery.targets" />
<!--
<!--
Any changes below must be copied to EntityFrameworkMultiTenant.csproj.SamplesGallery, except:
- $(NugetPack) must be replaced with ..\packages
-->

Просмотреть файл

@ -8,7 +8,6 @@
<RootNamespace>ElasticScaleStarterKit</RootNamespace>
<AssemblyName>ElasticScaleStarterKit</AssemblyName>
</PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Build.props))\Build.props" />
<!--
BUILD PROCESS FOR SAMPLES GALLERY
-->
@ -19,7 +18,7 @@
<SamplesGallerySolutionInput Include="ElasticScaleStarterKit.sln.SamplesGallery" />
</ItemGroup>
<Import Project="..\SamplesGallery.targets" />
<!--
<!--
Any changes below must be copied to ElasticScaleStarterKit.csproj.SamplesGallery except:
- "$(NugetPack)" must be replaced with "..\packages"
-->

Просмотреть файл

@ -8,7 +8,6 @@
<RootNamespace>ShardSqlCmd</RootNamespace>
<AssemblyName>ShardSqlCmd</AssemblyName>
</PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Build.props))\Build.props" />
<!--
BUILD PROCESS FOR SAMPLES GALLERY
-->
@ -19,9 +18,9 @@
<SamplesGallerySolutionInput Include="ShardSqlCmd.sln.SamplesGallery" />
</ItemGroup>
<Import Project="..\SamplesGallery.targets" />
<!--
<!--
Any changes below must be copied to ShardSqlCmd.csproj.SamplesGallery, except:
- $(NugetPack) must be replaced with ..\packages
- $(NugetPack) must be replaced with ..\packages
-->
<ItemGroup>
<Reference Include="$(NugetPack)\Microsoft.Azure.SqlDatabase.ElasticScale.Client.1.3.2\lib\net45\Microsoft.Azure.SqlDatabase.ElasticScale.Client.dll">

Просмотреть файл

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>
<PropertyGroup>
<CodeAnalysisRuleSet Condition="'$(CodeAnalysisRuleSet)'==''">$(MSBuildThisFileDirectory)CodeAnalysis.Samples.ruleset</CodeAnalysisRuleSet>
<RelativeOutputPath>Samples\$(RelativeOutputPath)</RelativeOutputPath>
<SigningType Condition="$(SigningType)==''">Test</SigningType>
</PropertyGroup>
<Import Project="$(MSBuildThisFileDirectory)\..\Build.props" />
</Project>

Просмотреть файл

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Build.props))\Build.props" />
<ItemGroup>
<ProjectFile Include="EFCodeFirst\EntityFrameworkCodeFirst.csproj" />
<ProjectFile Include="EFMultiTenant\EntityFrameworkMultiTenant.csproj" />
<ProjectFile Include="ElasticScaleStarterKit\ElasticScaleStarterKit.csproj" />
<ProjectFile Include="ShardSqlCmd\ShardSqlCmd.csproj" />
</ItemGroup>
<Import Project="$(BuildExtensionsPath)\Traversal.targets" />
</Project>

Просмотреть файл

@ -1,336 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{663D22BB-483A-46B0-A504-861C5335DAD1}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Microsoft.Azure.SqlDatabase.ElasticScale</RootNamespace>
<AssemblyName>Microsoft.Azure.SqlDatabase.ElasticScale.Client</AssemblyName>
<DocumentationFile>$(OutDir)$(AssemblyName).xml</DocumentationFile>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Build.props))\Build.props" />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<DefineConstants>$(DefineConstants);DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<DefineConstants>$(DefineConstants);TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.XML" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Compile Include="ElasticScale.Common\TransientFaultHandling\RetryingEventArgs.cs" />
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<!--
Common
-->
<ItemGroup>
<Compile Include="ElasticScale.Common\InternalHelpers\ApplicationNameHelper.cs" />
<Compile Include="ElasticScale.Common\ExceptionHandling\ExceptionExtensionMethods.cs" />
<Compile Include="ElasticScale.Common\GlobalSuppressions.cs" />
<Compile Include="ElasticScale.Common\TransientFaultHandling\Implementation\AsyncExecution.cs" />
<Compile Include="ElasticScale.Common\TransientFaultHandling\RetryBehavior.cs" />
<Compile Include="ElasticScale.Common\TransientFaultHandling\RetryPolicy.cs" />
<Compile Include="ElasticScale.Common\TransientFaultHandling\Implementation\Guard.cs" />
<Compile Include="ElasticScale.Common\TransientFaultHandling\Implementation\ITransientErrorDetectionStrategy.cs" />
<Compile Include="ElasticScale.Common\Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="ElasticScale.Common\TransientFaultHandling\Implementation\RetryingEventArgs.cs" />
<Compile Include="ElasticScale.Common\TransientFaultHandling\Implementation\RetryLimitExceededException.cs" />
<Compile Include="ElasticScale.Common\TransientFaultHandling\Implementation\RetryManager.cs" />
<Compile Include="ElasticScale.Common\TransientFaultHandling\Implementation\RetryPolicy.cs" />
<Compile Include="ElasticScale.Common\TransientFaultHandling\Implementation\RetryPolicy.Generic.cs" />
<Compile Include="ElasticScale.Common\TransientFaultHandling\Implementation\ExponentialBackoff.cs" />
<Compile Include="ElasticScale.Common\TransientFaultHandling\Implementation\FixedInterval.cs" />
<Compile Include="ElasticScale.Common\TransientFaultHandling\Implementation\Incremental.cs" />
<Compile Include="ElasticScale.Common\TransientFaultHandling\Implementation\RetryStrategy.cs" />
<Compile Include="ElasticScale.Common\TransientFaultHandling\Implementation\SqlDatabaseTransientErrorDetectionStrategy.cs" />
<Compile Include="ElasticScale.Common\TransientFaultHandling\Implementation\ThrottlingCondition.cs" />
<Compile Include="ElasticScale.Common\InternalHelpers\SerializationHelper.cs" />
<EmbeddedResource Include="ElasticScale.Common\Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Compile Include="ElasticScale.Common\Logging\TraceSource\ActivityIdScope.cs" />
<Compile Include="ElasticScale.Common\Logging\ILogger.cs" />
<Compile Include="ElasticScale.Common\Logging\LoggerFactory.cs" />
<Compile Include="ElasticScale.Common\Logging\ILogConfigWatcher.cs" />
<Compile Include="ElasticScale.Common\Logging\TraceSource\TraceSourceWrapper.cs" />
<Compile Include="ElasticScale.Common\Logging\TraceSource\TraceSourceFactory.cs" />
<Compile Include="ElasticScale.Common\Patterns\ConditionalDisposable.cs" />
</ItemGroup>
<!--
ShardManagement
-->
<ItemGroup>
<Compile Include="ShardManagement\Cache\CacheListMapper.cs" />
<Compile Include="ShardManagement\Cache\CacheMapper.cs" />
<Compile Include="ShardManagement\Cache\CacheMapping.cs" />
<Compile Include="ShardManagement\Cache\CacheMappingExtensions.cs" />
<Compile Include="ShardManagement\Cache\CacheObject.cs" />
<Compile Include="ShardManagement\Cache\CacheRangeMapper.cs" />
<Compile Include="ShardManagement\Cache\CacheShardMap.cs" />
<Compile Include="ShardManagement\Cache\CacheRoot.cs" />
<Compile Include="ShardManagement\Cache\CacheStore.cs" />
<Compile Include="ShardManagement\Cache\ICacheStore.cs" />
<Compile Include="ShardManagement\Cache\ICacheStoreMapping.cs" />
<Compile Include="ShardManagement\Cache\PerfCounterInstance.cs" />
<Compile Include="ShardManagement\Cache\PerformanceCounterWrapper.cs" />
<Compile Include="ShardManagement\Cache\ReadLockScope.cs" />
<Compile Include="ShardManagement\Cache\WriteLockScope.cs" />
<Compile Include="ShardManagement\Errors.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Errors.resx</DependentUpon>
</Compile>
<Compile Include="ShardManagement\Logging\TraceHelper.cs" />
<Compile Include="ShardManagement\Logging\TraceSourceConstants.cs" />
<Compile Include="ShardManagement\ReadOnlyScripts.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>ReadOnlyScripts.resx</DependentUpon>
</Compile>
<Compile Include="ShardManagement\PerformanceCounters.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>PerformanceCounters.resx</DependentUpon>
</Compile>
<Compile Include="ShardManagement\SchemaInformation\TableInfo.cs" />
<Compile Include="ShardManagement\SchemaInformation\SchemaInfoCollection.cs" />
<Compile Include="ShardManagement\SchemaInformation\SchemaInfoErrorCode.cs" />
<Compile Include="ShardManagement\SchemaInformation\SchemaInfoException.cs" />
<Compile Include="ShardManagement\SchemaInformation\ShardedTableInfo.cs" />
<Compile Include="ShardManagement\SchemaInformation\ReferenceTableInfo.cs" />
<Compile Include="ShardManagement\SchemaInformation\SchemaInfo.cs" />
<Compile Include="ShardManagement\Recovery\MappingDifference.cs" />
<Compile Include="ShardManagement\Recovery\MappingDifferenceType.cs" />
<Compile Include="ShardManagement\Recovery\MappingLocation.cs" />
<Compile Include="ShardManagement\Recovery\MappingDifferenceResolution.cs" />
<Compile Include="ShardManagement\Recovery\MappingComparisonUtils.cs" />
<Compile Include="ShardManagement\Recovery\MappingComparisonResult.cs" />
<Compile Include="ShardManagement\Recovery\RecoveryManager.cs" />
<Compile Include="ShardManagement\Recovery\RecoveryToken.cs" />
<Compile Include="ShardManagement\Scripts.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Scripts.resx</DependentUpon>
</Compile>
<Compile Include="ShardManagement\ShardMapManager\ShardManagementException.cs" />
<Compile Include="ShardManagement\ShardMapManager\ShardManagementTransientErrorDetectionStrategy.cs" />
<Compile Include="ShardManagement\Shard\MappingStatus.cs" />
<Compile Include="ShardManagement\Shard\ShardStatus.cs" />
<Compile Include="ShardManagement\SqlStore\SqlStoreConnection.cs" />
<Compile Include="ShardManagement\SqlStore\SqlStoreConnectionFactory.cs" />
<Compile Include="ShardManagement\SqlStore\SqlUserStoreConnection.cs" />
<Compile Include="ShardManagement\StoreOperations\Base\IStoreOperation.cs" />
<Compile Include="ShardManagement\StoreOperations\Base\IStoreOperationFactory.cs" />
<Compile Include="ShardManagement\StoreOperations\Base\IStoreOperationGlobal.cs" />
<Compile Include="ShardManagement\StoreOperations\Base\IStoreOperationLocal.cs" />
<Compile Include="ShardManagement\StoreOperations\Base\StoreOperationCode.cs" />
<Compile Include="ShardManagement\StoreOperations\Recovery\AttachShardOperation.cs" />
<Compile Include="ShardManagement\StoreOperations\Recovery\CheckShardLocalOperation.cs" />
<Compile Include="ShardManagement\StoreOperations\Recovery\DetachShardGlobalOperation.cs" />
<Compile Include="ShardManagement\StoreOperations\ShardMapper\FindMappingByKeyGlobalOperation.cs" />
<Compile Include="ShardManagement\StoreOperations\ShardMapper\FindMappingByIdGlobalOperation.cs" />
<Compile Include="ShardManagement\StoreOperations\ShardMapper\GetMappingsByRangeGlobalOperation.cs" />
<Compile Include="ShardManagement\StoreOperations\Recovery\GetMappingsByRangeLocalOperation.cs" />
<Compile Include="ShardManagement\StoreOperations\Recovery\GetShardsLocalOperation.cs" />
<Compile Include="ShardManagement\StoreOperations\Recovery\ReplaceMappingsGlobalOperation.cs" />
<Compile Include="ShardManagement\StoreOperations\Recovery\ReplaceMappingsLocalOperation.cs" />
<Compile Include="ShardManagement\StoreOperations\SchemaInformation\AddShardingSchemaInfoGlobalOperation.cs" />
<Compile Include="ShardManagement\StoreOperations\SchemaInformation\GetShardingSchemaInfosGlobalOperation.cs" />
<Compile Include="ShardManagement\StoreOperations\SchemaInformation\FindShardingSchemaInfoGlobalOperation.cs" />
<Compile Include="ShardManagement\StoreOperations\SchemaInformation\RemoveShardingSchemaInfoGlobalOperation.cs" />
<Compile Include="ShardManagement\StoreOperations\SchemaInformation\UpdateShardingSchemaInfoGlobalOperation.cs" />
<Compile Include="ShardManagement\StoreOperations\ShardMapper\AddMappingOperation.cs" />
<Compile Include="ShardManagement\StoreOperations\ShardMapper\LockOrUnLockMappingsGlobalOperation.cs" />
<Compile Include="ShardManagement\StoreOperations\ShardMapper\ReplaceMappingsOperation.cs" />
<Compile Include="ShardManagement\StoreOperations\ShardMapper\RemoveMappingOperation.cs" />
<Compile Include="ShardManagement\StoreOperations\ShardMapper\UpdateMappingOperation.cs" />
<Compile Include="ShardManagement\StoreOperations\ShardMap\AddShardOperation.cs" />
<Compile Include="ShardManagement\StoreOperations\ShardMap\FindShardByLocationGlobalOperation.cs" />
<Compile Include="ShardManagement\StoreOperations\ShardMap\GetShardsGlobalOperation.cs" />
<Compile Include="ShardManagement\StoreOperations\ShardMapManager\AddShardMapGlobalOperation.cs" />
<Compile Include="ShardManagement\StoreOperations\ShardMapManagerFactory\CreateShardMapManagerGlobalOperation.cs" />
<Compile Include="ShardManagement\StoreOperations\ShardMapManager\GetDistinctShardLocationsGlobalOperation.cs" />
<Compile Include="ShardManagement\StoreOperations\ShardMapManager\FindShardMapByNameGlobalOperation.cs" />
<Compile Include="ShardManagement\StoreOperations\ShardMapManagerFactory\GetShardMapManagerGlobalOperation.cs" />
<Compile Include="ShardManagement\StoreOperations\ShardMapManager\GetShardMapsGlobalOperation.cs" />
<Compile Include="ShardManagement\StoreOperations\ShardMapManager\LoadShardMapManagerGlobalOperation.cs" />
<Compile Include="ShardManagement\StoreOperations\ShardMapManager\RemoveShardMapGlobalOperation.cs" />
<Compile Include="ShardManagement\StoreOperations\ShardMap\RemoveShardOperation.cs" />
<Compile Include="ShardManagement\StoreOperations\ShardMap\UpdateShardOperation.cs" />
<Compile Include="ShardManagement\StoreOperations\Base\StoreConnectionInfo.cs" />
<Compile Include="ShardManagement\StoreOperations\Base\StoreOperationGlobal.cs" />
<Compile Include="ShardManagement\StoreOperations\Base\StoreOperationLocal.cs" />
<Compile Include="ShardManagement\StoreOperations\Base\StoreOperationState.cs" />
<Compile Include="ShardManagement\StoreOperations\Base\StoreOperation.cs" />
<Compile Include="ShardManagement\StoreOperations\Base\StoreOperationFactory.cs" />
<Compile Include="ShardManagement\StoreOperations\Upgrade\UpgradeStoreGlobalOperation.cs" />
<Compile Include="ShardManagement\StoreOperations\Upgrade\UpgradeStoreLocalOperation.cs" />
<Compile Include="ShardManagement\StoreOperations\Base\StoreOperationErrorHandler.cs" />
<Compile Include="ShardManagement\SqlStore\SqlStoreTransactionScope.cs" />
<Compile Include="ShardManagement\StoreOperations\Base\StoreOperationTransactionScopeKind.cs" />
<Compile Include="ShardManagement\StoreOperations\Base\StoreOperationRequestBuilder.cs" />
<Compile Include="ShardManagement\SqlStore\SqlLocation.cs" />
<Compile Include="ShardManagement\SqlStore\SqlLogEntry.cs" />
<Compile Include="ShardManagement\SqlStore\SqlSchemaInfo.cs" />
<Compile Include="ShardManagement\SqlStore\SqlShardMapManagerCredentials.cs" />
<Compile Include="ShardManagement\ShardMapper\BaseShardMapper.cs" />
<Compile Include="ShardManagement\ShardMapper\DefaultShardMapper.cs" />
<Compile Include="ShardManagement\ShardMapper\HashShardMapper.cs" />
<Compile Include="ShardManagement\ShardMapper\IShardMapper.cs" />
<Compile Include="ShardManagement\ShardMapper\ListShardMapper.cs" />
<Compile Include="ShardManagement\ShardMapper\RangeShardMapper.cs" />
<Compile Include="ShardManagement\ShardMap\ShardMapUtils.cs" />
<Compile Include="ShardManagement\Shard\BaseMappingUpdate.cs" />
<Compile Include="ShardManagement\Shard\IMappingInfoProvider.cs" />
<Compile Include="ShardManagement\Shard\IMappingUpdate.cs" />
<Compile Include="ShardManagement\Shard\IShardProvider.cs" />
<Compile Include="ShardManagement\Shard\ValidationUtils.cs" />
<Compile Include="ShardManagement\Shard\PointMappingUpdate.cs" />
<Compile Include="ShardManagement\Shard\RangeMappingUpdate.cs" />
<Compile Include="ShardManagement\Shard\ShardUpdate.cs" />
<Compile Include="ShardManagement\SqlStore\SqlMapping.cs" />
<Compile Include="ShardManagement\SqlStore\SqlResults.cs" />
<Compile Include="ShardManagement\SqlStore\SqlShard.cs" />
<Compile Include="ShardManagement\SqlStore\SqlShardMap.cs" />
<Compile Include="ShardManagement\Shard\PointMapping.cs" />
<Compile Include="ShardManagement\Shard\MappingLockToken.cs" />
<Compile Include="ShardManagement\Shard\Range.cs" />
<Compile Include="ShardManagement\Shard\RangeMapping.cs" />
<Compile Include="ShardManagement\Shard\Shard.cs" />
<Compile Include="ShardManagement\Shard\ShardKeyType.cs" />
<Compile Include="ShardManagement\Shard\ShardRange.cs" />
<Compile Include="ShardManagement\ShardMapManager\ShardMapManagerFactory.cs" />
<Compile Include="ShardManagement\Shard\ShardKey.cs" />
<Compile Include="ShardManagement\Shard\ShardLocation.cs" />
<Compile Include="ShardManagement\ShardMapManager\ShardMapManager.cs" />
<Compile Include="ShardManagement\ShardMap\ListShardMap.cs" />
<Compile Include="ShardManagement\ShardMap\RangeShardMap.cs" />
<Compile Include="ShardManagement\ShardMap\ShardMap.cs" />
<Compile Include="ShardManagement\ShardMap\ShardMapExtensions.cs" />
<Compile Include="ShardManagement\ShardMap\ShardMapType.cs" />
<Compile Include="ShardManagement\Store\DefaultStoreMapping.cs" />
<Compile Include="ShardManagement\Store\DefaultStoreSchemaInfo.cs" />
<Compile Include="ShardManagement\Store\DefaultStoreShard.cs" />
<Compile Include="ShardManagement\Store\DefaultStoreShardMap.cs" />
<Compile Include="ShardManagement\Store\IStoreConnection.cs" />
<Compile Include="ShardManagement\Store\IStoreConnectionFactory.cs" />
<Compile Include="ShardManagement\Store\IStoreLocation.cs" />
<Compile Include="ShardManagement\Store\IStoreLogEntry.cs" />
<Compile Include="ShardManagement\Store\IStoreMapping.cs" />
<Compile Include="ShardManagement\Store\IStoreResults.cs" />
<Compile Include="ShardManagement\Store\IStoreSchemaInfo.cs" />
<Compile Include="ShardManagement\Store\IStoreShard.cs" />
<Compile Include="ShardManagement\Store\IStoreShardMap.cs" />
<Compile Include="ShardManagement\Store\IStoreTransactionScope.cs" />
<Compile Include="ShardManagement\StoreOperations\Base\StoreObjectFormatterXml.cs" />
<Compile Include="ShardManagement\Store\IStoreVersion.cs" />
<Compile Include="ShardManagement\Store\SqlVersion.cs" />
<Compile Include="ShardManagement\Store\IUserStoreConnection.cs" />
<Compile Include="ShardManagement\Store\StoreException.cs" />
<Compile Include="ShardManagement\Utils\ExceptionUtils.cs" />
<Compile Include="ShardManagement\Utils\GlobalConstants.cs" />
<Compile Include="ShardManagement\Utils\ICloneable.cs" />
<Compile Include="ShardManagement\Utils\SqlUtils.cs" />
<Compile Include="ShardManagement\Utils\TimerUtils.cs" />
<Compile Include="ShardManagement\Utils\ValueLock.cs" />
<Compile Include="ShardManagement\Utils\StringUtils.cs" />
</ItemGroup>
<ItemGroup>
<None Include="ShardManagement\Scripts\CreateShardMapManagerGlobal.sql" />
</ItemGroup>
<ItemGroup>
<None Include="ShardManagement\Scripts\CreateShardMapManagerLocal.sql" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="ShardManagement\ReadOnlyScripts.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>ReadOnlyScripts.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="ShardManagement\PerformanceCounters.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>PerformanceCounters.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Include="ShardManagement\Scripts.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Scripts.Designer.cs</LastGenOutput>
<CustomToolNamespace>Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement</CustomToolNamespace>
</EmbeddedResource>
<EmbeddedResource Include="ShardManagement\Errors.resx">
<Generator>ResXFileCodeGenerator</Generator>
<CustomToolNamespace>Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement</CustomToolNamespace>
<LastGenOutput>Errors.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<Content Include="ShardManagement\Scripts\CheckShardMapManagerGlobal.sql" />
<Content Include="ShardManagement\Scripts\CheckShardMapManagerLocal.sql" />
<Content Include="ShardManagement\Scripts\DropShardMapManagerGlobal.sql" />
<Content Include="ShardManagement\Scripts\DropShardMapManagerLocal.sql" />
<Content Include="ShardManagement\Scripts\UpgradeShardMapManagerGlobalFrom1.1To1.2.sql" />
<Content Include="ShardManagement\Scripts\UpgradeShardMapManagerLocalFrom1.1To1.2.sql" />
<Content Include="ShardManagement\Scripts\UpgradeShardMapManagerLocalFrom1000.0To1000.1.sql" />
<Content Include="ShardManagement\Scripts\UpgradeShardMapManagerLocalFrom1.0To1.1.sql" />
<Content Include="ShardManagement\Scripts\UpgradeShardMapManagerLocalFrom0.0To1.0.sql" />
<Content Include="ShardManagement\Scripts\UpgradeShardMapManagerGlobalFrom1000.0To1000.1.sql" />
<Content Include="ShardManagement\Scripts\UpgradeShardMapManagerGlobalFrom1.0To1.1.sql" />
<Content Include="ShardManagement\Scripts\UpgradeShardMapManagerGlobalFrom0.0To1.0.sql" />
</ItemGroup>
<!--
Query
-->
<ItemGroup>
<Compile Include="Query\GlobalConstants.cs" />
<Compile Include="Query\Exceptions\MultiShardDataReaderInternalException.cs" />
<Compile Include="Query\LabeledDbDataReader.cs" />
<Compile Include="Query\Exceptions\MultiShardDataReaderClosedException.cs" />
<Compile Include="Query\Exceptions\MultiShardAggregateException.cs" />
<Compile Include="Query\Exceptions\MultiShardException.cs" />
<Compile Include="Query\Logging\TraceHelper.cs" />
<Compile Include="Query\MultiShardExecutionOptions.cs" />
<Compile Include="Query\MultiShardExecutionPolicy.cs" />
<Compile Include="Query\MultiShardQueryTransientErrorDetectionStrategy.cs" />
<Compile Include="Query\ShardExecutionEventArgs.cs" />
<Compile Include="Query\Exceptions\MultiShardSchemaMismatchException.cs" />
<Compile Include="Query\MultiShardConnection.cs" />
<Compile Include="Query\MultiShardCommand.cs" />
<Compile Include="Query\MultiShardDataReader.cs" />
<Compile Include="Query\MultiShardUtils.cs" />
<Compile Include="Query\Exceptions\MultiShardPartialReadException.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

Просмотреть файл

@ -2,10 +2,8 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Reflection;
namespace Microsoft.Azure.SqlDatabase.ElasticScale
{

Просмотреть файл

@ -26,8 +26,8 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale
/// <param name="activityId"></param>
public ActivityIdScope(Guid activityId)
{
_previousActivityId = Trace.CorrelationManager.ActivityId;
Trace.CorrelationManager.ActivityId = activityId;
_previousActivityId = CorrelationManager.ActivityId;
CorrelationManager.ActivityId = activityId;
}
/// <summary>
@ -35,7 +35,39 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale
/// </summary>
public void Dispose()
{
Trace.CorrelationManager.ActivityId = _previousActivityId;
CorrelationManager.ActivityId = _previousActivityId;
}
}
internal static class CorrelationManager
{
#if NETFRAMEWORK
public static Guid ActivityId
{
get
{
return Trace.CorrelationManager.ActivityId;
}
set
{
Trace.CorrelationManager.ActivityId = value;
}
}
#else
[ThreadStatic]
private static Guid _activityId;
public static Guid ActivityId
{
get
{
return _activityId;
}
set
{
_activityId = value;
}
}
#endif
}
}

Просмотреть файл

@ -108,7 +108,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale
}
/// <summary>
/// Traces an exception and a message at the Warning trace level
/// Traces an exception and a message at the Warning trace level
/// to the trace source
/// </summary>
/// <param name="exception"></param>
@ -119,7 +119,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale
}
/// <summary>
/// Traces an exception and a message at the Warning trace level
/// Traces an exception and a message at the Warning trace level
/// to the trace source
/// </summary>
/// <param name="exception"></param>
@ -202,7 +202,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale
}
/// <summary>
/// Traces the message and exception at the Critical source level
/// Traces the message and exception at the Critical source level
/// to the trace source
/// </summary>
/// <param name="exception"></param>
@ -213,7 +213,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale
}
/// <summary>
/// Traces the message and exception at the Critical source level
/// Traces the message and exception at the Critical source level
/// to the trace source
/// </summary>
/// <param name="exception"></param>
@ -236,7 +236,9 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale
/// <param name="activityId"></param>
public void TraceIn(string method, Guid activityId)
{
#if NETFRAMEWORK
_traceSource.TraceEvent(TraceEventType.Start, 0, "Start.{0}. ActivityId: {1}", method, activityId);
#endif
}
/// <summary>
@ -246,7 +248,9 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale
/// <param name="activityId"></param>
public void TraceOut(string method, Guid activityId)
{
#if NETFRAMEWORK
_traceSource.TraceEvent(TraceEventType.Stop, 0, "Stop.{0}. ActivityId: {1}", method, activityId);
#endif
}
/// <summary>
@ -258,8 +262,10 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale
/// <param name="vars"></param>
public void TraceIn(string method, Guid activityId, string format, params object[] vars)
{
#if NETFRAMEWORK
string fmtMessage = string.Format(format, vars);
_traceSource.TraceEvent(TraceEventType.Start, 0, "Start.{0}. {1}. ActivityId: {2}", method, fmtMessage, activityId);
#endif
}
/// <summary>
@ -271,10 +277,12 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale
/// <param name="vars"></param>
public void TraceOut(string method, Guid activityId, string format, params object[] vars)
{
#if NETFRAMEWORK
string fmtMessage = string.Format(format, vars);
_traceSource.TraceEvent(TraceEventType.Stop, 0, "Stop.{0}. {1}. ActivityId: {2}", method, fmtMessage, activityId);
#endif
}
#endregion
#endregion
}
}

Просмотреть файл

@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18033
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@ -19,7 +19,7 @@ namespace Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling.Propertie
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {

Просмотреть файл

@ -0,0 +1,53 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Description>This client library allows ADO.NET developers to create applications that implement and use the pattern known as database sharding in Azure SQL Database. Sharding is a scale-out strategy that spreads data across a number of independent databases. The library includes APIs for creating and managing shard maps, routing SQL operations to the appropriate shard, and performing queries that cross many shards. To learn more about elastic database tools, check out http://azure.microsoft.com/en-us/documentation/articles/sql-database-elastic-scale-documentation-map/.</Description>
<Copyright>Copyright (C) Microsoft Corporation. All rights reserved.</Copyright>
<AssemblyTitle>Microsoft Azure SQL Database: Elastic Database Client Library</AssemblyTitle>
<NeutralLanguage>en-US</NeutralLanguage>
<Version>2.0.0-preview2</Version>
<Authors>azure-sdk;Microsoft</Authors>
<TargetFrameworks>net451;netstandard2.0</TargetFrameworks>
<PackageTags>Microsoft;Elastic;Scale;Azure;SQL;DB;Database;Shard;Sharding;Management;Query;azureofficial</PackageTags>
<PackageReleaseNotes>Added support for .NET Standard 2.0.</PackageReleaseNotes>
<PackageIconUrl>http://go.microsoft.com/fwlink/?LinkID=288890</PackageIconUrl>
<PackageProjectUrl>https://github.com/Azure/elastic-db-tools</PackageProjectUrl>
<PackageLicenseUrl>http://go.microsoft.com/?linkid=9862941</PackageLicenseUrl>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/Azure/elastic-db-tools</RepositoryUrl>
<RuntimeIdentifiers>win;unix</RuntimeIdentifiers>
<RootNamespace>Microsoft.Azure.SqlDatabase.ElasticScale</RootNamespace>
</PropertyGroup>
<Import Project="$([MSBuild]::GetPathOfFileAbove('build.props'))" />
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<PackageReference Include="System.Data.SqlClient" Version="4.4.0" />
</ItemGroup>
<ItemGroup>
<Compile Update="ShardManagement\Errors.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Errors.resx</DependentUpon>
</Compile>
<Compile Update="ShardManagement\PerformanceCounters.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>PerformanceCounters.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="ShardManagement\Errors.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Errors.Designer.cs</LastGenOutput>
</EmbeddedResource>
<EmbeddedResource Update="ShardManagement\PerformanceCounters.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>PerformanceCounters.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
</Project>

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -7,67 +7,19 @@ using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Microsoft.Azure.SqlDatabase.ElasticScale.Client")]
[assembly: AssemblyDescription("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("4599fe76-62a2-4da8-8a0f-dd190c0c6c58")]
[assembly: InternalsVisibleTo("Microsoft.Azure.SqlDatabase.ElasticScale.ServiceCommon" + AssemblyRef.ProductPublicKey)]
[assembly: InternalsVisibleTo("Microsoft.Azure.SqlDatabase.ElasticScale.Query.UnitTests" + AssemblyRef.ProductPublicKey)]
[assembly: InternalsVisibleTo("Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement.UnitTests" + AssemblyRef.ProductPublicKey)]
[assembly: InternalsVisibleTo("Microsoft.Azure.SqlDatabase.ElasticScale.SplitMerge.Client" + AssemblyRef.ProductPublicKey)]
[assembly: InternalsVisibleTo("Microsoft.SqlServer.DataWarehouse.Engine" + AssemblyRef.ElasticQueryPublicKey)]
[assembly: InternalsVisibleTo("SplitMergeWorker" + AssemblyRef.ProductPublicKey)]
[assembly: InternalsVisibleTo("ShardSplitMergeTests" + AssemblyRef.ProductPublicKey)]
[assembly: InternalsVisibleTo("Microsoft.Azure.SqlDatabase.ElasticScale.Client.Fakes" + AssemblyRef.FakesPublicKey)]
// No-op, purely for Resharper's intellisense, as it does not understand AssemblyRef.ProductPublicKey
#if DEBUG
#pragma warning disable 1700
[assembly: InternalsVisibleTo("Microsoft.Azure.SqlDatabase.ElasticScale.ServiceCommon, PublicKey=00")]
[assembly: InternalsVisibleTo("Microsoft.Azure.SqlDatabase.ElasticScale.Query.UnitTests, PublicKey=00")]
[assembly: InternalsVisibleTo("Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement.UnitTests, PublicKey=00")]
[assembly: InternalsVisibleTo("Microsoft.Azure.SqlDatabase.ElasticScale.SplitMerge.Client, PublicKey=00")]
[assembly: InternalsVisibleTo("SplitMergeWorker, PublicKey=00")]
[assembly: InternalsVisibleTo("ShardSplitMergeTests, PublicKey=00")]
#pragma warning restore 1700
#endif
// Added reference to the nuget package in the unsigned versions
[assembly: InternalsVisibleTo("Microsoft.Azure.SqlDatabase.ElasticScale.ServiceCommon" + AssemblyRef.TestPublicKey)]
[assembly: InternalsVisibleTo("Microsoft.Azure.SqlDatabase.ElasticScale.SplitMerge.Client" + AssemblyRef.TestPublicKey)]
[assembly: InternalsVisibleTo("SplitMergeWorker" + AssemblyRef.TestPublicKey)]
[assembly: InternalsVisibleTo("ShardSplitMergeTests" + AssemblyRef.TestPublicKey)]
[assembly: InternalsVisibleTo("Microsoft.Azure.SqlDatabase.ElasticScale.Query.UnitTests")]
[assembly: InternalsVisibleTo("Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement.UnitTests")]
[assembly: CLSCompliant(true)]
// Associated VSTS #2466045
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1824:MarkAssembliesWithNeutralResourcesLanguage", Justification = "Too many dubious spelling errors.")]
// [assembly: NeutralResourcesLanguageAttribute("en-US")]
// The Microsoft Azure SQL Database team's build system automatically creates the AssemblyRef class during the build process.
// This class contains the values of the public keys that the assemblies are signed with. When building externally, we manually define it here.
#if STANDALONE_BUILD
internal static class AssemblyRef
{
public const string ProductPublicKey = "";
public const string TestPublicKey = "";
public const string FakesPublicKey = "";
public const string ElasticQueryPublicKey = "";
}
internal static class ElasticScaleVersionInfo
{
public const string ProductVersion = "1.0.0";
public const string ProductVersion = "2.0.0";
}
#endif

Просмотреть файл

@ -0,0 +1,51 @@
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Data.SqlClient;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query {
public static class DbCommandExtensions {
/// <summary>
/// Make best attempt to clone DbCommand
/// </summary>
/// <param name="from"></param>
/// <returns></returns>
public static DbCommand BestAttemptClone(this DbCommand from) {
if(from is ICloneable) {
return (DbCommand)(from as ICloneable).Clone();
}
DbCommand newcmd = null;
if(from is SqlCommand) {
// do some special magic for SqlCommand
newcmd = new SqlCommand(from.CommandText, (from as SqlCommand).Connection, (from as SqlCommand).Transaction);
} else {
var mi = from.GetType().GetMethod("Clone");
if(mi != null && mi.ReturnType != null && typeof(DbCommand).IsAssignableFrom(mi.ReturnType) && (mi.GetParameters()?.Count() ?? 0) == 0) {
return (DbCommand)mi.Invoke(from, null);
} else {
newcmd = (DbCommand)Activator.CreateInstance(from.GetType());
newcmd.CommandText = from.CommandText;
}
}
newcmd.CommandTimeout = from.CommandTimeout;
newcmd.CommandType = from.CommandType;
newcmd.DesignTimeVisible = from.DesignTimeVisible;
newcmd.UpdatedRowSource = from.UpdatedRowSource;
if(from.Parameters.Count > 0) {
DbParameter[] p = new DbParameter[from.Parameters.Count];
from.Parameters.CopyTo(p, 0);
foreach(object current in p) {
newcmd.Parameters.Add(current);
}
}
return newcmd;
}
}
}

Просмотреть файл

@ -26,7 +26,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
{
private readonly ReadOnlyCollection<Exception> _innerExceptions;
#region Standard Exception Constructors
#region Standard Exception Constructors
/// <summary>
/// Initializes a new instance of the <see cref="MultiShardAggregateException"/> class
@ -66,9 +66,9 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
_innerExceptions = (ReadOnlyCollection<Exception>)(info.GetValue("InnerExceptions", typeof(ReadOnlyCollection<Exception>)));
}
#endregion Standard Exception Constructors
#endregion Standard Exception Constructors
#region Additional Constructors
#region Additional Constructors
/// <summary>
///
@ -113,9 +113,9 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
_innerExceptions = new ReadOnlyCollection<Exception>(exceptions);
}
#endregion Additional Constructors
#endregion Additional Constructors
#region Serialization Support
#region Serialization Support
/// <summary>
/// Populates a SerializationInfo with the data needed to serialize the target object.
@ -128,7 +128,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
info.AddValue("InnerExceptions", _innerExceptions);
}
#endregion Serialization Support
#endregion Serialization Support
/// <summary>
/// Gets a read-only collection of the <see cref="Exception"/> instances

Просмотреть файл

@ -142,7 +142,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
info.AddValue("ShardLocation", _shardLocation);
}
#endregion Serialization Methods
#endregion Serialization Methods
/// <summary>
/// The shard associated with this exception

Просмотреть файл

@ -42,7 +42,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
params object[] vars)
{
string fmtMessage = string.Format(message, vars);
logger.Info("Method: {0}; {1}; ActivityId: {2};", methodName, fmtMessage, Trace.CorrelationManager.ActivityId);
logger.Info("Method: {0}; {1}; ActivityId: {2};", methodName, fmtMessage, CorrelationManager.ActivityId);
}
internal static void TraceWarning(this ILogger logger,
@ -52,7 +52,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
{
string fmtMessage = string.Format(message, vars);
logger.Warning("Method: {0}; {1}; ActivityId: {2};", methodName, fmtMessage,
Trace.CorrelationManager.ActivityId);
CorrelationManager.ActivityId);
}
internal static void TraceError(this ILogger logger,
@ -63,7 +63,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
{
string fmtMessage = string.Format(message, vars);
logger.Error("Method: {0}; {1}; Exception: {2}; ActivityId: {3};", methodName, fmtMessage, ex.ToString(),
Trace.CorrelationManager.ActivityId);
CorrelationManager.ActivityId);
}
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -26,7 +26,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Multi")]
public sealed class MultiShardConnection : IDisposable
{
#region Global Vars
#region Global Vars
/// <summary>
/// The suffix to append to each shard's ApplicationName
@ -44,9 +44,9 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
/// </summary>
private bool _disposed = false;
#endregion
#endregion
#region Ctors
#region Ctors
/// <summary>
/// Initializes a new instance of the <see cref="MultiShardConnection"/> class.
@ -124,9 +124,9 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
this.ShardConnections = shardConnections;
}
#endregion
#endregion
#region Properties
#region Properties
/// <summary>
/// Gets the collection of <see cref="Shard"/>s associated with this connection.
@ -154,9 +154,9 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
private set;
}
#endregion
#endregion
#region Public Methods
#region Public Methods
/// <summary>
/// Creates and returns a <see cref="MultiShardCommand"/> object.
@ -192,9 +192,9 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
}
}
#endregion
#endregion
#region Helpers
#region Helpers
private static void ValidateConnectionArguments<T>(
IEnumerable<T> namedCollection,
@ -267,6 +267,6 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
}
}
#endregion
#endregion
}
}

Просмотреть файл

@ -2,8 +2,8 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
// Purpose:
// Logic that wraps multiple DbDataReader objects and aggregates them
// (UNION ALL semantics) under the hood to provide the illusion that all
// Logic that wraps multiple DbDataReader objects and aggregates them
// (UNION ALL semantics) under the hood to provide the illusion that all
// results came from a single DbDataReader.
//
// Notes:
@ -22,7 +22,9 @@ using System.Data.SqlTypes;
using System.Diagnostics;
using System.Diagnostics.Contracts;
using System.IO;
#if NETFRAMEWORK
using System.Runtime.Remoting;
#endif
using System.Threading;
using System.Threading.Tasks;
using System.Xml;
@ -34,13 +36,13 @@ using Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement;
namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
{
// Suppression rationale:
// Suppression rationale:
// MultiShardDataReader is not a collection.
// "Multi" is the spelling we want.
// We can't move the methods to other types because that would break the interface we are aiming to provide.
//
/// <summary>
/// Provides a way of reading a forward-only stream of rows that is retrieved from a shard set.
/// Provides a way of reading a forward-only stream of rows that is retrieved from a shard set.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling"),
System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix"),
@ -53,7 +55,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
/// </summary>
private const String NameOfShardIdPseudoColumn = "$ShardName";
#region Private Fields
#region Private Fields
private readonly static ILogger s_tracer = TraceHelper.Tracer;
@ -93,9 +95,9 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
private bool _closed;
private bool _disposed;
#endregion Private Fields
#endregion Private Fields
#region Constructors
#region Constructors
/// <summary>
/// Instantiates a MultiShardDataReader object that wraps DbDataReader objects.
@ -106,9 +108,9 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
/// <param name="inputReaders">The <see cref="LabeledDbDataReader"/> from each shard</param>
/// <param name="executionPolicy">The execution policy to use</param>
/// <param name="addShardNamePseudoColumn">True if we should add the $ShardName pseudo column, false if not.</param>
/// <param name="expectedReaderCount">(Optional) If a number greater than the length of inputReaders is
/// <param name="expectedReaderCount">(Optional) If a number greater than the length of inputReaders is
/// specified, the MultiShardDataReader is left open for additional calls to AddReader at a later time.</param>
/// <exception cref="MultiShardSchemaMismatchException">If the complete results execution policy is used and
/// <exception cref="MultiShardSchemaMismatchException">If the complete results execution policy is used and
/// the schema isn't the same across shards</exception>
internal MultiShardDataReader(
MultiShardCommand command,
@ -142,9 +144,9 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
}
}
#endregion Constructors
#endregion Constructors
#region Properties
#region Properties
/// <summary>
/// Gets the <see cref="MultiShardConnection"/> associated with the MultiShardDataReader.
@ -180,9 +182,9 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
private set;
}
#endregion
#endregion
#region Public Methods
#region Public Methods
/// <summary>
/// Closes the MultiShardDataReader object.
@ -222,7 +224,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
arbitraryClosedReader = currentReader;
}
// To avoid writing special case logic for when the queue is empty, we are going to
// To avoid writing special case logic for when the queue is empty, we are going to
// add an arbitrary closed reader back to the queue, presuming we have any to choose from.
// If we don't, then default to the "No Data Reader" terminal state instead of introducing
// the possibility of a new NullReferenceException.
@ -240,6 +242,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
}
}
#if NETFRAMEWORK
/// <summary>
/// This method is currently not supported. Invoking the method will result in an exception.
/// </summary>
@ -248,6 +251,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
{
throw new RemotingException("MultiShardDataReader is not a valid remoting object.");
}
#endif
/// <summary>
/// Determines whether the specified object is equal to the current object. (Inherited from <see cref="Object"/>.)
@ -283,7 +287,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
}
/// <summary>
/// Reads a stream of bytes from the specified column, starting at location indicated by dataOffset, into the
/// Reads a stream of bytes from the specified column, starting at location indicated by dataOffset, into the
/// buffer, starting at the location indicated by bufferOffset.
/// </summary>
/// <param name="ordinal">The zero-based column ordinal.</param>
@ -317,7 +321,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
}
/// <summary>
/// Reads a stream of characters from the specified column, starting at location indicated by dataOffset, into
/// Reads a stream of characters from the specified column, starting at location indicated by dataOffset, into
/// the buffer, starting at the location indicated by bufferOffset.
/// </summary>
/// <param name="ordinal">The zero-based column ordinal.</param>
@ -411,7 +415,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
}
/// <summary>
/// Returns a DbDataReader object for the requested column ordinal that can be overridden with a
/// Returns a DbDataReader object for the requested column ordinal that can be overridden with a
/// provider-specific implementation.
/// </summary>
/// <param name="ordinal">The zero-based column ordinal.</param>
@ -477,7 +481,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
if (this.IsPseudoColumnReference(ordinal))
{
// It is a reference to our ShardName pseudo column.
// In this case, only a string type is valid for our T parameter, so check that, and
// In this case, only a string type is valid for our T parameter, so check that, and
// either return properly or throw an InvalidCast.
//
@ -500,8 +504,8 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
/// <typeparam name="T">The type of the value to be returned.</typeparam>
/// <param name="ordinal">The zero-based column ordinal.</param>
/// <param name="cancellationToken">
/// The cancellation instruction, which propagates a notification that operations should be canceled. This does
/// not guarantee the cancellation. A setting of CancellationToken.None makes this method equivalent to
/// The cancellation instruction, which propagates a notification that operations should be canceled. This does
/// not guarantee the cancellation. A setting of CancellationToken.None makes this method equivalent to
/// GetFieldValueAsync. The returned task must be marked as cancelled.
/// </param>
/// <returns>The value of the specified column.</returns>
@ -801,7 +805,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
}
/// <summary>
/// Returns the data value in the specified column as a native SQL Server type.
/// Returns the data value in the specified column as a native SQL Server type.
/// </summary>
/// <param name="ordinal">The zero-based column ordinal.</param>
/// <returns>The value of the column expressed as a SqlDbType.</returns>
@ -811,7 +815,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
}
/// <summary>
/// Fills an array of Object that contains the values for all the columns in the record,
/// Fills an array of Object that contains the values for all the columns in the record,
/// expressed as native SQL Server types.
/// </summary>
/// <param name="values">
@ -929,17 +933,17 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
return ProcessPotentialPseudoColumnReference<bool>(ordinal, (null == GetCurrentShardLabel()), GetCurrentDataReader().IsDBNull);
}
// Cannot override IsDBNullAsync(int ordinal). should we use new?
// Cannot override IsDBNullAsync(int ordinal). should we use new?
//
/// <summary>
/// An asynchronous version of IsDBNull, which gets a value that indicates whether the column contains
/// An asynchronous version of IsDBNull, which gets a value that indicates whether the column contains
/// nonexistent or missing values (NULL values).
/// </summary>
/// <param name="ordinal">The zero-based column to be retrieved.</param>
/// <param name="cancellationToken">
/// The cancellation instruction, which propagates a notification that operations should be canceled. This does
/// not guarantee the cancellation. A setting of CancellationToken.None makes this method equivalent to
/// not guarantee the cancellation. A setting of CancellationToken.None makes this method equivalent to
/// IsDBNullAsync. The returned task must be marked as cancelled.
/// </param>
/// <returns>True if the specified column value is equivalent to DBNull otherwise false.</returns>
@ -968,7 +972,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
/// <summary>
/// This method is currently not supported. Invoking the method will result in an exception.
/// </summary>
/// DEVNOTE (VSTS: 2202747): For now we are only supporting single result set. Need to do some more work if we want to
/// DEVNOTE (VSTS: 2202747): For now we are only supporting single result set. Need to do some more work if we want to
/// handle the multiple result set case. Especially if we attempt to move to a non "give me them all up front"
/// approach. This comment applies to all the NextResult-related methods.
public override bool NextResult()
@ -992,7 +996,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
if (hasNextResult)
{
// Invalidate this instance of the MultiShardDataReader and throw an exception.
// Invalidate this instance of the MultiShardDataReader and throw an exception.
// We currently do not support multiple result sets
this.Close();
@ -1026,7 +1030,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
/// <summary>
/// An asynchronous version of Read, which advances the MultiShardDataReader to the next record.
///
/// The cancellation token can be used to request that the operation be abandoned before the command timeout elapses.
/// The cancellation token can be used to request that the operation be abandoned before the command timeout elapses.
/// Exceptions will be reported via the returned Task object.
/// </summary>
/// <param name="cancellationToken">The cancellation instruction.</param>
@ -1114,9 +1118,9 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
return base.ToString();
}
#endregion Public Methods
#endregion Public Methods
#region Public Properties
#region Public Properties
/// <summary>
/// Gets a value indicating the depth of nesting for the current row.
@ -1130,7 +1134,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
}
/// <summary>
/// Gets the number of columns in the current row.
/// Gets the number of columns in the current row.
/// </summary>
public override int FieldCount
{
@ -1141,7 +1145,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
}
/// <summary>
/// Gets a value that indicates whether this MultiShardDataReader contains one or more rows.
/// Gets a value that indicates whether this MultiShardDataReader contains one or more rows.
/// </summary>
public override bool HasRows
{
@ -1206,9 +1210,9 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
}
}
#endregion Public Properties
#endregion Public Properties
#region Internal Methods
#region Internal Methods
/// <summary>
/// Cancels all the active commands executing for this reader.
@ -1231,9 +1235,9 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
}
}
#endregion Internal Methods
#endregion Internal Methods
#region Protected Methods
#region Protected Methods
/// <summary>
/// Releases the managed resources used by the DbDataReader and optionally releases the unmanaged resources.
@ -1285,9 +1289,9 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
}
}
#endregion Protected Methods
#endregion Protected Methods
#region Internal Methods
#region Internal Methods
/// <summary>
/// Method to add another DbDataReader to the set of underlying sources we are concatenating.
@ -1305,12 +1309,12 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
/// expecting for the DbDataReader objects underlying this MultiShardDataReader object.
/// </exception>
/// <returns>Null if we added successfully. The encountered exception if we hit an error.</returns>
///
///
internal void AddReader(LabeledDbDataReader toAdd)
{
if (toAdd != null)
{
// Don't try to read from readers that encountered an exception
// Don't try to read from readers that encountered an exception
if (toAdd.Exception != null)
{
// We tried adding a reader that we expected, but it was invalid. Let's expect one fewer inputReader as a result.
@ -1389,8 +1393,8 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
// We tried adding a reader that we expected, but it was invalid. Let's expect one fewer inputReader as a result.
// Is this the correct logic when we have complete results turned on? I understand that it is null so we
// don't know where it came from, but that seems like something that should cause us to throw anyway...
// Is it correct when we have partial turned on? We may not want to throw, but we should probably log this
// somewhere.
// Is it correct when we have partial turned on? We may not want to throw, but we should probably log this
// somewhere.
// Likely related to VSTS 2616238. Philip will be modifying logic/augmenting tests in this area.
//
this.DecrementExpectedReaders();
@ -1462,12 +1466,12 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
}
}
#endregion Internal Methods
#endregion Internal Methods
#region Private Methods
#region Private Methods
/// <summary>
/// Checks the schema of the passed in DbDataReader against the schema we are expecting for our
/// Checks the schema of the passed in DbDataReader against the schema we are expecting for our
/// fan-out result set.
/// </summary>
/// <param name="labeledReader">The LabeledDbDataReader object to check against our expected schema.</param>
@ -1490,7 +1494,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
throw new MultiShardDataReaderInternalException("Unexpected reader with null schema encountered among non-null readers");
}
// The SchemaTable holds 1 *row* for each *column* of the actual output returned. So in order to compare
// The SchemaTable holds 1 *row* for each *column* of the actual output returned. So in order to compare
// column metadata for the inputDataReaders we need to compare row information contained in the schemaTable.
//
DataRowCollection currentRows = currentDataTable.Rows;
@ -1501,7 +1505,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
if (null == _schemaComparisonTemplate)
{
// This is our first call to validate, so grab the table template off of this guy and use it as the
// This is our first call to validate, so grab the table template off of this guy and use it as the
// expected schema for our results. No need to validate since we are using this one as ground truth.
//
InitSchemaTemplate(reader);
@ -1583,15 +1587,15 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
}
/// <summary>
/// Checks all the column specifications (as encapsulated by a DataRow from a SchemaTable) for
/// Checks all the column specifications (as encapsulated by a DataRow from a SchemaTable) for
/// compatibility with the expected column specification.
/// </summary>
/// <param name="shardLocation">The shard being validated</param>
/// <param name="toValidate">The DataRow representing the column specification we wish to validate.</param>
/// <param name="expected">The DataRow representing the expectd column specification.</param>
/// <remarks>
/// There are lot of opportunities in here for relaxed comparison semantics, but for now let's
/// just be super strict.
/// There are lot of opportunities in here for relaxed comparison semantics, but for now let's
/// just be super strict.
/// DEVNOTE (2244709): Need to tighten up our schema checking!
/// </remarks>
/// <exception cref="MultiShardSchemaMismatchException">
@ -1605,7 +1609,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
DataRowCollection rowsExpected = expected.Rows;
// Eventually we may wish to be a bit more relaxed about the comparisons (e.g., if we expect bigint and we
// see int that may be ok) but for now let's just be super-strict and make the behavior different and/or
// see int that may be ok) but for now let's just be super-strict and make the behavior different and/or
// configurable later.
//
for (int curRowIndex = 0; curRowIndex < rowsExpected.Count; curRowIndex++)
@ -1627,7 +1631,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
/// <summary>
/// Handles the case where a reader has a null schema table
///
///
/// Behavior-
/// - Any exception will not be thrown if ALL readers have a null schema (regardless of execution
/// policy). Otherwise, a <see cref="MultiShardDataReaderInternalException"/> will be thrown.
@ -1684,7 +1688,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
// let it slide.
}
// It should never be closed already if the top-level reader is not closed, but in case it
// It should never be closed already if the top-level reader is not closed, but in case it
// happens we don't want to completely freeze the reader with no way to move forward and
// no way to close, so just ignore that it's already closed.
}
@ -1770,7 +1774,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
/// <summary>
/// Helper method that sets up the SchemaTemplate to use as our "Ground Truth" for
/// performing schema comparisons. In addition to storing a copy of the schema
/// performing schema comparisons. In addition to storing a copy of the schema
/// information, this method adds an additional row for the "ShardIdPseudoColumn".
/// </summary>
/// <param name="templateReader">
@ -1820,7 +1824,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
/// <typeparam name="T">The type of the column we wish to return.</typeparam>
/// <param name="getterFunction">The function to use to pull the column value.</param>
/// <param name="ordinal">The zero-based column ordinal.</param>
///
///
/// <returns>The desired column value.</returns>
private T GetColumn<T>(Func<int, T> getterFunction, int ordinal)
{
@ -1963,7 +1967,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
/// </summary>
/// <param name="token">The cancellation instruction.</param>
/// <returns>
/// An async task to perform the read; when executed the task returns true
/// An async task to perform the read; when executed the task returns true
/// if we read another row from the current reader, false if we hit the end.
/// </returns>
private async Task<bool> PerformReadToFillBufferAsync(CancellationToken token)
@ -2009,45 +2013,45 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
DataRow theRow = _finalSchemaTable.NewRow();
#region Shard Id Pseudo Column Schema Table information
#region Shard Id Pseudo Column Schema Table information
theRow[SchemaTableColumn.ColumnName] = MultiShardDataReader.NameOfShardIdPseudoColumn;
theRow[SchemaTableColumn.ColumnOrdinal] = _indexOfShardIdPseudoColumn;
theRow[SchemaTableColumn.ColumnSize] = (Int32)4000;
theRow[SchemaTableColumn.NumericPrecision] = (Int16)255;
theRow[SchemaTableColumn.NumericScale] = (Int16)255;
theRow[SchemaTableColumn.IsUnique] = (Boolean)false;
theRow[SchemaTableColumn.IsKey] = DBNull.Value; //Boolean
theRow[SchemaTableOptionalColumn.BaseServerName] = null; //string
theRow[SchemaTableOptionalColumn.BaseCatalogName] = null; //string
theRow[SchemaTableColumn.IsKey] = DBNull.Value; //Boolean
theRow[SchemaTableOptionalColumn.BaseServerName] = null; //string
theRow[SchemaTableOptionalColumn.BaseCatalogName] = null; //string
theRow[SchemaTableColumn.BaseColumnName] = MultiShardDataReader.NameOfShardIdPseudoColumn;
theRow[SchemaTableColumn.BaseSchemaName] = null; //string
theRow[SchemaTableColumn.BaseTableName] = null; //string
theRow[SchemaTableColumn.BaseSchemaName] = null; //string
theRow[SchemaTableColumn.BaseTableName] = null; //string
theRow[SchemaTableColumn.DataType] = typeof(string); //System.Type
theRow[SchemaTableColumn.AllowDBNull] = (Boolean)true;
theRow[SchemaTableColumn.ProviderType] = (Int32)12;
theRow[SchemaTableColumn.IsAliased] = DBNull.Value; //Boolean
theRow[SchemaTableColumn.IsExpression] = DBNull.Value; //Boolean
theRow[SchemaTableColumn.IsAliased] = DBNull.Value; //Boolean
theRow[SchemaTableColumn.IsExpression] = DBNull.Value; //Boolean
theRow["IsIdentity"] = (Boolean)false;
theRow[SchemaTableOptionalColumn.IsAutoIncrement] = (Boolean)false;
theRow[SchemaTableOptionalColumn.IsRowVersion] = (Boolean)false;
theRow[SchemaTableOptionalColumn.IsHidden] = DBNull.Value; //Boolean
theRow[SchemaTableOptionalColumn.IsHidden] = DBNull.Value; //Boolean
theRow[SchemaTableColumn.IsLong] = (Boolean)false;
theRow[SchemaTableOptionalColumn.IsReadOnly] = (Boolean)false;
theRow[SchemaTableOptionalColumn.ProviderSpecificDataType] = typeof(SqlString); //System.Type
theRow["DataTypeName"] = "nvarchar"; //string
theRow["XmlSchemaCollectionDatabase"] = null; //string
theRow["XmlSchemaCollectionOwningSchema"] = null; //string
theRow["XmlSchemaCollectionName"] = null; //string
theRow["UdtAssemblyQualifiedName"] = null; //string
theRow["XmlSchemaCollectionDatabase"] = null; //string
theRow["XmlSchemaCollectionOwningSchema"] = null; //string
theRow["XmlSchemaCollectionName"] = null; //string
theRow["UdtAssemblyQualifiedName"] = null; //string
theRow[SchemaTableColumn.NonVersionedProviderType] = (Int32)12;
theRow["IsColumnSet"] = (Boolean)false;
#endregion Shard Id Pseudo Column Schema Table information
#endregion Shard Id Pseudo Column Schema Table information
_finalSchemaTable.Rows.Add(theRow);
_finalSchemaTable.AcceptChanges();
}
#endregion Private Methods
#endregion Private Methods
}
}

Просмотреть файл

@ -24,4 +24,4 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
/// </summary>
IncludeShardNameColumn
};
}
}

Просмотреть файл

@ -31,4 +31,4 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
/// </summary>
PartialResults
};
}
}

Просмотреть файл

@ -68,7 +68,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query
/// <returns>Clone of <paramref name="cmd"/>.</returns>
internal static DbCommand CloneDbCommand(DbCommand cmd, DbConnection conn)
{
DbCommand clone = (DbCommand)(cmd as ICloneable).Clone();
DbCommand clone = cmd.BestAttemptClone();
clone.Connection = conn;
return clone;

Просмотреть файл

@ -31,6 +31,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement
/// </summary>
internal struct PerfCounterCreationData
{
#if NETFRAMEWORK
private PerformanceCounterName counterName;
private PerformanceCounterType counterType;
private string counterDisplayName;
@ -63,6 +64,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement
{
get { return counterHelpText; }
}
#endif
}
/// <summary>
@ -70,6 +72,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement
/// </summary>
internal class PerfCounterInstance : IDisposable
{
#if NETFRAMEWORK
private static object _lockObject = new object();
private static ILogger Tracer
@ -96,6 +99,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement
private bool _initialized;
private string _instanceName;
#endif
/// <summary>
/// Initialize perf counter instance based on shard map name
@ -103,6 +107,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement
/// <param name="shardMapName"></param>
public PerfCounterInstance(string shardMapName)
{
#if NETFRAMEWORK
_initialized = false;
_instanceName = string.Concat(Process.GetCurrentProcess().Id.ToString(), "-", shardMapName);
@ -125,7 +130,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement
{
// We are not creating performance counter category here as per recommendation in documentation, copying note from
// https://msdn.microsoft.com/en-us/library/sb32hxtc(v=vs.110).aspx
// It is strongly recommended that new performance counter categories be created
// It is strongly recommended that new performance counter categories be created
// during the installation of the application, not during the execution of the application.
// This allows time for the operating system to refresh its list of registered performance counter categories.
// If the list has not been refreshed, the attempt to use the category will fail.
@ -180,6 +185,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement
"Exception caught while creating performance counter instance, no performance data will be collected. Exception: {0}",
e.ToString());
}
#endif
}
/// <summary>
@ -188,6 +194,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement
/// <param name="counterName">Counter to increment.</param>
internal void IncrementCounter(PerformanceCounterName counterName)
{
#if NETFRAMEWORK
if (_initialized)
{
PerformanceCounterWrapper pc;
@ -196,6 +203,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement
pc.Increment();
}
}
#endif
}
/// <summary>
@ -205,6 +213,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement
/// <param name="value">New value.</param>
internal void SetCounter(PerformanceCounterName counterName, long value)
{
#if NETFRAMEWORK
if (_initialized)
{
PerformanceCounterWrapper pc;
@ -213,12 +222,15 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement
pc.SetRawValue(value);
}
}
#endif
}
/// <summary>
/// Static method to recreate Shard Management performance counter catagory with given counter list.
/// </summary>
internal static void CreatePerformanceCategoryAndCounters()
{
#if NETFRAMEWORK
// Creation of performance counters need Administrator privilege
if (HasCreatePerformanceCategoryPermissions())
{
@ -248,8 +260,10 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement
"createCategory",
"User does not have permissions to create performance counter category");
}
#endif
}
#if NETFRAMEWORK
/// <summary>
/// Check if caller has permissions to create performance counter catagory.
/// </summary>
@ -272,12 +286,14 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement
WindowsPrincipal wp = new WindowsPrincipal(WindowsIdentity.GetCurrent());
return wp.IsInRole(WindowsBuiltInRole.Administrator) || wp.IsInRole(PerformanceCounters.PerformanceMonitorUsersGroupName);
}
#endif
/// <summary>
/// Dispose performance counter instance
/// </summary>
public void Dispose()
{
#if NETFRAMEWORK
if (_initialized)
{
lock (_lockObject)
@ -300,6 +316,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement
_initialized = false;
}
}
#endif
}
}
}
}

Просмотреть файл

@ -23,7 +23,9 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement
}
}
#if NETFRAMEWORK
private PerformanceCounter _counter;
#endif
internal bool _isValid;
@ -47,6 +49,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement
this._instanceName = instanceName;
this._counterName = counterName;
#if NETFRAMEWORK
// Check if counter exists in the specified category and then create its instance
if (PerformanceCounterCategory.CounterExists(_counterName, _categoryName))
{
@ -75,6 +78,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement
"initialize",
"Performance counter {0} does not exist in shard management catagory.", counterName);
}
#endif
}
/// <summary>
@ -82,10 +86,12 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement
/// </summary>
public void Close()
{
#if NETFRAMEWORK
if (_isValid)
{
_counter.Close();
}
#endif
}
/// <summary>
@ -94,6 +100,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")]
public void Increment()
{
#if NETFRAMEWORK
if (_isValid)
{
try
@ -105,6 +112,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement
PerformanceCounterWrapper.TraceException("increment", "counter increment failed.", e);
}
}
#endif
}
/// <summary>
@ -114,6 +122,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")]
public void SetRawValue(long value)
{
#if NETFRAMEWORK
if (_isValid)
{
try
@ -125,6 +134,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement
PerformanceCounterWrapper.TraceException("SetRawValue", "failed to set raw value", e);
}
}
#endif
}
/// <summary>
@ -146,7 +156,9 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement
/// </summary>
public void Dispose()
{
#if NETFRAMEWORK
_counter.Dispose();
#endif
}
}
}

Просмотреть файл

@ -19,7 +19,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Errors {

Просмотреть файл

@ -117,29 +117,23 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="_Store_ShardMapper_MappingPointOrRangeAlreadyMapped" xml:space="preserve">
<value>Mapping referencing shard '{0}' in the shard map '{1}' cannot be added because the {2} it covers is already mapped by another mapping. Error occurred while executing stored procedure '{3}' for operation '{4}'. This can occur if another concurrent user has already added a mapping covering the given {2}.</value>
<data name="_General_InvalidArgumentValue" xml:space="preserve">
<value>Unsupport value '{0}' specified for parameter '{1}'.</value>
</data>
<data name="_Store_ShardMapper_MappingDoesNotExistGlobal" xml:space="preserve">
<value>Mapping referencing shard '{0}' in the shard map '{1}' does not exist. Error occurred while executing stored procedure '{2}' for operation '{3}'. This can occur if another concurrent user has already removed the mapping.</value>
<data name="_Recovery_InvalidRebuildShardSpecification" xml:space="preserve">
<value>The specified ShardRange {0} was not in the set of ShardRanges from which the local shardmap information can be rebuilt at location '{1}'.</value>
</data>
<data name="_Store_ShardMapper_MappingNotFoundForKeyGlobal" xml:space="preserve">
<value>Mapping containing the given key value could not be located in the shard map '{0}'. Error occurred while executing stored procedure '{1}' for operation '{2}'.</value>
<data name="_Recovery_InvalidRecoveryToken" xml:space="preserve">
<value>Recovery token {0} was not recognized.</value>
</data>
<data name="_Store_Validate_MappingDoesNotExist" xml:space="preserve">
<value>Mapping referencing shard '{0}' associated with shard map '{1}' no longer exists in store. Error occurred while executing stored procedure '{2}' for operation '{3}' on the shard. This can happen if another concurrent user has deleted or modified the mapping.</value>
<data name="_Recovery_ShardNotValid" xml:space="preserve">
<value>The given location '{0}' does not have the necessary storage structures present for a shard. Error occurred while performing operation '{1}'.</value>
</data>
<data name="_ShardMapping_RangeNotSubset" xml:space="preserve">
<value>Requested range is not a subset of the existing range mapping.</value>
<data name="_SchemaInfo_TableInfoAlreadyExists" xml:space="preserve">
<value>The SchemaInfo object already contains a {0} table by the given name of [{1}].[{2}].</value>
</data>
<data name="_ShardMapping_MergeDifferentShards" xml:space="preserve">
<value>Mappings provided for the merge operation which belong to shard map '{0}' belong to different shards '{1}' and '{2}'. Merge operation is only allowed for mappings belonging to the same shard.</value>
</data>
<data name="_ShardMapping_MergeNotAdjacent" xml:space="preserve">
<value>Mappings provided for the merge operation are not adjacent. Merge operation is only allowed for adjacent mappings.</value>
</data>
<data name="_ShardMapping_DifferentStatus" xml:space="preserve">
<value>Mappings provided for the Merge operation belonging to shard map '{0}' differ in their Status property. Merge operation is only allowed for mappings with same values for Status.</value>
<data name="_ShardKey_MaxValueCannotBeIncremented" xml:space="preserve">
<value>Shard key has maximum value which cannot be incremented. Perform the IsMax check on shard key before requesting next key.</value>
</data>
<data name="_ShardKey_MaxValueCannotBeRepresented" xml:space="preserve">
<value>Shard key has maximum value which cannot be represented. Perform the IsMax check on shard key before requesting a conversion.</value>
@ -165,62 +159,23 @@
<data name="_ShardKey_ValueLengthUnexpected" xml:space="preserve">
<value>The length of raw value specified for the shard key ({0} bytes) does not match the expected length ({1} bytes) for the ShardKeyType ({2}) specified.</value>
</data>
<data name="_ShardLocation_InvalidPort" xml:space="preserve">
<value>The given port number '{0}' is invalid.</value>
</data>
<data name="_ShardLocation_InvalidServerOrDatabase" xml:space="preserve">
<value>The given '{0}' name is longer than the allowed length of '{1}' characters.</value>
</data>
<data name="_ShardLocation_UnsupportedProtocol" xml:space="preserve">
<value>The given protocol value '{0}' is not supported.</value>
</data>
<data name="_ShardMapExtensions_AsTypedShardMap_ConversionFailure" xml:space="preserve">
<value>Shard map '{0}' can not be converted to the target type {1}ShardMap&lt;{2}&gt;. Its actual type is {3}ShardMap&lt;{4}&gt;.</value>
</data>
<data name="_Store_ShardMapManager_AlreadyExistsGlobal" xml:space="preserve">
<value>Data structures for shard map manager persistence already exists at the target location.</value>
</data>
<data name="_Store_ShardMap_AlreadyExistsGlobal" xml:space="preserve">
<value>Shard map with name '{0}' already exists in the store. Error occurred while executing stored procedure '{1}' for operation '{2}'.</value>
</data>
<data name="_ShardMapManager_ShardMapLookupFailed" xml:space="preserve">
<value>Shard map '{0}' could not be found in the shard map manager store at '{1}'.</value>
</data>
<data name="_Store_ShardMap_ContainsShardsGlobal" xml:space="preserve">
<value>Shard map '{0}' has shards associated with it. Shard maps can only be removed if there are no shards associated with them. Error occurred while executing stored procedure '{1}' for operation '{2}'.</value>
</data>
<data name="_ShardMapManager_DifferentShardMapManager" xml:space="preserve">
<value>Shard map '{0}' is not associated with the current instance of shard map manager at '{1}'. Only shard maps that are obtained from the same 'ShardMapManager' instance can be used.</value>
</data>
<data name="_Store_SqlExceptionGlobal" xml:space="preserve">
<value>Store Error: {0}. The error occurred while attempting to perform the underlying storage operation during '{1}' operation on the shard map manager database. See the inner StoreException for details.</value>
</data>
<data name="_ShardMap_OpenConnectionForKey_KeyTypeNotSupported" xml:space="preserve">
<value>Key values of type '{0}' are not supported. OpenConnectionForKey requests for the shard map '{1}' requires keys of type '{2}'.</value>
</data>
<data name="_ShardMap_OpenConnection_ConnectionStringPropertyDisallowed" xml:space="preserve">
<value>Property '{0}' must not be set in the input connection string for 'OpenConnection' operations.</value>
</data>
<data name="_Store_Shard_HasMappingsGlobal" xml:space="preserve">
<value>Shard '{0}' belonging to shard map '{1}' has mappings associated with it. Error occurred while executing stored procedure '{2}' for operation '{3}'. Remove all the mappings associated with the shard before attempting the operation.</value>
</data>
<data name="_Store_Shard_DoesNotExistGlobal" xml:space="preserve">
<value>Shard '{0}' belonging to shard map '{1}' could not be found in the shard map manager database. Error occurred while executing stored procedure '{2}' for operation '{3}'. This can happen when another concurrent user removes the shard from the store.</value>
</data>
<data name="_Store_Shard_VersionMismatchGlobal" xml:space="preserve">
<value>Shard '{0}' belonging to shard map '{1}' has been updated in store. Error occurred while executing stored procedure '{2}' for operation '{3}'. This can occur if another concurrent user updates the shard. Perform a GetShard operation for the shard location to obtain the updated instance.</value>
</data>
<data name="_ShardRange_LowGreaterThanOrEqualToHigh" xml:space="preserve">
<value>The low value {0} is greater than or equal to the high value {1}. Lower value must be less than the higher value.</value>
</data>
<data name="_Store_Validate_ShardDoesNotExist" xml:space="preserve">
<value>Shard '{0}' belonging to shard map '{1}' no longer exists in store. Error occurred while executing stored procedure '{2}' for operation '{3}' on the shard. This can happen if another concurrent user deletes the shard. </value>
</data>
<data name="_Store_Validate_ShardMapDoesNotExist" xml:space="preserve">
<value>Shard map '{0}' associated with shard '{1}' no longer exists in store. Error occurred while executing stored procedure '{2}' for operation '{3}'. This can happen if another concurrent user deletes the shard map.</value>
</data>
<data name="_SqlShardMapManagerCredentials_ConnectionStringPropertyRequired" xml:space="preserve">
<value>The required property '{0}' must be set in the connection string.</value>
</data>
<data name="_Shard_DifferentShardMap" xml:space="preserve">
<value>Shard '{0}' provided for the given '{1}' is not associated with current shard map '{2}'. The '{3}' operations required the shard to be associated with the current shard map.</value>
</data>
<data name="_Shard_DifferentShardMapManager" xml:space="preserve">
<value>Shard '{0}' provided for the given '{1}' is not associated with current shard map manager at '{2}'. The '{3}' operations required the shard to be associated with the current shard map manager.</value>
</data>
<data name="_ShardLocation_InvalidServerOrDatabase" xml:space="preserve">
<value>The given '{0}' name is longer than the allowed length of '{1}' characters.</value>
<data name="_ShardMapManager_ShardMapLookupFailed" xml:space="preserve">
<value>Shard map '{0}' could not be found in the shard map manager store at '{1}'.</value>
</data>
<data name="_ShardMapManager_UnsupportedShardMapName" xml:space="preserve">
<value>Shard map name '{0}' is not supported. Shard map names are only allowed to contain unicode letters and digits.</value>
@ -228,41 +183,53 @@
<data name="_ShardMapManager_UnsupportedShardMapNameLength" xml:space="preserve">
<value>Length of shard map name '{0}' exceeds the maximum allowed length of '{1}' characters.</value>
</data>
<data name="_Store_Validate_MappingIsOffline" xml:space="preserve">
<value>The shard key value for an OpenConnection request is associated with a mapping that is marked Offline. Data containing this key value is likely being moved, and the connection is blocked to avoid data corruption. Validated connection requests for this shardlet will succeed when the mapping is back Online. Shard: '{0}'. Shard map: '{1}'. Error occurred while executing stored procedure '{3}' for operation '{2}' on the shard.</value>
<data name="_ShardMapping_DifferentShardMap" xml:space="preserve">
<value>'{0}' provided for operation '{1}' is not associated with the current shard map '{2}'. Only mappings associated with the same shard map as the given shard map can be used. Error occurred for parameter '{3}'.</value>
</data>
<data name="_Store_ShardMapper_UnableToKillSessions" xml:space="preserve">
<value>Mapping referencing shard '{0}' belonging to shard map '{1}' could not be taken offline because all existing connections on the shard could not be terminated. Error occurred during '{2}' operation while executing stored procedure '{3}' on shard '{4}'.</value>
<data name="_ShardMapping_DifferentShardMapManager" xml:space="preserve">
<value>'{0}' provided for operation '{1}' is not associated with the current instance of shard map manager at '{2}'. Only mappings associated with the same 'ShardMapManager' instance as the the one associated with current shard map '{3}' can be used. Error occurred for parameter '{4}'.</value>
</data>
<data name="_Recovery_ShardNotValid" xml:space="preserve">
<value>The given location '{0}' does not have the necessary storage structures present for a shard. Error occurred while performing operation '{1}'.</value>
<data name="_ShardMapping_DifferentStatus" xml:space="preserve">
<value>Mappings provided for the Merge operation belonging to shard map '{0}' differ in their Status property. Merge operation is only allowed for mappings with same values for Status.</value>
</data>
<data name="_Recovery_InvalidRebuildShardSpecification" xml:space="preserve">
<value>The specified ShardRange {0} was not in the set of ShardRanges from which the local shardmap information can be rebuilt at location '{1}'.</value>
<data name="_ShardMapping_LockIdNotSupported" xml:space="preserve">
<value>LockId for locking the mapping referencing shard {0} with shard map name {1} has unsupported value '{2}'.</value>
</data>
<data name="_Recovery_InvalidRecoveryToken" xml:space="preserve">
<value>Recovery token {0} was not recognized.</value>
<data name="_ShardMapping_MergeDifferentShards" xml:space="preserve">
<value>Mappings provided for the merge operation which belong to shard map '{0}' belong to different shards '{1}' and '{2}'. Merge operation is only allowed for mappings belonging to the same shard.</value>
</data>
<data name="_Store_ShardMapper_MappingIsNotOffline" xml:space="preserve">
<value>Mapping referencing shard '{0}' in the shard map '{1}' has 'Online' status. Error occurred while executing stored procedure '{2}' for operation '{3}'. Updates to a mapping involving modification of the shard location or removal require the mapping to be 'Offline'. </value>
<data name="_ShardMapping_MergeNotAdjacent" xml:space="preserve">
<value>Mappings provided for the merge operation are not adjacent. Merge operation is only allowed for adjacent mappings.</value>
</data>
<data name="_Store_SchemaInfo_NameConflict" xml:space="preserve">
<value>Unable to create schema info with name '{0}' as there is already an entry with the same name.</value>
<data name="_ShardMapping_RangeNotProperSubset" xml:space="preserve">
<value>Requested range is exactly the range for existing mapping. Operation is only allowed for proper subsets of existing range.</value>
</data>
<data name="_Store_SchemaInfo_NameDoesNotExist" xml:space="preserve">
<value>Unable to {0} schema info with name '{1}' since there is no entry by the given name.</value>
<data name="_ShardMapping_RangeNotSubset" xml:space="preserve">
<value>Requested range is not a subset of the existing range mapping.</value>
</data>
<data name="_General_InvalidArgumentValue" xml:space="preserve">
<value>Unsupport value '{0}' specified for parameter '{1}'.</value>
</data>
<data name="_Store_ShardMapManager_DoesNotExistGlobal" xml:space="preserve">
<value>Data structures for shard map manager persistence do not exist at the target location.</value>
<data name="_ShardMapping_SplitPointOutOfRange" xml:space="preserve">
<value>Split point lies on the boundary or outside of the specified range mapping.</value>
</data>
<data name="_ShardMap_GetShard_ShardDoesNotExist" xml:space="preserve">
<value>Shard corresponding to location '{0}' could not be found in shard map '{1}' .</value>
</data>
<data name="_SchemaInfo_TableInfoAlreadyExists" xml:space="preserve">
<value>The SchemaInfo object already contains a {0} table by the given name of [{1}].[{2}].</value>
<data name="_ShardMap_OpenConnectionForKey_KeyTypeNotSupported" xml:space="preserve">
<value>Key values of type '{0}' are not supported. OpenConnectionForKey requests for the shard map '{1}' requires keys of type '{2}'.</value>
</data>
<data name="_ShardMap_OpenConnection_ConnectionStringPropertyDisallowed" xml:space="preserve">
<value>Property '{0}' must not be set in the input connection string for 'OpenConnection' operations.</value>
</data>
<data name="_ShardRange_LowGreaterThanOrEqualToHigh" xml:space="preserve">
<value>The low value {0} is greater than or equal to the high value {1}. Lower value must be less than the higher value.</value>
</data>
<data name="_Shard_DifferentShardMap" xml:space="preserve">
<value>Shard '{0}' provided for the given '{1}' is not associated with current shard map '{2}'. The '{3}' operations required the shard to be associated with the current shard map.</value>
</data>
<data name="_Shard_DifferentShardMapManager" xml:space="preserve">
<value>Shard '{0}' provided for the given '{1}' is not associated with current shard map manager at '{2}'. The '{3}' operations required the shard to be associated with the current shard map manager.</value>
</data>
<data name="_SqlShardMapManagerCredentials_ConnectionStringPropertyRequired" xml:space="preserve">
<value>The required property '{0}' must be set in the connection string.</value>
</data>
<data name="_Store_MissingSprocParametersGlobal" xml:space="preserve">
<value>All required parameters for operation '{0}' are not supplied. Error occurred while executing procedure '{1}' on the shard map manager database. Please verify and match library and store version.</value>
@ -270,47 +237,17 @@
<data name="_Store_MissingSprocParametersLocal" xml:space="preserve">
<value>All required parameters for operation '{0}' at shard '{1}' are not supplied. Error occurred while executing procedure '{2}' on the shard. Please verify and match library and store version.</value>
</data>
<data name="_Store_UnsupportedLibraryVersionGlobal" xml:space="preserve">
<value>Shard map manager store version '{0}' is not compatible with the version '{1}' supported by client library. Please upgrade the {2}.</value>
<data name="_Store_SchemaInfo_NameConflict" xml:space="preserve">
<value>Unable to create schema info with name '{0}' as there is already an entry with the same name.</value>
</data>
<data name="_Store_UnsupportedLibraryVersionLocal" xml:space="preserve">
<value>Shard map manager store version '{0}' at shard '{1}' is not compatible with the version '{2}' supported by client library. Please upgrade the {3}.</value>
<data name="_Store_SchemaInfo_NameDoesNotExist" xml:space="preserve">
<value>Unable to {0} schema info with name '{1}' since there is no entry by the given name.</value>
</data>
<data name="_ShardMapping_SplitPointOutOfRange" xml:space="preserve">
<value>Split point lies on the boundary or outside of the specified range mapping.</value>
<data name="_Store_ShardMapManager_AlreadyExistsGlobal" xml:space="preserve">
<value>Data structures for shard map manager persistence already exists at the target location.</value>
</data>
<data name="_Store_UnexpectedErrorGlobal" xml:space="preserve">
<value>Unexpected error code found while processing errors returned from the shard map manager store. This can occur because of a defect in the client library.</value>
</data>
<data name="_Store_SqlOperation_LockNotAcquired" xml:space="preserve">
<value>Exclusive access to application resource '{0}' could not be acquired.</value>
</data>
<data name="_Store_ShardMap_DoesNotExistGlobal" xml:space="preserve">
<value>Shard map '{0}' does not exist in the store. Error occurred while executing stored procedure '{1}' for operation '{2}' for shard '{3}'. This can happen if another concurrent user deletes the shard map.</value>
</data>
<data name="_ShardMapping_DifferentShardMap" xml:space="preserve">
<value>'{0}' provided for operation '{1}' is not associated with the current shard map '{2}'. Only mappings associated with the same shard map as the given shard map can be used. Error occurred for parameter '{3}'.</value>
</data>
<data name="_ShardMapping_DifferentShardMapManager" xml:space="preserve">
<value>'{0}' provided for operation '{1}' is not associated with the current instance of shard map manager at '{2}'. Only mappings associated with the same 'ShardMapManager' instance as the the one associated with current shard map '{3}' can be used. Error occurred for parameter '{4}'.</value>
</data>
<data name="_Store_Shard_AlreadyExistsGlobal" xml:space="preserve">
<value>Shard '{0}' already exists in store for shard map '{1}'. Error occurred while executing stored procedure '{2}' for operation '{3}'. This can happen when another concurrent user adds the shard to the store.</value>
</data>
<data name="_Store_Shard_LocationAlreadyExistsGlobal" xml:space="preserve">
<value>Shard referecing location '{0}' already exists in store for shard map '{1}'. Error occurred while executing stored procedure '{2}' for operation '{3}'. This can happen when another concurrent user has added a shard with specified location in store.</value>
</data>
<data name="_Store_SqlExceptionLocal" xml:space="preserve">
<value>Store Error: {0}. The error occurred while attempting to perform the underlying storage operation during '{1}' operation on shard '{2}'. See the inner StoreException for details.</value>
</data>
<data name="_Store_UnexpectedErrorLocal" xml:space="preserve">
<value>Unexpected error code found while processing errors returned from the shard location '{0}'. This can occur because of a defect in the client library.</value>
</data>
<data name="_ShardMapping_RangeNotProperSubset" xml:space="preserve">
<value>Requested range is exactly the range for existing mapping. Operation is only allowed for proper subsets of existing range.</value>
</data>
<data name="_ShardMapping_LockIdNotSupported" xml:space="preserve">
<value>LockId for locking the mapping referencing shard {0} with shard map name {1} has unsupported value '{2}'.</value>
<data name="_Store_ShardMapManager_DoesNotExistGlobal" xml:space="preserve">
<value>Data structures for shard map manager persistence do not exist at the target location.</value>
</data>
<data name="_Store_ShardMapper_LockMappingAlreadyLocked" xml:space="preserve">
<value>Mapping referencing shard '{0}' belonging to shard map '{1}' is already locked. Error occurred while executing procedure '{2}' for operation '{3}' on the shard map manager database. This can happen if another concurrent user locks the mapping.</value>
@ -318,25 +255,88 @@
<data name="_Store_ShardMapper_LockOwnerDoesNotMatch" xml:space="preserve">
<value>Mapping referencing shard '{0}' belonging to shard map '{1}' is locked and correct lock token is not provided. Error occurred while executing procedure '{2}' for operation '{3}' on the shard map manager database. This can happen if another concurrent user locks the mapping.</value>
</data>
<data name="_Store_ShardMapper_MappingDoesNotExistGlobal" xml:space="preserve">
<value>Mapping referencing shard '{0}' in the shard map '{1}' does not exist. Error occurred while executing stored procedure '{2}' for operation '{3}'. This can occur if another concurrent user has already removed the mapping.</value>
</data>
<data name="_Store_ShardMapper_MappingIsNotOffline" xml:space="preserve">
<value>Mapping referencing shard '{0}' in the shard map '{1}' has 'Online' status. Error occurred while executing stored procedure '{2}' for operation '{3}'. Updates to a mapping involving modification of the shard location or removal require the mapping to be 'Offline'. </value>
</data>
<data name="_Store_ShardMapper_MappingNotFoundForKeyGlobal" xml:space="preserve">
<value>Mapping containing the given key value could not be located in the shard map '{0}'. Error occurred while executing stored procedure '{1}' for operation '{2}'.</value>
</data>
<data name="_Store_ShardMapper_MappingPointOrRangeAlreadyMapped" xml:space="preserve">
<value>Mapping referencing shard '{0}' in the shard map '{1}' cannot be added because the {2} it covers is already mapped by another mapping. Error occurred while executing stored procedure '{3}' for operation '{4}'. This can occur if another concurrent user has already added a mapping covering the given {2}.</value>
</data>
<data name="_Store_ShardMapper_UnableToKillSessions" xml:space="preserve">
<value>Mapping referencing shard '{0}' belonging to shard map '{1}' could not be taken offline because all existing connections on the shard could not be terminated. Error occurred during '{2}' operation while executing stored procedure '{3}' on shard '{4}'.</value>
</data>
<data name="_Store_ShardMap_AlreadyExistsGlobal" xml:space="preserve">
<value>Shard map with name '{0}' already exists in the store. Error occurred while executing stored procedure '{1}' for operation '{2}'.</value>
</data>
<data name="_Store_ShardMap_ContainsShardsGlobal" xml:space="preserve">
<value>Shard map '{0}' has shards associated with it. Shard maps can only be removed if there are no shards associated with them. Error occurred while executing stored procedure '{1}' for operation '{2}'.</value>
</data>
<data name="_Store_ShardMap_DoesNotExistGlobal" xml:space="preserve">
<value>Shard map '{0}' does not exist in the store. Error occurred while executing stored procedure '{1}' for operation '{2}' for shard '{3}'. This can happen if another concurrent user deletes the shard map.</value>
</data>
<data name="_Store_ShardMap_DoesNotExistLocal" xml:space="preserve">
<value>Shard map '{0}' does not exist on shard '{1}'. Error occurred while executing stored procedure '{2}' for operation '{3}'. This can happen if another concurrent user deletes the shard map.</value>
</data>
<data name="_Store_Validate_ShardVersionMismatch" xml:space="preserve">
<value>Shard '{0}' belonging to shard map '{1}' has been modified in the store. Error occurred while executing stored procedure '{2}' for operation '{3}' on the shard. This can happen if another concurrent user performs modification operations on the shard or its associated mappings.</value>
<data name="_Store_Shard_AlreadyExistsGlobal" xml:space="preserve">
<value>Shard '{0}' already exists in store for shard map '{1}'. Error occurred while executing stored procedure '{2}' for operation '{3}'. This can happen when another concurrent user adds the shard to the store.</value>
</data>
<data name="_ShardLocation_UnsupportedProtocol" xml:space="preserve">
<value>The given protocol value '{0}' is not supported.</value>
<data name="_Store_Shard_DoesNotExistGlobal" xml:space="preserve">
<value>Shard '{0}' belonging to shard map '{1}' could not be found in the shard map manager database. Error occurred while executing stored procedure '{2}' for operation '{3}'. This can happen when another concurrent user removes the shard from the store.</value>
</data>
<data name="_Store_StoreException" xml:space="preserve">
<value>Error occurred while performing store operation. See the inner SqlException for details.</value>
<data name="_Store_Shard_HasMappingsGlobal" xml:space="preserve">
<value>Shard '{0}' belonging to shard map '{1}' has mappings associated with it. Error occurred while executing stored procedure '{2}' for operation '{3}'. Remove all the mappings associated with the shard before attempting the operation.</value>
</data>
<data name="_ShardKey_MaxValueCannotBeIncremented" xml:space="preserve">
<value>Shard key has maximum value which cannot be incremented. Perform the IsMax check on shard key before requesting next key.</value>
<data name="_Store_Shard_LocationAlreadyExistsGlobal" xml:space="preserve">
<value>Shard referecing location '{0}' already exists in store for shard map '{1}'. Error occurred while executing stored procedure '{2}' for operation '{3}'. This can happen when another concurrent user has added a shard with specified location in store.</value>
</data>
<data name="_ShardLocation_InvalidPort" xml:space="preserve">
<value>The given port number '{0}' is invalid.</value>
<data name="_Store_Shard_VersionMismatchGlobal" xml:space="preserve">
<value>Shard '{0}' belonging to shard map '{1}' has been updated in store. Error occurred while executing stored procedure '{2}' for operation '{3}'. This can occur if another concurrent user updates the shard. Perform a GetShard operation for the shard location to obtain the updated instance.</value>
</data>
<data name="_Store_SqlExceptionGlobal" xml:space="preserve">
<value>Store Error: {0}. The error occurred while attempting to perform the underlying storage operation during '{1}' operation on the shard map manager database. See the inner StoreException for details.</value>
</data>
<data name="_Store_SqlExceptionLocal" xml:space="preserve">
<value>Store Error: {0}. The error occurred while attempting to perform the underlying storage operation during '{1}' operation on shard '{2}'. See the inner StoreException for details.</value>
</data>
<data name="_Store_SqlOperation_LockNotAcquired" xml:space="preserve">
<value>Exclusive access to application resource '{0}' could not be acquired.</value>
</data>
<data name="_Store_SqlOperation_LockNotReleased" xml:space="preserve">
<value>Exclusive access to application resource '{0}' could not be released.</value>
</data>
<data name="_Store_StoreException" xml:space="preserve">
<value>Error occurred while performing store operation. See the inner SqlException for details.</value>
</data>
<data name="_Store_UnexpectedErrorGlobal" xml:space="preserve">
<value>Unexpected error code found while processing errors returned from the shard map manager store. This can occur because of a defect in the client library.</value>
</data>
<data name="_Store_UnexpectedErrorLocal" xml:space="preserve">
<value>Unexpected error code found while processing errors returned from the shard location '{0}'. This can occur because of a defect in the client library.</value>
</data>
<data name="_Store_UnsupportedLibraryVersionGlobal" xml:space="preserve">
<value>Shard map manager store version '{0}' is not compatible with the version '{1}' supported by client library. Please upgrade the {2}.</value>
</data>
<data name="_Store_UnsupportedLibraryVersionLocal" xml:space="preserve">
<value>Shard map manager store version '{0}' at shard '{1}' is not compatible with the version '{2}' supported by client library. Please upgrade the {3}.</value>
</data>
<data name="_Store_Validate_MappingDoesNotExist" xml:space="preserve">
<value>Mapping referencing shard '{0}' associated with shard map '{1}' no longer exists in store. Error occurred while executing stored procedure '{2}' for operation '{3}' on the shard. This can happen if another concurrent user has deleted or modified the mapping.</value>
</data>
<data name="_Store_Validate_MappingIsOffline" xml:space="preserve">
<value>The shard key value for an OpenConnection request is associated with a mapping that is marked Offline. Data containing this key value is likely being moved, and the connection is blocked to avoid data corruption. Validated connection requests for this shardlet will succeed when the mapping is back Online. Shard: '{0}'. Shard map: '{1}'. Error occurred while executing stored procedure '{3}' for operation '{2}' on the shard.</value>
</data>
<data name="_Store_Validate_ShardDoesNotExist" xml:space="preserve">
<value>Shard '{0}' belonging to shard map '{1}' no longer exists in store. Error occurred while executing stored procedure '{2}' for operation '{3}' on the shard. This can happen if another concurrent user deletes the shard. </value>
</data>
<data name="_Store_Validate_ShardMapDoesNotExist" xml:space="preserve">
<value>Shard map '{0}' associated with shard '{1}' no longer exists in store. Error occurred while executing stored procedure '{2}' for operation '{3}'. This can happen if another concurrent user deletes the shard map.</value>
</data>
<data name="_Store_Validate_ShardVersionMismatch" xml:space="preserve">
<value>Shard '{0}' belonging to shard map '{1}' has been modified in the store. Error occurred while executing stored procedure '{2}' for operation '{3}' on the shard. This can happen if another concurrent user performs modification operations on the shard or its associated mappings.</value>
</data>
</root>

Просмотреть файл

@ -42,7 +42,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement
params object[] vars)
{
string fmtMessage = string.Format(message, vars);
logger.Verbose("{0}.{1}; {2}; ActivityId: {3};", componentName, methodName, fmtMessage, Trace.CorrelationManager.ActivityId);
logger.Verbose("{0}.{1}; {2}; ActivityId: {3};", componentName, methodName, fmtMessage, CorrelationManager.ActivityId);
}
/// <summary>
@ -60,7 +60,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement
params object[] vars)
{
string fmtMessage = string.Format(message, vars);
logger.Info("{0}.{1}; {2}; ActivityId: {3};", componentName, methodName, fmtMessage, Trace.CorrelationManager.ActivityId);
logger.Info("{0}.{1}; {2}; ActivityId: {3};", componentName, methodName, fmtMessage, CorrelationManager.ActivityId);
}
/// <summary>
@ -78,7 +78,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement
params object[] vars)
{
string fmtMessage = string.Format(message, vars);
logger.Warning("{0}.{1}; {2}; ActivityId: {3};", componentName, methodName, fmtMessage, Trace.CorrelationManager.ActivityId);
logger.Warning("{0}.{1}; {2}; ActivityId: {3};", componentName, methodName, fmtMessage, CorrelationManager.ActivityId);
}
/// <summary>
@ -96,7 +96,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement
params object[] vars)
{
string fmtMessage = string.Format(message, vars);
logger.Error("{0}.{1}; {2}; ActivityId: {3};", componentName, methodName, fmtMessage, Trace.CorrelationManager.ActivityId);
logger.Error("{0}.{1}; {2}; ActivityId: {3};", componentName, methodName, fmtMessage, CorrelationManager.ActivityId);
}
}
}

Просмотреть файл

@ -1,7 +1,7 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34209
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@ -19,7 +19,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class PerformanceCounters {

Просмотреть файл

@ -1,97 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34209
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class ReadOnlyScripts {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal ReadOnlyScripts() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement.ReadOnlyScripts", typeof(ReadOnlyScripts).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to -- Copyright (c) Microsoft. All rights reserved.
///-- Licensed under the MIT license. See LICENSE file in the project root for full license information.
///
///---------------------------------------------------------------------------------------------------
///-- Reads from shard map manager version information table if it exists.
///---------------------------------------------------------------------------------------------------
///
///declare @stmt varchar(128)
///if object_id(N&apos;__ShardManagement.ShardMapManagerGlobal&apos;, N&apos;U [rest of string was truncated]&quot;;.
/// </summary>
internal static string CheckShardMapManagerGlobal {
get {
return ResourceManager.GetString("CheckShardMapManagerGlobal", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to -- Copyright (c) Microsoft. All rights reserved.
///-- Licensed under the MIT license. See LICENSE file in the project root for full license information.
///
///---------------------------------------------------------------------------------------------------
///-- Reads from shard map manager version information table if it exists.
///---------------------------------------------------------------------------------------------------
///
///declare @stmt varchar(128)
///if object_id(N&apos;__ShardManagement.ShardMapManagerLocal&apos;, N&apos;U&apos; [rest of string was truncated]&quot;;.
/// </summary>
internal static string CheckShardMapManagerLocal {
get {
return ResourceManager.GetString("CheckShardMapManagerLocal", resourceCulture);
}
}
}
}

Просмотреть файл

@ -1,127 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="CheckShardMapManagerGlobal" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>scripts\checkshardmapmanagerglobal.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
<data name="CheckShardMapManagerLocal" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>scripts\checkshardmapmanagerlocal.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
</root>

Просмотреть файл

@ -88,7 +88,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement.Schema
private SchemaInfoException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
this.ErrorCode = (SchemaInfoErrorCode)info.GetValue("ErrorCode", typeof(ShardManagementErrorCode));
this.ErrorCode = (SchemaInfoErrorCode)info.GetValue("ErrorCode", typeof(SchemaInfoErrorCode));
}
/// <summary>

Просмотреть файл

@ -1,281 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34209
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Scripts {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Scripts() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement.Scripts", typeof(Scripts).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to -- Copyright (c) Microsoft. All rights reserved.
///-- Licensed under the MIT license. See LICENSE file in the project root for full license information.
///
///---------------------------------------------------------------------------------------------------
///-- Schema
///---------------------------------------------------------------------------------------------------
///if schema_id(&apos;__ShardManagement&apos;) is null
///begin
/// exec sp_executesql N&apos;create schema __ShardManagement&apos;
///end
///go
///
///--------------------------------------- [rest of string was truncated]&quot;;.
/// </summary>
internal static string CreateShardMapManagerGlobal {
get {
return ResourceManager.GetString("CreateShardMapManagerGlobal", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to -- Copyright (c) Microsoft. All rights reserved.
///-- Licensed under the MIT license. See LICENSE file in the project root for full license information.
///
///---------------------------------------------------------------------------------------------------
///-- Schema
///---------------------------------------------------------------------------------------------------
///if schema_id(&apos;__ShardManagement&apos;) is null
///begin
/// exec sp_executesql N&apos;create schema __ShardManagement&apos;
///end
///go
///
///--------------------------------------- [rest of string was truncated]&quot;;.
/// </summary>
internal static string CreateShardMapManagerLocal {
get {
return ResourceManager.GetString("CreateShardMapManagerLocal", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to -- Copyright (c) Microsoft. All rights reserved.
///-- Licensed under the MIT license. See LICENSE file in the project root for full license information.
///
///---------------------------------------------------------------------------------------------------
///-- Stored Procedures
///---------------------------------------------------------------------------------------------------
///---------------------------------------------------------------------------------------------------
///-- Recovery
///--------------------------- [rest of string was truncated]&quot;;.
/// </summary>
internal static string DropShardMapManagerGlobal {
get {
return ResourceManager.GetString("DropShardMapManagerGlobal", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to -- Copyright (c) Microsoft. All rights reserved.
///-- Licensed under the MIT license. See LICENSE file in the project root for full license information.
///
///---------------------------------------------------------------------------------------------------
///-- Stored Procedures
///---------------------------------------------------------------------------------------------------
///
///---------------------------------------------------------------------------------------------------
///-- Shard Mappings
///-------------------- [rest of string was truncated]&quot;;.
/// </summary>
internal static string DropShardMapManagerLocal {
get {
return ResourceManager.GetString("DropShardMapManagerLocal", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to -- Copyright (c) Microsoft. All rights reserved.
///-- Licensed under the MIT license. See LICENSE file in the project root for full license information.
///
///---------------------------------------------------------------------------------------------------
///-- Script to upgrade Global Shard Map from version 0.0 to 1.0
///---------------------------------------------------------------------------------------------------
///
///-- add a column to ShardMapManagerGlobal table to hold SCH-M lock during upgrade
///alter table __Sh [rest of string was truncated]&quot;;.
/// </summary>
internal static string UpgradeShardMapManagerGlobalFrom0_0To1_0 {
get {
return ResourceManager.GetString("UpgradeShardMapManagerGlobalFrom0_0To1_0", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to -- Copyright (c) Microsoft. All rights reserved.
///-- Licensed under the MIT license. See LICENSE file in the project root for full license information.
///
///---------------------------------------------------------------------------------------------------
///-- Script to upgrade Global Shard Map from version 1.0 to 1.1
///---------------------------------------------------------------------------------------------------
///
///-- drop ShardMapManagerGlobal table
///drop table __ShardManagement.ShardMapManagerGlobal
///
///-- creat [rest of string was truncated]&quot;;.
/// </summary>
internal static string UpgradeShardMapManagerGlobalFrom1_0To1_1 {
get {
return ResourceManager.GetString("UpgradeShardMapManagerGlobalFrom1_0To1_1", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to -- Copyright (c) Microsoft. All rights reserved.
///-- Licensed under the MIT license. See LICENSE file in the project root for full license information.
///
///---------------------------------------------------------------------------------------------------
///-- Script to upgrade Global Shard Map from version 1.1 to 1.2
///-- Fix for VSTS# 3410606
///---------------------------------------------------------------------------------------------------
///
///-- drop extra objects from version 1.1
///
///if object_id(N&apos;__ShardManagement [rest of string was truncated]&quot;;.
/// </summary>
internal static string UpgradeShardMapManagerGlobalFrom1_1To1_2 {
get {
return ResourceManager.GetString("UpgradeShardMapManagerGlobalFrom1_1To1_2", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to -- Copyright (c) Microsoft. All rights reserved.
///-- Licensed under the MIT license. See LICENSE file in the project root for full license information.
///
///---------------------------------------------------------------------------------------------------
///-- Script to upgrade Global Shard Map from version 1000.0 to 1000.1
///---------------------------------------------------------------------------------------------------
///
///-- drop extra column from ShardMapManagerGlobal table which was added as first step to hold [rest of string was truncated]&quot;;.
/// </summary>
internal static string UpgradeShardMapManagerGlobalFrom1000_0To1000_1 {
get {
return ResourceManager.GetString("UpgradeShardMapManagerGlobalFrom1000_0To1000_1", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to -- Copyright (c) Microsoft. All rights reserved.
///-- Licensed under the MIT license. See LICENSE file in the project root for full license information.
///
///---------------------------------------------------------------------------------------------------
///-- Script to upgrade Local Shard Map from version 0.0 to 1.0
///---------------------------------------------------------------------------------------------------
///
///-- add a column to ShardMapManagerLocal table to hold SCH-M lock during upgrade
///alter table __Shar [rest of string was truncated]&quot;;.
/// </summary>
internal static string UpgradeShardMapManagerLocalFrom0_0To1_0 {
get {
return ResourceManager.GetString("UpgradeShardMapManagerLocalFrom0_0To1_0", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to -- Copyright (c) Microsoft. All rights reserved.
///-- Licensed under the MIT license. See LICENSE file in the project root for full license information.
///
///---------------------------------------------------------------------------------------------------
///-- Script to upgrade Local Shard Map from version 1.0 to 1.1
///---------------------------------------------------------------------------------------------------
///
///-- drop ShardMapManagerLocal table
///drop table __ShardManagement.ShardMapManagerLocal
///
///-- create S [rest of string was truncated]&quot;;.
/// </summary>
internal static string UpgradeShardMapManagerLocalFrom1_0To1_1 {
get {
return ResourceManager.GetString("UpgradeShardMapManagerLocalFrom1_0To1_1", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to -- Copyright (c) Microsoft. All rights reserved.
///-- Licensed under the MIT license. See LICENSE file in the project root for full license information.
///
///---------------------------------------------------------------------------------------------------
///-- Script to upgrade Local Shard Map from version 1.1 to 1.2
///---------------------------------------------------------------------------------------------------
///
///-- drop extra objects from version 1.1
///
///if object_id(N&apos;__ShardManagement.spUpdateShardLocal&apos;, N&apos;P&apos; [rest of string was truncated]&quot;;.
/// </summary>
internal static string UpgradeShardMapManagerLocalFrom1_1To1_2 {
get {
return ResourceManager.GetString("UpgradeShardMapManagerLocalFrom1_1To1_2", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to -- Copyright (c) Microsoft. All rights reserved.
///-- Licensed under the MIT license. See LICENSE file in the project root for full license information.
///
///---------------------------------------------------------------------------------------------------
///-- Script to upgrade Local Shard Map from version 1000.0 to 1000.1
///---------------------------------------------------------------------------------------------------
///
///-- drop extra column from ShardMapManagerLocal table which was added as first step to hold S [rest of string was truncated]&quot;;.
/// </summary>
internal static string UpgradeShardMapManagerLocalFrom1000_0To1000_1 {
get {
return ResourceManager.GetString("UpgradeShardMapManagerLocalFrom1000_0To1000_1", resourceCulture);
}
}
}
}

Просмотреть файл

@ -1,157 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="CreateShardMapManagerGlobal" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Scripts\CreateShardMapManagerGlobal.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
<data name="CreateShardMapManagerLocal" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Scripts\CreateShardMapManagerLocal.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
<data name="DropShardMapManagerGlobal" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Scripts\DropShardMapManagerGlobal.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
<data name="DropShardMapManagerLocal" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Scripts\DropShardMapManagerLocal.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
<data name="UpgradeShardMapManagerGlobalFrom0_0To1_0" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Scripts\UpgradeShardMapManagerGlobalFrom0.0To1.0.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
<data name="UpgradeShardMapManagerGlobalFrom1000_0To1000_1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Scripts\UpgradeShardMapManagerGlobalFrom1000.0To1000.1.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
<data name="UpgradeShardMapManagerGlobalFrom1_0To1_1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Scripts\UpgradeShardMapManagerGlobalFrom1.0To1.1.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
<data name="UpgradeShardMapManagerGlobalFrom1_1To1_2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Scripts\UpgradeShardMapManagerGlobalFrom1.1To1.2.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
<data name="UpgradeShardMapManagerLocalFrom0_0To1_0" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Scripts\UpgradeShardMapManagerLocalFrom0.0To1.0.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
<data name="UpgradeShardMapManagerLocalFrom1000_0To1000_1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Scripts\UpgradeShardMapManagerLocalFrom1000.0To1000.1.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
<data name="UpgradeShardMapManagerLocalFrom1_0To1_1" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Scripts\UpgradeShardMapManagerLocalFrom1.0To1.1.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
<data name="UpgradeShardMapManagerLocalFrom1_1To1_2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Scripts\UpgradeShardMapManagerLocalFrom1.1To1.2.sql;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
</root>

Просмотреть файл

@ -1,3 +1,14 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement
{
/// <summary>
/// Utility properties and methods used for managing scripts and errors.
/// </summary>
internal static partial class ReadOnlyScripts
{
internal const string CheckShardMapManagerGlobal = @"
-- Copyright (c) Microsoft. All rights reserved.
-- Licensed under the MIT license. See LICENSE file in the project root for full license information.
@ -19,3 +30,6 @@ begin
exec(@stmt)
end
go
";
}
}

Просмотреть файл

@ -1,3 +1,14 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement
{
/// <summary>
/// Utility properties and methods used for managing scripts and errors.
/// </summary>
internal static partial class ReadOnlyScripts
{
internal const string CheckShardMapManagerLocal = @"
-- Copyright (c) Microsoft. All rights reserved.
-- Licensed under the MIT license. See LICENSE file in the project root for full license information.
@ -19,3 +30,6 @@ begin
exec(@stmt)
end
go
";
}
}

Просмотреть файл

@ -1,3 +1,14 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement
{
/// <summary>
/// Utility properties and methods used for managing scripts and errors.
/// </summary>
internal static partial class Scripts
{
internal const string CreateShardMapManagerGlobal = @"
-- Copyright (c) Microsoft. All rights reserved.
-- Licensed under the MIT license. See LICENSE file in the project root for full license information.
@ -836,7 +847,7 @@ begin
while (@stepIndex <= @stepsCount)
begin
select
@currentStep = x.query('(./Step[@Id = sql:variable("@stepIndex")])[1]')
@currentStep = x.query('(./Step[@Id = sql:variable(""@stepIndex"")])[1]')
from
@input.nodes('/BulkOperationShardsGlobal/Steps') as t(x)
@ -1133,7 +1144,7 @@ begin
while (@stepIndex <= @stepsCount)
begin
select
@currentStep = x.query('(./Step[@Id = sql:variable("@stepIndex")])[1]')
@currentStep = x.query('(./Step[@Id = sql:variable(""@stepIndex"")])[1]')
from
@input.nodes('/BulkOperationShardsGlobal/Steps') as t(x)
@ -1285,10 +1296,10 @@ begin
select
@gsmVersionClient = x.value('(GsmVersion)[1]', 'int'),
@shardMapId = x.value('(ShardMap/Id)[1]', 'uniqueidentifier'),
@shardId = x.value('(Shard[@Null="0"]/Id)[1]', 'uniqueidentifier'),
@shardVersion = x.value('(Shard[@Null="0"]/Version)[1]', 'uniqueidentifier'),
@minValue = convert(varbinary(128), x.value('(Range[@Null="0"]/MinValue)[1]', 'varchar(258)'), 1),
@maxValue = convert(varbinary(128), x.value('(Range[@Null="0"]/MaxValue[@Null="0"])[1]', 'varchar(258)'), 1)
@shardId = x.value('(Shard[@Null=""0""]/Id)[1]', 'uniqueidentifier'),
@shardVersion = x.value('(Shard[@Null=""0""]/Version)[1]', 'uniqueidentifier'),
@minValue = convert(varbinary(128), x.value('(Range[@Null=""0""]/MinValue)[1]', 'varchar(258)'), 1),
@maxValue = convert(varbinary(128), x.value('(Range[@Null=""0""]/MaxValue[@Null=""0""])[1]', 'varchar(258)'), 1)
from
@input.nodes('/GetAllShardMappingsGlobal') as t(x)
@ -1845,7 +1856,7 @@ begin
while (@stepIndex <= @stepsCount)
begin
select
@currentStep = x.query('(./Step[@Id = sql:variable("@stepIndex")])[1]')
@currentStep = x.query('(./Step[@Id = sql:variable(""@stepIndex"")])[1]')
from
@input.nodes('/BulkOperationShardMappingsGlobal/Steps') as t(x)
@ -1960,7 +1971,7 @@ begin
@stepShouldValidate = x.value('(@Validate)[1]', 'bit'),
@stepMappingId = x.value('(Mapping/Id)[1]', 'uniqueidentifier'),
@stepMinValue = convert(varbinary(128), x.value('(Mapping/MinValue)[1]', 'varchar(258)'), 1),
@stepMaxValue = convert(varbinary(128), x.value('(Mapping/MaxValue[@Null="0"])[1]', 'varchar(258)'), 1),
@stepMaxValue = convert(varbinary(128), x.value('(Mapping/MaxValue[@Null=""0""])[1]', 'varchar(258)'), 1),
@stepStatus = x.value('(Mapping/Status)[1]', 'int'),
@stepLockOwnerId = x.value('(Mapping/LockOwnerId)[1]', 'uniqueidentifier')
from
@ -2224,7 +2235,7 @@ begin
while (@stepIndex <= @stepsCount)
begin
select
@currentStep = x.query('(./Step[@Id = sql:variable("@stepIndex")])[1]')
@currentStep = x.query('(./Step[@Id = sql:variable(""@stepIndex"")])[1]')
from
@input.nodes('/BulkOperationShardMappingsGlobal/Steps') as t(x)
@ -2935,7 +2946,7 @@ begin
@serverName = x.value('(Location/ServerName)[1]', 'nvarchar(128)'),
@port = x.value('(Location/Port)[1]', 'int'),
@databaseName = x.value('(Location/DatabaseName)[1]', 'nvarchar(128)'),
@name = x.value('(Shardmap[@Null="0"]/Name)[1]', 'nvarchar(50)')
@name = x.value('(Shardmap[@Null=""0""]/Name)[1]', 'nvarchar(50)')
from
@input.nodes('/DetachShardGlobal') as t(x)
@ -3062,7 +3073,7 @@ begin
while (@removeStepIndex <= @removeStepsCount)
begin
select
@currentRemoveStep = x.query('(./Step[@Id = sql:variable("@removeStepIndex")])[1]')
@currentRemoveStep = x.query('(./Step[@Id = sql:variable(""@removeStepIndex"")])[1]')
from
@input.nodes('ReplaceShardMappingsGlobal/RemoveSteps') as t(x)
@ -3111,14 +3122,14 @@ begin
while (@addStepIndex <= @addStepsCount)
begin
select
@currentAddStep = x.query('(./Step[@Id = sql:variable("@addStepIndex")])[1]')
@currentAddStep = x.query('(./Step[@Id = sql:variable(""@addStepIndex"")])[1]')
from
@input.nodes('ReplaceShardMappingsGlobal/AddSteps') as t(x)
select
@stepMappingId = x.value('(Mapping/Id)[1]', 'uniqueidentifier'),
@stepMinValue = convert(varbinary(128), x.value('(Mapping/MinValue)[1]', 'varchar(258)'), 1),
@stepMaxValue = convert(varbinary(128), x.value('(Mapping/MaxValue[@Null="0"])[1]', 'varchar(258)'), 1),
@stepMaxValue = convert(varbinary(128), x.value('(Mapping/MaxValue[@Null=""0""])[1]', 'varchar(258)'), 1),
@stepStatus = x.value('(Mapping/Status)[1]', 'int')
from
@currentAddStep.nodes('./Step') as t(x)
@ -3177,3 +3188,6 @@ Error_GSMVersionMismatch:
Exit_Procedure:
end
go
";
}
}

Просмотреть файл

@ -1,3 +1,14 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement
{
/// <summary>
/// Utility properties and methods used for managing scripts and errors.
/// </summary>
internal static partial class Scripts
{
internal const string CreateShardMapManagerLocal = @"
-- Copyright (c) Microsoft. All rights reserved.
-- Licensed under the MIT license. See LICENSE file in the project root for full license information.
@ -19,7 +30,7 @@ StoreVersion int not null
go
create table __ShardManagement.ShardMapsLocal(
ShardMapId uniqueidentifier not null,
ShardMapId uniqueidentifier not null,
Name nvarchar(50) collate SQL_Latin1_General_CP1_CI_AS not null,
MapType int not null,
KeyType int not null,
@ -30,11 +41,11 @@ go
create table __ShardManagement.ShardsLocal(
ShardId uniqueidentifier not null,
Version uniqueidentifier not null,
ShardMapId uniqueidentifier not null,
ShardMapId uniqueidentifier not null,
Protocol int not null,
ServerName nvarchar(128) collate SQL_Latin1_General_CP1_CI_AS not null,
ServerName nvarchar(128) collate SQL_Latin1_General_CP1_CI_AS not null,
Port int not null,
DatabaseName nvarchar(128) collate SQL_Latin1_General_CP1_CI_AS not null,
DatabaseName nvarchar(128) collate SQL_Latin1_General_CP1_CI_AS not null,
Status int not null, -- user defined
LastOperationId uniqueidentifier default('00000000-0000-0000-0000-000000000000') not null
)
@ -44,7 +55,7 @@ create table __ShardManagement.ShardMappingsLocal(
MappingId uniqueidentifier not null,
ShardId uniqueidentifier not null,
ShardMapId uniqueidentifier not null,
MinValue varbinary(128) not null,
MinValue varbinary(128) not null,
MaxValue varbinary(128), -- nulls are allowed since +ve infinity is represented by null
Status int not null, -- 0 online, 1 offline
LockOwnerId uniqueidentifier default('00000000-0000-0000-0000-000000000000') not null,
@ -55,11 +66,11 @@ go
---------------------------------------------------------------------------------------------------
-- Constraints
---------------------------------------------------------------------------------------------------
alter table __ShardManagement.ShardMapManagerLocal
alter table __ShardManagement.ShardMapManagerLocal
add constraint pkShardMapManagerLocal_StoreVersion primary key (StoreVersion)
go
alter table __ShardManagement.ShardMapsLocal
alter table __ShardManagement.ShardMapsLocal
add constraint pkShardMapsLocal_ShardMapId primary key (ShardMapId)
go
@ -99,9 +110,9 @@ go
---------------------------------------------------------------------------------------------------
-- Data
---------------------------------------------------------------------------------------------------
insert into
insert into
__ShardManagement.ShardMapManagerLocal (StoreVersion)
values
values
(1)
go
@ -199,7 +210,7 @@ as
begin
select
5, StoreVersion
from
from
__ShardManagement.ShardMapManagerLocal
end
go
@ -223,9 +234,9 @@ as
begin
declare @lsmVersionClient int
select
select
@lsmVersionClient = x.value('(LsmVersion)[1]', 'int')
from
from
@input.nodes('/GetAllShardsLocal') as t(x)
if (@lsmVersionClient is null)
@ -235,14 +246,14 @@ begin
goto Error_LSMVersionMismatch;
-- shard maps
select
select
1, ShardMapId, Name, MapType, KeyType
from
from
__ShardManagement.ShardMapsLocal
-- shards
select
2, ShardId, Version, ShardMapId, Protocol, ServerName, Port, DatabaseName, Status
select
2, ShardId, Version, ShardMapId, Protocol, ServerName, Port, DatabaseName, Status
from
__ShardManagement.ShardsLocal
@ -279,12 +290,12 @@ begin
@shardMapId uniqueidentifier,
@shardId uniqueidentifier,
@shardVersion uniqueidentifier
select
select
@lsmVersionClient = x.value('(LsmVersion)[1]', 'int'),
@shardMapId = x.value('(ShardMapId)[1]', 'uniqueidentifier'),
@shardId = x.value('(ShardId)[1]', 'uniqueidentifier'),
@shardVersion = x.value('(ShardVersion)[1]', 'uniqueidentifier')
from
from
@input.nodes('/ValidateShardLocal') as t(x)
if (@lsmVersionClient is null or @shardMapId is null or @shardId is null or @shardVersion is null)
@ -295,12 +306,12 @@ begin
-- find shard map
declare @currentShardMapId uniqueidentifier
select
@currentShardMapId = ShardMapId
from
select
@currentShardMapId = ShardMapId
from
__ShardManagement.ShardMapsLocal
where
where
ShardMapId = @shardMapId
if (@currentShardMapId is null)
@ -308,11 +319,11 @@ begin
declare @currentShardVersion uniqueidentifier
select
@currentShardVersion = Version
from
select
@currentShardVersion = Version
from
__ShardManagement.ShardsLocal
where
where
ShardMapId = @shardMapId and ShardId = @shardId
if (@currentShardVersion is null)
@ -373,7 +384,7 @@ begin
@databaseName nvarchar(128),
@shardStatus int
select
select
@lsmVersionClient = x.value('(LsmVersion)[1]', 'int'),
@operationId = x.value('(@OperationId)[1]', 'uniqueidentifier'),
@shardMapId = x.value('(ShardMap/Id)[1]', 'uniqueidentifier'),
@ -387,11 +398,11 @@ begin
@port = x.value('(Shard/Location/Port)[1]', 'int'),
@databaseName = x.value('(Shard/Location/DatabaseName)[1]', 'nvarchar(128)'),
@shardStatus = x.value('(Shard/Status)[1]', 'int')
from
from
@input.nodes('/AddShardLocal') as t(x)
if (@lsmVersionClient is null or @shardMapId is null or @operationId is null or @name is null or @sm_kind is null or @sm_keykind is null or
@shardId is null or @shardVersion is null or @protocol is null or @serverName is null or
if (@lsmVersionClient is null or @shardMapId is null or @operationId is null or @name is null or @sm_kind is null or @sm_keykind is null or
@shardId is null or @shardVersion is null or @protocol is null or @serverName is null or
@port is null or @databaseName is null or @shardStatus is null)
goto Error_MissingParameters;
@ -400,7 +411,7 @@ begin
-- check for reentrancy
if exists (
select
select
ShardMapId
from
__ShardManagement.ShardMapsLocal
@ -409,34 +420,34 @@ begin
goto Success_Exit;
-- add shard map row
insert into
__ShardManagement.ShardMapsLocal
insert into
__ShardManagement.ShardMapsLocal
(ShardMapId, Name, MapType, KeyType, LastOperationId)
values
(@shardMapId, @name, @sm_kind, @sm_keykind, @operationId)
values
(@shardMapId, @name, @sm_kind, @sm_keykind, @operationId)
-- add shard row
insert into
insert into
__ShardManagement.ShardsLocal(
ShardId,
Version,
ShardMapId,
Protocol,
ServerName,
Port,
DatabaseName,
ShardId,
Version,
ShardMapId,
Protocol,
ServerName,
Port,
DatabaseName,
Status,
LastOperationId)
values (
@shardId,
@shardVersion,
@shardId,
@shardVersion,
@shardMapId,
@protocol,
@serverName,
@port,
@databaseName,
@protocol,
@serverName,
@port,
@databaseName,
@shardStatus,
@operationId)
@operationId)
goto Success_Exit;
@ -453,7 +464,7 @@ Error_LSMVersionMismatch:
Success_Exit:
set @result = 1
goto Exit_Procedure;
Exit_Procedure:
end
go
@ -472,12 +483,12 @@ begin
@shardMapId uniqueidentifier,
@shardId uniqueidentifier
select
select
@lsmVersionClient = x.value('(LsmVersion)[1]', 'int'),
@operationId = x.value('(@OperationId)[1]', 'uniqueidentifier'),
@shardMapId = x.value('(ShardMap/Id)[1]', 'uniqueidentifier'),
@shardId = x.value('(Shard/Id)[1]', 'uniqueidentifier')
from
from
@input.nodes('/RemoveShardLocal') as t(x)
if (@lsmVersionClient is null or @operationId is null or @shardMapId is null or @shardId is null)
@ -488,13 +499,13 @@ begin
-- remove shard row
delete from
__ShardManagement.ShardsLocal
__ShardManagement.ShardsLocal
where
ShardMapId = @shardMapId and ShardId = @shardId
-- remove shard map row
delete from
__ShardManagement.ShardMapsLocal
__ShardManagement.ShardMapsLocal
where
ShardMapId = @shardMapId
@ -531,14 +542,14 @@ begin
@shardVersion uniqueidentifier,
@shardStatus int
select
select
@lsmVersionClient = x.value('(LsmVersion)[1]', 'int'),
@operationId = x.value('(@OperationId)[1]', 'uniqueidentifier'),
@shardMapId = x.value('(ShardMap/Id)[1]', 'uniqueidentifier'),
@shardId = x.value('(Shard/Id)[1]', 'uniqueidentifier'),
@shardVersion = x.value('(Shard/Version)[1]', 'uniqueidentifier'),
@shardStatus = x.value('(Shard/Status)[1]', 'int')
from
from
@input.nodes('/UpdateShardLocal') as t(x)
if (@lsmVersionClient is null or @operationId is null or @shardMapId is null or @shardId is null or @shardVersion is null or @shardStatus is null)
@ -547,7 +558,7 @@ begin
if (@lsmVersionClient <> __ShardManagement.fnGetStoreVersionLocal())
goto Error_LSMVersionMismatch;
update
update
__ShardManagement.ShardsLocal
set
Version = @shardVersion,
@ -592,13 +603,13 @@ begin
declare @minValue varbinary(128)
declare @maxValue varbinary(128)
select
select
@lsmVersionClient = x.value('(LsmVersion)[1]', 'int'),
@shardMapId = x.value('(ShardMap/Id)[1]', 'uniqueidentifier'),
@shardId = x.value('(Shard/Id)[1]', 'uniqueidentifier'),
@minValue = convert(varbinary(128), x.value('(Range[@Null="0"]/MinValue)[1]', 'varchar(258)'), 1),
@maxValue = convert(varbinary(128), x.value('(Range[@Null="0"]/MaxValue[@Null="0"])[1]', 'varchar(258)'), 1)
from
@minValue = convert(varbinary(128), x.value('(Range[@Null=""0""]/MinValue)[1]', 'varchar(258)'), 1),
@maxValue = convert(varbinary(128), x.value('(Range[@Null=""0""]/MaxValue[@Null=""0""])[1]', 'varchar(258)'), 1)
from
@input.nodes('/GetAllShardMappingsLocal') as t(x)
if (@lsmVersionClient is null or @shardMapId is null or @shardId is null)
@ -609,7 +620,7 @@ begin
declare @mapType int
select
select
@mapType = MapType
from
__ShardManagement.ShardMapsLocal
@ -630,41 +641,41 @@ begin
set @maxValueCalculated = @maxValue
if (@mapType = 1)
begin
select
begin
select
3, m.MappingId, m.ShardMapId, m.MinValue, m.MaxValue, m.Status, m.LockOwnerId, -- fields for SqlMapping
s.ShardId, s.Version, s.ShardMapId, s.Protocol, s.ServerName, s.Port, s.DatabaseName, s.Status -- fields for SqlShard, ShardMapId is repeated here
from
__ShardManagement.ShardMappingsLocal m
join
__ShardManagement.ShardsLocal s
on
from
__ShardManagement.ShardMappingsLocal m
join
__ShardManagement.ShardsLocal s
on
m.ShardId = s.ShardId
where
m.ShardMapId = @shardMapId and
m.ShardId = @shardId and
MinValue >= @minValueCalculated and
m.ShardMapId = @shardMapId and
m.ShardId = @shardId and
MinValue >= @minValueCalculated and
((@maxValueCalculated is null) or (MinValue < @maxValueCalculated))
order by
order by
m.MinValue
end
else
begin
select
select
3, m.MappingId, m.ShardMapId, m.MinValue, m.MaxValue, m.Status, m.LockOwnerId, -- fields for SqlMapping
s.ShardId, s.Version, s.ShardMapId, s.Protocol, s.ServerName, s.Port, s.DatabaseName, s.Status -- fields for SqlShard, ShardMapId is repeated here
from
__ShardManagement.ShardMappingsLocal m
join
__ShardManagement.ShardsLocal s
on
from
__ShardManagement.ShardMappingsLocal m
join
__ShardManagement.ShardsLocal s
on
m.ShardId = s.ShardId
where
m.ShardMapId = @shardMapId and
m.ShardId = @shardId and
((MaxValue is null) or (MaxValue > @minValueCalculated)) and
m.ShardMapId = @shardMapId and
m.ShardId = @shardId and
((MaxValue is null) or (MaxValue > @minValueCalculated)) and
((@maxValueCalculated is null) or (MinValue < @maxValueCalculated))
order by
order by
m.MinValue
end
@ -702,13 +713,13 @@ begin
@shardMapId uniqueidentifier,
@keyValue varbinary(128)
select
select
@lsmVersionClient = x.value('(LsmVersion)[1]', 'int'),
@shardMapId = x.value('(ShardMap/Id)[1]', 'uniqueidentifier'),
@keyValue = convert(varbinary(128), x.value('(Key/Value)[1]', 'varchar(258)'), 1)
from
from
@input.nodes('/FindShardMappingByKeyLocal') as t(x)
if (@lsmVersionClient is null or @shardMapId is null or @keyValue is null)
goto Error_MissingParameters;
@ -717,7 +728,7 @@ begin
declare @mapType int
select
select
@mapType = MapType
from
__ShardManagement.ShardMapsLocal
@ -728,33 +739,33 @@ begin
goto Error_ShardMapNotFound;
if (@mapType = 1)
begin
begin
select
3, m.MappingId, m.ShardMapId, m.MinValue, m.MaxValue, m.Status, m.LockOwnerId, -- fields for SqlMapping
s.ShardId, s.Version, s.ShardMapId, s.Protocol, s.ServerName, s.Port, s.DatabaseName, s.Status -- fields for SqlShard, ShardMapId is repeated here
from
__ShardManagement.ShardMappingsLocal m
join
join
__ShardManagement.ShardsLocal s
on
on
m.ShardId = s.ShardId
where
m.ShardMapId = @shardMapId and
m.ShardMapId = @shardMapId and
m.MinValue = @keyValue
end
else
begin
select
select
3, m.MappingId, m.ShardMapId, m.MinValue, m.MaxValue, m.Status, m.LockOwnerId, -- fields for SqlMapping
s.ShardId, s.Version, s.ShardMapId, s.Protocol, s.ServerName, s.Port, s.DatabaseName, s.Status -- fields for SqlShard, ShardMapId is repeated here
from
__ShardManagement.ShardMappingsLocal m
join
__ShardManagement.ShardsLocal s
on
from
__ShardManagement.ShardMappingsLocal m
join
__ShardManagement.ShardsLocal s
on
m.ShardId = s.ShardId
where
m.ShardMapId = @shardMapId and
m.ShardMapId = @shardMapId and
m.MinValue <= @keyValue and (m.MaxValue is null or m.MaxValue > @keyValue)
end
@ -814,12 +825,12 @@ begin
-- find shard map
declare @currentShardMapId uniqueidentifier
select
@currentShardMapId = ShardMapId
from
select
@currentShardMapId = ShardMapId
from
__ShardManagement.ShardMapsLocal
where
where
ShardMapId = @shardMapId
if (@currentShardMapId is null)
@ -827,13 +838,13 @@ begin
declare @m_status_current int
select
select
@m_status_current = Status
from
__ShardManagement.ShardMappingsLocal
where
ShardMapId = @shardMapId and MappingId = @mappingId
if (@m_status_current is null)
goto Error_MappingDoesNotExist;
@ -888,14 +899,14 @@ begin
@shardVersion uniqueidentifier
-- get operation information as well as number of steps information
select
select
@lsmVersionClient = x.value('(LsmVersion)[1]', 'int'),
@operationId = x.value('(@OperationId)[1]', 'uniqueidentifier'),
@stepsCount = x.value('(@StepsCount)[1]', 'int'),
@shardMapId = x.value('(ShardMap/Id)[1]', 'uniqueidentifier'),
@shardId = x.value('(Shard/Id)[1]', 'uniqueidentifier'),
@shardVersion = x.value('(Shard/Version)[1]', 'uniqueidentifier')
from
from
@input.nodes('/BulkOperationShardMappingsLocal') as t(x)
if (@lsmVersionClient is null or @operationId is null or @stepsCount is null or @shardMapId is null or @shardId is null or @shardVersion is null)
@ -906,7 +917,7 @@ begin
-- check for reentrancy
if exists (
select
select
ShardId
from
__ShardManagement.ShardsLocal
@ -929,9 +940,9 @@ begin
while (@stepIndex <= @stepsCount)
begin
select
@currentStep = x.query('(./Step[@Id = sql:variable("@stepIndex")])[1]')
from
select
@currentStep = x.query('(./Step[@Id = sql:variable(""@stepIndex"")])[1]')
from
@input.nodes('/BulkOperationShardMappingsLocal/Steps') as t(x)
-- Identify the step type.
@ -940,7 +951,7 @@ begin
@stepMappingId = x.value('(Mapping/Id)[1]', 'uniqueidentifier')
from
@currentStep.nodes('./Step') as t(x)
if (@stepType is null or @stepMappingId is null)
goto Error_MissingParameters;
@ -960,9 +971,9 @@ begin
@stepMappingStatus int
-- AddMapping
select
select
@stepMinValue = convert(varbinary(128), x.value('(Mapping/MinValue)[1]', 'varchar(258)'), 1),
@stepMaxValue = convert(varbinary(128), x.value('(Mapping/MaxValue[@Null="0"])[1]', 'varchar(258)'), 1),
@stepMaxValue = convert(varbinary(128), x.value('(Mapping/MaxValue[@Null=""0""])[1]', 'varchar(258)'), 1),
@stepMappingStatus = x.value('(Mapping/Status)[1]', 'int')
from
@currentStep.nodes('./Step') as t(x)
@ -973,19 +984,19 @@ begin
-- add mapping
insert into
__ShardManagement.ShardMappingsLocal
(MappingId,
ShardId,
ShardMapId,
MinValue,
MaxValue,
(MappingId,
ShardId,
ShardMapId,
MinValue,
MaxValue,
Status,
LastOperationId)
values
(@stepMappingId,
@shardId,
@shardMapId,
@stepMinValue,
@stepMaxValue,
(@stepMappingId,
@shardId,
@shardMapId,
@stepMinValue,
@stepMaxValue,
@stepMappingStatus,
@operationId)
@ -1016,7 +1027,7 @@ Error_LSMVersionMismatch:
Success_Exit:
set @result = 1
goto Exit_Procedure;
Exit_Procedure:
end
go
@ -1034,10 +1045,10 @@ begin
@patternForKill nvarchar(128)
-- get operation information as well as number of steps information
select
select
@lsmVersionClient = x.value('(LsmVersion)[1]', 'int'),
@patternForKill = x.value('(Pattern)[1]', 'nvarchar(128)')
from
from
@input.nodes('/KillSessionsForShardMappingLocal') as t(x)
if (@lsmVersionClient is null or @patternForKill is null)
@ -1049,31 +1060,31 @@ begin
declare @tvKillCommands table (spid smallint primary key, commandForKill nvarchar(10))
-- insert empty row
insert into
@tvKillCommands (spid, commandForKill)
values
insert into
@tvKillCommands (spid, commandForKill)
values
(0, N'')
insert into
@tvKillCommands(spid, commandForKill)
select
insert into
@tvKillCommands(spid, commandForKill)
select
session_id, 'kill ' + convert(nvarchar(10), session_id)
from
sys.dm_exec_sessions
where
from
sys.dm_exec_sessions
where
session_id > 50 and program_name like '%' + @patternForKill + '%'
declare @currentSpid int,
declare @currentSpid int,
@currentCommandForKill nvarchar(10)
declare @current_error int
select top 1
@currentSpid = spid,
@currentCommandForKill = commandForKill
from
@tvKillCommands
order by
select top 1
@currentSpid = spid,
@currentCommandForKill = commandForKill
from
@tvKillCommands
order by
spid desc
while (@currentSpid > 0)
@ -1083,18 +1094,18 @@ begin
exec (@currentCommandForKill)
-- remove the current row
delete
@tvKillCommands
where
delete
@tvKillCommands
where
spid = @currentSpid
-- get next row
select top 1
@currentSpid = spid,
@currentCommandForKill = commandForKill
from
@tvKillCommands
order by
select top 1
@currentSpid = spid,
@currentCommandForKill = commandForKill
from
@tvKillCommands
order by
spid desc
end try
begin catch
@ -1106,7 +1117,7 @@ begin
set @result = 1
goto Exit_Procedure;
Error_UnableToKillSessions:
set @result = 305
goto Exit_Procedure;
@ -1124,3 +1135,6 @@ Error_LSMVersionMismatch:
Exit_Procedure:
end
go
";
}
}

Просмотреть файл

@ -1,3 +1,14 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement
{
/// <summary>
/// Utility properties and methods used for managing scripts and errors.
/// </summary>
internal static partial class Scripts
{
internal const string DropShardMapManagerGlobal = @"
-- Copyright (c) Microsoft. All rights reserved.
-- Licensed under the MIT license. See LICENSE file in the project root for full license information.
@ -285,3 +296,6 @@ begin
drop schema __ShardManagement
end
go
";
}
}

Просмотреть файл

@ -1,3 +1,14 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement
{
/// <summary>
/// Utility properties and methods used for managing scripts and errors.
/// </summary>
internal static partial class Scripts
{
internal const string DropShardMapManagerLocal = @"
-- Copyright (c) Microsoft. All rights reserved.
-- Licensed under the MIT license. See LICENSE file in the project root for full license information.
@ -118,7 +129,7 @@ go
if object_id(N'__ShardManagement.ucShardMappingsLocal_ShardMapId_MinValue', N'UQ') is not null
begin
alter table __ShardManagement.ShardMappingsLocal
alter table __ShardManagement.ShardMappingsLocal
drop constraint ucShardMappingsLocal_ShardMapId_MinValue
end
go
@ -170,3 +181,6 @@ begin
drop schema __ShardManagement
end
go
";
}
}

Просмотреть файл

@ -0,0 +1,82 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System.Collections.Generic;
namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement
{
/// <summary>
/// Utility properties and methods used for managing scripts and errors.
/// </summary>
internal static partial class Scripts
{
/// <summary>
/// structure to hold upgrade command batches along with the starting version to apply the upgrade step.
/// </summary>
internal struct UpgradeScript
{
/// <summary>
/// Major version to apply this upgrade step.
/// </summary>
public int InitialMajorVersion
{
get;
private set;
}
/// <summary>
/// Minor version to apply this upgrade step.
/// </summary>
public int InitialMinorVersion
{
get;
private set;
}
/// <summary>
/// Commands in this upgrade step batch. These will be executed only when store is at (this.InitialMajorVersion, this.InitialMinorVersion).
/// </summary>
public string Script
{
get;
private set;
}
/// <summary>
/// Construct upgrade steps.
/// </summary>
/// <param name="initialMajorVersion">Expected major version of store to run this upgrade step.</param>
/// <param name="initialMinorVersion">Expected minor version of store to run this upgrade step.</param>
/// <param name="commands">Commands to execute as part of this upgrade step.</param>
public UpgradeScript(int initialMajorVersion, int initialMinorVersion, string commands)
: this()
{
this.InitialMajorVersion = initialMajorVersion;
this.InitialMinorVersion = initialMinorVersion;
this.Script = commands;
}
};
/// <remarks>
/// Implemented as property to avoid static initialization ordering issues
/// </remarks>
internal static IEnumerable<UpgradeScript> UpgradeGlobalScripts => new[]
{
UpgradeShardMapManagerGlobalFrom0_0To1_0,
UpgradeShardMapManagerGlobalFrom1_0To1_1,
UpgradeShardMapManagerGlobalFrom1_1To1_2,
UpgradeShardMapManagerGlobalFrom1000_0To1000_1
};
/// <remarks>
/// Implemented as property to avoid static initialization ordering issues
/// </remarks>
internal static IEnumerable<UpgradeScript> UpgradeLocalScripts => new[]
{
UpgradeShardMapManagerLocalFrom0_0To1_0,
UpgradeShardMapManagerLocalFrom1_0To1_1,
UpgradeShardMapManagerLocalFrom1_1To1_2,
UpgradeShardMapManagerLocalFrom1000_0To1000_1
};
}
}

Просмотреть файл

@ -1,3 +1,14 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement
{
/// <summary>
/// Utility properties and methods used for managing scripts and errors.
/// </summary>
internal static partial class Scripts
{
internal static readonly UpgradeScript UpgradeShardMapManagerGlobalFrom0_0To1_0 = new UpgradeScript(0, 0, @"
-- Copyright (c) Microsoft. All rights reserved.
-- Licensed under the MIT license. See LICENSE file in the project root for full license information.
@ -8,3 +19,6 @@
-- add a column to ShardMapManagerGlobal table to hold SCH-M lock during upgrade
alter table __ShardManagement.ShardMapManagerGlobal add UpgradeLock int null
go
");
}
}

Просмотреть файл

@ -1,3 +1,14 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement
{
/// <summary>
/// Utility properties and methods used for managing scripts and errors.
/// </summary>
internal static partial class Scripts
{
internal static readonly UpgradeScript UpgradeShardMapManagerGlobalFrom1_1To1_2 = new UpgradeScript(1, 1, @"
-- Copyright (c) Microsoft. All rights reserved.
-- Licensed under the MIT license. See LICENSE file in the project root for full license information.
@ -26,7 +37,7 @@ create procedure __ShardManagement.spLockOrUnlockShardMappingsGlobal
@result int output
as
begin
declare @gsmVersionMajorClient int,
declare @gsmVersionMajorClient int,
@gsmVersionMinorClient int,
@shardMapId uniqueidentifier,
@mappingId uniqueidentifier,
@ -34,7 +45,7 @@ begin
@lockOperationType int
select
@gsmVersionMajorClient = x.value('(GsmVersion/MajorVersion)[1]', 'int'),
@gsmVersionMajorClient = x.value('(GsmVersion/MajorVersion)[1]', 'int'),
@gsmVersionMinorClient = x.value('(GsmVersion/MinorVersion)[1]', 'int'),
@shardMapId = x.value('(ShardMap/Id)[1]', 'uniqueidentifier'),
@mappingId = x.value('(Mapping/Id)[1]', 'uniqueidentifier'),
@ -53,9 +64,9 @@ begin
goto Error_MissingParameters;
if not exists (
select
ShardMapId
from
select
ShardMapId
from
__ShardManagement.ShardMapsGlobal with (updlock)
where
ShardMapId = @shardMapId)
@ -65,14 +76,14 @@ begin
@currentOperationId uniqueidentifier
if (@lockOperationType < 2)
begin
begin
declare @ForceUnLockLockOwnerId uniqueidentifier = 'FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF',
@currentLockOwnerId uniqueidentifier
select
select
@currentOperationId = OperationId,
@currentLockOwnerId = LockOwnerId
from
from
__ShardManagement.ShardMappingsGlobal with (updlock)
where
ShardMapId = @shardMapId and MappingId = @mappingId
@ -92,16 +103,16 @@ begin
update
__ShardManagement.ShardMappingsGlobal
set
LockOwnerId = case
when
@lockOperationType = 0
then
@lockOwnerId
when
set
LockOwnerId = case
when
@lockOperationType = 0
then
@lockOwnerId
when
@lockOperationType = 1 or @lockOperationType = 2 or @lockOperationType = 3
then
@DefaultLockOwnerId
then
@DefaultLockOwnerId
end
where
ShardMapId = @shardMapId and (@lockOperationType = 3 or -- unlock all mappings
@ -149,10 +160,13 @@ go
-- update version as 1.2
update
__ShardManagement.ShardMapManagerGlobal
set
__ShardManagement.ShardMapManagerGlobal
set
StoreVersionMinor = 2
where
StoreVersionMajor = 1 and StoreVersionMinor = 1
go
");
}
}

Просмотреть файл

@ -1,3 +1,14 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement
{
/// <summary>
/// Utility properties and methods used for managing scripts and errors.
/// </summary>
internal static partial class Scripts
{
internal static readonly UpgradeScript UpgradeShardMapManagerGlobalFrom1000_0To1000_1 = new UpgradeScript(1000, 0, @"
-- Copyright (c) Microsoft. All rights reserved.
-- Licensed under the MIT license. See LICENSE file in the project root for full license information.
@ -11,3 +22,6 @@ begin
alter table __ShardManagement.ShardMapManagerGlobal drop column UpgradeLock
end
go
");
}
}

Просмотреть файл

@ -1,3 +1,14 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement
{
/// <summary>
/// Utility properties and methods used for managing scripts and errors.
/// </summary>
internal static partial class Scripts
{
internal static readonly UpgradeScript UpgradeShardMapManagerLocalFrom0_0To1_0 = new UpgradeScript(0, 0, @"
-- Copyright (c) Microsoft. All rights reserved.
-- Licensed under the MIT license. See LICENSE file in the project root for full license information.
@ -8,3 +19,6 @@
-- add a column to ShardMapManagerLocal table to hold SCH-M lock during upgrade
alter table __ShardManagement.ShardMapManagerLocal add UpgradeLock int null
go
");
}
}

Просмотреть файл

@ -1,3 +1,14 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement
{
/// <summary>
/// Utility properties and methods used for managing scripts and errors.
/// </summary>
internal static partial class Scripts
{
internal static readonly UpgradeScript UpgradeShardMapManagerLocalFrom1_0To1_1 = new UpgradeScript(1, 0, @"
-- Copyright (c) Microsoft. All rights reserved.
-- Licensed under the MIT license. See LICENSE file in the project root for full license information.
@ -5,7 +16,7 @@
-- Script to upgrade Local Shard Map from version 1.0 to 1.1
---------------------------------------------------------------------------------------------------
-- drop ShardMapManagerLocal table
-- drop ShardMapManagerLocal table
drop table __ShardManagement.ShardMapManagerLocal
-- create ShardMapManagerLocal table with new column names
@ -33,61 +44,61 @@ go
if object_id(N'__ShardManagement.spGetAllShardsLocal', N'P') is not null
begin
drop procedure __ShardManagement.spGetAllShardsLocal
end
end
go
if object_id(N'__ShardManagement.spValidateShardLocal', N'P') is not null
begin
drop procedure __ShardManagement.spValidateShardLocal
end
end
go
if object_id(N'__ShardManagement.spAddShardLocal', N'P') is not null
begin
drop procedure __ShardManagement.spAddShardLocal
end
end
go
if object_id(N'__ShardManagement.spRemoveShardLocal', N'P') is not null
begin
drop procedure __ShardManagement.spRemoveShardLocal
end
end
go
if object_id(N'__ShardManagement.spUpdateShardLocal', N'P') is not null
begin
drop procedure __ShardManagement.spUpdateShardLocal
end
end
go
if object_id(N'__ShardManagement.spGetAllShardMappingsLocal', N'P') is not null
begin
drop procedure __ShardManagement.spGetAllShardMappingsLocal
end
end
go
if object_id(N'__ShardManagement.spFindShardMappingByKeyLocal', N'P') is not null
begin
drop procedure __ShardManagement.spFindShardMappingByKeyLocal
end
end
go
if object_id(N'__ShardManagement.spValidateShardMappingLocal', N'P') is not null
begin
drop procedure __ShardManagement.spValidateShardMappingLocal
end
end
go
if object_id(N'__ShardManagement.spBulkOperationShardMappingsLocal', N'P') is not null
begin
drop procedure __ShardManagement.spBulkOperationShardMappingsLocal
end
end
go
if object_id(N'__ShardManagement.spKillSessionsForShardMappingLocal', N'P') is not null
begin
drop procedure __ShardManagement.spKillSessionsForShardMappingLocal
end
end
go
-- create new objects for version 1.1
@ -111,7 +122,7 @@ as
begin
select
5, StoreVersionMajor, StoreVersionMinor
from
from
__ShardManagement.ShardMapManagerLocal
end
go
@ -128,10 +139,10 @@ begin
declare @lsmVersionMajorClient int,
@lsmVersionMinorClient int
select
select
@lsmVersionMajorClient = x.value('(LsmVersion/MajorVersion)[1]', 'int'),
@lsmVersionMinorClient = x.value('(LsmVersion/MinorVersion)[1]', 'int')
from
from
@input.nodes('/GetAllShardsLocal') as t(x)
if (@lsmVersionMajorClient is null or @lsmVersionMinorClient is null)
@ -141,14 +152,14 @@ begin
goto Error_LSMVersionMismatch;
-- shard maps
select
select
1, ShardMapId, Name, MapType, KeyType
from
from
__ShardManagement.ShardMapsLocal
-- shards
select
2, ShardId, Version, ShardMapId, Protocol, ServerName, Port, DatabaseName, Status
select
2, ShardId, Version, ShardMapId, Protocol, ServerName, Port, DatabaseName, Status
from
__ShardManagement.ShardsLocal
@ -169,7 +180,7 @@ Success_Exit:
goto Exit_Procedure;
Exit_Procedure:
end
end
go
---------------------------------------------------------------------------------------------------
@ -186,13 +197,13 @@ begin
@shardMapId uniqueidentifier,
@shardId uniqueidentifier,
@shardVersion uniqueidentifier
select
@lsmVersionMajorClient = x.value('(LsmVersion/MajorVersion)[1]', 'int'),
select
@lsmVersionMajorClient = x.value('(LsmVersion/MajorVersion)[1]', 'int'),
@lsmVersionMinorClient = x.value('(LsmVersion/MinorVersion)[1]', 'int'),
@shardMapId = x.value('(ShardMapId)[1]', 'uniqueidentifier'),
@shardId = x.value('(ShardId)[1]', 'uniqueidentifier'),
@shardVersion = x.value('(ShardVersion)[1]', 'uniqueidentifier')
from
from
@input.nodes('/ValidateShardLocal') as t(x)
if (@lsmVersionMajorClient is null or @lsmVersionMinorClient is null or @shardMapId is null or @shardId is null or @shardVersion is null)
@ -203,12 +214,12 @@ begin
-- find shard map
declare @currentShardMapId uniqueidentifier
select
@currentShardMapId = ShardMapId
from
select
@currentShardMapId = ShardMapId
from
__ShardManagement.ShardMapsLocal
where
where
ShardMapId = @shardMapId
if (@currentShardMapId is null)
@ -216,11 +227,11 @@ begin
declare @currentShardVersion uniqueidentifier
select
@currentShardVersion = Version
from
select
@currentShardVersion = Version
from
__ShardManagement.ShardsLocal
where
where
ShardMapId = @shardMapId and ShardId = @shardId
if (@currentShardVersion is null)
@ -255,7 +266,7 @@ Error_LSMVersionMismatch:
goto Exit_Procedure;
Exit_Procedure:
end
end
go
---------------------------------------------------------------------------------------------------
@ -267,7 +278,7 @@ create procedure __ShardManagement.spAddShardLocal
@result int output
as
begin
declare @lsmVersionMajorClient int,
declare @lsmVersionMajorClient int,
@lsmVersionMinorClient int,
@operationId uniqueidentifier,
@shardMapId uniqueidentifier,
@ -282,8 +293,8 @@ begin
@databaseName nvarchar(128),
@shardStatus int
select
@lsmVersionMajorClient = x.value('(LsmVersion/MajorVersion)[1]', 'int'),
select
@lsmVersionMajorClient = x.value('(LsmVersion/MajorVersion)[1]', 'int'),
@lsmVersionMinorClient = x.value('(LsmVersion/MinorVersion)[1]', 'int'),
@operationId = x.value('(@OperationId)[1]', 'uniqueidentifier'),
@shardMapId = x.value('(ShardMap/Id)[1]', 'uniqueidentifier'),
@ -297,11 +308,11 @@ begin
@port = x.value('(Shard/Location/Port)[1]', 'int'),
@databaseName = x.value('(Shard/Location/DatabaseName)[1]', 'nvarchar(128)'),
@shardStatus = x.value('(Shard/Status)[1]', 'int')
from
from
@input.nodes('/AddShardLocal') as t(x)
if (@lsmVersionMajorClient is null or @lsmVersionMinorClient is null or @shardMapId is null or @operationId is null or @name is null or @sm_kind is null or @sm_keykind is null or
@shardId is null or @shardVersion is null or @protocol is null or @serverName is null or
if (@lsmVersionMajorClient is null or @lsmVersionMinorClient is null or @shardMapId is null or @operationId is null or @name is null or @sm_kind is null or @sm_keykind is null or
@shardId is null or @shardVersion is null or @protocol is null or @serverName is null or
@port is null or @databaseName is null or @shardStatus is null)
goto Error_MissingParameters;
@ -310,7 +321,7 @@ begin
-- check for reentrancy
if exists (
select
select
ShardMapId
from
__ShardManagement.ShardMapsLocal
@ -319,34 +330,34 @@ begin
goto Success_Exit;
-- add shard map row
insert into
__ShardManagement.ShardMapsLocal
insert into
__ShardManagement.ShardMapsLocal
(ShardMapId, Name, MapType, KeyType, LastOperationId)
values
(@shardMapId, @name, @sm_kind, @sm_keykind, @operationId)
values
(@shardMapId, @name, @sm_kind, @sm_keykind, @operationId)
-- add shard row
insert into
insert into
__ShardManagement.ShardsLocal(
ShardId,
Version,
ShardMapId,
Protocol,
ServerName,
Port,
DatabaseName,
ShardId,
Version,
ShardMapId,
Protocol,
ServerName,
Port,
DatabaseName,
Status,
LastOperationId)
values (
@shardId,
@shardVersion,
@shardId,
@shardVersion,
@shardMapId,
@protocol,
@serverName,
@port,
@databaseName,
@protocol,
@serverName,
@port,
@databaseName,
@shardStatus,
@operationId)
@operationId)
goto Success_Exit;
@ -363,9 +374,9 @@ Error_LSMVersionMismatch:
Success_Exit:
set @result = 1
goto Exit_Procedure;
Exit_Procedure:
end
end
go
---------------------------------------------------------------------------------------------------
@ -377,19 +388,19 @@ create procedure __ShardManagement.spRemoveShardLocal
@result int output
as
begin
declare @lsmVersionMajorClient int,
declare @lsmVersionMajorClient int,
@lsmVersionMinorClient int,
@operationId uniqueidentifier,
@shardMapId uniqueidentifier,
@shardId uniqueidentifier
select
select
@lsmVersionMajorClient = x.value('(LsmVersion/MajorVersion)[1]', 'int'),
@lsmVersionMinorClient = x.value('(LsmVersion/MinorVersion)[1]', 'int'),
@operationId = x.value('(@OperationId)[1]', 'uniqueidentifier'),
@shardMapId = x.value('(ShardMap/Id)[1]', 'uniqueidentifier'),
@shardId = x.value('(Shard/Id)[1]', 'uniqueidentifier')
from
from
@input.nodes('/RemoveShardLocal') as t(x)
if (@lsmVersionMajorClient is null or @lsmVersionMinorClient is null or @operationId is null or @shardMapId is null or @shardId is null)
@ -400,13 +411,13 @@ begin
-- remove shard row
delete from
__ShardManagement.ShardsLocal
__ShardManagement.ShardsLocal
where
ShardMapId = @shardMapId and ShardId = @shardId
-- remove shard map row
delete from
__ShardManagement.ShardMapsLocal
__ShardManagement.ShardMapsLocal
where
ShardMapId = @shardMapId
@ -424,7 +435,7 @@ Error_LSMVersionMismatch:
goto Exit_Procedure;
Exit_Procedure:
end
end
go
---------------------------------------------------------------------------------------------------
@ -436,7 +447,7 @@ create procedure __ShardManagement.spUpdateShardLocal
@result int output
as
begin
declare @lsmVersionMajorClient int,
declare @lsmVersionMajorClient int,
@lsmVersionMinorClient int,
@operationId uniqueidentifier,
@shardMapId uniqueidentifier,
@ -444,7 +455,7 @@ begin
@shardVersion uniqueidentifier,
@shardStatus int
select
select
@lsmVersionMajorClient = x.value('(LsmVersion/MajorVersion)[1]', 'int'),
@lsmVersionMinorClient = x.value('(LsmVersion/MinorVersion)[1]', 'int'),
@operationId = x.value('(@OperationId)[1]', 'uniqueidentifier'),
@ -452,7 +463,7 @@ begin
@shardId = x.value('(Shard/Id)[1]', 'uniqueidentifier'),
@shardVersion = x.value('(Shard/Version)[1]', 'uniqueidentifier'),
@shardStatus = x.value('(Shard/Status)[1]', 'int')
from
from
@input.nodes('/UpdateShardLocal') as t(x)
if (@lsmVersionMajorClient is null or @lsmVersionMinorClient is null or @operationId is null or @shardMapId is null or @shardId is null or @shardVersion is null or @shardStatus is null)
@ -461,7 +472,7 @@ begin
if (@lsmVersionMajorClient <> __ShardManagement.fnGetStoreVersionMajorLocal())
goto Error_LSMVersionMismatch;
update
update
__ShardManagement.ShardsLocal
set
Version = @shardVersion,
@ -484,7 +495,7 @@ Error_LSMVersionMismatch:
goto Exit_Procedure;
Exit_Procedure:
end
end
go
---------------------------------------------------------------------------------------------------
@ -496,21 +507,21 @@ create procedure __ShardManagement.spGetAllShardMappingsLocal
@result int output
as
begin
declare @lsmVersionMajorClient int,
declare @lsmVersionMajorClient int,
@lsmVersionMinorClient int,
@shardMapId uniqueidentifier,
@shardId uniqueidentifier,
@minValue varbinary(128),
@maxValue varbinary(128)
select
select
@lsmVersionMajorClient = x.value('(LsmVersion/MajorVersion)[1]', 'int'),
@lsmVersionMinorClient = x.value('(LsmVersion/MinorVersion)[1]', 'int'),
@shardMapId = x.value('(ShardMap/Id)[1]', 'uniqueidentifier'),
@shardId = x.value('(Shard/Id)[1]', 'uniqueidentifier'),
@minValue = convert(varbinary(128), x.value('(Range[@Null="0"]/MinValue)[1]', 'varchar(258)'), 1),
@maxValue = convert(varbinary(128), x.value('(Range[@Null="0"]/MaxValue[@Null="0"])[1]', 'varchar(258)'), 1)
from
@minValue = convert(varbinary(128), x.value('(Range[@Null=""0""]/MinValue)[1]', 'varchar(258)'), 1),
@maxValue = convert(varbinary(128), x.value('(Range[@Null=""0""]/MaxValue[@Null=""0""])[1]', 'varchar(258)'), 1)
from
@input.nodes('/GetAllShardMappingsLocal') as t(x)
if (@lsmVersionMajorClient is null or @lsmVersionMinorClient is null or @shardMapId is null or @shardId is null)
@ -521,7 +532,7 @@ begin
declare @mapType int
select
select
@mapType = MapType
from
__ShardManagement.ShardMapsLocal
@ -542,41 +553,41 @@ begin
set @maxValueCalculated = @maxValue
if (@mapType = 1)
begin
select
begin
select
3, m.MappingId, m.ShardMapId, m.MinValue, m.MaxValue, m.Status, m.LockOwnerId, -- fields for SqlMapping
s.ShardId, s.Version, s.ShardMapId, s.Protocol, s.ServerName, s.Port, s.DatabaseName, s.Status -- fields for SqlShard, ShardMapId is repeated here
from
__ShardManagement.ShardMappingsLocal m
join
__ShardManagement.ShardsLocal s
on
from
__ShardManagement.ShardMappingsLocal m
join
__ShardManagement.ShardsLocal s
on
m.ShardId = s.ShardId
where
m.ShardMapId = @shardMapId and
m.ShardId = @shardId and
MinValue >= @minValueCalculated and
m.ShardMapId = @shardMapId and
m.ShardId = @shardId and
MinValue >= @minValueCalculated and
((@maxValueCalculated is null) or (MinValue < @maxValueCalculated))
order by
order by
m.MinValue
end
else
begin
select
select
3, m.MappingId, m.ShardMapId, m.MinValue, m.MaxValue, m.Status, m.LockOwnerId, -- fields for SqlMapping
s.ShardId, s.Version, s.ShardMapId, s.Protocol, s.ServerName, s.Port, s.DatabaseName, s.Status -- fields for SqlShard, ShardMapId is repeated here
from
__ShardManagement.ShardMappingsLocal m
join
__ShardManagement.ShardsLocal s
on
from
__ShardManagement.ShardMappingsLocal m
join
__ShardManagement.ShardsLocal s
on
m.ShardId = s.ShardId
where
m.ShardMapId = @shardMapId and
m.ShardId = @shardId and
((MaxValue is null) or (MaxValue > @minValueCalculated)) and
m.ShardMapId = @shardMapId and
m.ShardId = @shardId and
((MaxValue is null) or (MaxValue > @minValueCalculated)) and
((@maxValueCalculated is null) or (MinValue < @maxValueCalculated))
order by
order by
m.MinValue
end
@ -598,7 +609,7 @@ Error_LSMVersionMismatch:
goto Exit_Procedure;
Exit_Procedure:
end
end
go
---------------------------------------------------------------------------------------------------
@ -615,14 +626,14 @@ begin
@shardMapId uniqueidentifier,
@keyValue varbinary(128)
select
select
@lsmVersionMajorClient = x.value('(LsmVersion/MajorVersion)[1]', 'int'),
@lsmVersionMinorClient = x.value('(LsmVersion/MinorVersion)[1]', 'int'),
@shardMapId = x.value('(ShardMap/Id)[1]', 'uniqueidentifier'),
@keyValue = convert(varbinary(128), x.value('(Key/Value)[1]', 'varchar(258)'), 1)
from
from
@input.nodes('/FindShardMappingByKeyLocal') as t(x)
if (@lsmVersionMajorClient is null or @lsmVersionMinorClient is null or @shardMapId is null or @keyValue is null)
goto Error_MissingParameters;
@ -631,7 +642,7 @@ begin
declare @mapType int
select
select
@mapType = MapType
from
__ShardManagement.ShardMapsLocal
@ -642,33 +653,33 @@ begin
goto Error_ShardMapNotFound;
if (@mapType = 1)
begin
begin
select
3, m.MappingId, m.ShardMapId, m.MinValue, m.MaxValue, m.Status, m.LockOwnerId, -- fields for SqlMapping
s.ShardId, s.Version, s.ShardMapId, s.Protocol, s.ServerName, s.Port, s.DatabaseName, s.Status -- fields for SqlShard, ShardMapId is repeated here
from
__ShardManagement.ShardMappingsLocal m
join
join
__ShardManagement.ShardsLocal s
on
on
m.ShardId = s.ShardId
where
m.ShardMapId = @shardMapId and
m.ShardMapId = @shardMapId and
m.MinValue = @keyValue
end
else
begin
select
select
3, m.MappingId, m.ShardMapId, m.MinValue, m.MaxValue, m.Status, m.LockOwnerId, -- fields for SqlMapping
s.ShardId, s.Version, s.ShardMapId, s.Protocol, s.ServerName, s.Port, s.DatabaseName, s.Status -- fields for SqlShard, ShardMapId is repeated here
from
__ShardManagement.ShardMappingsLocal m
join
__ShardManagement.ShardsLocal s
on
from
__ShardManagement.ShardMappingsLocal m
join
__ShardManagement.ShardsLocal s
on
m.ShardId = s.ShardId
where
m.ShardMapId = @shardMapId and
m.ShardMapId = @shardMapId and
m.MinValue <= @keyValue and (m.MaxValue is null or m.MaxValue > @keyValue)
end
@ -697,7 +708,7 @@ Error_LSMVersionMismatch:
goto Exit_Procedure;
Exit_Procedure:
end
end
go
---------------------------------------------------------------------------------------------------
@ -730,12 +741,12 @@ begin
-- find shard map
declare @currentShardMapId uniqueidentifier
select
@currentShardMapId = ShardMapId
from
select
@currentShardMapId = ShardMapId
from
__ShardManagement.ShardMapsLocal
where
where
ShardMapId = @shardMapId
if (@currentShardMapId is null)
@ -743,13 +754,13 @@ begin
declare @m_status_current int
select
select
@m_status_current = Status
from
__ShardManagement.ShardMappingsLocal
where
ShardMapId = @shardMapId and MappingId = @mappingId
if (@m_status_current is null)
goto Error_MappingDoesNotExist;
@ -782,7 +793,7 @@ Error_LSMVersionMismatch:
goto Exit_Procedure;
Exit_Procedure:
end
end
go
---------------------------------------------------------------------------------------------------
@ -805,7 +816,7 @@ begin
@shardVersion uniqueidentifier
-- get operation information as well as number of steps information
select
select
@lsmVersionMajorClient = x.value('(LsmVersion/MajorVersion)[1]', 'int'),
@lsmVersionMinorClient = x.value('(LsmVersion/MinorVersion)[1]', 'int'),
@operationId = x.value('(@OperationId)[1]', 'uniqueidentifier'),
@ -813,7 +824,7 @@ begin
@shardMapId = x.value('(ShardMap/Id)[1]', 'uniqueidentifier'),
@shardId = x.value('(Shard/Id)[1]', 'uniqueidentifier'),
@shardVersion = x.value('(Shard/Version)[1]', 'uniqueidentifier')
from
from
@input.nodes('/BulkOperationShardMappingsLocal') as t(x)
if (@lsmVersionMajorClient is null or @lsmVersionMinorClient is null or @operationId is null or @stepsCount is null or @shardMapId is null or @shardId is null or @shardVersion is null)
@ -824,7 +835,7 @@ begin
-- check for reentrancy
if exists (
select
select
ShardId
from
__ShardManagement.ShardsLocal
@ -847,9 +858,9 @@ begin
while (@stepIndex <= @stepsCount)
begin
select
@currentStep = x.query('(./Step[@Id = sql:variable("@stepIndex")])[1]')
from
select
@currentStep = x.query('(./Step[@Id = sql:variable(""@stepIndex"")])[1]')
from
@input.nodes('/BulkOperationShardMappingsLocal/Steps') as t(x)
-- Identify the step type.
@ -858,7 +869,7 @@ begin
@stepMappingId = x.value('(Mapping/Id)[1]', 'uniqueidentifier')
from
@currentStep.nodes('./Step') as t(x)
if (@stepType is null or @stepMappingId is null)
goto Error_MissingParameters;
@ -878,9 +889,9 @@ begin
@stepMappingStatus int
-- AddMapping
select
select
@stepMinValue = convert(varbinary(128), x.value('(Mapping/MinValue)[1]', 'varchar(258)'), 1),
@stepMaxValue = convert(varbinary(128), x.value('(Mapping/MaxValue[@Null="0"])[1]', 'varchar(258)'), 1),
@stepMaxValue = convert(varbinary(128), x.value('(Mapping/MaxValue[@Null=""0""])[1]', 'varchar(258)'), 1),
@stepMappingStatus = x.value('(Mapping/Status)[1]', 'int')
from
@currentStep.nodes('./Step') as t(x)
@ -891,19 +902,19 @@ begin
-- add mapping
insert into
__ShardManagement.ShardMappingsLocal
(MappingId,
ShardId,
ShardMapId,
MinValue,
MaxValue,
(MappingId,
ShardId,
ShardMapId,
MinValue,
MaxValue,
Status,
LastOperationId)
values
(@stepMappingId,
@shardId,
@shardMapId,
@stepMinValue,
@stepMaxValue,
(@stepMappingId,
@shardId,
@shardMapId,
@stepMinValue,
@stepMaxValue,
@stepMappingStatus,
@operationId)
@ -934,9 +945,9 @@ Error_LSMVersionMismatch:
Success_Exit:
set @result = 1
goto Exit_Procedure;
Exit_Procedure:
end
end
go
---------------------------------------------------------------------------------------------------
@ -953,11 +964,11 @@ begin
@patternForKill nvarchar(128)
-- get operation information as well as number of steps information
select
select
@lsmVersionMajorClient = x.value('(LsmVersion/MajorVersion)[1]', 'int'),
@lsmVersionMinorClient = x.value('(LsmVersion/MinorVersion)[1]', 'int'),
@patternForKill = x.value('(Pattern)[1]', 'nvarchar(128)')
from
from
@input.nodes('/KillSessionsForShardMappingLocal') as t(x)
if (@lsmVersionMajorClient is null or @lsmVersionMinorClient is null or @patternForKill is null)
@ -969,31 +980,31 @@ begin
declare @tvKillCommands table (spid smallint primary key, commandForKill nvarchar(10))
-- insert empty row
insert into
@tvKillCommands (spid, commandForKill)
values
insert into
@tvKillCommands (spid, commandForKill)
values
(0, N'')
insert into
@tvKillCommands(spid, commandForKill)
select
insert into
@tvKillCommands(spid, commandForKill)
select
session_id, 'kill ' + convert(nvarchar(10), session_id)
from
sys.dm_exec_sessions
where
from
sys.dm_exec_sessions
where
session_id > 50 and program_name like '%' + @patternForKill + '%'
declare @currentSpid int,
declare @currentSpid int,
@currentCommandForKill nvarchar(10)
declare @current_error int
select top 1
@currentSpid = spid,
@currentCommandForKill = commandForKill
from
@tvKillCommands
order by
select top 1
@currentSpid = spid,
@currentCommandForKill = commandForKill
from
@tvKillCommands
order by
spid desc
while (@currentSpid > 0)
@ -1003,18 +1014,18 @@ begin
exec (@currentCommandForKill)
-- remove the current row
delete
@tvKillCommands
where
delete
@tvKillCommands
where
spid = @currentSpid
-- get next row
select top 1
@currentSpid = spid,
@currentCommandForKill = commandForKill
from
@tvKillCommands
order by
select top 1
@currentSpid = spid,
@currentCommandForKill = commandForKill
from
@tvKillCommands
order by
spid desc
end try
begin catch
@ -1026,7 +1037,7 @@ begin
set @result = 1
goto Exit_Procedure;
Error_UnableToKillSessions:
set @result = 305
goto Exit_Procedure;
@ -1042,9 +1053,12 @@ Error_LSMVersionMismatch:
goto Exit_Procedure;
Exit_Procedure:
end
end
go
-- update version as 1.1
insert into __ShardManagement.ShardMapManagerLocal values (1, 1)
go
");
}
}

Просмотреть файл

@ -1,3 +1,14 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement
{
/// <summary>
/// Utility properties and methods used for managing scripts and errors.
/// </summary>
internal static partial class Scripts
{
internal static readonly UpgradeScript UpgradeShardMapManagerLocalFrom1_1To1_2 = new UpgradeScript(1, 1, @"
-- Copyright (c) Microsoft. All rights reserved.
-- Licensed under the MIT license. See LICENSE file in the project root for full license information.
@ -10,19 +21,19 @@
if object_id(N'__ShardManagement.spUpdateShardLocal', N'P') is not null
begin
drop procedure __ShardManagement.spUpdateShardLocal
end
end
go
if object_id(N'__ShardManagement.spBulkOperationShardMappingsLocal', N'P') is not null
begin
drop procedure __ShardManagement.spBulkOperationShardMappingsLocal
end
end
go
if object_id(N'__ShardManagement.spAddShardLocal', N'P') is not null
begin
drop procedure __ShardManagement.spAddShardLocal
end
end
go
-- create new objects for version 1.2
@ -36,7 +47,7 @@ create procedure __ShardManagement.spUpdateShardLocal
@result int output
as
begin
declare @lsmVersionMajorClient int,
declare @lsmVersionMajorClient int,
@lsmVersionMinorClient int,
@operationId uniqueidentifier,
@shardMapId uniqueidentifier,
@ -48,7 +59,7 @@ begin
@databaseName nvarchar(128),
@shardStatus int
select
select
@lsmVersionMajorClient = x.value('(LsmVersion/MajorVersion)[1]', 'int'),
@lsmVersionMinorClient = x.value('(LsmVersion/MinorVersion)[1]', 'int'),
@operationId = x.value('(@OperationId)[1]', 'uniqueidentifier'),
@ -60,10 +71,10 @@ begin
@port = x.value('(Shard/Location/Port)[1]', 'int'),
@databaseName = x.value('(Shard/Location/DatabaseName)[1]', 'nvarchar(128)'),
@shardStatus = x.value('(Shard/Status)[1]', 'int')
from
from
@input.nodes('/UpdateShardLocal') as t(x)
if (@lsmVersionMajorClient is null or @lsmVersionMinorClient is null or @operationId is null or
if (@lsmVersionMajorClient is null or @lsmVersionMinorClient is null or @operationId is null or
@shardMapId is null or @shardId is null or @shardVersion is null or @shardStatus is null or
@protocol is null or @serverName is null or @port is null or @databaseName is null)
goto Error_MissingParameters;
@ -71,7 +82,7 @@ begin
if (@lsmVersionMajorClient <> __ShardManagement.fnGetStoreVersionMajorLocal())
goto Error_LSMVersionMismatch;
update
update
__ShardManagement.ShardsLocal
set
Version = @shardVersion,
@ -105,7 +116,7 @@ Error_ShardDoesNotExist:
goto Exit_Procedure;
Exit_Procedure:
end
end
go
---------------------------------------------------------------------------------------------------
@ -129,7 +140,7 @@ begin
@shardVersion uniqueidentifier
-- get operation information as well as number of steps information
select
select
@lsmVersionMajorClient = x.value('(LsmVersion/MajorVersion)[1]', 'int'),
@lsmVersionMinorClient = x.value('(LsmVersion/MinorVersion)[1]', 'int'),
@operationId = x.value('(@OperationId)[1]', 'uniqueidentifier'),
@ -138,7 +149,7 @@ begin
@shardMapId = x.value('(ShardMap/Id)[1]', 'uniqueidentifier'),
@shardId = x.value('(Shard/Id)[1]', 'uniqueidentifier'),
@shardVersion = x.value('(Shard/Version)[1]', 'uniqueidentifier')
from
from
@input.nodes('/BulkOperationShardMappingsLocal') as t(x)
if (@lsmVersionMajorClient is null or @lsmVersionMinorClient is null or @operationId is null or @stepsCount is null or @shardMapId is null or @shardId is null or @shardVersion is null)
@ -149,7 +160,7 @@ begin
-- check for reentrancy
if exists (
select
select
ShardId
from
__ShardManagement.ShardsLocal
@ -172,9 +183,9 @@ begin
while (@stepIndex <= @stepsCount)
begin
select
@currentStep = x.query('(./Step[@Id = sql:variable("@stepIndex")])[1]')
from
select
@currentStep = x.query('(./Step[@Id = sql:variable(""@stepIndex"")])[1]')
from
@input.nodes('/BulkOperationShardMappingsLocal/Steps') as t(x)
-- Identify the step type.
@ -183,7 +194,7 @@ begin
@stepMappingId = x.value('(Mapping/Id)[1]', 'uniqueidentifier')
from
@currentStep.nodes('./Step') as t(x)
if (@stepType is null or @stepMappingId is null)
goto Error_MissingParameters;
@ -203,9 +214,9 @@ begin
@stepMappingStatus int
-- AddMapping
select
select
@stepMinValue = convert(varbinary(128), x.value('(Mapping/MinValue)[1]', 'varchar(258)'), 1),
@stepMaxValue = convert(varbinary(128), x.value('(Mapping/MaxValue[@Null="0"])[1]', 'varchar(258)'), 1),
@stepMaxValue = convert(varbinary(128), x.value('(Mapping/MaxValue[@Null=""0""])[1]', 'varchar(258)'), 1),
@stepMappingStatus = x.value('(Mapping/Status)[1]', 'int')
from
@currentStep.nodes('./Step') as t(x)
@ -217,19 +228,19 @@ begin
begin try
insert into
__ShardManagement.ShardMappingsLocal
(MappingId,
ShardId,
ShardMapId,
MinValue,
MaxValue,
(MappingId,
ShardId,
ShardMapId,
MinValue,
MaxValue,
Status,
LastOperationId)
values
(@stepMappingId,
@shardId,
@shardMapId,
@stepMinValue,
@stepMaxValue,
(@stepMappingId,
@shardId,
@shardMapId,
@stepMinValue,
@stepMaxValue,
@stepMappingStatus,
@operationId)
end try
@ -242,7 +253,7 @@ begin
@errorState int = error_state(),
@errorLine int = error_line(),
@errorProcedure nvarchar(128) = isnull(error_procedure(), '-');
select @errorMessage = N'Error %d, Level %d, State %d, Procedure %s, Line %d, Message: ' + @errorMessage
raiserror (@errorMessage, @errorSeverity, 1, @errorNumber, @errorSeverity, @errorState, @errorProcedure, @errorLine);
rollback transaction; -- To avoid extra error message in response.
@ -282,9 +293,9 @@ Error_UnexpectedError:
Success_Exit:
set @result = 1
goto Exit_Procedure;
Exit_Procedure:
end
end
go
---------------------------------------------------------------------------------------------------
@ -296,7 +307,7 @@ create procedure __ShardManagement.spAddShardLocal
@result int output
as
begin
declare @lsmVersionMajorClient int,
declare @lsmVersionMajorClient int,
@lsmVersionMinorClient int,
@operationId uniqueidentifier,
@undo int,
@ -317,8 +328,8 @@ begin
@errorState int,
@errorLine int,
@errorProcedure nvarchar(128)
select
@lsmVersionMajorClient = x.value('(LsmVersion/MajorVersion)[1]', 'int'),
select
@lsmVersionMajorClient = x.value('(LsmVersion/MajorVersion)[1]', 'int'),
@lsmVersionMinorClient = x.value('(LsmVersion/MinorVersion)[1]', 'int'),
@operationId = x.value('(@OperationId)[1]', 'uniqueidentifier'),
@undo = x.value('(@Undo)[1]', 'int'),
@ -333,11 +344,11 @@ begin
@port = x.value('(Shard/Location/Port)[1]', 'int'),
@databaseName = x.value('(Shard/Location/DatabaseName)[1]', 'nvarchar(128)'),
@shardStatus = x.value('(Shard/Status)[1]', 'int')
from
from
@input.nodes('/AddShardLocal') as t(x)
if (@lsmVersionMajorClient is null or @lsmVersionMinorClient is null or @shardMapId is null or @operationId is null or @name is null or @sm_kind is null or @sm_keykind is null or
@shardId is null or @shardVersion is null or @protocol is null or @serverName is null or
if (@lsmVersionMajorClient is null or @lsmVersionMinorClient is null or @shardMapId is null or @operationId is null or @name is null or @sm_kind is null or @sm_keykind is null or
@shardId is null or @shardVersion is null or @protocol is null or @serverName is null or
@port is null or @databaseName is null or @shardStatus is null)
goto Error_MissingParameters;
@ -346,7 +357,7 @@ begin
-- check for reentrancy
if exists (
select
select
ShardMapId
from
__ShardManagement.ShardMapsLocal
@ -356,10 +367,10 @@ begin
-- add shard map row, ignore duplicate inserts in this is part of undo operation
begin try
insert into
__ShardManagement.ShardMapsLocal
insert into
__ShardManagement.ShardMapsLocal
(ShardMapId, Name, MapType, KeyType, LastOperationId)
values
values
(@shardMapId, @name, @sm_kind, @sm_keykind, @operationId)
end try
begin catch
@ -370,7 +381,7 @@ begin
set @errorSeverity = error_severity();
set @errorState = error_state();
set @errorLine = error_line();
set @errorProcedure = isnull(error_procedure(), '-');
set @errorProcedure = isnull(error_procedure(), '-');
select @errorMessage = N'Error %d, Level %d, State %d, Procedure %s, Line %d, Message: ' + @errorMessage
raiserror (@errorMessage, @errorSeverity, 1, @errorNumber, @errorSeverity, @errorState, @errorProcedure, @errorLine);
rollback transaction; -- To avoid extra error message in response.
@ -380,25 +391,25 @@ begin
-- add shard row, ignore duplicate inserts if this is part of undo operation
begin try
insert into
insert into
__ShardManagement.ShardsLocal(
ShardId,
Version,
ShardMapId,
Protocol,
ServerName,
Port,
DatabaseName,
ShardId,
Version,
ShardMapId,
Protocol,
ServerName,
Port,
DatabaseName,
Status,
LastOperationId)
values (
@shardId,
@shardVersion,
@shardId,
@shardVersion,
@shardMapId,
@protocol,
@serverName,
@port,
@databaseName,
@protocol,
@serverName,
@port,
@databaseName,
@shardStatus,
@operationId)
end try
@ -411,13 +422,13 @@ begin
set @errorState = error_state();
set @errorLine = error_line();
set @errorProcedure = isnull(error_procedure(), '-');
select @errorMessage = N'Error %d, Level %d, State %d, Procedure %s, Line %d, Message: ' + @errorMessage
raiserror (@errorMessage, @errorSeverity, 1, @errorNumber, @errorSeverity, @errorState, @errorProcedure, @errorLine);
rollback transaction; -- To avoid extra error message in response.
goto Error_UnexpectedError;
end
end catch
end catch
goto Success_Exit;
@ -438,16 +449,19 @@ Error_UnexpectedError:
Success_Exit:
set @result = 1
goto Exit_Procedure;
Exit_Procedure:
end
end
go
-- update version as 1.2
update
__ShardManagement.ShardMapManagerLocal
set
__ShardManagement.ShardMapManagerLocal
set
StoreVersionMinor = 2
where
StoreVersionMajor = 1 and StoreVersionMinor = 1
go
");
}
}

Просмотреть файл

@ -1,3 +1,14 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement
{
/// <summary>
/// Utility properties and methods used for managing scripts and errors.
/// </summary>
internal static partial class Scripts
{
internal static readonly UpgradeScript UpgradeShardMapManagerLocalFrom1000_0To1000_1 = new UpgradeScript(1000, 0, @"
-- Copyright (c) Microsoft. All rights reserved.
-- Licensed under the MIT license. See LICENSE file in the project root for full license information.
@ -11,3 +22,6 @@ begin
alter table __ShardManagement.ShardMapManagerLocal drop column UpgradeLock
end
go
");
}
}

Просмотреть файл

@ -243,9 +243,9 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement
{
int h;
h = ShardKey.QPHash(this.Protocol.GetHashCode(), this.DataSource.ToUpper(CultureInfo.InvariantCulture).GetHashCode());
h = ShardKey.QPHash(this.Protocol.GetHashCode(), this.DataSource.ToUpperInvariant().GetHashCode());
h = ShardKey.QPHash(h, this.Port.GetHashCode());
h = ShardKey.QPHash(h, this.Database.ToUpper(CultureInfo.InvariantCulture).GetHashCode());
h = ShardKey.QPHash(h, this.Database.ToUpperInvariant().GetHashCode());
return h;
}

Просмотреть файл

@ -319,6 +319,8 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement
this.ErrorCode = code;
}
#region Serialization Support
/// <summary>
/// Initializes a new instance with serialized data.
/// </summary>
@ -331,7 +333,6 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement
this.ErrorCode = (ShardManagementErrorCode)info.GetValue("ErrorCode", typeof(ShardManagementErrorCode));
}
#region Serialization Support
/// <summary>
/// Populates a SerializationInfo with the data needed to serialize the target object.

Просмотреть файл

@ -104,7 +104,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement
{
if (reader.FieldCount > 0)
{
SqlResultType resultType = SqlResults.SqlResultTypeFromColumnName(reader.GetSchemaTable().Rows[1]["ColumnName"].ToString());
SqlResultType resultType = SqlResults.SqlResultTypeFromColumnName(reader.GetName(1));
switch (resultType)
{
@ -179,7 +179,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement
{
if (reader.FieldCount > 0)
{
SqlResultType resultType = SqlResults.SqlResultTypeFromColumnName(reader.GetSchemaTable().Rows[1]["ColumnName"].ToString());
SqlResultType resultType = SqlResults.SqlResultTypeFromColumnName(reader.GetName(1));
switch (resultType)
{

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,20 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.Reflection;
namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement.Utils
{
internal static class ReflectionUtils
{
public static Assembly GetAssembly(this Type type)
{
#if NETFRAMEWORK
return type.Assembly;
#else
return type.GetTypeInfo().Assembly;
#endif
}
}
}

Просмотреть файл

@ -10,6 +10,7 @@ using System.Data.SqlTypes;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Text;
using System.Text.RegularExpressions;
@ -491,38 +492,13 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement
{
List<UpgradeSteps> upgradeSteps = new List<UpgradeSteps>();
ResourceSet rs = Scripts.ResourceManager.GetResourceSet(System.Globalization.CultureInfo.CurrentCulture, true, true);
IEnumerable<Scripts.UpgradeScript> upgradeScripts = parseLocal ? Scripts.UpgradeLocalScripts : Scripts.UpgradeGlobalScripts;
string upgradeFileNameFilter = @"^UpgradeShardMapManagerGlobalFrom(\d*).(\d*)";
if (parseLocal)
foreach (var entry in upgradeScripts)
{
upgradeFileNameFilter = upgradeFileNameFilter.Replace("Global", "Local");
}
Regex fileNameRegEx = new Regex(
upgradeFileNameFilter,
RegexOptions.IgnoreCase | RegexOptions.CultureInvariant);
// Filter upgrade scripts based on file name and order by initial Major.Minor version
var upgradeScriptObjects = from r in rs.Cast<DictionaryEntry>()
let m = fileNameRegEx.Match(r.Key.ToString())
where
m.Success
orderby new Version(Convert.ToInt32(m.Groups[1].Value), Convert.ToInt32(m.Groups[2].Value))
select new
{
Key = r.Key,
Value = r.Value,
initialMajorVersion = Convert.ToInt32(m.Groups[1].Value),
initialMinorVersion = Convert.ToInt32(m.Groups[2].Value)
};
foreach (var entry in upgradeScriptObjects)
{
foreach (StringBuilder cmd in SplitScriptCommands(entry.Value.ToString()))
foreach (StringBuilder cmd in SplitScriptCommands(entry.Script))
{
upgradeSteps.Add(new UpgradeSteps(entry.initialMajorVersion, entry.initialMinorVersion, cmd));
upgradeSteps.Add(new UpgradeSteps(entry.InitialMajorVersion, entry.InitialMinorVersion, cmd));
}
}

Просмотреть файл

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>
<PropertyGroup>
<RelativeOutputPath>Product\$(RelativeOutputPath)</RelativeOutputPath>
</PropertyGroup>
<Import Project="$(MSBuildThisFileDirectory)\..\Build.props" />
</Project>

Просмотреть файл

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Build.props))\Build.props" />
<ItemGroup>
<ProjectFile Include="ElasticScale.Client\ElasticScale.Client.csproj" />
</ItemGroup>
<Import Project="$(BuildExtensionsPath)\Traversal.targets" />
</Project>

Просмотреть файл

@ -274,8 +274,6 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Test.Common
return;
}
Trace.TraceError("Expected: [{0}]", expectedArray.ToCommaSeparatedString());
Trace.TraceError("Actual: [{0}]", actualArray.ToCommaSeparatedString());
Assert.Fail(
"Sequences were not equal. Message: {0}. Expected sequence had {1} elements, actual had {2}. Comma separated contents for expected: <{3}>, for actual: <{4}>",
message,
@ -320,8 +318,6 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Test.Common
}
}
Trace.TraceError("Expected: [{0}]", expectedArray.ToCommaSeparatedString());
Trace.TraceError("Actual: [{0}]", actualArray.ToCommaSeparatedString());
Assert.Fail(
"Sequences were not equivalent. Message: {0}. Expected sequence had {1} elements, actual had {2}. Comma separated contents for expected: <{3}>, for actual: <{4}>",
message,

Просмотреть файл

@ -0,0 +1,22 @@
using System;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
namespace Microsoft.Azure.SqlDatabase.ElasticScale.Test.Common
{
public static class CommonTestUtils
{
public static T SerializeDeserialize<T>(T originalException) where T : Exception
{
using (MemoryStream memStream = new MemoryStream())
{
BinaryFormatter formatter = new BinaryFormatter();
formatter.Serialize(memStream, originalException);
memStream.Seek(0, SeekOrigin.Begin);
return (T)formatter.Deserialize(memStream);
}
}
}
}

Просмотреть файл

@ -1,49 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{13200c7c-8606-47b8-a004-570b56e3a9a8}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Microsoft.Azure.SqlDatabase.ElasticScale.ClientTestCommon</RootNamespace>
<AssemblyName>Microsoft.Azure.SqlDatabase.ElasticScale.ClientTestCommon</AssemblyName>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Build.props))\Build.props" />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<DefineConstants>$(DefineConstants);DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<DefineConstants>$(DefineConstants);TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
</ItemGroup>
<Choose>
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
</ItemGroup>
</When>
<Otherwise>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
</ItemGroup>
</Otherwise>
</Choose>
<ItemGroup>
<Compile Include="AssertExtensions.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

Просмотреть файл

@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net451;netstandard2.0</TargetFrameworks>
</PropertyGroup>
<Import Project="$([MSBuild]::GetPathOfFileAbove('build.props'))" />
<ItemGroup>
<PackageReference Include="MSTest.TestFramework" Version="1.1.18" />
</ItemGroup>
</Project>

Просмотреть файл

@ -4,30 +4,9 @@ using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ElasticScale.Test.Common")]
[assembly: AssemblyDescription("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
[assembly: CLSCompliant(true)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
// [assembly: AssemblyVersion("1.0.0.0")]
// [assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: NeutralResourcesLanguage("en-US")]

Просмотреть файл

@ -0,0 +1,14 @@
using System.Data;
namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query.UnitTests
{
#if !NET451
static class DataSetExtensions
{
public static T Field<T>(this DataRow dataSet, int index)
{
return (T)dataSet[index];
}
}
#endif
}

Просмотреть файл

@ -1,115 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{56DDEC7E-0B14-4636-B287-DB38DEC55192}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Microsoft.Azure.SqlDatabase.ElasticScale.Query</RootNamespace>
<AssemblyName>Microsoft.Azure.SqlDatabase.ElasticScale.Query.UnitTests</AssemblyName>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType>
</PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Build.props))\Build.props" />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<DefineConstants>$(DefineConstants);DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<DefineConstants>$(DefineConstants);TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Transactions" />
<Reference Include="System.XML" />
</ItemGroup>
<Choose>
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
</ItemGroup>
</When>
<Otherwise>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
</ItemGroup>
</Otherwise>
</Choose>
<ItemGroup>
<Compile Include="MultiShardTestCaseColumn.cs" />
<Compile Include="MockSqlCommand.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="MockSqlConnection.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="MockSqlDataReader.cs" />
<Compile Include="MultiShardDataReaderTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="MultiShardQueryE2ETests.cs" />
<Compile Include="MultiShardTestUtils.cs" />
<Compile Include="MultiShardUnitTests.cs" />
<Compile Include="ProxyServer.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config">
<SubType>Designer</SubType>
</None>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Service References\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ElasticScale.ClientTestCommon\ElasticScale.ClientTestCommon.csproj">
<Project>{13200c7c-8606-47b8-a004-570b56e3a9a8}</Project>
<Name>ClientTestCommon</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Src\ElasticScale.Client\ElasticScale.Client.csproj">
<Project>{663D22BB-483A-46B0-A504-861C5335DAD1}</Project>
<Name>Microsoft.Azure.SqlDatabase.ElasticScale.Client</Name>
</ProjectReference>
</ItemGroup>
<Choose>
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
</ItemGroup>
</When>
</Choose>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

Просмотреть файл

@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net452;netcoreapp2.0</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup>
<Import Project="$([MSBuild]::GetPathOfFileAbove('build.props'))" />
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0-preview-20170628-02" />
<PackageReference Include="MSTest.TestAdapter" Version="1.1.18" />
<PackageReference Include="MSTest.TestFramework" Version="1.1.18" />
<PackageReference Include="System.Data.SqlClient" Version="4.4.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Src\ElasticScale.Client\Microsoft.Azure.SqlDatabase.ElasticScale.Client.csproj" />
<ProjectReference Include="..\ElasticScale.ClientTestCommon\Microsoft.Azure.SqlDatabase.ElasticScale.ClientTestCommon.csproj" />
</ItemGroup>
</Project>

Просмотреть файл

@ -167,15 +167,6 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query.UnitTests
throw new NotSupportedException();
}
/// <summary>
/// </summary>
/// <param name="isolationLevel"></param>
/// <returns></returns>
public override void EnlistTransaction(System.Transactions.Transaction transaction)
{
throw new NotSupportedException();
}
/// <summary>
/// </summary>
/// <param name="databaseName"></param>

Просмотреть файл

@ -10,7 +10,9 @@ using System.Collections;
using System.Data;
using System.Data.Common;
using System.IO;
#if NETFRAMEWORK
using System.Runtime.Remoting;
#endif
using System.Threading;
using System.Threading.Tasks;
@ -52,7 +54,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query.UnitTests
}
/// <summary>
/// Gets the number of columns in the current row.
/// Gets the number of columns in the current row.
/// </summary>
public override int FieldCount
{
@ -60,7 +62,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query.UnitTests
}
/// <summary>
/// Gets a value that indicates whether this DbDataReader contains one or more rows.
/// Gets a value that indicates whether this DbDataReader contains one or more rows.
/// </summary>
public override bool HasRows
{
@ -99,7 +101,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query.UnitTests
}
/// <summary>
/// Gets the number of rows changed, inserted, or deleted by execution of the SQL statement.
/// Gets the number of rows changed, inserted, or deleted by execution of the SQL statement.
/// </summary>
/// <remarks>
/// However, from the SqlDataReader source, it looks like the property is updated before the reader is closed
@ -154,6 +156,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query.UnitTests
_isClosed = false;
}
#if NETFRAMEWORK
/// <summary>
/// Not implemented
///</summary>
@ -161,6 +164,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query.UnitTests
{
throw new NotImplementedException();
}
#endif
/// <summary>
/// Gets the value of the specified column as a Boolean.
@ -183,7 +187,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query.UnitTests
}
/// <summary>
/// Reads a stream of bytes from the specified column, starting at location indicated by dataOffset, into the
/// Reads a stream of bytes from the specified column, starting at location indicated by dataOffset, into the
/// buffer, starting at the location indicated by bufferOffset.
/// </summary>
/// <param name="ordinal">The zero-based column ordinal.</param>
@ -208,7 +212,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query.UnitTests
}
/// <summary>
/// Reads a stream of characters from the specified column, starting at location indicated by dataOffset, into
/// Reads a stream of characters from the specified column, starting at location indicated by dataOffset, into
/// the buffer, starting at the location indicated by bufferOffset.
/// </summary>
/// <param name="ordinal">The zero-based column ordinal.</param>
@ -243,7 +247,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query.UnitTests
}
/// <summary>
/// Returns a DbDataReader object for the requested column ordinal that can be overridden with a
/// Returns a DbDataReader object for the requested column ordinal that can be overridden with a
/// provider-specific implementation.
/// </summary>
/// <param name="ordinal">The zero-based column ordinal.</param>
@ -544,6 +548,6 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query.UnitTests
base.Dispose(disposing);
}
#endregion
#endregion
}
}

Просмотреть файл

@ -2,14 +2,14 @@
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
// Purpose:
// Basic unit testing for the MultiShardDataReader class. Will integrate with
// Basic unit testing for the MultiShardDataReader class. Will integrate with
// build at a later date.
//
// Notes:
// Aim is to integrate this within a broader cleint-side wrapper framework.
// As a result, unit testing will likely be relatively significantly
// restructured once we have the rest of the wrapper classes in place.
// *NOTE: Unit tests currently assume that a sql server instance is
// *NOTE: Unit tests currently assume that a sql server instance is
// accessible on localhost.
// *NOTE: Unit tests will blow away and recreate databases called Test1, Test2,
// and Test3. Should change these database names to guids at some point, but
@ -29,7 +29,9 @@ using System.Data;
using System.Data.Common;
using System.Data.SqlClient;
using System.Diagnostics;
#if NETFRAMEWORK
using System.Runtime.Remoting;
#endif
using System.IO;
using System.Threading.Tasks;
using System.Threading;
@ -37,7 +39,7 @@ using System.Threading;
namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query.UnitTests
{
/// <summary>
/// Very basic unit tests for the MultiShardDataReader class.
/// Very basic unit tests for the MultiShardDataReader class.
/// Just enough to ensure that simple scenarios working as expected.
/// </summary>
[TestClass]
@ -71,7 +73,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query.UnitTests
///</summary>
public TestContext TestContext { get; set; }
#region Additional test attributes
#region Additional test attributes
/// <summary>
/// Sets up our three test databases that we drive the unit testing off of.
@ -146,7 +148,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query.UnitTests
}
}
#endregion
#endregion
/// <summary>
/// Validate MultiShardDataReader can be supplied as argument to DataTable.Load
@ -328,8 +330,8 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query.UnitTests
}
/// <summary>
/// Check that we collect an exception and expose it on the ShardedReader
/// when encountering schema mismatches across result sets due to different
/// Check that we collect an exception and expose it on the ShardedReader
/// when encountering schema mismatches across result sets due to different
/// column names.
/// </summary>
[TestMethod]
@ -337,7 +339,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query.UnitTests
public void TestMismatchedSchemasWrongColumnName()
{
// What we're doing:
// Issue different queries to readers 1 & 2 so that we have the same column count and types but we have a
// Issue different queries to readers 1 & 2 so that we have the same column count and types but we have a
// column name mismatch.
// Try to load them into a MultiShardDataReader.
// Should see an exception on the MultiShardDataReader.
@ -373,7 +375,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query.UnitTests
}
/// <summary>
/// Check that we throw as expected when encountering schema mismatches across result sets due to different
/// Check that we throw as expected when encountering schema mismatches across result sets due to different
/// column types.
/// </summary>
[TestMethod]
@ -381,7 +383,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query.UnitTests
public void TestMismatchedSchemasWrongType()
{
// What we're doing:
// Issue different queries to readers 1 & 2 so that we have the same column count and names but we have a
// Issue different queries to readers 1 & 2 so that we have the same column count and names but we have a
// column type mismatch.
// Try to load them into a MultiShardDataReader.
// Should see an exception on the MultiShardDataReader.
@ -495,9 +497,9 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query.UnitTests
}
/// <summary>
/// Validate ReadAsync() behavior when multiple data readers are involved. This test is same as existing test TestMiddleResultEmptyOnSelect
/// Validate ReadAsync() behavior when multiple data readers are involved. This test is same as existing test TestMiddleResultEmptyOnSelect
/// except that we are using ReadAsync() in this case instead of Read() to read individual rows.
///
///
/// NOTE: We needn't replicate every single Read() test for ReadAsync() since Read() ends up calling ReadAsync().Result under the
/// hood. So, by validating Read(), we are also validating ReadAsync() indirectly.
/// </summary>
@ -575,7 +577,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query.UnitTests
// Create a new task that would try to read rows off the second shard while they are locked by the previous task
// and block therefore.
Task readToBlockTask = Task.Factory.StartNew(() =>
Task readToBlockTask = Task.Factory.StartNew(() =>
{
string selectSql = string.Format(
"SELECT dbNameField, Test_int_Field, Test_bigint_Field FROM ConsistentShardedTable WHERE dbNameField='{0}'",
@ -604,7 +606,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query.UnitTests
Assert.IsTrue(ex != null, "A task canceled exception was not received upon cancellation.");
}
// Set the event signaling the first task to rollback its update transaction.
rollback.Set();
@ -620,8 +622,8 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query.UnitTests
{
// The code below exposes a flaw in our current implementation related to
// CompleteResults semantics and the internal c-tor. The flaw does not
// leak out to customers because the MultiShardCommand object manages the
// necessary logic, but we need to patch the flaw so it doesn't end up
// leak out to customers because the MultiShardCommand object manages the
// necessary logic, but we need to patch the flaw so it doesn't end up
// inadvertently leaking out to customers.
// See VSTS 2616238 (i believe). Philip will be modofying logic and
// augmenting tests to deal with this issue.
@ -656,8 +658,8 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query.UnitTests
{
// The code below exposes a flaw in our current implementation related to
// CompleteResults semantics and the internal c-tor. The flaw does not
// leak out to customers because the MultiShardCommand object manages the
// necessary logic, but we need to patch the flaw so it doesn't end up
// leak out to customers because the MultiShardCommand object manages the
// necessary logic, but we need to patch the flaw so it doesn't end up
// inadvertently leaking out to customers.
// See VSTS 2616238 (i believe). Philip will be modofying logic and
// augmenting tests to deal with this issue.
@ -686,7 +688,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query.UnitTests
/// <summary>
/// Validate that we throw an exception and invalidate the
/// MultiShardDataReader when we encounter a reader that has
/// MultiShardDataReader when we encounter a reader that has
/// multiple result sets
/// </summary>
[TestMethod]
@ -791,8 +793,8 @@ SELECT dbNameField, Test_int_Field, Test_bigint_Field FROM ConsistentShardedTab
{
// The code below exposes a flaw in our current implementation related to
// CompleteResults semantics and the internal c-tor. The flaw does not
// leak out to customers because the MultiShardCommand object manages the
// necessary logic, but we need to patch the flaw so it doesn't end up
// leak out to customers because the MultiShardCommand object manages the
// necessary logic, but we need to patch the flaw so it doesn't end up
// inadvertently leaking out to customers.
// See VSTS 2616238 (i believe). Philip will be modofying logic and
// augmenting tests to deal with this issue.
@ -858,9 +860,9 @@ SELECT dbNameField, Test_int_Field, Test_bigint_Field FROM ConsistentShardedTab
LabeledDbDataReader[] readers = new LabeledDbDataReader[0];
using (MultiShardDataReader sdr = new MultiShardDataReader(
_dummyCommand,
_dummyCommand,
readers,
MultiShardExecutionPolicy.CompleteResults,
MultiShardExecutionPolicy.CompleteResults,
addShardNamePseudoColumn: true,
expectedReaderCount: connections.Count))
{
@ -900,7 +902,7 @@ SELECT dbNameField, Test_int_Field, Test_bigint_Field FROM ConsistentShardedTab
}
/// <summary>
/// Check that we successfuly support the asynchronous addition of readers while we are in the process of reading, when we start
/// Check that we successfuly support the asynchronous addition of readers while we are in the process of reading, when we start
/// with some readers already added.
/// </summary>
[TestMethod]
@ -917,9 +919,9 @@ SELECT dbNameField, Test_int_Field, Test_bigint_Field FROM ConsistentShardedTab
};
using (MultiShardDataReader sdr = new MultiShardDataReader(
_dummyCommand,
readers,
MultiShardExecutionPolicy.CompleteResults,
_dummyCommand,
readers,
MultiShardExecutionPolicy.CompleteResults,
addShardNamePseudoColumn: true,
expectedReaderCount: connections.Count))
{
@ -1035,7 +1037,7 @@ SELECT dbNameField, Test_int_Field, Test_bigint_Field FROM ConsistentShardedTab
}
}
#if NETFRAMEWORK
/// <summary>
/// Check that we throw as expected when trying to call CreateObjRef.
/// </summary>
@ -1056,6 +1058,7 @@ SELECT dbNameField, Test_int_Field, Test_bigint_Field FROM ConsistentShardedTab
sdr.CreateObjRef(typeof(MultiShardDataReader));
}
}
#endif
/// <summary>
/// Check that we can iterate through the result sets as expected comparing all the values
@ -1158,7 +1161,7 @@ SELECT dbNameField, Test_int_Field, Test_bigint_Field FROM ConsistentShardedTab
}
}
#region Helpers
#region Helpers
private void ExpectException<T>(Func<int, object> func, int ordinal) where T : Exception
{
@ -1207,14 +1210,14 @@ SELECT dbNameField, Test_int_Field, Test_bigint_Field FROM ConsistentShardedTab
private void VerifyAllGettersPositiveCases(MultiShardDataReader reader, MutliShardTestCaseColumn column, int ordinal)
{
// General pattern here:
// Grab the value through the regular getter, through the getValue,
// through the sync GetFieldValue, and through the async GetFieldValue to ensure we are
// Grab the value through the regular getter, through the getValue,
// through the sync GetFieldValue, and through the async GetFieldValue to ensure we are
// getting back the same thing from all calls.
//
// Then grab through the Sql getter to make sure it works. (should we compare again?)
//
// Then verify that the field types are as we expect.
//
//
// Note: For the array-based getters we can't do the sync/async comparison.
//
@ -1237,7 +1240,7 @@ SELECT dbNameField, Test_int_Field, Test_bigint_Field FROM ConsistentShardedTab
// And these are indexes into our SQL type array.
//
//
int SqlValueResult = 0;
int SqlGetResult = 1;
object[] sqlResults = new object[SqlGetResult + 1];
@ -1649,6 +1652,6 @@ SELECT dbNameField, Test_int_Field, Test_bigint_Field FROM ConsistentShardedTab
return sdr;
}
#endregion Helpers
#endregion Helpers
}
}

Просмотреть файл

@ -45,12 +45,6 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query.UnitTests
/// </summary>
private static string s_dbNameField = "dbNameField";
/// <summary>
/// SqlCredential encapsulating the testUserId and testPassword that we will use
/// when opening connections to shards when issuing a fanout query.
/// </summary>
private static SqlCredential s_testCredential = GenerateDefaultSqlCredential();
/// <summary>
/// Connection string for local shard user.
/// </summary>
@ -166,15 +160,6 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query.UnitTests
ExecuteNonQueries("master", commands);
}
/// <summary>
/// Simple helper to obtain the SqlCredential to use in running our tests.
/// </summary>
/// <returns>The test username and password packaged up into a SqlCredential object.</returns>
internal static SqlCredential GetTestSqlCredential()
{
return s_testCredential;
}
/// <summary>
/// Helper method that alters the column name on one of our test tables in one of our test databases.
/// Useful for inducing a schema mismatch to test our failure handling.
@ -251,26 +236,6 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query.UnitTests
return rVal;
}
/// <summary>
/// Static helper that populates our defualt password into a SecureString.
/// </summary>
/// <returns>The default password encoded in a SecureString.</returns>
private static SqlCredential GenerateDefaultSqlCredential()
{
SecureString ss = new SecureString();
char[] pwdChars = s_testPassword.ToCharArray();
for (int i = 0; i < pwdChars.Length; i++)
{
ss.AppendChar(pwdChars[i]);
}
// Need to mark it as read only to avoid an ArgumentException in the SqlCredential c-tor.
//
ss.MakeReadOnly();
return new SqlCredential(s_testUserId, ss);
}
/// <summary>
/// Helper to populate a list with our test database names.
/// </summary>

Просмотреть файл

@ -14,12 +14,11 @@ using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Data;
using System.Data.Common;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement;
using Microsoft.Azure.SqlDatabase.ElasticScale.Test.Common;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query.UnitTests
@ -570,9 +569,14 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query.UnitTests
MultiShardAggregateException aggEx = new MultiShardAggregateException(exList);
TestSerialization<MultiShardException>(innerEx1);
TestSerialization<MultiShardException>(innerEx2);
TestSerialization<MultiShardAggregateException>(aggEx);
MultiShardException deserialized1 = CommonTestUtils.SerializeDeserialize(innerEx1);
CompareForEquality(innerEx1, deserialized1);
MultiShardException deserialized2 = CommonTestUtils.SerializeDeserialize(innerEx2);
CompareForEquality(innerEx2, deserialized2);
MultiShardAggregateException deserialized3 = CommonTestUtils.SerializeDeserialize(aggEx);
CompareForEquality(aggEx, deserialized3);
}
/// <summary>
@ -737,20 +741,6 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.Query.UnitTests
#endregion
private void TestSerialization<T>(T originalException) where T : Exception
{
MemoryStream memStream = new MemoryStream();
BinaryFormatter formatter = new BinaryFormatter();
formatter.Serialize(memStream, originalException);
memStream.Seek(0, SeekOrigin.Begin);
T deserializedException = (T)formatter.Deserialize(memStream);
memStream.Close();
CompareForEquality(originalException, deserializedException);
}
private void CompareForEquality(Exception first, Exception second)
{
Assert.AreEqual(first.GetType(), second.GetType());

Просмотреть файл

@ -5,14 +5,8 @@ using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Microsoft.Azure.SqlDatabase.ElasticScale.Query.UnitTests")]
[assembly: AssemblyDescription("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

Просмотреть файл

@ -14,7 +14,6 @@
<TestProjectType>WebTest</TestProjectType>
<IsCodedUITest>False</IsCodedUITest>
</PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Build.props))\Build.props" />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
@ -69,7 +68,7 @@
</Choose>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,145 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{EA7DA8D7-6B11-4AF7-9C24-6FEEBDA7E188}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement.UnitTests</RootNamespace>
<AssemblyName>Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement.UnitTests</AssemblyName>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<EnableFakes>true</EnableFakes>
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType>
</PropertyGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Build.props))\Build.props" />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<DefineConstants>$(DefineConstants);DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<DefineConstants>$(DefineConstants);TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<Choose>
<When Condition="'$(StandaloneBuild)' == 'true'" />
<Otherwise>
<ItemGroup>
<Reference Include="Microsoft.Azure.SqlDatabase.ElasticScale.Client.Fakes, Version=$(VersionMajor).$(VersionMinor).0.0, Culture=neutral, PublicKeyToken=0ae41878053f6703, processorArchitecture=MSIL" />
</ItemGroup>
</Otherwise>
</Choose>
<ItemGroup>
<Reference Include="$(NugetPack)\EnterpriseLibrary.TransientFaultHandling.6.0.1304.0\lib\portable-net45+win+wp8\Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling.dll">
<Name>Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling</Name>
</Reference>
<Reference Include="$(NugetPack)\EnterpriseLibrary.TransientFaultHandling.Data.6.0.1304.1\lib\net45\Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling.Data.dll">
<Name>Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling.Data</Name>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Runtime.Serialization" />
<Reference Include="System.XML" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<Choose>
<When Condition="('$(VisualStudioVersion)' == '10.0' or '$(VisualStudioVersion)' == '') and '$(TargetFrameworkVersion)' == 'v3.5'">
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
</ItemGroup>
</When>
<Otherwise>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework" />
</ItemGroup>
</Otherwise>
</Choose>
<ItemGroup>
<Compile Include="DateTimeShardMapperTests.cs" />
<Compile Include="Decorators\CacheStoreDecorator.cs" />
<Compile Include="Decorators\CountingCacheStore.cs" />
<Compile Include="Decorators\StoreOperationDecorator.cs" />
<Compile Include="Stubs\IStubBehavior.cs" />
<Compile Include="Stubs\StubAddMappingOperation.cs" />
<Compile Include="Stubs\StubAddShardOperation.cs" />
<Compile Include="Stubs\StubBehaviors.cs" />
<Compile Include="Stubs\StubCacheStore.cs" />
<Compile Include="Stubs\StubFindMappingByKeyGlobalOperation.cs" />
<Compile Include="Stubs\StubICacheStoreMapping.cs" />
<Compile Include="Stubs\StubRemoveMappingOperation.cs" />
<Compile Include="Stubs\StubRemoveShardOperation.cs" />
<Compile Include="Stubs\StubReplaceMappingsOperation.cs" />
<Compile Include="Stubs\StubSqlStoreConnectionFactory.cs" />
<Compile Include="Stubs\StubStoreOperationFactory.cs" />
<Compile Include="RecoveryManagerTests.cs" />
<Compile Include="Globals.cs" />
<Compile Include="ScenarioTests.cs" />
<Compile Include="ShardKeyInfo.cs" />
<Compile Include="ShardKeyTests.cs" />
<Compile Include="ShardKeyTypeInfo.cs" />
<Compile Include="ShardMapFaultHandlingTests.cs" />
<Compile Include="ShardMapManagerConcurrencyTests.cs" />
<Compile Include="ShardMapManagerTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ShardMapManagerUpgradeTests.cs" />
<Compile Include="ShardMapperTests.cs" />
<Compile Include="ShardMapManagerLoadTests.cs" />
<Compile Include="ShardMapTests.cs" />
<Compile Include="ShardMapManagerFactoryTests.cs" />
<Compile Include="SchemaInfoCollectionTests.cs" />
<Compile Include="ShardRangeTests.cs" />
<Compile Include="Stubs\StubUpdateMappingOperation.cs" />
<Compile Include="Stubs\StubUpdateShardOperation.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ElasticScale.ClientTestCommon\ElasticScale.ClientTestCommon.csproj">
<Project>{13200c7c-8606-47b8-a004-570b56e3a9a8}</Project>
<Name>ClientTestCommon</Name>
</ProjectReference>
<ProjectReference Include="..\..\Src\ElasticScale.Client\ElasticScale.Client.csproj">
<Project>{663d22bb-483a-46b0-a504-861c5335dad1}</Project>
<Name>Microsoft.Azure.SqlDatabase.ElasticScale.Client</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="App.config">
<SubType>Designer</SubType>
</None>
<None Include="packages.config" />
</ItemGroup>
<Choose>
<When Condition="'$(VisualStudioVersion)' == '10.0' And '$(IsCodedUITest)' == 'True'">
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.QualityTools.CodedUITestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITest.Extension, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestTools.UITesting, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<Private>False</Private>
</Reference>
</ItemGroup>
</When>
</Choose>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

Просмотреть файл

@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net451;netcoreapp2.0</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup>
<Import Project="$([MSBuild]::GetPathOfFileAbove('build.props'))" />
<ItemGroup>
<PackageReference Include="Microsoft.CSharp" Version="4.3.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.3.0-preview-20170628-02" />
<PackageReference Include="MSTest.TestAdapter" Version="1.1.18" />
<PackageReference Include="MSTest.TestFramework" Version="1.1.18" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Src\ElasticScale.Client\Microsoft.Azure.SqlDatabase.ElasticScale.Client.csproj" />
<ProjectReference Include="..\ElasticScale.ClientTestCommon\Microsoft.Azure.SqlDatabase.ElasticScale.ClientTestCommon.csproj" />
</ItemGroup>
</Project>

Просмотреть файл

@ -5,14 +5,8 @@ using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("ShardMapManagerUnitTests")]
[assembly: AssemblyDescription("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

Просмотреть файл

@ -1344,6 +1344,7 @@ end", s_testUser);
[TestCategory("ExcludeFromGatedCheckin")]
public void ListShardMapPerformanceCounterValidation()
{
#if NETFRAMEWORK
if (PerfCounterInstance.HasCreatePerformanceCategoryPermissions())
{
string shardMapName = "PerTenantShardMap";
@ -1454,8 +1455,10 @@ end", s_testUser);
{
Assert.Inconclusive("Do not have permissions to create performance counter category, test skipped");
}
#endif
}
#if NETFRAMEWORK
private bool ValidateNonZeroCounterValue(string instanceName, PerformanceCounterName counterName)
{
string counterdisplayName = (from c in PerfCounterInstance.counterList
@ -1486,6 +1489,7 @@ end", s_testUser);
{
return PerformanceCounterCategory.InstanceExists(instanceName, PerformanceCounters.ShardManagementPerformanceCounterCategory);
}
#endif
private RangeMapping<T> MarkMappingOfflineAndUpdateShard<T>(RangeShardMap<T> map, RangeMapping<T> mapping, Shard newShard)
{

Просмотреть файл

@ -328,6 +328,18 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement.UnitTests
Assert.AreEqual(3, i);
}
[TestMethod]
[TestCategory("ExcludeFromGatedCheckin")]
public void TestSchemaInfoExceptionSerializability()
{
SchemaInfoException ex = new SchemaInfoException(SchemaInfoErrorCode.SchemaInfoNameConflict, "message");
SchemaInfoException deserialized = CommonTestUtils.SerializeDeserialize(ex);
// Validate
Assert.AreEqual(ex.ErrorCode, deserialized.ErrorCode, "ErrorCode");
Assert.AreEqual(ex.ToString(), deserialized.ToString(), "ToString()");
}
/// <summary>
/// Verifies that the serialization format of <see cref="SchemaInfo"/> matches the serialization format
/// from v1.0.0. If this fails, then an older version of EDCL v1.0.0 will not be able to successfully

Просмотреть файл

@ -1481,11 +1481,16 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement.UnitTests
private static SqlException CreateSqlException()
{
ConstructorInfo ciSqlError = typeof(SqlError)
.GetConstructors(BindingFlags.Instance | BindingFlags.NonPublic)
.Single(c => c.GetParameters().Length == 7);
ConstructorInfo[] cisSqlError = typeof(SqlError)
.GetConstructors(BindingFlags.Instance | BindingFlags.NonPublic);
#if NETFRAMEWORK
ConstructorInfo ciSqlError = cisSqlError.Single(c => c.GetParameters().Length == 7);
SqlError se = (SqlError)ciSqlError.Invoke(new object[] { (int)10928, (byte)0, (byte)0, "", "", "", (int)0 });
#else
ConstructorInfo ciSqlError = cisSqlError.Single(c => c.GetParameters().Length == 8);
SqlError se = (SqlError)ciSqlError.Invoke(new object[] { (int)10928, (byte)0, (byte)0, "", "", "", (int)0, null });
#endif
ConstructorInfo ciSqlErrorCollection = typeof(SqlErrorCollection)
.GetConstructors(BindingFlags.Instance | BindingFlags.NonPublic).Single();

Просмотреть файл

@ -1,6 +1,7 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Microsoft.Azure.SqlDatabase.ElasticScale;
using Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement.Recovery;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
@ -8,8 +9,6 @@ using System.Collections.Generic;
using System.Data.SqlClient;
using System.Diagnostics;
using System.Linq;
using Microsoft.Practices.EnterpriseLibrary.TransientFaultHandling;
using Microsoft.Practices.EnterpriseLibrary.WindowsAzure.TransientFaultHandling.SqlAzure;
namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement.UnitTests
{
@ -114,7 +113,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement.UnitTests
/// <summary>
/// Retry policy used for DDR in unit tests.
/// </summary>
private static RetryPolicy<SqlAzureTransientErrorDetectionStrategy> s_retryPolicy;
private static TransientFaultHandling.RetryPolicy<TransientFaultHandling.SqlDatabaseTransientErrorDetectionStrategy> s_retryPolicy;
#region CommonMethods
@ -215,8 +214,8 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement.UnitTests
}
// Initialize retry policy
s_retryPolicy = new RetryPolicy<SqlAzureTransientErrorDetectionStrategy>(
new ExponentialBackoff(5, TimeSpan.FromMilliseconds(100), TimeSpan.FromSeconds(5), TimeSpan.FromMilliseconds(100)));
s_retryPolicy = new TransientFaultHandling.RetryPolicy<TransientFaultHandling.SqlDatabaseTransientErrorDetectionStrategy>(
new TransientFaultHandling.ExponentialBackoff(5, TimeSpan.FromMilliseconds(100), TimeSpan.FromSeconds(5), TimeSpan.FromMilliseconds(100)));
}
/// <summary>

Просмотреть файл

@ -91,7 +91,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement.UnitTests
}
catch (ShardManagementException smme)
{
Assert.IsTrue(smme.ErrorCode == ShardManagementErrorCode.ShardMapLookupFailure);
Assert.AreEqual(ShardManagementErrorCode.ShardMapLookupFailure, smme.ErrorCode);
}
}
@ -111,7 +111,7 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement.UnitTests
}
catch (ShardManagementException smme)
{
Assert.IsTrue(smme.ErrorCode == ShardManagementErrorCode.ShardMapLookupFailure);
Assert.AreEqual(ShardManagementErrorCode.ShardMapLookupFailure, smme.ErrorCode);
}
}
@ -364,24 +364,12 @@ namespace Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement.UnitTests
var errorCode = ShardManagementErrorCode.ShardMapDoesNotExist;
ShardManagementException ex = new ShardManagementException(errorCategory, errorCode, "Testing");
string exceptionToString = ex.ToString();
// Serialize and de-serialize with a BinaryFormatter
BinaryFormatter bf = new BinaryFormatter();
using (MemoryStream ms = new MemoryStream())
{
// Serialize
bf.Serialize(ms, ex);
// Deserialize
ms.Seek(0, 0);
ex = (ShardManagementException)bf.Deserialize(ms);
}
ShardManagementException deserialized = CommonTestUtils.SerializeDeserialize(ex);
// Validate
Assert.AreEqual(ex.ErrorCode, errorCode, "ErrorCode");
Assert.AreEqual(ex.ErrorCategory, errorCategory, "ErrorCategory");
Assert.AreEqual(exceptionToString, ex.ToString(), "ToString()");
Assert.AreEqual(ex.ErrorCode, deserialized.ErrorCode, "ErrorCode");
Assert.AreEqual(ex.ErrorCategory, deserialized.ErrorCategory, "ErrorCategory");
Assert.AreEqual(ex.ToString(), deserialized.ToString(), "ToString()");
}
#region GsmAbortTests

Просмотреть файл

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>
<PropertyGroup>
<RelativeOutputPath>Test\$(RelativeOutputPath)</RelativeOutputPath>
</PropertyGroup>
<Import Project="$(MSBuildThisFileDirectory)\..\Build.props" />
</Project>

Просмотреть файл

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Build.props))\Build.props" />
<ItemGroup>
<ProjectFile Include="ElasticScale.ClientTestCommon\ElasticScale.ClientTestCommon.csproj" />
<ProjectFile Include="ElasticScale.Query.UnitTests\ElasticScale.Query.UnitTests.csproj" />
<ProjectFile Include="ElasticScale.ShardManagement.LoadTests\ElasticScale.ShardManagement.LoadTests.csproj" />
<ProjectFile Include="ElasticScale.ShardManagement.UnitTests\ElasticScale.ShardManagement.UnitTests.csproj" />
</ItemGroup>
<Import Project="$(BuildExtensionsPath)\Traversal.targets" />
</Project>

Просмотреть файл

@ -1,31 +0,0 @@
@ECHO OFF
SETLOCAL
SET CACHED_NUGET=%LocalAppData%\NuGet\NuGet.exe
SET SOLUTION_PATH="%~dp0ElasticDatabaseTools.sln"
SET MSBUILD12_TOOLS_PATH="%ProgramFiles(x86)%\MSBuild\12.0\bin\MSBuild.exe"
SET MSBUILD14_TOOLS_PATH="%ProgramFiles(x86)%\MSBuild\14.0\bin\MSBuild.exe"
SET BUILD_TOOLS_PATH=%MSBUILD14_TOOLS_PATH%
IF EXIST %MSBUILD14_TOOLS_PATH% (
SET BUILD_TOOLS_PATH=%MSBUILD14_TOOLS_PATH%
) else if exist %MSBUILD12_TOOLS_PATH% (
SET BUILD_TOOLS_PATH=%MSBUILD12_TOOLS_PATH%
) else (
echo Could not find MSBuild in any of the following locations:
echo %MSBUILD14_TOOLS_PATH%
echo %MSBUILD12_TOOLS_PATH%
exit /b 1
)
IF EXIST %CACHED_NUGET% goto restore
echo Downloading latest version of NuGet.exe...
IF NOT EXIST %LocalAppData%\NuGet md %LocalAppData%\NuGet
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://www.nuget.org/nuget.exe' -OutFile '%CACHED_NUGET%'"
:restore
IF NOT EXIST src\packages md src\packages
%CACHED_NUGET% restore %SOLUTION_PATH%
%BUILD_TOOLS_PATH% %SOLUTION_PATH% /nologo /m /v:m /flp:verbosity=normal %*

Просмотреть файл

@ -1,52 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup Condition=" $(TargetFramework.StartsWith(`net4`)) ">
<DefineConstants>$(DefineConstants);NETFRAMEWORK</DefineConstants>
</PropertyGroup>
<PropertyGroup>
<!--
Determine whether we are building in the Microsoft Azure SQL Database team's build system
or standalone (i.e. from open source).
-->
<StandaloneBuild Condition="!Exists('$(MSBuildThisFileDirectory)\..\Build.props')">true</StandaloneBuild>
<StandaloneBuild Condition="Exists('$(MSBuildThisFileDirectory)\..\Build.props')">false</StandaloneBuild>
</PropertyGroup>
<!--
Properties that are implicitly defined in the Microsoft Azure SQL Database team's build system
that need to be defined here for standalone build to work.
-->
<PropertyGroup Condition="'$(StandaloneBuild)' == 'true'">
<!-- Common compile properties -->
<ErrorReport Condition="'$(ErrorReport)' == ''">prompt</ErrorReport>
<WarningLevel Condition="'$(WarningLevel)' == ''">4</WarningLevel>
<DefineConstants>$(DefineConstants);STANDALONE_BUILD</DefineConstants>
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
<TargetFrameworkProfile />
<Configuration Condition="'$(Configuration)' == ''">Debug</Configuration>
<!-- Folder layout properties -->
<BaseIntermediateOutputPath>$(MSBuildThisFileDirectory)\obj\$(MSBuildProjectFile)</BaseIntermediateOutputPath>
<BaseOutputPath>$(MSBuildThisFileDirectory)\bin</BaseOutputPath>
<OutputPath>$(BaseOutputPath)\$(Configuration)\$(AssemblyName)</OutputPath>
<NugetPack>$(MSBuildThisFileDirectory)\packages</NugetPack>
</PropertyGroup>
<PropertyGroup Condition="'$(StandaloneBuild)' == 'true' and '$(Configuration)' == 'Debug'">
<!-- Debug compile properties -->
<Optimize Condition="'$(Optimize)' == ''">false</Optimize>
<DebugType Condition="'$(DebugType)' == ''">full</DebugType>
<DefineConstants>$(DefineConstants),DEBUG,TRACE,CODE_ANALYSIS</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(StandaloneBuild)' == 'true' and ('$(Configuration)' == 'Release' or '$(Configuration)' == 'Cover')">
<!-- Release compile properties -->
<Optimize Condition="'$(Optimize)' == ''">true</Optimize>
<DebugType Condition="'$(DebugType)' == ''">pdbonly</DebugType>
<DefineConstants>$(DefineConstants),TRACE</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(StandaloneBuild)' == 'false'">
<!-- Enable flag that sets the version number of the built assemblies. -->
<EnableElasticScaleClientHardcodedVersioning>true</EnableElasticScaleClientHardcodedVersioning>
</PropertyGroup>
<Import Condition="'$(StandaloneBuild)' == 'false'" Project="$(MSBuildThisFileDirectory)\..\Build.props" />
</Project>
</Project>

Просмотреть файл

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Build.props))\Build.props" />
<ItemGroup>
<ProjectFile Include="Samples\dirs.proj" />
<ProjectFile Include="Src\dirs.proj" />
<ProjectFile Include="Test\dirs.proj" />
</ItemGroup>
<Import Project="$(BuildExtensionsPath)\Traversal.targets" />
</Project>

3
global.json Normal file
Просмотреть файл

@ -0,0 +1,3 @@
{
"projects": [ "Src" ]
}