Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ideas for using the flags #8514

Open
ThomasWaldmann opened this issue Nov 1, 2024 · 3 comments
Open

ideas for using the flags #8514

ThomasWaldmann opened this issue Nov 1, 2024 · 3 comments

Comments

@ThomasWaldmann
Copy link
Member

ThomasWaldmann commented Nov 1, 2024

The ChunkIndex is a mapping 256bit key --> (32bit flags, 32bit size) since #8513.

The user flags are:

  • F_USED, meaning the chunk is referenced / used. this is used by borg compact to determine which chunks are used / which are not used (and then deleting the unused chunks from the repo).
  • F_COMPRESS, meaning the chunk shall get (re-)compressed, used by borg repo-compress.

The system flags are:

  • F_NEW, meaning the chunk was added after the last saving of the chunk index (flagging the chunks that need to be saved next)

Other flag bits are not used yet and available for creative usage.

Besides using these bits as flags/markers of some kind, we can also do memory-efficient (no additional memory use!) set operations, like e.g. to compute a set intersection:

  • set bit1 for members of set1
  • set bit2 for members of set2
  • intersection set1 & set2: iterate over all entries in the ChunkIndex, entries with both bits set are members of the intersection.

Collect any ideas what can be done with that below.

@ThomasWaldmann
Copy link
Member Author

ThomasWaldmann commented Nov 5, 2024

In #8503 there was the idea of F_CLEAN (when not set, the hashtable entry is "dirty", meaning it has not yet been written to storage).

Update: Instead the of the clean/dirty metaphor, "new" (F_NEW) was found to be more appropriate.

Update: fixed by #8541

@ThomasWaldmann
Copy link
Member Author

ThomasWaldmann commented Nov 14, 2024

borg repo-compress could flag the chunks it finds in need of recompression. currently it uses a python datastructure for them.

Update: fixed by #8543

@ThomasWaldmann
Copy link
Member Author

ThomasWaldmann commented Nov 15, 2024

Maybe borg check could use the flags to avoid having to read repo chunks multiple times in different parts of the check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant