Commit e351555
reftable/stack: add function to check if optimization is required
The reftable backend performs auto-compaction as part of its regular
flow, which is required to keep the number of tables part of a stack at
bay. This allows it to stay optimized.
Compaction can also be triggered voluntarily by the user via the 'git
pack-refs' or the 'git refs optimize' command. However, currently there
is no way for the user to check if optimization is required without
actually performing it.
Extract out the heuristics logic from 'reftable_stack_auto_compact()'
into an internal function 'update_segment_if_compaction_required()'.
Then use this to add and expose `reftable_stack_compaction_required()`
which will allow users to check if the reftable backend can be
optimized.
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Acked-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>1 parent 135f491 commit e351555
File tree
3 files changed
+58
-7
lines changed- reftable
- t/unit-tests
3 files changed
+58
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
126 | 137 | | |
127 | 138 | | |
128 | 139 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1647 | 1647 | | |
1648 | 1648 | | |
1649 | 1649 | | |
1650 | | - | |
| 1650 | + | |
| 1651 | + | |
| 1652 | + | |
| 1653 | + | |
1651 | 1654 | | |
1652 | | - | |
1653 | 1655 | | |
1654 | 1656 | | |
1655 | | - | |
| 1657 | + | |
| 1658 | + | |
| 1659 | + | |
| 1660 | + | |
| 1661 | + | |
| 1662 | + | |
| 1663 | + | |
1656 | 1664 | | |
| 1665 | + | |
| 1666 | + | |
| 1667 | + | |
| 1668 | + | |
| 1669 | + | |
| 1670 | + | |
| 1671 | + | |
| 1672 | + | |
| 1673 | + | |
| 1674 | + | |
| 1675 | + | |
| 1676 | + | |
| 1677 | + | |
| 1678 | + | |
| 1679 | + | |
| 1680 | + | |
| 1681 | + | |
| 1682 | + | |
| 1683 | + | |
| 1684 | + | |
| 1685 | + | |
| 1686 | + | |
| 1687 | + | |
| 1688 | + | |
1657 | 1689 | | |
1658 | | - | |
| 1690 | + | |
1659 | 1691 | | |
1660 | 1692 | | |
1661 | 1693 | | |
1662 | | - | |
| 1694 | + | |
1663 | 1695 | | |
1664 | 1696 | | |
1665 | 1697 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1067 | 1067 | | |
1068 | 1068 | | |
1069 | 1069 | | |
| 1070 | + | |
1070 | 1071 | | |
1071 | 1072 | | |
1072 | 1073 | | |
| |||
1087 | 1088 | | |
1088 | 1089 | | |
1089 | 1090 | | |
1090 | | - | |
| 1091 | + | |
| 1092 | + | |
1091 | 1093 | | |
1092 | | - | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
1093 | 1099 | | |
| 1100 | + | |
| 1101 | + | |
1094 | 1102 | | |
1095 | 1103 | | |
1096 | 1104 | | |
| |||
0 commit comments