TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

I Accidentally Deleted 7TB of Videos Before Going to Production

516 pointsby thevinterabout 3 years ago

82 comments

dsegoabout 3 years ago
&gt; but at the time the code seemed completely correct to me<p>It always does.<p>&gt; Well, it teaches me to do more diverse tests when doing destructive operations.<p>Or add some logging and do a dry run and check the results, literally simple prints statements:<p><pre><code> print(&quot;-----&quot;) print(&quot;Downloading videos ids from url: {url}&quot;) print(list of ids) ... ... ... # delete() dangerous action commented out until I&#x27;m sure it&#x27;s right print(&quot;I&#x27;m about to delete video {id}&quot;) print(&quot;Deleted {count} videos&quot;) # maybe even assert ... </code></pre> Then dump out to a file and spot check it five times before running for real.
评论 #31271821 未加载
评论 #31272177 未加载
评论 #31272157 未加载
评论 #31271815 未加载
评论 #31274628 未加载
评论 #31272174 未加载
评论 #31271809 未加载
评论 #31271964 未加载
评论 #31272271 未加载
评论 #31274172 未加载
评论 #31271827 未加载
评论 #31273474 未加载
评论 #31271778 未加载
评论 #31277413 未加载
评论 #31272743 未加载
评论 #31292699 未加载
评论 #31272435 未加载
评论 #31271936 未加载
评论 #31282783 未加载
评论 #31271818 未加载
评论 #31277463 未加载
评论 #31271919 未加载
评论 #31273052 未加载
评论 #31272441 未加载
评论 #31272051 未加载
评论 #31279525 未加载
评论 #31273355 未加载
评论 #31272782 未加载
评论 #31272092 未加载
qwertoxabout 3 years ago
Aaaahhh, the feeling you get when you notice that you fucked up. Everything gets quiet, body motion stops, cheeks get hot, heart starts to beat and sinks really low, &quot;fuck, fuck, fuck, fuck, fuck, fuck, fuck, fuck, fuck, fucking shit&quot;. Pause. Wait. Think. &quot;Backups, what do I have, how hard will it be to recover? What is lost?&quot;. Later you get up and walk in circles, fingers rolling the beard, building the plan in the head. Coffee gets made.
评论 #31275644 未加载
评论 #31276867 未加载
评论 #31276564 未加载
评论 #31274071 未加载
评论 #31273807 未加载
评论 #31274404 未加载
评论 #31279874 未加载
评论 #31279841 未加载
评论 #31280376 未加载
评论 #31275207 未加载
iambenabout 3 years ago
I like these stories. I think they resonate well for &#x27;the rest of us&#x27;. I&#x27;ve made plenty of mistakes like this - you learn and grow, right?<p>One of the best things about HN is that so many incredible, talented people post. It&#x27;s incredibly inspiring to raise your own game, to see what the best are doing. But sometimes it&#x27;s equally important to realise we all fuck up, and for every unicorn dev there&#x27;s another thousand of us grinding away.<p>OP - well done for sorting the problem and telling us all about it!
评论 #31276934 未加载
muglugabout 3 years ago
The root of this particular issue was Vimeo&#x27;s failure to do this migration for their customers.<p>Vimeo OTT has a codebase written in Rails, whereas the main PHP application is written in PHP. At the time Vimeo acquired Vimeo OTT&#x27;s codebase, the Vimeo OTT codebase was small — around 10,000 lines of Ruby. Rewriting that codebase inside the Vimeo PHP application would have been a tough technical challenge for the all-Ruby team, and they&#x27;d have likely lost some people along the way and missed out on some content deals, so they decided instead to maintain two separate codebases and two separate login systems.<p>The video-playback and video-storage infra has since been unified, but all the business logic is still siloed.
评论 #31273599 未加载
评论 #31276277 未加载
评论 #31273396 未加载
tomkwongabout 3 years ago
First, I want to say that this is a great post. You always grow stronger when you make mistakes. Writing it up solidify understanding in the learning process.<p>This story resonates with many people here because many experienced engineers had done something similar before. For me, destructive batch operations like this would be two distinct steps:<p>1. Identify files that need to be deleted; 2. Loop through the list and delete them one by one.<p>These steps are decoupled so that the list can be validated. Each step can be tested independently. And the scripts are idempotent and can be reused.<p>Production operations are always risky. A good practice is to always prepare an execution plan with detailed steps, a validation plan, and a rollback plan. And, review the plan with peers before the operation.
评论 #31273793 未加载
评论 #31279740 未加载
RankingMemberabout 3 years ago
I&#x27;m impressed you went with an automated solution (PlayWright) for 500 videos after all that, considering they could be cross-loaded from Google Drive almost instantaneously. I&#x27;m glad it worked, but coding around a screw-up under the gun seems like a high-risk operation compared to spending 4 hours doing the task manually (albeit being super bored the whole time), but with the benefit of knowing it&#x27;s being done correctly instead of hurriedly writing a script to potentially do something else wrong very efficiently and dig your hole deeper.
评论 #31277627 未加载
评论 #31278383 未加载
rexreedabout 3 years ago
A big part of the reason for the problem in this post is because Vimeo made it impossible to move videos from one Vimeo product to another Vimeo product: &quot;There were roughly 500 videos on VimeoOTT that had to be transferred to Enterprise and Vimeo doesn&#x27;t provide an easy way of doing it.&quot;<p>I have found working with Vimeo to be very frustrating, especially recently. They have a great video solution, especially for streaming, but they seem to put these unnecessary and frustrating roadblocks that make me constantly question my decision to use Vimeo. From in ability to move videos from one place to another, requiring complete uploads (resulting in problems like this post) to nonsensical limits and pricing, especially on their new webinar offering, which has a limit of 100 registered attendees. For anyone who has run webinars before, this makes no sense since 100 registered attendees usually means 20-30% of those people actually attend, so you&#x27;re capped at 20-30 live attendees. They should price it like most event sites and charge per live attendance rather than registration.<p>Regardless, I&#x27;ve been very frustrated with Vimeo since it could be so much better if they didn&#x27;t have these roadblocks in place. If they could have easily enabled moving videos from one product to another, the post (and 7TB of lost videos) would never have happened. It wasn&#x27;t always this way with Vimeo, but they went IPO in May 2021 and it&#x27;s no surprise they&#x27;re turning the screws on their product offering and pricing now.
NikolaNovakabout 3 years ago
Honestly, this is positively representative of any junior developer with comparable experience. Depending on their background and how much production work they had, there&#x27;s an overwhelming sense of eagerness and enthusiasm. Quick to script and perhaps a bit too quick to execute.<p>A friendly team will harness that enthusiasm and tame the quickness &#x2F; encourage respect for production. We all made a massive doo doo and its how you proceed that&#x27;ll define your career.
johnklosabout 3 years ago
We can all poke at this person for doing things incorrectly, but one has to wonder what mindset could lead to any programmer ever thinking that:<p><pre><code> 1) parsing a web page shouldn&#x27;t be considered incredibly fraught with problems 2) that reloading web pages should be part of (1) 3) that this should ever possibly be run without validating the list of files that would be deleted </code></pre> So forget the specifics. Where are people learning these things, and what do we do to teach them better things?
评论 #31272807 未加载
评论 #31272713 未加载
评论 #31273014 未加载
评论 #31277064 未加载
评论 #31276723 未加载
ghoomketuabout 3 years ago
The more I read about vimeo the more I wonder what&#x27;s up with these guys.<p>Only recently they made some god aweful policy changes for content creators(1), but it looks like they treat their enterprise customers just the same.<p>Surely, there must be better alternatives for hosting videos than being at the mercy of a company who couldn&#x27;t care less about big paying customers.<p>(1) <a href="https:&#x2F;&#x2F;www.theverge.com&#x2F;2022&#x2F;3&#x2F;18&#x2F;22985820&#x2F;vimeo-bandwidth-policy-changes-2tb-cap" rel="nofollow">https:&#x2F;&#x2F;www.theverge.com&#x2F;2022&#x2F;3&#x2F;18&#x2F;22985820&#x2F;vimeo-bandwidth-...</a>
评论 #31272630 未加载
RcouF1uZ4gsCabout 3 years ago
This is one of those times that even if you don’t use a fully functional language, trying to make as much of your program logic pure functions would be helpful.<p>It also makes it more testable. Instead of putting the delete call right in the loop, split it into four functions.<p><pre><code> function getAllVimeoVideos() function getAllDbVideos() function getVideosToDelete(vimeo_videos, db_videos) function deleteVideos(videos_to_delete) </code></pre> Your core logic lives in getVideosToDelete which is simply a set difference.<p>Given that there are only a few hundred videos, it is easy to run the getter functions above and quickly verify they are returning what you expect.
评论 #31273395 未加载
评论 #31275855 未加载
KingOfCodersabout 3 years ago
&quot;I&#x27;m under an NDA&quot;<p>Don&#x27;t write a blog post.
desarunabout 3 years ago
Oh dude, we&#x27;ve all been there.<p>9 years ago I was working for a major broadcasting company in the arse end of London as a junior dev, building one of their Android apps.<p>We&#x27;d roll features out months before &amp; enable them with feature flags via a json file we&#x27;d manually push to a prod server at a later date.<p>We&#x27;d just built a huge new feature letting you request content to be downloaded to your set top box remotely &amp; it had a 250k marketing campaign to go along with the launch.<p>Senior dev trusted me with prod deployment rights.<p>I pushed the wrong json config to prod, launching the feature weeks before the marketing campaign.<p>Thank god I was a junior perm, that was definitely a firing offence.
评论 #31273106 未加载
JacobiXabout 3 years ago
&gt; It involves bad practices and errors from multiple parties in a world that might seem<p>&gt; foreign to the &quot;Silicon Valley&quot; world but paints an accurate picture of what<p>&gt; development is for small IT companies around the world<p>Everybody makes mistakes even in the &quot;Silicon Valley&quot; world, but such problems cloud be easily caught by testing (which he did but it was restricted to the first page) and performing a simple dry-run.
评论 #31271862 未加载
photon-torpedoabout 3 years ago
Apart from all the advice on how to do such destructive operations more safely, I think there&#x27;s also a lesson to be learned about communicating more actively:<p>1. Vimeo responds to the original request with &quot;will look into it&quot;, then... nothing happens? This may depend on culture, but at least from my experience in the UK, this is a very non-committal response, and if you really want them to do something, you&#x27;ll need to chase them. Wait a few days and inquire if they have any estimate for when it might get done, or if they need more information. I find that the &quot;looking into it&quot; response is sometimes used to gauge how important the request is to you.<p>2. Once you go with your own solution, just drop a quick message to Vimeo: &quot;Hey, just wanted to let you know we&#x27;ve found our own solution for this, and won&#x27;t require your help any more. Sorry if you&#x27;ve already committed any resources for this task. Have a nice day, yada yada.&quot; This not just avoids what happened here, but is also a courtesy to them.
aristusabout 3 years ago
Hey, everyone, ease up. I have: 1) dropped a production database because I thought it was the test database. 2) screwed up a print job costing $100,000 in today’s money and had to do it again 3) crashed all of Facebook with a C++ bug. 4) crashed Facebook photo uploads, with a JavaScript bug, in my first month. 5) literally killed a startup’s cash flow and caused them to lose their merchant account because I over focused on the wrong bugs.
评论 #31273863 未加载
评论 #31273949 未加载
评论 #31276044 未加载
wruzaabout 3 years ago
Code without constant logging of “utc [who] does what exactly” is a no-go for me for a long time. Also, if you have to be destructive, replace the &lt;rm&#x2F;sell&#x2F;halt&gt; with log() for at least one time (aka --verbose --dry-run) and check your expectations. One-shot scripts like this are screaming disaster.<p>(The problematic line lacks the closing &quot;, probably a typo? I though it closed in an unexpected location)
0xbadcafebeeabout 3 years ago
This is more common than you think. Not just losing data, but not having a good handle on where the important parts of the system are, and how close you are to catastrophe. I find diagrams really help. I can recall a visual map of the system when I work on some component, and think, &quot;OH, I remember seeing this component connected to a really critical thing, I need to check something first.&quot;<p>Start by creating one empty page for every component of your system. You won&#x27;t remember them all, but over time you can add missing ones. Each page is the authoritative source of info on that component. If you need more pages for one component, put them in a directory of the same name as the page and add &quot;.d&quot; to the directory name, and link to them from the first page. Finally, create a diagram (however you want) that includes every component you have a page for. Add the count of components to the top of the diagram. If the count on the diagram doesn&#x27;t match the number of documents, time to update the diagram. If you ever add, remove or rename a page, time to update the diagram. If you do this the same way for every different system you have, you can link them all together and get both small and large scale diagrams. (p.s. don&#x27;t waste time automating this unless you find the system changing constantly or you have a very big system)
JasonFruitabout 3 years ago
I believe if we&#x27;re honest, we&#x27;ve all done stupid things we should have avoided. I remember a group of about 3000 emails that went out to insurance agents saying that policy #123456789 for Someone Funky was going to be cancelled by underwriting. I also remember very quickly figuring out how to automate Outlook&#x27;s email recall feature.<p>We&#x27;ve all made big dumb mistakes. Recover and learn.
batch12about 3 years ago
It&#x27;s like the first time you run<p><pre><code> rm -rf &#x2F;path&#x2F;to&#x2F;delete&#x2F; * </code></pre> And realize it is taking too long...
评论 #31272304 未加载
mastaziabout 3 years ago
&gt; Vimeo doesn&#x27;t provide an easy way of doing it. I wrote to the support team around October asking them if it was possible to do a migration, and they told us that they &quot;will look into it&quot; without letting us know anything ever since. [...] At one point, without letting us know anything, Vimeo decided it was a great idea to comply with our request and dumped all the videos present on OTT onto the new platform. No questions were asked [...] they were duplicating videos that were already uploaded.<p>Oh yes Vimeo, the crappy company that won&#x27;t let you play videos unless you enable autoplay in your browser[1].<p>Selecting them as a provider was the actual mistake.<p>[1] <a href="https:&#x2F;&#x2F;askubuntu.com&#x2F;questions&#x2F;777489&#x2F;vimeo-video-not-playing-in-firefox" rel="nofollow">https:&#x2F;&#x2F;askubuntu.com&#x2F;questions&#x2F;777489&#x2F;vimeo-video-not-playi...</a>
Fritsdehackerabout 3 years ago
This is why you have backups. Good on you to have them!<p>When I just started as a junior dev at a small company I made the classic mistake of emptying the prod db instead of my local dev db. This was a small and in hindsight insignificant project. But Google was our customer, so it didn&#x27;t feel insignificant at the time.<p>In this case my inexperience was partly my savior. All the data was inputted by people via a web form. Normally you&#x27;re supposed to use POST to submit a form. But I was quite clueless at the time, so I had used GET. This meant all requests were still in the Apache logs. I could simply replay all requests.<p>I still feel my hard pounding when I think about the moment I realized what had happened. I was really relieved when everything was back!<p>What I learned from this incident:<p>- make automated backups<p>- no access to prod db from anywhere but prod
评论 #31275045 未加载
BillyTheKingabout 3 years ago
For larger &#x27;live&#x27; production changes I&#x27;ve now started to rely on generative programming. I&#x27;ve got one script in some &#x27;normal&#x27; programming language like javascript, or python, which in turn generates a script that contains a list of curl or other cli commands which do the actual deletion, modification, addition, etc.<p>This allows me to run a small sub-set of commands and test those under a live-environment before running all commands at once. In addition, this also functions as a complete log of what has been changed manually in production.
brunoolivabout 3 years ago
Kudos to you for &quot;learning in public&quot; by showcasing part of your learnings online!!! I think this is extremely important to do!<p>Not everyone is an innate rockstar developer who provisions k8s clusters for breakfasts and delivers features for lunch!<p>Being a developer is a really hard job and there are endless complexities and difficulties along the way and when we are more seasoned already.<p>Don&#x27;t let any negative feedback deter you from keeping doing what you&#x27;re doing: learning from your mistakes and improving along the way!
LinAGKarabout 3 years ago
Shouldn&#x27;t that be `page={page}` rather than `page{page}`? Or better yet, use the requests `params` argument.
ricardobayesabout 3 years ago
Any process that makes a junior directly access prod codebase&#x2F;database is flawed. No matter how small of a company you are, you can set up a proper CI&#x2F;CD pipeline.
评论 #31272541 未加载
thisNeeds2BeSadabout 3 years ago
The only thing that I can remember helping against such actions, is the exponential need for confirmation by intent.<p>Means, if you delete one small file you need one confirmation, if you delete thousands, you need a intent stating i expect thousand files to be deleted. Same goes for size. So not a okay button, but instead a form allowing you to enter the dimension of the intented outcome. 100 files max, 1 gb max deleted.<p>If the request goves over the intent, the system aborts.
andreagrandiabout 3 years ago
It should really be something like: &quot;a flaw in our system allowed me to delete 7am TB of videos&quot;. Not entirely your fault.
评论 #31272478 未加载
franciscopabout 3 years ago
This is a great technical write up, I&#x27;d love to hear the human side of this story as well! When did you tell the higher ups that you deleted production? Was no one more senior on call to try to fix it? Did they want you to learn how to fix it? Or were you the most senior responsible for this whole area? Or did they don&#x27;t know?
评论 #31273993 未加载
Reason077about 3 years ago
&gt; <i>&quot;What does this teach us? Well, it teaches me to do more diverse tests when doing destructive operations.&quot;</i><p>I think it also teaches us that adversity sometimes leads to better solutions. I love that the OP made a hacky script that did in 4 hours what a guy was paid to do manually over several months!
DonHopkinsabout 3 years ago
&gt;... the &quot;Silicon Valley&quot; world ...<p>To rebillionizing!<p><a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=wGy5SGTuAGI&amp;t=369s" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=wGy5SGTuAGI&amp;t=369s</a><p>...yeah, the Tres Commas bottle was on the DELETE key. The corner of it was just, it juuuust got on there...
macspoofingabout 3 years ago
&gt; but at the time the code seemed completely correct to me<p>I venture this kind of (misplaced) over-confidence is not atypical of many junior developers. As someone with a few years under my belt, I don&#x27;t care how sure I was of the code I wrote that deletes important data, I would have gone through the code over and over again, and at least ran a simulation (by maybe logging the generated delete urls for manual verification).<p>It&#x27;s a rite of passage and we all went through something like this. It&#x27;s how you learn and grow.<p>&gt;It also should probably teach something to Vimeo<p>No. Even if Vimeo could have made things better, it&#x27;s still your fault. You have to take responsibility for your business. At the end of the day, if this causes the closure of your company, Vimeo is still fine.
aasasdabout 3 years ago
After having read about plenty of such cases over the years, I have a persistent dread of pulling something like that myself, to the point of being nervous with ‘*’ in the terminal, and generally checking everything twice. (And also have some kind of mild horror-high from corporate snafu stories, weirdly reminiscent of Ballard&#x27;s ‘Crash’).<p>So: I never feed the data straight from the gathering script into the modifying script, at least not in the first runs. Instead, I dump the whole list of items into a file, count them in there, gawk at them to see that they&#x27;re right, and compare with the source data by hand until I begin to annoy myself. Then I feed that file to the second script.
furyofantaresabout 3 years ago
Great post and great attitude.<p>I think I would reflect on why this is a script to begin with. It&#x27;s run once and with only 500 items could be done manually, though 500 is certainly a bit much.<p>But it&#x27;s not a massive time saver; the point of the script should be almost entirely to increase accuracy. I think I would write one script to generate the list of videos to delete; that&#x27;s the part that&#x27;s actually difficult, and a human can then verify the list. I would probably just delete them by hand after that, but if I really wanted a script for that part too, it would be a separate script that uses a list that has been vetted by a human even if initially created by the first script.
alkaloidabout 3 years ago
Does anyone else get that deep, dark, disturbing feeling in their gut when they know they have done something bad like this?<p>This is why I use so many print statements and comment out destructive actions! Lots of experience with these feelings!
cat_plus_plusabout 3 years ago
You are fine dude, you didn&#x27;t delete any videos, only high availability cache of videos on a streaming site. If that was your master copy, you probably would have taken greater care, if not :-). Anyway, when working with caches that can be recreated in reasonable time, it&#x27;s normal to take less care than when it comes to originals.<p>The only concern is Google Drive as the only backup, please make sure you have a local copy on a local RAID drive and another one regularly archived and stored in a bank locker.
orange_puffabout 3 years ago
As everyone else has already pointed out, better testing would have been very useful here. For instance, print(len(our_ids)) would have been a dead giveaway that that something was up<p>I am also a junior dev and completely empathize with being given a lot of responsibility and potentially messing up. I think for someone with &lt; 1 year of experience, to solve the problems you created as fast as you did is really impressive. Thankfully your story ends well :)
ge96about 3 years ago
The product I work on, I can watch the events occur afterwards (videos of people using it) and it&#x27;s so embarrassing watching it fail. The wasted time. Ahh... I&#x27;ve gotten better to check deps and run a full automated E2E test everytime new code is deployed (before&#x2F;after diff envs).<p>Still things happen. Hopefully you have a large enough client base where some bad experience doesn&#x27;t define the whole thing.
p0dabout 3 years ago
For many years I have had a private blog. I like to write but realised 99% of us are not interesting to read. This is a young guy processing his thoughts. Not &quot;teaching&quot; the rest of us as he frames it. This should have stayed in-house and personal. The company can then decide which clients, authorities to contact if necessary. There is a book in all of us as they say. For most of us it should stay there.
chanandler_bongabout 3 years ago
Experience is directly proportional to the amount of equipment ruined or data lost.<p>Even though you were fortunate not to lose any data, you gained a lot of experience!
stareatgoatsabout 3 years ago
A great success story as far as I&#x27;m concerned, even if it doesn&#x27;t reflect well on Vimeo support. But a good reminder to have someone doublecheck your logic if you aim to delete massive amounts of data from production. And to check if the backups are working (producing restorable data) on a regular basis. Sometimes they just seem to be working, as I have learned the hard way...
unfocusedabout 3 years ago
I&#x27;m currently working with FOIA software, and a regular user can only delete one document at a time from the information that they verify&#x2F;redact before sending out. They can&#x27;t even multi select! Only an admin can delete multiple documents at one time.<p>I&#x27;m guessing users accidentally deleted multiple documents one too many times, and now it&#x27;s baked in.
wummsabout 3 years ago
Not completely off topic (as one of my scripts deleted files recently which dates were off by one):<p>&gt; Fri May 06 2022<p>&gt; I&#x27;m currently working [...] in Italy
kirillzubovskyabout 3 years ago
Mistakes happen. Kudos to the author on taking it as a learning opportunity. I am friends with a lot of smart devs, and many of them have dropped a production db at least once, and if not then, then accidentally emailed 10k people …etc. It happens. Work to avoid it, but plan for what to do when it inevitably happens. ¯\_(ツ)_&#x2F;¯
SnowHill9902about 3 years ago
Related: is there any HTTP API model that supports transactions with commit and rollback? Also isolation levels? Usually one wants to set_stock(get_stock() + 10) but there may be competing from various clients between both calls, resulting in races. Usual web APIs seem vulnerable to this.
评论 #31272624 未加载
peter303about 3 years ago
Happened to Pixar Toy Story 2 too.<p><a href="https:&#x2F;&#x2F;thenextweb.com&#x2F;news&#x2F;how-pixars-toy-story-2-was-deleted-twice-once-by-technology-and-again-for-its-own-good" rel="nofollow">https:&#x2F;&#x2F;thenextweb.com&#x2F;news&#x2F;how-pixars-toy-story-2-was-delet...</a>
dclowd9901about 3 years ago
His solution reminds me of how I used Cypress to generate test accounts on our local admin dashboard for Cypress tests, since our api was inadequate (it didn&#x27;t do the billing signoff required to create accounts that last longer than a month... don&#x27;t ask...).
BurningPenguinabout 3 years ago
I accidentally deleted a printer from the printserver by using a python script. The docs weren&#x27;t exactly clear, so i thought it would only remove the local printer connection. After reading this post i feel better now. My fuckup wasn&#x27;t that bad in comparison. :)
fedeb95about 3 years ago
in my opinion any process that isn&#x27;t preceded by another identical and automated process that varies only by the data involved is very risky to do in production. your management hopefully had a big reality check? or not because of backups?
mikotodomoabout 3 years ago
&gt; Some of the things that might seem obvious to some might not be so for me, thanks!<p>&gt; my mind thought that url would refresh itself as soon as the page variable changed<p>This is what I thought too when I read the code. I don&#x27;t think it&#x27;s obvious at all!
评论 #31278976 未加载
notaplumber1about 3 years ago
&gt; .. physically backed up in a Google Drive folder ...<p>That&#x27;s not what a physical backup means.
hanly_paulabout 3 years ago
I am also a junior with 1 year’s experience, just in Python but none with the requests module or web development. If the ‘page’ variable is being changed, was the error something specific to this module, not refreshing the page?
DeathArrowabout 3 years ago
This wouldn&#x27;t be an issues if providers like Vimeo would soft delete and hard delete the items after a period of time, allowing recovery between.<p>Everywhere I have to implement a delete operation, I never hard delete data on first call.
dncornholioabout 3 years ago
What is the f doing in<p>url = f&quot;<a href="https:&#x2F;&#x2F;api.ourservice.com&#x2F;media?page{page}&amp;step=100" rel="nofollow">https:&#x2F;&#x2F;api.ourservice.com&#x2F;media?page{page}&amp;step=100</a> ?
评论 #31273093 未加载
评论 #31273530 未加载
评论 #31273321 未加载
评论 #31273132 未加载
ElCapitanMarklaabout 3 years ago
Nice work :D I tend to always add a `--dryrun` flag to any scripts like this these days so that when we move it to production we can run an extra test there just to be sure.
havkomabout 3 years ago
The company was lucky to have someone like you that could actually sort out real problems efficiently. I would bring up this story when negotiating for a raise.
bufferoverflowabout 3 years ago
Always do a dry run when deleting many things with code.<p>- Captain Obvious
donalhuntabout 3 years ago
fwiw I would probably have turned to rclone.org for this. It doesn&#x27;t have support for vimeo out of the box but the Vimeo API seems sane enough that it would be trivial to implement uploads quickly.<p>Previously used rclone for doing massive transfers between cloud providers using &quot;cheap&quot; on-demand servers which provide unlimited data transfer (the public clouds make this very expensive).
Sirikonabout 3 years ago
Everyone makes mistakes, juniors and seniors alike, but I consider you have the right mindset and resolutive skills that will make you thrive :)
vjustabout 3 years ago
So much wisdom in these comments, people have different styles of being careful, and each makes sense in a nuclear &quot;go&quot; situation
amtamtabout 3 years ago
A computer lets you make more mistakes faster than any invention in human history, with the possible exceptions of handguns and tequila.
评论 #31274339 未加载
lnxg33k1about 3 years ago
But are you a junior dev with less than one year of experience working by yourself alone at a company? No tech lead&#x2F;help?
hexspriteabout 3 years ago
when doing migrations&#x2F;conversions I always write a script in dry-run mode first. I exhaustively check the results to make sure they are expected. Then try to do a real conversion&#x2F;transfer of only the 1st file and make sure that worked. Then do a couple more. Etc. Only then do I feel confident to do the whole thing.
IYashaabout 3 years ago
So, apparently, vimeo has better support than youtube (not informative, but at least they DO something). Duly noted.
arein3about 3 years ago
You can automate using puppeteer or selenium
评论 #31271957 未加载
beeforporkabout 3 years ago
&gt; I Accidentally Deleted 7TB of Videos ...<p>Spoiler:<p>But there was a backup that could be reuploaded in time and everything was fine in the end.
AtNightWeCodeabout 3 years ago
The conclusion should include that backup at separate locations is key. Also, that the backups are tested and work. I worked with clients that had everything from lightning strikes destroying servers to ransomware to people making mistakes. No problem with solid backups. There is a difference between a good process and skill.
urbandw311erabout 3 years ago
Would you have had the courage to post this here if you hadn’t been able to fix it?
uptownabout 3 years ago
Junior Dev: &quot;I&#x27;m under an NDA&quot;<p>Also Junior Dev: &quot;Here&#x27;s my source code&quot;
评论 #31279929 未加载
birdyroosterabout 3 years ago
Is 7TB a lot? Peers at personal arrays at orders of magnitude greater.
mbostlemanabout 3 years ago
Related: The change is fine, it&#x27;s only one line.
progxabout 3 years ago
Now you learned what a backup is.
评论 #31272852 未加载
bbbushabout 3 years ago
scary. maybe as well just pay vimeo to restore data.
legalcorrectionabout 3 years ago
[deleted]
评论 #31271721 未加载
评论 #31271836 未加载
shantnutiwariabout 3 years ago
What negativity and arrogance in the comments here. Jeez, it&#x27;s like no one HN ever made a mistake, a bunch of 10xers ninja programmers here. Please read this:<p>&gt;I also want to preface this whole post by saying that I&#x27;m a Junior Developer with less than one year of actual experience. Some of the things that might seem obvious to some might not be so for me, thanks!<p>It&#x27;s just some kid sharing a mistake they made and owning up. Ease up on the &quot;LOL what an idiot&quot; attitude
评论 #31273140 未加载
评论 #31273328 未加载
评论 #31273525 未加载
评论 #31273147 未加载
评论 #31273928 未加载
评论 #31273876 未加载
评论 #31273444 未加载
评论 #31273796 未加载
评论 #31273446 未加载
评论 #31274044 未加载
评论 #31273386 未加载
评论 #31273909 未加载
davbryn1about 3 years ago
&quot;What does this teach us? Well, it teaches me to do more diverse tests when doing destructive operations. It also should probably teach something to Vimeo and to my contractor but I doubt it will (and yes, the upload for some reason is still manual to this day. Go figure!)&quot;<p>So you wrote bad code, didn&#x27;t test it properly, ran it on production on the Friday before a release and are blaming Vimeo and [name redacted]?<p>And your resolution was yet another cobbled together script that you probably didn&#x27;t test?<p>This isn&#x27;t a great article to have attached your name to
评论 #31272014 未加载
评论 #31272331 未加载
评论 #31271998 未加载
评论 #31272164 未加载
评论 #31273630 未加载
评论 #31273791 未加载
评论 #31272773 未加载
评论 #31275918 未加载
评论 #31273394 未加载
评论 #31273927 未加载
whiplash451about 3 years ago
So, “i am under NDA” but I reveal my client’s name and a lot of sensitive details about what we are doing. LOL.
评论 #31271860 未加载
评论 #31273937 未加载
Peleusabout 3 years ago
Under NDA but I&#x27;ll give rough details of what&#x27;s occurring while also naming my client and disparaging them to the public.<p>Well that&#x27;s a brave move...
评论 #31271863 未加载
评论 #31273972 未加载
DeathArrowabout 3 years ago
There&#x27;s a thing called unit tests.
Helitioabout 3 years ago
Just a note: being able to click yourself a server at Google, AWS etc. Might be cheap enough even paying for 15tb of traffic.
nix23about 3 years ago
ZFS -&gt; Snapshot....always!! Before touching writable-data (my personal mantra) ;)
评论 #31271851 未加载
masswerkabout 3 years ago
Controversial opinion: And this is why block syntax by white space is not for production.
评论 #31272069 未加载