From 75c4c59020b3418a3880e76f630351ea005a6167 Mon Sep 17 00:00:00 2001 From: siddontang Date: Thu, 6 Nov 2014 15:51:17 +0800 Subject: [PATCH] travis can not be build ok for mmap, later fix --- rpl/file_table.go | 4 ++-- rpl/file_table_test.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rpl/file_table.go b/rpl/file_table.go index ec6f8c1..be69e39 100644 --- a/rpl/file_table.go +++ b/rpl/file_table.go @@ -136,7 +136,7 @@ func (t *tableReader) check() error { return fmt.Errorf("invalid magic data %q", b) } - if t.m, err = mmap.MapRegion(t.f, int(t.offsetLen), mmap.COPY, 0, t.offsetStartPos); err != nil { + if t.m, err = mmap.MapRegion(t.f, int(t.offsetLen), mmap.RDONLY, 0, t.offsetStartPos); err != nil { return err } @@ -289,7 +289,7 @@ func (t *tableReader) openTable() error { } if t.m == nil { - if t.m, err = mmap.MapRegion(t.f, int(t.offsetLen), mmap.COPY, 0, t.offsetStartPos); err != nil { + if t.m, err = mmap.MapRegion(t.f, int(t.offsetLen), mmap.RDONLY, 0, t.offsetStartPos); err != nil { return fmt.Errorf("mmap %s error %s", t.name, err.Error()) } } diff --git a/rpl/file_table_test.go b/rpl/file_table_test.go index a7ad9b5..2b9e906 100644 --- a/rpl/file_table_test.go +++ b/rpl/file_table_test.go @@ -10,8 +10,6 @@ import ( ) func TestFileTable(t *testing.T) { - log.SetLevel(log.LevelFatal) - base, err := ioutil.TempDir("", "test_table") if err != nil { t.Fatal(err) @@ -137,6 +135,8 @@ func TestFileTable(t *testing.T) { r.Close() + log.SetLevel(log.LevelFatal) + testRepair(t, name, 1, s, 11) testRepair(t, name, 1, s, 32) testRepair(t, name, 1, s, 42)