Skip to content
This repository was archived by the owner on Aug 13, 2019. It is now read-only.

Commit b81e0fb

Browse files
author
Fabian Reinartz
committed
Address comments
Signed-off-by: Fabian Reinartz <[email protected]>
1 parent 3e76f01 commit b81e0fb

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

docs/format/wal.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# WAL Disk Format
22

3-
The write ahead log operates in segments that that are numbered and sequential,
3+
The write ahead log operates in segments that are numbered and sequential,
44
e.g. `000000`, `000001`, `000002`, etc., and are limited to 128MB by default.
55
A segment is written to in pages of 32KB. Only the last page of the most recent segment
66
may be partial. A WAL record is an opaque byte slice that gets split up into sub-records
@@ -17,13 +17,21 @@ Notable deviations are that the record fragment is encoded as:
1717
└───────────┴──────────┴────────────┴──────────────┘
1818
```
1919

20+
The type flag has the following states:
21+
22+
* `0`: rest of page will be empty
23+
* `1`: a full record encoded in a single fragment
24+
* `2`: first fragment of a record
25+
* `3`: middle fragment of a record
26+
* `4`: final fragment of a record
27+
2028
## Record encoding
2129

2230
The records written to the write ahead log are encoded as follows:
2331

2432
### Series records
2533

26-
Series records encode the labels that identifier a series and its unique ID.
34+
Series records encode the labels that identifies a series and its unique ID.
2735

2836
```
2937
┌────────────────────────────────────────────┐

fileutil/fileutil.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ func ReadDir(dirpath string) ([]string, error) {
2727

2828
// Rename safely renames a file.
2929
func Rename(from, to string) error {
30-
if err := os.RemoveAll(to); err != nil {
31-
return err
32-
}
3330
if err := os.Rename(from, to); err != nil {
3431
return err
3532
}

wal/wal.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ func OpenReadSegment(fn string) (*Segment, error) {
140140

141141
// WAL is a write ahead log that stores records in segment files.
142142
// It must be read from start to end once before logging new data.
143-
// If an erroe occurs during read, the repair procedure must be called
143+
// If an error occurs during read, the repair procedure must be called
144144
// before it's safe to do further writes.
145145
//
146146
// Segments are written to in pages of 32KB, with records possibly split

0 commit comments

Comments
 (0)