httpie的Github仓库丢失了5.4万收藏量

full httpie lost 54k stars

前两天逛httpie的Github仓库,发现README写了一段有意思的内容

We lost 54k GitHub stars

有点好奇,就点进去看了一下,总的来说这是发生在2022年因为一次误操作把仓库从public改到private导致Github系统把原仓库5.4万的stars清零的悲惨事件。

到现在有一年时间也不属于什么新鲜新闻了,甚至可能看到这篇文章的很多读者都已经知道了这件事,接下来我就摘抄文章里的一些有意思的片段

You’re about to kill 55,000 people

The dialog should be more contextual and, paraphrasing again, it should say “You’re about to kill 55,000 people.” That would’ve certainly made me pause.

在Github弹窗修改repo的visibility从public到private时,应该提示我这个操作我将会杀掉5万5千个人

GitHub didn’t allow me to do that—for an entire half an hour

So I went back to the repo’s settings to flip the switch. But GitHub didn’t allow me to do that—for an entire half an hour.

作者意识有问题了,于是他想切换repo的visibility从private到public,但Github在半小时内不允许它这么做,随后它解释了为什么Github为什么在半个小时内不允许他切换会public,因为Github此刻正在忙着删除httpie仓库的star星星

mysql > UPDATE repo_stargazers SET visibility-"private" WHERE
repo="httpie/httpie";
Query OK, 1 row affected (0.012 sec)
mysql > DELETE FROM repo_stargazers WHERE repo="httpie/httpie"; Query OK, 54386 rows affected (28 min)
mysql > DELETE FROM repo_watchers WHERE repo-"httpie/httpie";
Query OK, 1154 rows affected (4 sec)

Why doesn’t GitHub restore it?

GitHub obviously has backups. And it is indeed possible to undo the damage done by accidentally making a repo private. The GitHub team themselves accidentally made the GitHub Desktop app repo private once. And they restored everything for themselves within hours

简单说就是Github是有备份数据的,他们完全可以恢复数据在个把小时内

GitHub will restore a repo damaged by making it private

So the answer to the question is, unfortunately, the following: GitHub will restore a repo damaged by making it private. But only if it’s one of their own projects, not a community one. The latter gets a tweet, at best.

他愿意付钱让Github团队帮他恢复,但Github团队说他们有更高优先级的事情拒绝了帮httpie恢复星星,为什么他觉得Github可以做到呢?是因为2020年GitHub桌面App的Repo也犯过同样的错误,然后他们的前CEO发推说

A developer mistakenly made the GitHub Desktop repo private this morning. Flipping it back doesn’t restore stars (and a few other things), so we are restoring from DB backup. That's all.

但是Github团队备份数据只能恢复他们自己的项目,不是社区的项目。

a few lessons learned

吸取一些教训,作者给了UI/UX的建议

full httpie delete ui

也给了数据库设计的例子,Soft-deletes(软删除),可以从30分钟的操作缩短到1秒以内,还能解决错误操作的迅速恢复

mysqI > UPDATE repo_stargazers SET visibility "private" WHERE
repo="httpie/httpie"; Query OK, 1 row affected (0.012 sec) mysq1 > UPDATE repo_stargazers SET _deleted-true WHERE repo-"httpie/
httpie"; Query OK, 54386 rows affected (0.85 sec) mysqi > UPDATE repo_watchers SET _deleted-true WHERE repo-"httpie/
httpie";
Query OK, 1154 rows affected (0.09 sec)

我猜作者几乎是哭着写这篇文章,同时还很气愤,Github上如果你的项目星星很多要注意别误操作了~后果很严重

分享

TITLE: httpie的Github仓库丢失了5.4万收藏量

LINK: https://www.qttc.net/555-httpie-lost-54k-stars.html

NOTE: 原创内容,转载请注明出自琼台博客