Skip to content

Commit

Permalink
core.fsync: add a derived-metadata aggregate option
Browse files Browse the repository at this point in the history
This commit adds an aggregate option that currently includes the
commit-graph file and pack metadata (indexes and bitmaps).

The user may want to exclude this set from durability since they can be
recomputed from other data if they wind up corrupt or missing.

This is split out from the other patches in the series since it is
an optional nice-to-have that might be controversial.

Signed-off-by: Neeraj Singh <neerajsi@microsoft.com>
  • Loading branch information
neerajsi-msft committed Jan 18, 2022
1 parent 39a4e94 commit 7f2e1ce
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
6 changes: 3 additions & 3 deletions Documentation/config/core.txt
Original file line number Diff line number Diff line change
Expand Up @@ -562,9 +562,9 @@ core.fsync::
* `pack-metadata` hardens packfile bitmaps and indexes.
* `commit-graph` hardens the commit graph file.
* `index` hardens the index when it is modified.
* `objects` is an aggregate option that includes `loose-objects`, `pack`,
`pack-metadata`, and `commit-graph`.
* `default` is an aggregate option that is equivalent to `objects,-loose-object`
* `objects` is an aggregate option that includes `loose-objects` and `pack`.
* `derived-metadata` is an aggregate option that includes `pack-metadata` and `commit-graph`.
* `default` is an aggregate option that is equivalent to `objects,derived-metadata,-loose-object`
* `all` is an aggregate option that syncs all individual components above.

core.fsyncMethod::
Expand Down
7 changes: 4 additions & 3 deletions cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -1012,9 +1012,10 @@ enum fsync_component {
FSYNC_COMPONENT_COMMIT_GRAPH)

#define FSYNC_COMPONENTS_OBJECTS (FSYNC_COMPONENT_LOOSE_OBJECT | \
FSYNC_COMPONENT_PACK | \
FSYNC_COMPONENT_PACK_METADATA | \
FSYNC_COMPONENT_COMMIT_GRAPH)
FSYNC_COMPONENT_PACK)

#define FSYNC_COMPONENTS_DERIVED_METADATA (FSYNC_COMPONENT_PACK_METADATA | \
FSYNC_COMPONENT_COMMIT_GRAPH)

#define FSYNC_COMPONENTS_ALL (FSYNC_COMPONENT_LOOSE_OBJECT | \
FSYNC_COMPONENT_PACK | \
Expand Down
1 change: 1 addition & 0 deletions config.c
Original file line number Diff line number Diff line change
Expand Up @@ -1223,6 +1223,7 @@ static const struct fsync_component_entry {
{ "commit-graph", FSYNC_COMPONENT_COMMIT_GRAPH },
{ "index", FSYNC_COMPONENT_INDEX },
{ "objects", FSYNC_COMPONENTS_OBJECTS },
{ "derived-metadata", FSYNC_COMPONENTS_DERIVED_METADATA },
{ "default", FSYNC_COMPONENTS_DEFAULT },
{ "all", FSYNC_COMPONENTS_ALL },
};
Expand Down

0 comments on commit 7f2e1ce

Please sign in to comment.