Skip to content

Commit 6599714

Browse files
author
Steffen Siering
authored
Prepare release 0.0.2 (#19)
1 parent 80a2e39 commit 6599714

File tree

5 files changed

+61
-9
lines changed

5 files changed

+61
-9
lines changed

CHANGELOG.md

+21-5
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,38 @@ This project adheres to [Semantic Versioning](http://semver.org/).
44

55
## [Unreleased]
66

7+
### Added
8+
9+
### Changed
10+
11+
### Deprecated
12+
13+
### Removed
14+
15+
### Fixed
16+
17+
18+
## [0.0.2]
19+
720
### Added
821
- Add `(*pq.Reader).Begin/Done` to reuse a read transaction for multiple reads. PR #4
922
- Add `Flags` to txfile.Options. PR #5
1023
- Add support to increase a file's maxSize on open. PR #5
24+
- Add support to reduce the maximum file size PR #8
1125
- Add support to pre-allocate the meta area. PR #7
26+
- Improved error handling and error reporting. PR #15, #16, #17, #18
1227
- Begin returns an error if transaction is not compatible to file open mode. PR #17
1328
- Introduce Error type to txfile and pq package. PR #17, #18
1429

1530
### Changed
1631
- Refine platform dependent file syncing. PR #10
17-
18-
### Deprecated
19-
20-
### Removed
32+
- Begin methods can return an error. PR #17
2133

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

2439

25-
[Unreleased]: https://github.com/elastic/go-structform/compare/v0.0.1...HEAD
40+
[Unreleased]: https://github.com/elastic/go-txfile/compare/v0.0.2...HEAD
41+
[0.0.2]: https://github.com/elastic/go-txfile/compare/v0.0.1...v0.0.2

file.go

+5-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ import (
2323
"math/bits"
2424
"os"
2525
"sync"
26+
"sync/atomic"
2627
"unsafe"
2728

28-
"github.com/elastic/beats/libbeat/common/atomic"
2929
"github.com/elastic/go-txfile/internal/cleanup"
3030
"github.com/elastic/go-txfile/internal/invariant"
3131
"github.com/elastic/go-txfile/internal/vfs"
@@ -53,7 +53,7 @@ type File struct {
5353
meta [2]*metaPage
5454
metaActive int
5555

56-
txids atomic.Uint
56+
txids uint64
5757
}
5858

5959
// internal contants
@@ -299,7 +299,9 @@ func (f *File) beginTx(settings TxOptions) (*Tx, reason) {
299299
lock := f.locks.TxLock(settings.Readonly)
300300
lock.Lock()
301301
tracef("init new transaction (readonly: %v)\n", settings.Readonly)
302-
tx := newTx(f, f.txids.Inc(), lock, settings)
302+
303+
txid := atomic.AddUint64(&f.txids, 1)
304+
tx := newTx(f, txid, lock, settings)
303305
tracef("begin transaction: %p (readonly: %v)\n", tx, settings.Readonly)
304306
return tx, nil
305307
}

go.mod

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
module github.com/elastic/go-txfile
2+
3+
require (
4+
github.com/davecgh/go-spew v1.1.0 // indirect
5+
github.com/kr/pretty v0.1.0 // indirect
6+
github.com/pmezard/go-difflib v1.0.0 // indirect
7+
github.com/stretchr/testify v1.2.2
8+
github.com/theckman/go-flock v0.4.0
9+
github.com/urso/go-bin v0.0.0-20180220135811-781c575c9f0e
10+
github.com/urso/qcgen v0.0.0-20180131103024-0b059e7db4f4
11+
golang.org/x/sys v0.0.0-20180802203216-0ffbfd41fbef
12+
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 // indirect
13+
)

go.sum

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
2+
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
3+
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
4+
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
5+
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
6+
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
7+
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
8+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
9+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
10+
github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w=
11+
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
12+
github.com/theckman/go-flock v0.4.0 h1:bcqNkS4RTQBGWybG7IBimUMxnLz53Qes1+D4QaOhzJc=
13+
github.com/theckman/go-flock v0.4.0/go.mod h1:kjuth3y9VJ2aNlkNEO99G/8lp9fMIKaGyBmh84IBheM=
14+
github.com/urso/go-bin v0.0.0-20180220135811-781c575c9f0e h1:NiofbjIUI5gR+ybDsGSVH1fWyjSeDYiYVJHT1+kcsak=
15+
github.com/urso/go-bin v0.0.0-20180220135811-781c575c9f0e/go.mod h1:6GfHrdWBQYjFRIznu7XuQH4lYB2w8nO4bnImVKkzPOM=
16+
github.com/urso/qcgen v0.0.0-20180131103024-0b059e7db4f4 h1:hhA8EBThzz9PztawVTycKvfETVuBqxAQ5keFlAVtbAw=
17+
github.com/urso/qcgen v0.0.0-20180131103024-0b059e7db4f4/go.mod h1:RspW+E2Yb7Fs7HclB2tiDaiu6Rp41BiIG4Wo1YaoXGc=
18+
golang.org/x/sys v0.0.0-20180802203216-0ffbfd41fbef h1:ESfhYoBNk2UQGmavscFPKfwmc4ZTB2+UdQYsVw6Bq9M=
19+
golang.org/x/sys v0.0.0-20180802203216-0ffbfd41fbef/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
20+
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
21+
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

tx.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ type txFlags struct {
7777
checkpoint bool // mark wal checkpoint has been applied
7878
}
7979

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

0 commit comments

Comments
 (0)