195 Commits

Author SHA1 Message Date
Ben Johnson
1c3ebaebae Merge pull request #109 from benbjohnson/consolidate-file-descriptors
Consolidate file and metafile descriptors.
2014-04-02 13:58:03 -06:00
Ben Johnson
4ef19124d1 Consolidate file and metafile descriptors.
Previously, a two file descriptors were used for the database: file & metafile. The "file" file
descriptor was used for async writes while the "metafile" file descriptor was used with O_SYNC
writes. This commit changes that so that there's only one file descriptor and it uses fdatasync()
to synchronize writes.
2014-04-02 13:50:03 -06:00
Ben Johnson
76acd60ff3 README
Remove the 'Internals' section since it is half-assed right now.
2014-04-02 10:28:17 -06:00
Ben Johnson
8c5646982c Merge branch 'master' of https://github.com/boltdb/bolt 2014-04-02 07:46:47 -06:00
Ben Johnson
43eda94ec1 Remove count and overflow columns for free pages on 'bolt pages'.
The count and overflow columns are meaningless for freed pages since
there could be random overflow data in there. This commit removes those
columns for free pages.
2014-04-02 07:44:54 -06:00
Ben Johnson
4364c2f7f6 Merge pull request #107 from DocSavage/master
Add DVID to projects using Bolt
2014-03-31 13:31:26 -06:00
Bill Katz
6dd15bbf70 Add DVID to projects using Bolt
DVID added Bolt as an optional storage engine.
2014-03-31 15:25:05 -04:00
Ben Johnson
4870e5fe8c Merge pull request #104 from benbjohnson/remove-db-open
Remove DB.Open() and only allow bolt.Open().
2014-03-31 12:03:53 -06:00
Ben Johnson
8dafb2312b Remove DB.Open() and only allow bolt.Open().
Per @tv42's suggestion, this commit removes the ability to reopen an
instance of DB. All open calls go through bolt.Open().

Fixes #103.
2014-03-31 11:22:27 -06:00
Ben Johnson
b5c1715a36 Merge pull request #102 from benbjohnson/fix-freelist
Write freelist after each commit.
2014-03-31 11:08:27 -06:00
Ben Johnson
440b89418f Write freelist after each commit.
Well, this is embarassing. Somehow the freelist was never getting written after each commit.
This commit fixes that and fixes a small reporting issue with "bolt pages".
2014-03-31 08:52:19 -06:00
Ben Johnson
fcce87626c Merge pull request #98 from benbjohnson/fsck
Add DB.Check().
2014-03-29 14:28:53 -06:00
Ben Johnson
7f2de9f17a Add DB.Check(). 2014-03-29 14:22:32 -06:00
Ben Johnson
7dafeaa896 Merge pull request #97 from benbjohnson/cli
Refactor bolt commands into individual files.
2014-03-27 22:39:29 -06:00
Ben Johnson
fea388b03d Refactor bolt commands into individual files. 2014-03-27 22:36:05 -06:00
Ben Johnson
b10aa18c88 Merge pull request #92 from benbjohnson/safe-copy
Fix DB.Copy() meta lock and partial write checks.
2014-03-26 11:00:25 -06:00
Ben Johnson
f45f1ed8d4 Fix DB.Copy() meta lock and partial write checks. 2014-03-26 10:11:31 -06:00
Ben Johnson
2327fd97d7 Merge pull request #91 from benbjohnson/quickcheck
Fix quickcheck test for duplicate keys.
2014-03-25 08:21:58 -06:00
Ben Johnson
03ba0d1d4d Fix quickcheck test for duplicate keys. 2014-03-25 08:20:21 -06:00
Ben Johnson
381d08dffd Merge pull request #90 from benbjohnson/fix-bucket-reclamation
Fix bucket reclamation
2014-03-25 07:31:49 -06:00
Ben Johnson
d8e4cffa12 Fix bucket reclamation.
The bucket page is allocated separately from the rest of the pages but the old bucket pages were
not being added to the freelist. This change fixes that and adds a simple check for database
consistency. More advanced consistency checks can be added in the future.

Fixes #82.
2014-03-25 07:25:00 -06:00
Ben Johnson
32da80f953 README
Add a list of "Other Projects Using Bolt".
2014-03-24 13:41:08 -06:00
Ben Johnson
2bc868c466 Merge pull request #88 from benbjohnson/tx-rename
Make DB/Tx API more consistent.
2014-03-24 11:46:58 -06:00
Ben Johnson
f8ad21bad3 Make DB/Tx API more consistent.
I consolidated the DB.Tx() and DB.RWTx() calls into a single
DB.Begin(writable bool) call. This is more consistent with the
database/sql library.

