aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dedo.go41
1 files changed, 5 insertions, 36 deletions
diff --git a/src/dedo.go b/src/dedo.go
index dcc4956..437d04f 100644
--- a/src/dedo.go
+++ b/src/dedo.go
@@ -1294,12 +1294,6 @@ const version = 2
// Represents a marker value to indicate that a file is a Bolt DB.
const magic uint32 = 0xED0CDAED
-// IgnoreNoSync specifies whether the NoSync field of a DB is ignored when
-// syncing changes to a file. This is required as some operating systems,
-// such as OpenBSD, do not have a unified buffer cache (UBC) and writes
-// must be synchronized using the msync(2) syscall.
-const IgnoreNoSync = runtime.GOOS == "openbsd"
-
// Default values if not set in a DB instance.
const (
DefaultMaxBatchSize int = 1000
@@ -1320,18 +1314,6 @@ type DB struct {
// debugging purposes.
StrictMode bool
- // 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.
- //
- // If the package global IgnoreNoSync constant is true, this value is
- // ignored. See the comment on that constant for more details.
- //
- // THIS IS UNSAFE. PLEASE USE WITH CAUTION.
- NoSync bool
-
// When true, skips the truncate call when growing the database.
// Setting this to true is only safe on non-ext3/ext4 systems.
// Skipping truncation avoids preallocation of hard drive space and
@@ -2039,12 +2021,6 @@ func safelyCall(fn func(*Tx) error, tx *Tx) (err error) {
return fn(tx)
}
-// Sync executes fdatasync() against the database file handle.
-//
-// This is not necessary under normal operation, however, if you use NoSync
-// then it allows you to force the database file to sync against the disk.
-func (db *DB) Sync() error { return fdatasync(db) }
-
// Stats retrieves ongoing performance stats for the database.
// This is only updated when a transaction closes.
func (db *DB) Stats() Stats {
@@ -3954,11 +3930,8 @@ func (tx *Tx) write() error {
}
}
- // Ignore file sync if flag is set on DB.
- if !tx.db.NoSync || IgnoreNoSync {
- if err := fdatasync(tx.db); err != nil {
- return err
- }
+ if err := fdatasync(tx.db); err != nil {
+ return err
}
// Put small pages back to page pool.
@@ -3992,10 +3965,9 @@ func (tx *Tx) writeMeta() error {
if _, err := tx.db.ops.writeAt(buf, int64(p.id)*int64(tx.db.pageSize)); err != nil {
return err
}
- if !tx.db.NoSync || IgnoreNoSync {
- if err := fdatasync(tx.db); err != nil {
- return err
- }
+
+ if err := fdatasync(tx.db); err != nil {
+ return err
}
// Update statistics.
@@ -5020,7 +4992,6 @@ func (cmd *BenchCommand) Run(args ...string) error {
if err != nil {
return err
}
- db.NoSync = options.NoSync
defer db.Close()
// Write to the database.
@@ -5058,7 +5029,6 @@ func (cmd *BenchCommand) ParseFlags(args []string) (*BenchOptions, error) {
fs.StringVar(&options.MemProfile, "memprofile", "", "")
fs.StringVar(&options.BlockProfile, "blockprofile", "", "")
fs.Float64Var(&options.FillPercent, "fill-percent", DefaultFillPercent, "")
- fs.BoolVar(&options.NoSync, "no-sync", false, "")
fs.BoolVar(&options.Work, "work", false, "")
fs.StringVar(&options.Path, "path", "", "")
fs.SetOutput(cmd.Stderr)
@@ -5388,7 +5358,6 @@ type BenchOptions struct {
BlockProfile string
StatsInterval time.Duration
FillPercent float64
- NoSync bool
Work bool
Path string
}