From 0d98dd73c5f452ed87a2b081d36ef0eab61266a0 Mon Sep 17 00:00:00 2001 From: Ryu Yu Date: Fri, 24 Feb 2017 14:57:22 -0800 Subject: [PATCH] Syncing master into dev (#109) * Merge logging fixes to master (#103) * Fix logging to properly attach exception info in Stats.ImportAzureCdnStatistics catch-all blocks (#102) * Fix logging message * Hotfix: stats total download counts overflow --- src/Stats.CreateAzureCdnWarehouseReports/GalleryTotalsReport.cs | 2 +- .../Stored Procedures/dbo.SelectTotalDownloadCounts.sql | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Stats.CreateAzureCdnWarehouseReports/GalleryTotalsReport.cs b/src/Stats.CreateAzureCdnWarehouseReports/GalleryTotalsReport.cs index 3000a6e03..105bb7d4c 100644 --- a/src/Stats.CreateAzureCdnWarehouseReports/GalleryTotalsReport.cs +++ b/src/Stats.CreateAzureCdnWarehouseReports/GalleryTotalsReport.cs @@ -46,7 +46,7 @@ public async Task Run() using (var connection = await StatisticsDatabase.ConnectTo()) using (var transaction = connection.BeginTransaction(IsolationLevel.Snapshot)) { - totalsData.Downloads = (await connection.ExecuteScalarWithRetryAsync( + totalsData.Downloads = (await connection.ExecuteScalarWithRetryAsync( WarehouseStoredProcedureName, commandType: CommandType.StoredProcedure, transaction: transaction)); } Trace.TraceInformation("Total downloads: {0}", totalsData.Downloads); diff --git a/src/Stats.Warehouse/Programmability/Stored Procedures/dbo.SelectTotalDownloadCounts.sql b/src/Stats.Warehouse/Programmability/Stored Procedures/dbo.SelectTotalDownloadCounts.sql index 87cc0ca06..1aa76d3b3 100644 --- a/src/Stats.Warehouse/Programmability/Stored Procedures/dbo.SelectTotalDownloadCounts.sql +++ b/src/Stats.Warehouse/Programmability/Stored Procedures/dbo.SelectTotalDownloadCounts.sql @@ -4,6 +4,6 @@ BEGIN SET NOCOUNT ON; -- select total # of downloads + correction for packages that can not be mapped - SELECT SUM(ISNULL(F.[DownloadCount], 0)) - 21000000 AS [Downloads] + SELECT SUM(CAST(ISNULL(F.[DownloadCount], 0) AS BIGINT)) - 21000000 AS [Downloads] FROM [dbo].[Fact_Download] (NOLOCK) AS F END \ No newline at end of file