Azure-Samples/azure-sql-db-hyperscale-autoscaler

Code was not updating the RequestedSLO as expected.

jcbendernh opened this issue · 2 comments

We had to change line 200 of the AutoScaler.cs file from ...

var index = availableSlos.IndexOf(currentSLO.ToString());

to...

var index = availableSlos.IndexOf(currentSLO.ToString().ToLower());

Once we did that, the RequestedSLO was showing correctly on the [dbo].[AutoscalerMonitor] table and also the ALTER DATABASE script was executing as expected to scale up/scale down the server.

Neither were happening with the old line 200.

I am also a Microsoft employee, you can reach me at jobender@microsoft.com.

yorek commented

Yeah, that make sense, not sure why it has been working before :). Would be great if you can create a PR so that you can also get the proper credit for fixing this :)

Hello @yorek, first of all, big thanks to you for this solution!!! I want to just propose that it will be good to get this code updated. I just spent some time to figure out why the function is not scaling as I didn't notice that there is opened issue with this. I basically changed line number 21:
From: return $"{Name}gen{Generation}{Cores}".ToUpper();
To: return $"{Name}gen{Generation}{Cores}".ToLower();

Without that, case sensitivity blocked IF conditions in "public static HyperScaleTier GetServiceObjective(HyperScaleTier currentSLO, SearchDirection direction)" Screen from my testing output:
image

Thank you!
BR
Stanislav