Snapshot and different version

Hi everybody,
I have one doubt about snapshot mechanism.
I imported shakespeare index with 111k documents and then I created a snapshot (ver.1). its size is 21 mb (the same of index). after that I created a second snapshot (ver.2) but the repository folder didn't increase its size (still remain 21 mb). in my mind, the ver.2 was incremental so I supposed that if I delete index and snapshot (ver.1) and then try to restore snapshot (ver.2) something should fail. instead, it works correctly and restores the whole index.
so, my question is: how does really snapshot mechanism work? something escapes to me

A snapshot is like a pointer to segments. Segments are immutable.
When you don't modify anything and snapshot again, the same segments are still the "right" segments for your index, which means that snapshot2 just reference existing segments.

When you delete a snapshot, only segments which are not referenced anymore are removed. In that case, nothing has been removed as all segments are still useful for snapshot2.

That's why you can restore snapshot2 as it has all needed files.

2 Likes

first of all, thank you for the answer.
so:
ver.1 contains all the documents + pointer to segments.
ver.2 contains only a pointer to segments, since all the documents are still in the folder.

right?
so, I can create 10 snapshot but the image of the index on the disk will be just one, isn't it?

That's it. Note that a segment contains documents. It's not segments + documents.

So, if I want to create the snapshot of an index and then move it (with all files) on the backup tapes to recovery disk space, is there something that should know before to do that?

You can't move a snapshot. You can move a repository with all its snapshots.
In other words, create a new repository, snapshot the index and move the repository.

1 Like

Sounds good! So, in this way I should create a new repository every time (with a timestamp in the name), snapshot whatever I want and then move it.
Really thanks

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.