Live data from Hacker News

Who Needs Git When You Have ZFS?

zef.me

11–20 of 148 posts

Re: Who Needs Git When You Have ZFS?

#11
post #10
post #7

ZFS is excellent for database development! Create a snapshot before you try something that mess up your data and instantly restore it! If your development database is a few gigabytes, this will save you a lot of time.

Sounds great. Can you also duplicate versions of a database to coworkers on the same machine without much cost?

Yes, if they have ZFS too, it is basically snapshot, send & receive. Or you can clone it and rsync it to them.

Do not try to snapshot a running database though. Before you execute the snapshot you should make sure everything is flushed to disk. For example with PostgreSQL you need to create a checkpoint before the snapshot, so you write:

SELECT pg_start_backup('prepare_my_snapshot');

AND when the snapshot is done:

SELECT pg_stop_backup();

Re: Who Needs Git When You Have ZFS?

#12

> Who needs Git? > Notably missing is support for merging So, it's almost like a car except it's missing its wheels No, it's not like Git

That and the rather obvious 'sudo' in front of all the commands.

I mean, it's a cool tool; I use it on my NAS (particularly like the ECC mode instead of dumb RAID), but the git-equivalence aspect looks a little bit like a flamebait ;-)

Re: Who Needs Git When You Have ZFS?

#13
post #11
post #10

Earlier quoted context omitted.

Sounds great. Can you also duplicate versions of a database to coworkers on the same machine without much cost?

Yes, if they have ZFS too, it is basically snapshot, send & receive. Or you can clone it and rsync it to them. Do not try to snapshot a running database though. Before you execute the snapshot you should make sure everything is flushed to disk. For example with PostgreSQL you need to create a checkpoint before the snapshot, so you write: SELECT pg_start_backup('prepare_my_snapshot'); AND when the snapshot is done: SE…

It's not so critical as that. Any transactions in flight when you take the snapshot won't be finalized and will be discarded when you start it back up from the snapshot, but that won't affect the consistency of the database.

Re: Who Needs Git When You Have ZFS?

#16
post #11
post #10

Earlier quoted context omitted.

Sounds great. Can you also duplicate versions of a database to coworkers on the same machine without much cost?

Yes, if they have ZFS too, it is basically snapshot, send & receive. Or you can clone it and rsync it to them. Do not try to snapshot a running database though. Before you execute the snapshot you should make sure everything is flushed to disk. For example with PostgreSQL you need to create a checkpoint before the snapshot, so you write: SELECT pg_start_backup('prepare_my_snapshot'); AND when the snapshot is done: SE…

> Do not try to snapshot a running database though. Before you execute the snapshot you should make sure everything is flushed to disk.

Is a database (or anything else) really supposed to behave that way? Shouldn't every state along the way be possible to resume from? In particular, shouldn't database transactions take care of this?

Re: Who Needs Git When You Have ZFS?

#17
post #7

ZFS is excellent for database development! Create a snapshot before you try something that mess up your data and instantly restore it! If your development database is a few gigabytes, this will save you a lot of time.

Except you'll lose all the data since you created the snapshot... You've been able to do this for years on Linux with LVM anyway.

Re: Who Needs Git When You Have ZFS?

#18
post #7

ZFS is excellent for database development! Create a snapshot before you try something that mess up your data and instantly restore it! If your development database is a few gigabytes, this will save you a lot of time.

Except you'll lose all the data since you created the snapshot... You've been able to do this for years on Linux with LVM anyway.

Re: Who Needs Git When You Have ZFS?

#19
ZFS and other advanced versioned/copy-on-write filesystems are really cool and useful but it's not a source code management tool.

E.g. the examples show branching but not merging.

On the other hand, this might be useful for storing binary large files that are not really diffable and mergeable, and thus a bad fit for Git. However, the typical use case for this is art assets in games, which means that it's the artists and designers who are the target audience. Git is often said to be too difficult for non-programmers, and ZFS or BTRFS is definitely not easier.

Re: Who Needs Git When You Have ZFS?

#20
If you look past the attention-grabbing headline, this shows some pretty cool stuff with ZFS, using source versioning as an analogy to explain what would otherwise be quite abstract when it comes to filesystems. The only thing I knew about ZFS was the name, this helped me see some of its impressive features.

Of course, I'll take reliability & stability over fancy features any day, but I'm glad there's active development in this area, and look forward to seeing these features mature. They could contribute to some interesting simplifications.

Post reply on HN