Skip to content

Commit

Permalink
Drop old reindex stored procedure (#3830)
Browse files Browse the repository at this point in the history
* Drop old reindex stored procedure

* Extension
  • Loading branch information
SergeyGaluzo authored Apr 30, 2024
1 parent e21c7ed commit 7e2c7c8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
IF object_id('dbo.ReindexResource') IS NOT NULL DROP PROCEDURE dbo.ReindexResource -- Ths still exists on old accounts and prevents TVP drop
GO
DECLARE @Names TABLE (Name varchar(100) PRIMARY KEY)
INSERT INTO @Names SELECT name FROM sys.objects WHERE type = 'p' AND name LIKE '%[0-9]' AND name NOT LIKE '%ResourceChanges%'
DECLARE @Name varchar(100)
Expand Down
4 changes: 3 additions & 1 deletion tools/BlobRewriter/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@
<add key="WritesEnabled" value="true" />
<!-- If false splits lines in blob by first characters of ResourceId (assumes ndjson format). -->
<add key="SplitBySize" value="true" />
<!-- Filter on blob names. If empoty string - no filtering. -->
<!-- Filter on blob names. If empty string - no filtering. -->
<add key="NameFilter" value="" />
<!-- extension -->
<add key="ExtensionFilter" value="ndjson" />
<!-- If true tries to replace {"resourceType": by {"meta":{"versionId":"seconds from last updated","lastUpdated":"YYYY-MM-DDThh:mm:ss"},"resourceType": -->
<add key="AddMeta" value="false" />
</appSettings>
Expand Down
3 changes: 2 additions & 1 deletion tools/BlobRewriter/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public static class Program
private static readonly bool WritesEnabled = bool.Parse(ConfigurationManager.AppSettings["WritesEnabled"]);
private static readonly bool SplitBySize = bool.Parse(ConfigurationManager.AppSettings["SplitBySize"]);
private static readonly string NameFilter = ConfigurationManager.AppSettings["NameFilter"];
private static readonly string ExtensionFilter = ConfigurationManager.AppSettings["ExtensionFilter"];
private static readonly bool AddMeta = bool.Parse(ConfigurationManager.AppSettings["AddMeta"]);
private static readonly string BundleType = ConfigurationManager.AppSettings["BundleType"];
private static readonly bool MultiResourceTypes = bool.Parse(ConfigurationManager.AppSettings["MultiResourceTypes"]);
Expand All @@ -50,7 +51,7 @@ public static void Main()
var gPrefix = $"BlobRewriter.Threads={Threads}.Source={SourceContainerName}{(WritesEnabled ? $".Target={TargetContainerName}" : string.Empty)}";
Console.WriteLine($"{DateTime.UtcNow:s}: {gPrefix}: Starting...");
var blobs = WritesEnabled
? sourceContainer.GetBlobs().Where(_ => _.Name.Contains(NameFilter, StringComparison.OrdinalIgnoreCase) && _.Name.EndsWith(".ndjson", StringComparison.OrdinalIgnoreCase)).OrderBy(_ => _.Name).Take(SourceBlobs)
? sourceContainer.GetBlobs().Where(_ => _.Name.Contains(NameFilter, StringComparison.OrdinalIgnoreCase) && _.Name.EndsWith($".{ExtensionFilter}", StringComparison.OrdinalIgnoreCase)).OrderBy(_ => _.Name).Take(SourceBlobs)
: sourceContainer.GetBlobs().Where(_ => _.Name.Contains(NameFilter, StringComparison.OrdinalIgnoreCase)).Take(SourceBlobs);
if (WritesEnabled)
{
Expand Down

0 comments on commit 7e2c7c8

Please sign in to comment.