I also changed the DB.Do() and DB.With() call to DB.Update() and
DB.View(), respectively. This is more intuitive and more inline with
other database verbiage.
2014-03-24 11:43:06 -06:00
Ben Johnson
0866abf733 Merge pull request #87 from benbjohnson/errors
Error refactoring
2014-03-24 08:32:38 -06:00
Ben Johnson
59fde2f664 Error refactoring.
Fixed up a few error issues and refactored out the Error type.
2014-03-24 08:31:15 -06:00
Ben Johnson
7ea635c8fc Merge pull request #86 from benbjohnson/mock
Re-add tests for write failures
2014-03-24 07:49:09 -06:00
Tommi Virtanen
e9b2cab0fa Re-add tests for write failures
Commit d2173f5f0ecbf4ed93c768e975435b04df3186ec removed the complete
os & syscall mocking layer as overly complex. This commit adds back
the simplest possible thing: hooks to control the database file
writes.

Missing tests: TestDBOpenMetaFileError, TestDBMmapStatError.
These are harder to test without more extensive mocking.

Conflicts:
	db_test.go
2014-03-24 07:47:33 -06:00
Ben Johnson
3c1ecb925e Resolve remaining errcheck warnings. 2014-03-24 07:38:27 -06:00
Tommi Virtanen
e0a6f5b2af Check errors from file close in DB.CopyFile
Write errors are often delayed and reported only by the close.

The extra close in defer on success is harmless, (*os.File).Close
protects itself against multiple closes, and this way it's immediately
obvious there is no code path that would leak open files.
2014-03-23 13:27:37 -07:00
Tommi Virtanen
cb896f6525 Check spill error in Commit 2014-03-23 13:27:37 -07:00
Tommi Virtanen
bfb02aec20 Check meta page write error in Commit 2014-03-23 13:27:36 -07:00
Ben Johnson
42bc0f210a Merge pull request #81 from benbjohnson/tx-closed
Add ErrTxClosed error.
2014-03-23 12:24:32 -06:00
Ben Johnson
482f00fdfc Add ErrTxClosed error.
Commit/Rollback and mutable calls on Tx and Bucket now return ErrTxClosed
if the transaction has already been committed or rolled back. Non-mutable
calls have added an assertion to check if the transaction is closed which
will cause a panic. I don't want to introduce an error return for accessor
methods that are being used improperly so I think the panic is appropriate.
2014-03-23 12:20:16 -06:00
Ben Johnson
8303617b72 Merge pull request #78 from benbjohnson/tx-managed
Mark Do()/With() transaction as managed.
2014-03-23 11:52:10 -06:00
Ben Johnson
76f6ead6b0 Mark Do()/With() transaction as managed.
Transaction created from Do() and With() are now considered "managed".
Managed transactions cannot be manually committed or rolled back since
the Do() and With() functions provide that functionally automatically.
Previously, a Tx could be manually committed and then any changes after
that would be lost.
2014-03-23 10:34:53 -06:00
Ben Johnson
1282a4aff7 Merge pull request #76 from benbjohnson/fsync
fdatasync
2014-03-23 10:01:58 -06:00
Ben Johnson
a10ce47f54 Consolidate syscall files. 2014-03-23 08:59:45 -07:00
Ben Johnson
fd8a13e837 Merge branch 'fdatasync' of https://github.com/tv42/bolt into fsync 2014-03-23 09:42:21 -06:00
Ben Johnson
f0e582d910 Merge pull request #75 from Slacken/32bit_build_fails_bucket_go_67
Fix 32bit build
2014-03-23 09:37:27 -06:00
binz
540d94614d fix 32bit build fails: bucket.go#67 2014-03-23 13:54:51 +08:00
Tommi Virtanen
5ce378b046 Call fdatasync/fsync after writing out non-meta pages
This avoids a case where writes can be reordered so meta page is
written before a page it refers to, potentially causing a corrupt
database after a power loss or kernel crash.
2014-03-22 20:47:08 -07:00
Ben Johnson
6d6303a0a2 Merge pull request #74 from benbjohnson/cli
CLI
2014-03-22 14:12:00 -06:00
Ben Johnson
4f4e15e6dd Fix print. 2014-03-21 23:07:46 -06:00
Ben Johnson
845a4d47ce Add 'bolt buckets'. 2014-03-21 22:56:17 -06:00
Ben Johnson
64a52452d3 Add 'bolt set'. 2014-03-21 22:51:22 -06:00
Ben Johnson
0e4d77d424 Add 'bolt pages'. 2014-03-21 22:34:54 -06:00
Ben Johnson
8fa6531b1c Add 'bolt keys'. 2014-03-21 22:05:28 -06:00
Ben Johnson
e8d3ae6287 Add 'bolt get'. 2014-03-21 22:00:34 -06:00
Ben Johnson
e86296ede7 Merge pull request #71 from benbjohnson/munmap-fix
Fix db.munmap() to return an error.
2014-03-21 13:32:40 -06:00