From 413b6a59ffbd36f0a4c8cee5f867360eaf26aaf1 Mon Sep 17 00:00:00 2001 From: Brandon Philips Date: Thu, 11 Sep 2014 12:51:50 -0700 Subject: [PATCH] wal: add more explanation to wal filename format --- wal/doc.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/wal/doc.go b/wal/doc.go index b39f5f1dc..0727d9252 100644 --- a/wal/doc.go +++ b/wal/doc.go @@ -31,11 +31,16 @@ When a user has finished using a WAL it must be closed: WAL files are placed inside of the directory in the following format: $seq-$index.wal +The first WAL file to be created will be 0000000000000000-0000000000000000.wal +indicating an initial sequence of 0 and an initial raft index of 0. + Periodically a user will want to "cut" the WAL and place new entries into a new file. This will increment an internal sequence number and cause a new file to be created. If the last raft index saved was 0x20 and this is the first time Cut has been called on this WAL then the sequence will increment from 0x0 to -0x1. The new file will be: 0000000000000001-0000000000000020.wal +0x1. The new file will be: 0000000000000001-0000000000000020.wal. If a second +Cut is issues 0x10 entries later then the file will be called: +0000000000000002-0000000000000030.wal. At a later time a WAL can be opened at a particular raft index: