1
0
Fork 0

Merge pull request #223 from rqlite/tx_on_load

Use a transaction for loaded batch
master
Philip O'Toole 8 years ago committed by GitHub
commit c3b3f92804

@ -103,7 +103,7 @@ const (
PermBackup = "backup" PermBackup = "backup"
// LoadBatchSz is the batch size for loading a dump file. // LoadBatchSz is the batch size for loading a dump file.
LoadBatchSz = 100 LoadBatchSz = 1000
) )
func init() { func init() {

@ -479,7 +479,7 @@ func (s *Store) Load(r io.Reader, sz int) (int64, error) {
queries = append(queries, cmd) queries = append(queries, cmd)
if len(queries) == sz { if len(queries) == sz {
_, err = s.Execute(queries, false, false) _, err = s.Execute(queries, false, true)
if err != nil { if err != nil {
return n, err return n, err
} }
@ -490,7 +490,7 @@ func (s *Store) Load(r io.Reader, sz int) (int64, error) {
// Flush residual // Flush residual
if len(queries) > 0 { if len(queries) > 0 {
_, err = s.Execute(queries, false, false) _, err = s.Execute(queries, false, true)
if err != nil { if err != nil {
return n, err return n, err
} }

Loading…
Cancel
Save