Skip to content

Commit

Permalink
Make node ID ephemeral (#398)
Browse files Browse the repository at this point in the history
  • Loading branch information
benbjohnson authored Aug 29, 2023
1 parent 3541d07 commit b216362
Show file tree
Hide file tree
Showing 5 changed files with 111 additions and 182 deletions.
4 changes: 2 additions & 2 deletions backup_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (c *FileBackupClient) Open() (err error) {
return err
}

if err := os.MkdirAll(c.path, 0777); err != nil {
if err := os.MkdirAll(c.path, 0o777); err != nil {
return err
}
return nil
Expand Down Expand Up @@ -170,7 +170,7 @@ func (c *FileBackupClient) WriteTx(ctx context.Context, name string, r io.Reader
// Write file to a temporary file.
filename := filepath.Join(c.path, name, ltx.FormatFilename(hdr.MinTXID, hdr.MaxTXID))
tempFilename := filename + ".tmp"
if err := os.MkdirAll(filepath.Dir(tempFilename), 0777); err != nil {
if err := os.MkdirAll(filepath.Dir(tempFilename), 0o777); err != nil {
return 0, err
}
f, err := os.Create(tempFilename)
Expand Down
4 changes: 2 additions & 2 deletions cmd/litefs/mount_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2370,7 +2370,7 @@ func TestFunctional_OK(t *testing.T) {
return
}

t.Logf("%s @ %s: insert", m.Store.LogPrefix(), m.Store.DB("db").Pos())
t.Logf("@%s: insert", m.Store.DB("db").Pos())
if _, err := db.Exec(`INSERT INTO t (node_id, value) VALUES (?, ?)`, i, strings.Repeat("x", 200)); err != nil {
t.Errorf("cannot insert (node %d, iter %d): %s", i, j, err)
return
Expand All @@ -2388,7 +2388,7 @@ func TestFunctional_OK(t *testing.T) {

<-ticker.C

t.Logf("%s @ %s: read", m.Store.LogPrefix(), m.Store.DB("db").Pos())
t.Logf("@%s: read", m.Store.DB("db").Pos())

var id, nodeID int
var value string
Expand Down
Loading

0 comments on commit b216362

Please sign in to comment.