Skip to content

Commit

Permalink
comment(logger): add comment about linearisable reads
Browse files Browse the repository at this point in the history
  • Loading branch information
symbiont-stevan-andjelkovic committed Jan 29, 2021
1 parent b63512d commit 0e08de7
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/logger/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,19 @@ func main() {
r := bufio.NewReaderSize(fh, PIPE_BUF)

for {
// TODO(stevan): If we want or need to support linearisable
// reads rather than eventual consist ant reads, we could do it
// as follows. Upon opening the db, save the highest index of
// the event log table. When reading a line, increment the
// index, parse the line to determine if it's a write or a read.
// If it's a write, proceed like below. If it's a read then
// spawn a new goroutine and pass it the index and the read
// query. This reader goroutine should then wait until the index
// is persisted in the db and then perform the read query. This
// way the reads happen as fast they can while being
// linearisable and not holding up writes. The efficiency of
// this solution relies on the assumption that there are many
// writes between each read.
line, err := r.ReadBytes('\n')
for err == nil {
enqueue(queue, line)
Expand Down

0 comments on commit 0e08de7

Please sign in to comment.