All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] reftable/stack: fsync "tables.list" during compaction
@ 2024-01-30  5:22 Patrick Steinhardt
  2024-01-30 19:04 ` Justin Tobler
  0 siblings, 1 reply; 3+ messages in thread
From: Patrick Steinhardt @ 2024-01-30  5:22 UTC (permalink / raw)
  To: git; +Cc: John Cai

[-- Attachment #1: Type: text/plain, Size: 1263 bytes --]

In 1df18a1c9a (reftable: honor core.fsync, 2024-01-23), we have added
code to fsync both newly written reftables as well as "tables.list" to
disk. But there are two code paths where "tables.list" is being written:

  - When appending a new table due to a normal ref update.

  - When compacting a range of tables during compaction.

We have only addressed the former code path, but do not yet sync the new
"tables.list" file in the latter. Fix this ommission.

Note that we are not yet adding any tests. These tests will be added
once the "reftable" backend has been upstreamed.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
 reftable/stack.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/reftable/stack.c b/reftable/stack.c
index ab295341cc..01d05933f6 100644
--- a/reftable/stack.c
+++ b/reftable/stack.c
@@ -1018,6 +1018,14 @@ static int stack_compact_range(struct reftable_stack *st, int first, int last,
 		unlink(new_table_path.buf);
 		goto done;
 	}
+
+	err = fsync_component(FSYNC_COMPONENT_REFERENCE, lock_file_fd);
+	if (err < 0) {
+		err = REFTABLE_IO_ERROR;
+		unlink(new_table_path.buf);
+		goto done;
+	}
+
 	err = close(lock_file_fd);
 	lock_file_fd = -1;
 	if (err < 0) {
-- 
2.43.GIT


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] reftable/stack: fsync "tables.list" during compaction
  2024-01-30  5:22 [PATCH] reftable/stack: fsync "tables.list" during compaction Patrick Steinhardt
@ 2024-01-30 19:04 ` Justin Tobler
  2024-01-31  5:46   ` Patrick Steinhardt
  0 siblings, 1 reply; 3+ messages in thread
From: Justin Tobler @ 2024-01-30 19:04 UTC (permalink / raw)
  To: Patrick Steinhardt; +Cc: git, John Cai

On Mon, Jan 29, 2024 at 11:23 PM Patrick Steinhardt <ps@pks.im> wrote:
>
> In 1df18a1c9a (reftable: honor core.fsync, 2024-01-23), we have added
> code to fsync both newly written reftables as well as "tables.list" to
> disk. But there are two code paths where "tables.list" is being written:
>
>   - When appending a new table due to a normal ref update.
>
>   - When compacting a range of tables during compaction.
>
> We have only addressed the former code path, but do not yet sync the new
> "tables.list" file in the latter. Fix this ommission.

nit: s/ommission/omission

>
> Note that we are not yet adding any tests. These tests will be added
> once the "reftable" backend has been upstreamed.
>

Nice catch! I noticed a small typo in the commit message but otherwise looks
good to me.

-Justin

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] reftable/stack: fsync "tables.list" during compaction
  2024-01-30 19:04 ` Justin Tobler
@ 2024-01-31  5:46   ` Patrick Steinhardt
  0 siblings, 0 replies; 3+ messages in thread
From: Patrick Steinhardt @ 2024-01-31  5:46 UTC (permalink / raw)
  To: Justin Tobler; +Cc: git, John Cai

[-- Attachment #1: Type: text/plain, Size: 1139 bytes --]

On Tue, Jan 30, 2024 at 01:04:46PM -0600, Justin Tobler wrote:
> On Mon, Jan 29, 2024 at 11:23 PM Patrick Steinhardt <ps@pks.im> wrote:
> >
> > In 1df18a1c9a (reftable: honor core.fsync, 2024-01-23), we have added
> > code to fsync both newly written reftables as well as "tables.list" to
> > disk. But there are two code paths where "tables.list" is being written:
> >
> >   - When appending a new table due to a normal ref update.
> >
> >   - When compacting a range of tables during compaction.
> >
> > We have only addressed the former code path, but do not yet sync the new
> > "tables.list" file in the latter. Fix this ommission.
> 
> nit: s/ommission/omission

I knew this looked weird when writing it! Should've looked it up.

> > Note that we are not yet adding any tests. These tests will be added
> > once the "reftable" backend has been upstreamed.
> >
> 
> Nice catch! I noticed a small typo in the commit message but otherwise looks
> good to me.

Thanks. I'll refrain from sending out a new version for this typo alone,
but will fix it if other feedback requires a second iteration.

Patrick

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-01-31  5:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-30  5:22 [PATCH] reftable/stack: fsync "tables.list" during compaction Patrick Steinhardt
2024-01-30 19:04 ` Justin Tobler
2024-01-31  5:46   ` Patrick Steinhardt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.