Category: Editorial

  • Scripting Makes Mistakes Easier Than Ever

    A number of you likely use Atlassian products like Jira, Confluence, Opsgenie, or something else. You might have been affected by a large outage they had (post incident blog, Company Q&A, TechRepublic report) recently which lasted at least 9 days. I don’t know if all customers have their data back and are working, but this was a surprisingly poorly handled incident according to a number of reports from customers. There’s a great write-up from the outside that you might want to read.

    The bottom line in this issue is that Atlassian looked to deactivate a legacy product with a script, but they apparently didn’t communicate well among their teams. The script ended up using the wrong customer IDs and also marked the sites for permanent removal, not temporary removal (soft delete). While they supposedly test their restore capabilities, they weren’t prepared for partial restores of subsites. I’m guessing this is likely a partial database restore, which many of us know is way more complex than a full database restore.

    Leave aside the issue of a software-as-a-service (SaaS) company failing their customers, and the lack of communication with customers. The more interesting thing for me is the challenge of poor coding and communication internally. Clearly, the project to deactivate their legacy app wasn’t well planned or tested and the code used was probably executed at too wide a scale initially.

    When we deploy code changes to a large number of items, we want to test them at a small number first. Whether we are deploying to multiple databases, against many customers, or different systems, a standard method of making changes at scale involves working in rings. Azure DevOps describes this in docs, and they actually use rings to change the platform. We used the same pattern 20 years ago for software and database updates to many systems. We would internally deploy to a few users to look for issues. Then a week later we would deploy to a small number of systems to check for unexpected issues. Then typically to most systems in the third ring with a fourth ring a week later to catch up stragglers that needed more time to prepare.

    I find many customers, especially those with sharded/federated databases or many systems unwilling to spread out deployments in this manner. Often they yield to pressure from business users to ensure everyone gets the same update at the same time. I would never recommend this approach as we need to ensure we are looking at scripts in a controlled environment, or even two, before we deploy things widely. I’d be even more cautious about one-off administrative scripts that might make a change similar to the one Atlassian attempted. Those are often not seriously tested enough.

    At the very least, any of us working with multiple customers in a single database or in multiple databases ought to ensure we can backup and restore a single customer, but more importantly, can you restore a group of customers. If you make a mistake like Atlassian, which scripting allows us to do extremely rapidly, can you recover a partial set of data? Many of us don’t test this, but that’s likely something we ought to consider when we work with scripts that are designed to only change some data. Most of us don’t experience complete failures, but partial ones, usually because of human error. We ought to know how to deal with these situations.

    Steve Jones

    Listen to the podcast at Libsyn, Stitcher, Spotify, or iTunes.

  • Using T-SQL over PoSh

    Why would you use SSMS/T-SQL over PowerShell (PoSh)? When is T-SQL directly a better option than PoSh? That’s a question I ask myself regularly as I see articles and blogs that discuss how to accomplish a particular task using one tool or the other. There is plenty of overlap in the capabilities for each language when it comes to working with SQL Server, so this is a decision I think about regularly. This is especially true if you use dbatools.

    There also appears to be a bias towards one tool or the other for each individual. Many people traditionally have used T-SQL to accomplish most database tasks, and they tend to always look for a solution with a script in SSMS. Others are excited by PoSh and I have seen plenty of questions on the SQL Server Central forums asking how to structure their code in that language. In both cases, there is no shortage of people that argue that you should use T-SQL instead of PoSh or vice versa.

    Personally, I think that there are lots of development items where I’d use T-SQL. For any sort of schema change, most data changes, and a lot of database administrative tasks, I would use T-SQL first. Trying to alter a table in PoSh vs. T-SQL doesn’t make sense to me. Now the deployment of these changes is something where I’d use PoSh to run the T-SQL, which is what we do in the Redgate Deploy tools.

    I was with a panel recently and all the individuals on the panel said they wouldn’t use PoSh over SSMS for much of anything. The exception is where a task involved working with files or folders in the file system. PoSh excels here, and for work that might delete old files or move files from one folder to another, PoSh is preferred.

    I think the defining line for me is whether I need to accomplish a task inside of SQL Server or outside of it. When I cross instances or work with the file system, then PoSh is my preferred method. I can use xp_cmdshell or a linked server as well as anyone, but I prefer not to. Anything inside SQL Server, usually has me reaching for SSMS instead of VS Code.

    Steve Jones

    Listen to the podcast at Libsyn, Stitcher, Spotify, or iTunes.

  • A Third Space

    It’s 2022, two years into a pandemic, and it finally seems that many things are returning to the way they were in 2019. Life outside of work is fairly normal for me, and I have a number of trips. Work is starting to pick up and we’ve seen a few conferences and SQL Saturday events pop up on the schedule.

    Work is still mostly remote for many technology workers. Not all, and some companies are starting to require workers to come back to the office, part or full time. My son got a job as a software engineer and he has to go to the office every day for six months. After that, if he proves himself reliable, he can work at home 2-3 days a week.

    For many tech people I talk with, there is a still a mostly remote atmosphere. The feelings about this situation vary dramatically from person to person, and from role to role. I find as many managers love remote work as hate it. I find more tech people prefer remote work, but not all, and certainly not all like working at home. Depending on your environment, and how many others might be at home (and their ages), you might find remote work more stressful than commuting to an office.

    A friend pointed me to an article on someone that doesn’t love working at home and needs a third space. My friend feels the same way, as isolation and quiet can be hard to cope with for long periods. As much as I have loved working from home for nearly 20 years, I haven’t done this for 20 years. I’ve traveled regularly and when I have long stretches at home, I usually spend some periods in a Starbucks or another space just to be around people. Talking to my dogs isn’t bad, but they often don’t talk back in a way that satisfies my need for background noise.

    My friend’s company has a subscription to WeWork, which allows remote employees to get some social interaction, or just ambient noise, as needed. We’ve experimented with this at Redgate as well, and while I don’t know I’d go to WeWork over a coffee shop or restaurant, I do appreciate the ability to have a space where 5 or 10 of us could gather in an ad hoc manner periodically. If I had more employees in Denver, I would look forward to meeting them a few times a month.

    For those of you working at home, do you want a place to gather on a regular or periodic basis? Do you miss interacting with live people? Or do you love being alone at home. I certainly like the latter many days of the week, but I miss interacting with people on a regular basis. I look forward to regular trips to Redgate offices and more events where I can talk technology with people whose hands I can shake.

    Steve Jones

    Listen to the podcast at Libsyn, Stitcher, Spotify, or iTunes.

  • Constant Azure Improvement

    This week I noticed a number of changes in the Azure platform from their change feed. Actually, every week has a crazy number of changes across the entire platform, but this week a number of these were related to data and databases. That isn’t always the case, but I saw some interesting items.

    We have zone redundancy for the general purpose tier of Azure SQL database, as well as AAD security principals in the master database and a new DMV for backups. I think Azure SQL Database is a great product, though one that has felt quite limited at times. The use of DTUs at first, the high pause period for Serverless and limited options at lower tiers were always annoying.

    The point at times seemed to be to get customers to place a big financial bet that a higher tier would meet their needs. I had hoped that some of that was just a blip in time as technology improved and more features would be deployed to all tiers. After all, the original Azure SQL database was a key-value store.

    That seems to be coming true as I continue to see improvements to the offerings. Azure SQL Serverless now has a 1 hour pause period minimum instead of the original 6 hour time. Now Cosmos DB has also lowered their autoscale offering. Cosmos DB can be provisioned at a lower entry point for autoscale, at 100RU/s instead of 400RU/s, which might get more people to experiment with a PoC over a bit of time and use the database. I know I’m thinking of trying to mess with some data on the platform. I don’t think I’d need 100 RU/s, much less 400, but I can better live the cost for a few months.

    Hyperscale has been an interesting version of Azure SQL Database. I know quite a few customers that aren’t sure if they need it, but they considered experimenting with it. The problem was that once you choose Hyperscale, you can’t go back to another tier. That’s quite a disincentive to experimentation, which seems to be part of the philosophy of choosing the cloud. There is now a preview of the migration of Hyperscale back to the general purpose tier. I’m guessing it took a little time for the Azure team to implement this, which is why there was a restriction, but it looks like that limit will go away.

    The cloud is an amazing place, as I’ve written before. It enables things to happen at a pace, and with ease that I’ve never seen in a data center without a lot of prep work. This week it seems that the Azure cloud advanced quite a bit in the area that I care about, the data platform space.

    There was also the general availability release of the Azure SQL Migration extension for ADS.

    Steve Jones