From 68793cfcbb6b1ae35cd28c9c33abfcb34f7d2118 Mon Sep 17 00:00:00 2001 From: Philip O'Toole Date: Sun, 20 Nov 2016 21:35:52 -0800 Subject: [PATCH] Use a transaction for loaded batch Bump the batch size to 1000 too. --- http/service.go | 2 +- store/store.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/http/service.go b/http/service.go index e6d6b993..b8976991 100644 --- a/http/service.go +++ b/http/service.go @@ -103,7 +103,7 @@ const ( PermBackup = "backup" // LoadBatchSz is the batch size for loading a dump file. - LoadBatchSz = 100 + LoadBatchSz = 1000 ) func init() { diff --git a/store/store.go b/store/store.go index 52c19508..87b9c648 100644 --- a/store/store.go +++ b/store/store.go @@ -479,7 +479,7 @@ func (s *Store) Load(r io.Reader, sz int) (int64, error) { queries = append(queries, cmd) if len(queries) == sz { - _, err = s.Execute(queries, false, false) + _, err = s.Execute(queries, false, true) if err != nil { return n, err } @@ -490,7 +490,7 @@ func (s *Store) Load(r io.Reader, sz int) (int64, error) { // Flush residual if len(queries) > 0 { - _, err = s.Execute(queries, false, false) + _, err = s.Execute(queries, false, true) if err != nil { return n, err }