aboutsummaryrefslogtreecommitdiff
path: root/db.go
diff options
context:
space:
mode:
authorBen Johnson <benbjohnson@yahoo.com>2014-07-15 07:37:46 -0600
committerBen Johnson <benbjohnson@yahoo.com>2014-07-15 07:37:46 -0600
commit048d3f19b28ee04dd6b2ca3c8f86e5fa65dc7355 (patch)
treedbc4f69d728c34c6edc6d41872a21a2200d41c76 /db.go
parentMerge pull request #224 from benbjohnson/rebalance-time (diff)
downloaddedo-048d3f19b28ee04dd6b2ca3c8f86e5fa65dc7355.tar.gz
dedo-048d3f19b28ee04dd6b2ca3c8f86e5fa65dc7355.tar.xz
Add DB.NoSync option for bulk loading.
This commit adds the DB.NoSync flag to skip fsync() calls on each commit. This should only be used for bulk loading as it can corrupt your database in the event of a system failure. Initial tests show it can provide a 2x speed up for sequential inserts.
Diffstat (limited to 'db.go')
-rw-r--r--db.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/db.go b/db.go
index 4df79e2..2a2e2ed 100644
--- a/db.go
+++ b/db.go
@@ -47,6 +47,15 @@ type DB struct {
// amount if you know that your write workloads are mostly append-only.
FillPercent float64
+ // Setting the NoSync flag will cause the database to skip fsync()
+ // calls after each commit. This can be useful when bulk loading data
+ // into a database and you can restart the bulk load in the event of
+ // a system failure or database corruption. Do not set this flag for
+ // normal use.
+ //
+ // THIS IS UNSAFE. PLEASE USE WITH CAUTION.
+ NoSync bool
+
path string
file *os.File
dataref []byte