diff options
-rw-r--r-- | src/dedo.go | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/src/dedo.go b/src/dedo.go index c4a5532..ead56b8 100644 --- a/src/dedo.go +++ b/src/dedo.go @@ -291,14 +291,6 @@ type Tx struct { pages map[pgid]*page stats TxStats commitHandlers []func() - - // WriteFlag specifies the flag for write-related methods like WriteTo(). - // Tx opens the database file with the specified flag to copy the data. - // - // By default, the flag is unset, which works well for mostly in-memory - // workloads. For databases that are much larger than available RAM, - // set the flag to syscall.O_DIRECT to avoid trashing the page cache. - WriteFlag int } // TxStats represents statistics about the actions performed by the transaction. @@ -3766,12 +3758,11 @@ func (tx *Tx) Copy(w io.Writer) error { // WriteTo writes the entire database to a writer. // If err == nil then exactly tx.Size() bytes will be written into the writer. func (tx *Tx) WriteTo(w io.Writer) (n int64, err error) { - // Attempt to open reader with WriteFlag - f, err := os.OpenFile(tx.db.path, os.O_RDONLY|tx.WriteFlag, 0) + f, err := os.OpenFile(tx.db.path, os.O_RDONLY, 0) if err != nil { return 0, err } - defer func() { _ = f.Close() }() + defer f.Close() // Generate a meta page. We use the same page data for both meta pages. buf := make([]byte, tx.db.pageSize) |