pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/gitgitgadget/git/commit/bc91330cecfdc9a00a486923126a969fee6ace36

2350aeda.css" /> reftable/stack: expose option to disable auto-compaction · gitgitgadget/git@bc91330 · GitHub
Skip to content

Commit bc91330

Browse files
jltoblergitster
authored andcommitted
reftable/stack: expose option to disable auto-compaction
The reftable stack already has a variable to configure whether or not to run auto-compaction, but it is inaccessible to users of the library. There exist use cases where a caller may want to have more control over auto-compaction. Move the `disable_auto_compact` option into `reftable_write_options` to allow external callers to disable auto-compaction. This will be used in a subsequent commit. Signed-off-by: Justin Tobler <jltobler@gmail.com> Acked-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 7424fb7 commit bc91330

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

reftable/reftable-writer.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ struct reftable_write_options {
4646
* is a single line, and add '\n' if missing.
4747
*/
4848
unsigned exact_log_message : 1;
49+
50+
/* boolean: Prevent auto-compaction of tables. */
51+
unsigned disable_auto_compact : 1;
4952
};
5053

5154
/* reftable_block_stats holds statistics for a single block type */

reftable/stack.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ int reftable_addition_commit(struct reftable_addition *add)
680680
if (err)
681681
goto done;
682682

683-
if (!add->stack->disable_auto_compact) {
683+
if (!add->stack->config.disable_auto_compact) {
684684
/*
685685
* Auto-compact the stack to keep the number of tables in
686686
* control. It is possible that a concurrent writer is already

reftable/stack.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ struct reftable_stack {
1919
int list_fd;
2020

2121
char *reftable_dir;
22-
int disable_auto_compact;
2322

2423
struct reftable_write_options config;
2524

reftable/stack_test.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ static void test_reftable_stack_transaction_api_performs_auto_compaction(void)
315315
* we can ensure that we indeed honor this setting and have
316316
* better control over when exactly auto compaction runs.
317317
*/
318-
st->disable_auto_compact = i != n;
318+
st->config.disable_auto_compact = i != n;
319319

320320
err = reftable_stack_new_addition(&add, st);
321321
EXPECT_ERR(err);
@@ -487,6 +487,7 @@ static void test_reftable_stack_add(void)
487487
struct reftable_write_options cfg = {
488488
.exact_log_message = 1,
489489
.default_permissions = 0660,
490+
.disable_auto_compact = 1,
490491
};
491492
struct reftable_stack *st = NULL;
492493
char *dir = get_tmp_dir(__LINE__);
@@ -498,7 +499,6 @@ static void test_reftable_stack_add(void)
498499

499500
err = reftable_new_stack(&st, dir, cfg);
500501
EXPECT_ERR(err);
501-
st->disable_auto_compact = 1;
502502

503503
for (i = 0; i < N; i++) {
504504
char buf[256];
@@ -925,7 +925,9 @@ static void test_empty_add(void)
925925

926926
static void test_reftable_stack_auto_compaction(void)
927927
{
928-
struct reftable_write_options cfg = { 0 };
928+
struct reftable_write_options cfg = {
929+
.disable_auto_compact = 1,
930+
};
929931
struct reftable_stack *st = NULL;
930932
char *dir = get_tmp_dir(__LINE__);
931933

@@ -935,7 +937,6 @@ static void test_reftable_stack_auto_compaction(void)
935937
err = reftable_new_stack(&st, dir, cfg);
936938
EXPECT_ERR(err);
937939

938-
st->disable_auto_compact = 1; /* call manually below for coverage. */
939940
for (i = 0; i < N; i++) {
940941
char name[100];
941942
struct reftable_ref_record ref = {
@@ -984,7 +985,7 @@ static void test_reftable_stack_add_performs_auto_compaction(void)
984985
* we can ensure that we indeed honor this setting and have
985986
* better control over when exactly auto compaction runs.
986987
*/
987-
st->disable_auto_compact = i != n;
988+
st->config.disable_auto_compact = i != n;
988989

989990
strbuf_reset(&refname);
990991
strbuf_addf(&refname, "branch-%04d", i);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy