Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Windows flock/funlock race #122

Merged
merged 1 commit into from
Sep 12, 2018
Merged

Conversation

lowenna
Copy link

@lowenna lowenna commented Sep 11, 2018

Signed-off-by: John Howard jhoward@microsoft.com

Fixes #121, and downstream moby/libnetwork#1950.

Using the test program from #121:

package main

import (
	"fmt"
	"os"
	"sync"

	bolt "github.com/etcd-io/bbolt"
)

func main() {
	const instances = 30
	var wg sync.WaitGroup
	for instance := 0; instance < instances; instance++ {
		wg.Add(1)
		go opener(instance, &wg)

	}
	wg.Wait()
	fmt.Println("Success :)")
}

func opener(instance int, wg *sync.WaitGroup) {
	defer wg.Done()
	db, err := bolt.Open(`c:\bolt\test.db`, 0600, nil)
	if err != nil {
		panic(fmt.Sprintf("instance %d failed to open: %s", instance, err))
		os.Exit(-1)
	}
	db.Close()
}

Running it in two separate Windows, this now succeeds after running a significant amount of time without a panic. Pre this change, it would panic within the first few iterations.

$lastExitCode=0;$i=0;while ($lastExitCode -eq 0) {$i++;echo $i;.\test.exe}

Success :)
3128
Success :)
3129
Success :)
3130
Success :)
3131
Success :)
3132
Success :)
3133
Success :)
3134
Success :)
3135
Success :)
3136
Success :)
3137
Success :)
3138
Success :)
3139
Success :)
3140

etc.

@jstarks - Could you do a quick check please.

@dineshgovindasamy @msabansal @carlfischer1 @johnstep @mavenugo FYI.

