Skip to content

Commit

Permalink
Prepare release 0.0.2 (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
Steffen Siering committed Aug 3, 2018
1 parent 80a2e39 commit 6599714
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 9 deletions.
26 changes: 21 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,38 @@ This project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

### Added

### Changed

### Deprecated

### Removed

### Fixed


## [0.0.2]

### Added
- Add `(*pq.Reader).Begin/Done` to reuse a read transaction for multiple reads. PR #4
- Add `Flags` to txfile.Options. PR #5
- Add support to increase a file's maxSize on open. PR #5
- Add support to reduce the maximum file size PR #8
- Add support to pre-allocate the meta area. PR #7
- Improved error handling and error reporting. PR #15, #16, #17, #18
- Begin returns an error if transaction is not compatible to file open mode. PR #17
- Introduce Error type to txfile and pq package. PR #17, #18

### Changed
- Refine platform dependent file syncing. PR #10

### Deprecated

### Removed
- Begin methods can return an error. PR #17

### Fixed
- Windows Fix: Add missing file unlock on close, so file can be reopened and locked. PR #11
- Windows Fix: Can not open file because '<filename>' can not be locked right now. PR #11
- Windows Fix: Max mmaped area must not exceed actual file size on windows. PR #11


[Unreleased]: https://github.com/elastic/go-structform/compare/v0.0.1...HEAD
[Unreleased]: https://github.com/elastic/go-txfile/compare/v0.0.2...HEAD
[0.0.2]: https://github.com/elastic/go-txfile/compare/v0.0.1...v0.0.2
8 changes: 5 additions & 3 deletions file.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ import (
"math/bits"
"os"
"sync"
"sync/atomic"
"unsafe"

"github.com/elastic/beats/libbeat/common/atomic"
"github.com/elastic/go-txfile/internal/cleanup"
"github.com/elastic/go-txfile/internal/invariant"
"github.com/elastic/go-txfile/internal/vfs"
Expand Down Expand Up @@ -53,7 +53,7 @@ type File struct {
meta [2]*metaPage
metaActive int

txids atomic.Uint
txids uint64
}

// internal contants
Expand Down Expand Up @@ -299,7 +299,9 @@ func (f *File) beginTx(settings TxOptions) (*Tx, reason) {
lock := f.locks.TxLock(settings.Readonly)
lock.Lock()
tracef("init new transaction (readonly: %v)\n", settings.Readonly)
tx := newTx(f, f.txids.Inc(), lock, settings)

txid := atomic.AddUint64(&f.txids, 1)
tx := newTx(f, txid, lock, settings)
tracef("begin transaction: %p (readonly: %v)\n", tx, settings.Readonly)
return tx, nil
}
Expand Down
13 changes: 13 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module github.com/elastic/go-txfile

require (
github.com/davecgh/go-spew v1.1.0 // indirect
github.com/kr/pretty v0.1.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/stretchr/testify v1.2.2
github.com/theckman/go-flock v0.4.0
github.com/urso/go-bin v0.0.0-20180220135811-781c575c9f0e
github.com/urso/qcgen v0.0.0-20180131103024-0b059e7db4f4
golang.org/x/sys v0.0.0-20180802203216-0ffbfd41fbef
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
)
21 changes: 21 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/theckman/go-flock v0.4.0 h1:bcqNkS4RTQBGWybG7IBimUMxnLz53Qes1+D4QaOhzJc=
github.com/theckman/go-flock v0.4.0/go.mod h1:kjuth3y9VJ2aNlkNEO99G/8lp9fMIKaGyBmh84IBheM=
github.com/urso/go-bin v0.0.0-20180220135811-781c575c9f0e h1:NiofbjIUI5gR+ybDsGSVH1fWyjSeDYiYVJHT1+kcsak=
github.com/urso/go-bin v0.0.0-20180220135811-781c575c9f0e/go.mod h1:6GfHrdWBQYjFRIznu7XuQH4lYB2w8nO4bnImVKkzPOM=
github.com/urso/qcgen v0.0.0-20180131103024-0b059e7db4f4 h1:hhA8EBThzz9PztawVTycKvfETVuBqxAQ5keFlAVtbAw=
github.com/urso/qcgen v0.0.0-20180131103024-0b059e7db4f4/go.mod h1:RspW+E2Yb7Fs7HclB2tiDaiu6Rp41BiIG4Wo1YaoXGc=
golang.org/x/sys v0.0.0-20180802203216-0ffbfd41fbef h1:ESfhYoBNk2UQGmavscFPKfwmc4ZTB2+UdQYsVw6Bq9M=
golang.org/x/sys v0.0.0-20180802203216-0ffbfd41fbef/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
2 changes: 1 addition & 1 deletion tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ type txFlags struct {
checkpoint bool // mark wal checkpoint has been applied
}

func newTx(file *File, id uint, lock sync.Locker, settings TxOptions) *Tx {
func newTx(file *File, id uint64, lock sync.Locker, settings TxOptions) *Tx {
meta := file.getMetaPage()
invariant.Check(meta != nil, "file meta is not set")

Expand Down

0 comments on commit 6599714

Please sign in to comment.