Azure / azure-rest-api-specs

The source for REST API specifications for Microsoft Azure.
MIT License
2.61k stars 5.02k forks source link

Restore Points - List By Database only returns the earliest restore point (BUG?) #8837

Closed karthik25 closed 4 years ago

karthik25 commented 4 years ago

I am trying to use the Restore Points - List By Database API (https://docs.microsoft.com/en-us/rest/api/sql/restorepoints/listbydatabase) and it does not seem to be working as expected/documented. It (almost?) always returns only the earliest restore point (CONTINUOUS) not all the available restore points (DISCRETE).

To elaborate a little bit more, one of my databases has the following point-in-time restore points. I got these dates from the azure portal. It displays the earliest and lets us choose a different restore point using a calendar.

2020-03-08 00:00 UTC (CONTINUOUS)
2020-03-09 04:10 UTC (DISCRETE)
2020-03-10 04:10 UTC      "
2020-03-11 04:10 UTC      "
2020-03-12 04:10 UTC      "
2020-03-13 04:10 UTC      "
2020-03-14 04:10 UTC      "
2020-03-15 04:10 UTC      "

But only the first one (2020-03-08 00:00 UTC) is returned by this API.

Am I missing something here? The version of the API is also really old - "2014-04-01". If all that's required is an API version update in the documentation, can you please do that?

The portal can get this obviously, implying either there is a newer version of the API or something special was done for the portal (I am presuming the portal also uses the API's!). If this API is not updated, it greatly reduces our ability to automate things. With 100's of databases in our subscription, having this API working is crucial for us. I really need this API to work for a major implementation I am planning.

ghost commented 4 years ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @azureSQLGitHub.

adeal commented 4 years ago

@karthik25 this is by design. For Azure SQL DB, you can restore a database to any point-in-time up to the earliest restore point.

This differs from SQL DataWarehouse where you can only restore to specific, discrete points in time.

karthik25 commented 4 years ago

@adeal

You mentioned -

For Azure SQL DB, you can restore a database to any point-in-time up to the earliest restore point

In this case I should get both the CONTINUOUS and DISCRETE restore points right? I am saying I am getting only the CONTINUOUS restore point. In other words the API returns only 1 item as opposed to 8 items.

So, if by design I can restore my database to "any" point-in-time, how could I without knowing them all?

Am I missing something?

adeal commented 4 years ago

@karthik25 You should only receive one single CONTINUOUS point which marks the earliest possible time you can restore to. Any time after this point is valid, and it is up to the user which time is used.

In your example above, this is 2020-03-08 00:00 UTC, which means you can request any point-in-time in [2020-03-08 00:00, UtcNow - 5 minutes].

This doc may help explain: What is a Sql Database Backup

I see where we can improve our API reference to explain this more. Thanks for bringing it to our attention.

karthik25 commented 4 years ago

@adeal Thank you! I guess I am good now. I read this somewhere, but I kind of assumed (incorrectly) that it won't be applicable for every 5 minute interval.

You are welcome (reg. documentation). An update would be really helpful !