bolt_windows.go Outdated
@@ -49,27 +49,23 @@ func fdatasync(db *DB) error {

// flock acquires an advisory lock on a file descriptor.
func flock(db *DB, mode os.FileMode, exclusive bool, timeout time.Duration) error {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mode is probably not used anymore.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to _. Has to be in parameters to match other platform implementation though.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's used in any of the other platforms. It was just there for Windows.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, indeed. Removed.

bolt_windows.go Outdated
// Create a separate lock file on windows because a process
// cannot share an exclusive lock on the same file. This is
// needed during Tx.WriteTo().
f, err := os.OpenFile(db.path+lockExt, os.O_CREATE, mode)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lockExt's definition can be removed

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Updated.

@gyuho
Copy link
Contributor

gyuho commented Sep 11, 2018

@jhowardmsft Thanks for fix. Can we add a test case? And any good recommendation for setting up Windows CI?

@lowenna
Copy link
Author

lowenna commented Sep 11, 2018

@gyuho

Can we add a test case?

Sure, added TestOpen_MultipleGoroutines. Basically that same test code I was using, doing 30 iterations of 30 goroutines.

It doesn't look like Travis supports Windows yet, although there's many requests for it as far as I can see from a quick look: travis-ci/travis-ci#2104 as an example. However, appveyor does support Windows - it's what we have for CI in https://github.com/Microsoft/hcsshim for example. It also looks like Azure Devops/Azure pipeline may be free: https://azure.microsoft.com/en-us/services/devops/pipelines/

New test:

E:\go\src\go.etcd.io\bbolt>go test -test.v -run TestOpen_MultipleGoroutines
seed: 4700
quick settings: count=5, items=1000, ksize=1024, vsize=1024
=== RUN   TestOpen_MultipleGoroutines
--- PASS: TestOpen_MultipleGoroutines (9.73s)
PASS
ok      go.etcd.io/bbolt        9.858s

And the entire test suite locally, including that new test.

PS E:\go\src\go.etcd.io\bbolt> go test --test.timeout=60m -v
seed: 41700
quick settings: count=5, items=1000, ksize=1024, vsize=1024
=== RUN   TestTx_allocatePageStats
--- PASS: TestTx_allocatePageStats (0.00s)
=== RUN   TestFreelist_free
--- PASS: TestFreelist_free (0.00s)
=== RUN   TestFreelist_free_overflow
--- PASS: TestFreelist_free_overflow (0.00s)
=== RUN   TestFreelist_release
--- PASS: TestFreelist_release (0.00s)
=== RUN   TestFreelist_releaseRange
--- PASS: TestFreelist_releaseRange (0.00s)
=== RUN   TestFreelist_allocate
--- PASS: TestFreelist_allocate (0.00s)
=== RUN   TestFreelist_read
--- PASS: TestFreelist_read (0.00s)
=== RUN   TestFreelist_write
--- PASS: TestFreelist_write (0.00s)
=== RUN   TestNode_put
--- PASS: TestNode_put (0.00s)
=== RUN   TestNode_read_LeafPage
--- PASS: TestNode_read_LeafPage (0.00s)
=== RUN   TestNode_write_LeafPage
--- PASS: TestNode_write_LeafPage (0.00s)
=== RUN   TestNode_split
--- PASS: TestNode_split (0.00s)
=== RUN   TestNode_split_MinKeys
--- PASS: TestNode_split_MinKeys (0.00s)
=== RUN   TestNode_split_SinglePage
--- PASS: TestNode_split_SinglePage (0.00s)
=== RUN   TestPage_typ
--- PASS: TestPage_typ (0.00s)
=== RUN   TestPage_dump
00010000000000000000000000000000
--- PASS: TestPage_dump (0.00s)
=== RUN   TestPgids_merge
--- PASS: TestPgids_merge (0.00s)
=== RUN   TestPgids_merge_quick
--- PASS: TestPgids_merge_quick (0.00s)
=== RUN   TestBucket_Get_NonExistent
--- PASS: TestBucket_Get_NonExistent (0.03s)
=== RUN   TestBucket_Get_FromNode
--- PASS: TestBucket_Get_FromNode (0.03s)
=== RUN   TestBucket_Get_IncompatibleValue
--- PASS: TestBucket_Get_IncompatibleValue (0.04s)
=== RUN   TestBucket_Get_Capacity
--- PASS: TestBucket_Get_Capacity (0.04s)
=== RUN   TestBucket_Put
--- PASS: TestBucket_Put (0.04s)
=== RUN   TestBucket_Put_Repeat
--- PASS: TestBucket_Put_Repeat (0.03s)
=== RUN   TestBucket_Put_Large
--- PASS: TestBucket_Put_Large (0.06s)
=== RUN   TestDB_Put_VeryLarge
--- PASS: TestDB_Put_VeryLarge (7.35s)
=== RUN   TestBucket_Put_IncompatibleValue
--- PASS: TestBucket_Put_IncompatibleValue (0.03s)
=== RUN   TestBucket_Put_Closed
--- PASS: TestBucket_Put_Closed (0.03s)
=== RUN   TestBucket_Put_ReadOnly
--- PASS: TestBucket_Put_ReadOnly (0.03s)
=== RUN   TestBucket_Delete
--- PASS: TestBucket_Delete (0.03s)
=== RUN   TestBucket_Delete_Large
--- PASS: TestBucket_Delete_Large (0.04s)
=== RUN   TestBucket_Delete_FreelistOverflow
--- PASS: TestBucket_Delete_FreelistOverflow (149.75s)
=== RUN   TestBucket_Delete_NonExisting
--- PASS: TestBucket_Delete_NonExisting (0.06s)
=== RUN   TestBucket_Nested
--- PASS: TestBucket_Nested (0.14s)
=== RUN   TestBucket_Delete_Bucket
--- PASS: TestBucket_Delete_Bucket (0.03s)
=== RUN   TestBucket_Delete_ReadOnly
--- PASS: TestBucket_Delete_ReadOnly (0.03s)
=== RUN   TestBucket_Delete_Closed
--- PASS: TestBucket_Delete_Closed (0.02s)
=== RUN   TestBucket_DeleteBucket_Nested
--- PASS: TestBucket_DeleteBucket_Nested (0.06s)
=== RUN   TestBucket_DeleteBucket_Nested2
--- PASS: TestBucket_DeleteBucket_Nested2 (0.05s)
=== RUN   TestBucket_DeleteBucket_Large
--- PASS: TestBucket_DeleteBucket_Large (0.05s)
=== RUN   TestBucket_Bucket_IncompatibleValue
--- PASS: TestBucket_Bucket_IncompatibleValue (0.03s)
=== RUN   TestBucket_CreateBucket_IncompatibleValue
--- PASS: TestBucket_CreateBucket_IncompatibleValue (0.04s)
=== RUN   TestBucket_DeleteBucket_IncompatibleValue
--- PASS: TestBucket_DeleteBucket_IncompatibleValue (0.03s)
=== RUN   TestBucket_Sequence
--- PASS: TestBucket_Sequence (0.04s)
=== RUN   TestBucket_NextSequence
--- PASS: TestBucket_NextSequence (0.03s)
=== RUN   TestBucket_NextSequence_Persist
--- PASS: TestBucket_NextSequence_Persist (0.05s)
=== RUN   TestBucket_NextSequence_ReadOnly
--- PASS: TestBucket_NextSequence_ReadOnly (0.03s)
=== RUN   TestBucket_NextSequence_Closed
--- PASS: TestBucket_NextSequence_Closed (0.02s)
=== RUN   TestBucket_ForEach
--- PASS: TestBucket_ForEach (0.03s)
=== RUN   TestBucket_ForEach_ShortCircuit
--- PASS: TestBucket_ForEach_ShortCircuit (0.03s)
=== RUN   TestBucket_ForEach_Closed
--- PASS: TestBucket_ForEach_Closed (0.02s)
=== RUN   TestBucket_Put_EmptyKey
--- PASS: TestBucket_Put_EmptyKey (0.02s)
=== RUN   TestBucket_Put_KeyTooLarge
--- PASS: TestBucket_Put_KeyTooLarge (0.03s)
=== RUN   TestBucket_Put_ValueTooLarge
--- PASS: TestBucket_Put_ValueTooLarge (0.09s)
=== RUN   TestBucket_Stats
--- PASS: TestBucket_Stats (5.41s)
=== RUN   TestBucket_Stats_RandomFill
--- PASS: TestBucket_Stats_RandomFill (78.22s)
=== RUN   TestBucket_Stats_Small
--- PASS: TestBucket_Stats_Small (0.04s)
=== RUN   TestBucket_Stats_EmptyBucket
--- PASS: TestBucket_Stats_EmptyBucket (0.05s)
=== RUN   TestBucket_Stats_Nested
--- PASS: TestBucket_Stats_Nested (0.04s)
=== RUN   TestBucket_Stats_Large
--- PASS: TestBucket_Stats_Large (1.48s)
=== RUN   TestBucket_Put_Single
--- PASS: TestBucket_Put_Single (42.09s)
=== RUN   TestBucket_Put_Multiple
--- PASS: TestBucket_Put_Multiple (0.45s)
=== RUN   TestBucket_Delete_Quick
--- PASS: TestBucket_Delete_Quick (41.48s)
=== RUN   TestCursor_Bucket
--- PASS: TestCursor_Bucket (0.03s)
=== RUN   TestCursor_Seek
--- PASS: TestCursor_Seek (0.03s)
=== RUN   TestCursor_Delete
--- PASS: TestCursor_Delete (0.04s)
=== RUN   TestCursor_Seek_Large
--- PASS: TestCursor_Seek_Large (0.05s)
=== RUN   TestCursor_EmptyBucket
--- PASS: TestCursor_EmptyBucket (0.03s)
=== RUN   TestCursor_EmptyBucketReverse
--- PASS: TestCursor_EmptyBucketReverse (0.03s)
=== RUN   TestCursor_Iterate_Leaf
--- PASS: TestCursor_Iterate_Leaf (0.03s)
=== RUN   TestCursor_LeafRootReverse
--- PASS: TestCursor_LeafRootReverse (0.03s)
=== RUN   TestCursor_Restart
--- PASS: TestCursor_Restart (0.04s)
=== RUN   TestCursor_First_EmptyPages
--- PASS: TestCursor_First_EmptyPages (0.05s)
=== RUN   TestCursor_QuickCheck
--- PASS: TestCursor_QuickCheck (0.34s)
=== RUN   TestCursor_QuickCheck_Reverse
--- PASS: TestCursor_QuickCheck_Reverse (0.31s)
=== RUN   TestCursor_QuickCheck_BucketsOnly
--- PASS: TestCursor_QuickCheck_BucketsOnly (0.03s)
=== RUN   TestCursor_QuickCheck_BucketsOnly_Reverse
--- PASS: TestCursor_QuickCheck_BucketsOnly_Reverse (0.03s)
=== RUN   TestOpen
--- PASS: TestOpen (0.00s)
=== RUN   TestOpen_MultipleGoroutines
--- PASS: TestOpen_MultipleGoroutines (1.84s)
=== RUN   TestOpen_ErrPathRequired
--- PASS: TestOpen_ErrPathRequired (0.00s)
=== RUN   TestOpen_ErrNotExists
--- PASS: TestOpen_ErrNotExists (0.00s)
=== RUN   TestOpen_ErrInvalid
--- PASS: TestOpen_ErrInvalid (0.00s)
=== RUN   TestOpen_ErrVersionMismatch
--- PASS: TestOpen_ErrVersionMismatch (0.01s)
=== RUN   TestOpen_ErrChecksum
--- PASS: TestOpen_ErrChecksum (0.01s)
=== RUN   TestOpen_Size
--- PASS: TestOpen_Size (0.25s)
=== RUN   TestOpen_Size_Large
--- PASS: TestOpen_Size_Large (130.05s)
=== RUN   TestOpen_Check
--- PASS: TestOpen_Check (0.01s)
=== RUN   TestOpen_MetaInitWriteError
--- SKIP: TestOpen_MetaInitWriteError (0.00s)
    db_test.go:360: pending
=== RUN   TestOpen_FileTooSmall
--- PASS: TestOpen_FileTooSmall (0.01s)
=== RUN   TestDB_Open_InitialMmapSize
--- PASS: TestDB_Open_InitialMmapSize (0.26s)
=== RUN   TestDB_Open_ReadOnly
--- PASS: TestDB_Open_ReadOnly (0.02s)
=== RUN   TestOpen_BigPage
--- PASS: TestOpen_BigPage (0.05s)
=== RUN   TestOpen_RecoverFreeList
--- PASS: TestOpen_RecoverFreeList (0.07s)
=== RUN   TestDB_Begin_ErrDatabaseNotOpen
--- PASS: TestDB_Begin_ErrDatabaseNotOpen (0.00s)
=== RUN   TestDB_BeginRW
--- PASS: TestDB_BeginRW (0.03s)
=== RUN   TestDB_Concurrent_WriteTo
--- PASS: TestDB_Concurrent_WriteTo (0.24s)
=== RUN   TestDB_BeginRW_Closed
--- PASS: TestDB_BeginRW_Closed (0.00s)
=== RUN   TestDB_Close_PendingTx_RW
--- PASS: TestDB_Close_PendingTx_RW (0.22s)
=== RUN   TestDB_Close_PendingTx_RO
--- PASS: TestDB_Close_PendingTx_RO (0.21s)
=== RUN   TestDB_Update
--- PASS: TestDB_Update (0.05s)
=== RUN   TestDB_Update_Closed
--- PASS: TestDB_Update_Closed (0.00s)
=== RUN   TestDB_Update_ManualCommit
--- PASS: TestDB_Update_ManualCommit (0.05s)
=== RUN   TestDB_Update_ManualRollback
--- PASS: TestDB_Update_ManualRollback (0.03s)
=== RUN   TestDB_View_ManualCommit
--- PASS: TestDB_View_ManualCommit (0.02s)
=== RUN   TestDB_View_ManualRollback
--- PASS: TestDB_View_ManualRollback (0.03s)
=== RUN   TestDB_Update_Panic
--- PASS: TestDB_Update_Panic (0.04s)
    db_test.go:895: recover: update omg
=== RUN   TestDB_View_Error
--- PASS: TestDB_View_Error (0.02s)
=== RUN   TestDB_View_Panic
--- PASS: TestDB_View_Panic (0.03s)
    db_test.go:960: recover: view omg
=== RUN   TestDB_Stats
--- PASS: TestDB_Stats (0.02s)
=== RUN   TestDB_Consistency
--- PASS: TestDB_Consistency (0.15s)
=== RUN   TestDBStats_Sub
--- PASS: TestDBStats_Sub (0.00s)
=== RUN   TestDB_Batch
--- PASS: TestDB_Batch (0.06s)
=== RUN   TestDB_Batch_Panic
--- PASS: TestDB_Batch_Panic (0.03s)
=== RUN   TestDB_BatchFull
--- PASS: TestDB_BatchFull (0.05s)
=== RUN   TestDB_BatchTime
--- PASS: TestDB_BatchTime (0.04s)
=== RUN   TestSimulateNoFreeListSync_1op_1p
--- PASS: TestSimulateNoFreeListSync_1op_1p (0.16s)
=== RUN   TestSimulateNoFreeListSync_10op_1p
--- PASS: TestSimulateNoFreeListSync_10op_1p (0.39s)
=== RUN   TestSimulateNoFreeListSync_100op_1p
--- PASS: TestSimulateNoFreeListSync_100op_1p (1.49s)
=== RUN   TestSimulateNoFreeListSync_1000op_1p
--- PASS: TestSimulateNoFreeListSync_1000op_1p (17.47s)
=== RUN   TestSimulateNoFreeListSync_10000op_1p
--- PASS: TestSimulateNoFreeListSync_10000op_1p (182.25s)
=== RUN   TestSimulateNoFreeListSync_10op_10p
--- PASS: TestSimulateNoFreeListSync_10op_10p (0.20s)
=== RUN   TestSimulateNoFreeListSync_100op_10p
--- PASS: TestSimulateNoFreeListSync_100op_10p (1.13s)
=== RUN   TestSimulateNoFreeListSync_1000op_10p
--- PASS: TestSimulateNoFreeListSync_1000op_10p (11.93s)
=== RUN   TestSimulateNoFreeListSync_10000op_10p
--- PASS: TestSimulateNoFreeListSync_10000op_10p (119.76s)
=== RUN   TestSimulateNoFreeListSync_100op_100p
--- PASS: TestSimulateNoFreeListSync_100op_100p (1.05s)
=== RUN   TestSimulateNoFreeListSync_1000op_100p
--- PASS: TestSimulateNoFreeListSync_1000op_100p (10.98s)
=== RUN   TestSimulateNoFreeListSync_10000op_100p
--- PASS: TestSimulateNoFreeListSync_10000op_100p (117.59s)
=== RUN   TestSimulateNoFreeListSync_10000op_1000p
--- PASS: TestSimulateNoFreeListSync_10000op_1000p (119.15s)
=== RUN   TestSimulate_1op_1p
--- PASS: TestSimulate_1op_1p (0.03s)
=== RUN   TestSimulate_10op_1p
--- PASS: TestSimulate_10op_1p (0.06s)
=== RUN   TestSimulate_100op_1p
--- PASS: TestSimulate_100op_1p (0.15s)
=== RUN   TestSimulate_1000op_1p
--- PASS: TestSimulate_1000op_1p (1.36s)
=== RUN   TestSimulate_10000op_1p
--- PASS: TestSimulate_10000op_1p (16.53s)
=== RUN   TestSimulate_10op_10p
--- PASS: TestSimulate_10op_10p (0.06s)
=== RUN   TestSimulate_100op_10p
--- PASS: TestSimulate_100op_10p (0.15s)
=== RUN   TestSimulate_1000op_10p
--- PASS: TestSimulate_1000op_10p (1.27s)
=== RUN   TestSimulate_10000op_10p
--- PASS: TestSimulate_10000op_10p (16.98s)
=== RUN   TestSimulate_100op_100p
--- PASS: TestSimulate_100op_100p (0.21s)
=== RUN   TestSimulate_1000op_100p
--- PASS: TestSimulate_1000op_100p (1.51s)
=== RUN   TestSimulate_10000op_100p
--- PASS: TestSimulate_10000op_100p (17.86s)
=== RUN   TestSimulate_10000op_1000p
--- PASS: TestSimulate_10000op_1000p (17.77s)
=== RUN   TestTx_Check_ReadOnly
--- PASS: TestTx_Check_ReadOnly (0.01s)
=== RUN   TestTx_Commit_ErrTxClosed
--- PASS: TestTx_Commit_ErrTxClosed (0.02s)
=== RUN   TestTx_Rollback_ErrTxClosed
--- PASS: TestTx_Rollback_ErrTxClosed (0.01s)
=== RUN   TestTx_Commit_ErrTxNotWritable
--- PASS: TestTx_Commit_ErrTxNotWritable (0.01s)
=== RUN   TestTx_Cursor
--- PASS: TestTx_Cursor (0.02s)
=== RUN   TestTx_CreateBucket_ErrTxNotWritable
--- PASS: TestTx_CreateBucket_ErrTxNotWritable (0.02s)
=== RUN   TestTx_CreateBucket_ErrTxClosed
--- PASS: TestTx_CreateBucket_ErrTxClosed (0.02s)
=== RUN   TestTx_Bucket
--- PASS: TestTx_Bucket (0.02s)
=== RUN   TestTx_Get_NotFound
--- PASS: TestTx_Get_NotFound (0.02s)
=== RUN   TestTx_CreateBucket
--- PASS: TestTx_CreateBucket (0.02s)
=== RUN   TestTx_CreateBucketIfNotExists
--- PASS: TestTx_CreateBucketIfNotExists (0.02s)
=== RUN   TestTx_CreateBucketIfNotExists_ErrBucketNameRequired
--- PASS: TestTx_CreateBucketIfNotExists_ErrBucketNameRequired (0.02s)
=== RUN   TestTx_CreateBucket_ErrBucketExists
--- PASS: TestTx_CreateBucket_ErrBucketExists (0.03s)
=== RUN   TestTx_CreateBucket_ErrBucketNameRequired
--- PASS: TestTx_CreateBucket_ErrBucketNameRequired (0.02s)
=== RUN   TestTx_DeleteBucket
--- PASS: TestTx_DeleteBucket (0.03s)
=== RUN   TestTx_DeleteBucket_ErrTxClosed
--- PASS: TestTx_DeleteBucket_ErrTxClosed (0.02s)
=== RUN   TestTx_DeleteBucket_ReadOnly
--- PASS: TestTx_DeleteBucket_ReadOnly (0.01s)
=== RUN   TestTx_DeleteBucket_NotFound
--- PASS: TestTx_DeleteBucket_NotFound (0.02s)
=== RUN   TestTx_ForEach_NoError
--- PASS: TestTx_ForEach_NoError (0.03s)
=== RUN   TestTx_ForEach_WithError
--- PASS: TestTx_ForEach_WithError (0.02s)
=== RUN   TestTx_OnCommit
--- PASS: TestTx_OnCommit (0.02s)
=== RUN   TestTx_OnCommit_Rollback
--- PASS: TestTx_OnCommit_Rollback (0.02s)
=== RUN   TestTx_CopyFile
--- PASS: TestTx_CopyFile (0.02s)
=== RUN   TestTx_CopyFile_Error_Meta
--- PASS: TestTx_CopyFile_Error_Meta (0.02s)
=== RUN   TestTx_CopyFile_Error_Normal
--- PASS: TestTx_CopyFile_Error_Normal (0.02s)
=== RUN   TestTx_releaseRange
--- PASS: TestTx_releaseRange (0.06s)
=== RUN   ExampleBucket_Put
--- PASS: ExampleBucket_Put (0.02s)
=== RUN   ExampleBucket_Delete
--- PASS: ExampleBucket_Delete (0.02s)
=== RUN   ExampleBucket_ForEach
--- PASS: ExampleBucket_ForEach (0.02s)
=== RUN   ExampleCursor
--- PASS: ExampleCursor (0.02s)
=== RUN   ExampleCursor_reverse
--- PASS: ExampleCursor_reverse (0.01s)
=== RUN   ExampleDB_Update
--- PASS: ExampleDB_Update (0.02s)
=== RUN   ExampleDB_View
--- PASS: ExampleDB_View (0.01s)
=== RUN   ExampleDB_Begin_ReadOnly
--- PASS: ExampleDB_Begin_ReadOnly (0.02s)
=== RUN   ExampleTx_Rollback
--- PASS: ExampleTx_Rollback (0.02s)
=== RUN   ExampleTx_CopyFile
--- PASS: ExampleTx_CopyFile (0.02s)
PASS
ok      go.etcd.io/bbolt        1121.557s
PS E:\go\src\go.etcd.io\bbolt>

db_test.go Outdated
wg.Add(1)
go func() {
defer wg.Done()
db, err := bolt.Open(`c:\bolt\test.db`, 0600, nil)
Copy link
Author

@lowenna lowenna Sep 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops. Will change that to a temp file. Had it hard coded in my test program.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And that's fixed to use tempfile() instead.

Signed-off-by: John Howard <jhoward@microsoft.com>
@lowenna
Copy link
Author

lowenna commented Sep 11, 2018

@gyuho Are you OK merging this and tagging a release? I have some 7 upstream projects currently using boltdb/bolt which I'd like to get all moved across to etcd-io/bbolt and pick up this fix. Thanks 😄

Copy link
Contributor

@gyuho gyuho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. This should be safe since mode arg was never used for flock unix builds. /cc @xiang90

@gyuho
Copy link
Contributor

gyuho commented Sep 11, 2018

@jhowardmsft I will let @xiang90 do the final review. And as soon as it gets merged, I will cut another release. Thanks for fix!

@xiang90
Copy link
Contributor

xiang90 commented Sep 12, 2018

Not a windows expert. But the fix and the test make sense to me.

@xiang90 xiang90 merged commit 7ee3ded into etcd-io:master Sep 12, 2018
@lowenna
Copy link
Author

lowenna commented Sep 12, 2018

@xiang90 @gyuho Thanks so much for you reviews and merging. Greatly appreciated. Just need a tag to vendor in nicely to the upstream repos :)

@lowenna lowenna deleted the windowslocking branch September 12, 2018 20:58
@gyuho
Copy link
Contributor

gyuho commented Sep 12, 2018

@jhowardmsft Tagging now.

@gyuho
Copy link
Contributor

gyuho commented Sep 12, 2018

v1.3.1-etcd.7...v1.3.1-etcd.8

Released https://github.com/etcd-io/bbolt/releases/tag/v1.3.1-etcd.8.

@lowenna
Copy link
Author

lowenna commented Sep 12, 2018

Fantastic. Thank you so much.

lowenna pushed a commit to lowenna/containerd that referenced this pull request Sep 12, 2018
Signed-off-by: John Howard <jhoward@microsoft.com>

This is the maintained version of boltdb, which includes the Windows-specific fix
detailed in etcd-io/bbolt#122
lowenna pushed a commit to microsoft/docker that referenced this pull request Sep 13, 2018
Signed-off-by: John Howard <jhoward@microsoft.com>

This also adds go.etcd.io/bbolt as boltdb/bolt is no longer
maintained, and we need etcd-io/bbolt#122 which
was merged in https://github.com/etcd-io/bbolt/releases/tag/v1.3.1-etcd.8
in order to fix moby/libnetwork#1950.

Note that I can't entirely remove boltdb/bolt as it is still used by
other components. Still need to work my way through them.... These include
containerd/containerd (containerd/containerd#2634),
docker/swarmkit; moby/buildkit. And probably more....
thaJeztah pushed a commit to thaJeztah/docker that referenced this pull request Sep 14, 2018
Signed-off-by: John Howard <jhoward@microsoft.com>

This also adds go.etcd.io/bbolt as boltdb/bolt is no longer
maintained, and we need etcd-io/bbolt#122 which
was merged in https://github.com/etcd-io/bbolt/releases/tag/v1.3.1-etcd.8
in order to fix moby/libnetwork#1950.

Note that I can't entirely remove boltdb/bolt as it is still used by
other components. Still need to work my way through them.... These include
containerd/containerd (containerd/containerd#2634),
docker/swarmkit; moby/buildkit. And probably more....

(cherry picked from commit 1a6e260)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
docker-jenkins pushed a commit to docker-archive/docker-ce that referenced this pull request Sep 14, 2018
Signed-off-by: John Howard <jhoward@microsoft.com>

This also adds go.etcd.io/bbolt as boltdb/bolt is no longer
maintained, and we need etcd-io/bbolt#122 which
was merged in https://github.com/etcd-io/bbolt/releases/tag/v1.3.1-etcd.8
in order to fix moby/libnetwork#1950.

Note that I can't entirely remove boltdb/bolt as it is still used by
other components. Still need to work my way through them.... These include
containerd/containerd (containerd/containerd#2634),
docker/swarmkit; moby/buildkit. And probably more....
Upstream-commit: 1a6e2609ead86144b75067bfe5154dad5e42d5cf
Component: engine
dims pushed a commit to dims/sys that referenced this pull request Oct 29, 2020
Signed-off-by: John Howard <jhoward@microsoft.com>

This also adds go.etcd.io/bbolt as boltdb/bolt is no longer
maintained, and we need etcd-io/bbolt#122 which
was merged in https://github.com/etcd-io/bbolt/releases/tag/v1.3.1-etcd.8
in order to fix moby/libnetwork#1950.

Note that I can't entirely remove boltdb/bolt as it is still used by
other components. Still need to work my way through them.... These include
containerd/containerd (containerd/containerd#2634),
docker/swarmkit; moby/buildkit. And probably more....
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants