Skip to content

reftable: fix writing multi-level indices

Patrick Steinhardt git 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest5 patches 4 repliesIn review
  2. v15 patches 5 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5reftable/reader: be more careful about errors in indexed seeksreftable/reader.c+3 -00 replies
2/5reftable/writer: use correct type to iterate through index entriesreftable/writer.c+7 -90 replies
3/5reftable/writer: simplify writing index recordsreftable/writer.c+3 -150 replies
4/5reftable/writer: fix writing multi-level indicesreftable/readwrite_test.c reftable/writer.c+60 -42 replies
5/5reftable: document reading and writing indicesreftable/reader.c reftable/writer.c+50 -02 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/5] reftable: fix writing multi-level indices

Hi,

this is the second version of my patch series that fixes writing of multi-level indices. There are two minor changes compared to v1:

- Slightly rephrased a commit message.

- Dropped an added newline that resulted in a new hunk.

The patch series continues to build on top of jc/reftable-core-fsync.

Thanks!

Patrick

Patrick Steinhardt (5):
reftable/reader: be more careful about errors in indexed seeks reftable/writer: use correct type to iterate through index entries reftable/writer: simplify writing index records reftable/writer: fix writing multi-level indices
reftable: document reading and writing indices

 reftable/reader.c         | 30 +++++++++++++++++++
 reftable/readwrite_test.c | 56 ++++++++++++++++++++++++++++++++++
 reftable/writer.c         | 63 ++++++++++++++++++++++-----------------
 3 files changed, 122 insertions(+), 27 deletions(-)

Range-diff against v1:

1:  ecf834a299 = 1:  ecf834a299 reftable/reader: be more careful about errors in indexed seeks
2:  88541d03be = 2:  88541d03be reftable/writer: use correct type to iterate through index entries
3:  b0982baacf ! 3:  b3de0b7f3b reftable/writer: simplify writing index records

@@ Metadata
## Commit message ##
reftable/writer: simplify writing index records

- When finishing the current section we may end up writing index records
- for the section to the table. The logic to do so essentially copies what
- we already have in writer_add_record(), making this more complicated
- than it really has to be.
+ When finishing the current section some index records might be written
+ for the section to the table. The logic that adds these records to the
+ writer duplicates what we already have in writer_add_record(), making
+ this more complicated than it really has to be.

- Simplify the code by using writer_add_record() instead.
+ Simplify the code by using writer_add_record() instead. While at it,
+ drop the unneeded braces around a loop to make the code conform to our
+ code style better.

## reftable/writer.c ##
-@@ reftable/writer.c: static int writer_finish_section(struct reftable_writer *w)
- w->index = NULL;
- w->index_len = 0;
- w->index_cap = 0;
-+
- for (i = 0; i < idx_len; i++) {
- struct reftable_record rec = {
- .type = BLOCK_TYPE_INDEX,
@@ reftable/writer.c: static int writer_finish_section(struct reftable_writer *w)
.idx = idx[i],
},

4:  9c6622c409 = 4:  89a88cf83e reftable/writer: fix writing multi-level indices
5:  7850e65878 = 5:  c3492bbd42 reftable: document reading and writing indices
Signature · 1 line
2.43.GIT