[ARVADOS] updated: f37f7c068b8d59934c7b0632d531c08470323123

git at public.curoverse.com git at public.curoverse.com
Fri Apr 25 17:23:33 EDT 2014


Summary of changes:
 services/keep/src/keep/keep.go        |    7 ++-----
 services/keep/src/keep/volume.go      |   10 ++++++----
 services/keep/src/keep/volume_test.go |   20 +++++++++++---------
 3 files changed, 19 insertions(+), 18 deletions(-)

       via  f37f7c068b8d59934c7b0632d531c08470323123 (commit)
      from  e05f165ac12cb54faad707548b8b8f2005f2eef6 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit f37f7c068b8d59934c7b0632d531c08470323123
Author: Tim Pierce <twp at curoverse.com>
Date:   Fri Apr 25 17:23:40 2014 -0400

    Make sure an IOHandler is running when -serialize is on.
    
    Use MakeUnixVolume to create new UnixVolumes, to ensure that an
    IOHandler is started whenever necessary. (refs #2620)

diff --git a/services/keep/src/keep/keep.go b/services/keep/src/keep/keep.go
index 51dde94..c619f92 100644
--- a/services/keep/src/keep/keep.go
+++ b/services/keep/src/keep/keep.go
@@ -112,11 +112,8 @@ func main() {
 	for _, v := range keepvols {
 		if _, err := os.Stat(v); err == nil {
 			log.Println("adding Keep volume:", v)
-			newvol := &UnixVolume{v, nil}
-			if serialize_io {
-				newvol.queue = make(chan *IORequest)
-			}
-			KeepVolumes = append(KeepVolumes, newvol)
+			newvol := MakeUnixVolume(v, serialize_io)
+			KeepVolumes = append(KeepVolumes, &newvol)
 		} else {
 			log.Printf("bad Keep volume: %s\n", err)
 		}
diff --git a/services/keep/src/keep/volume.go b/services/keep/src/keep/volume.go
index f2f61a9..2e1e661 100644
--- a/services/keep/src/keep/volume.go
+++ b/services/keep/src/keep/volume.go
@@ -75,12 +75,14 @@ func (v *UnixVolume) IOHandler() {
 	}
 }
 
-func MakeUnixVolume(root string, queue chan *IORequest) UnixVolume {
-	v := UnixVolume{root, queue}
-	if queue != nil {
+func MakeUnixVolume(root string, serialize bool) (v UnixVolume) {
+	if serialize {
+		v = UnixVolume{root, make(chan *IORequest)}
 		go v.IOHandler()
+	} else {
+		v = UnixVolume{root, nil}
 	}
-	return v
+	return
 }
 
 func (v *UnixVolume) Get(loc string) ([]byte, error) {
diff --git a/services/keep/src/keep/volume_test.go b/services/keep/src/keep/volume_test.go
index f4c204d..d1f1874 100644
--- a/services/keep/src/keep/volume_test.go
+++ b/services/keep/src/keep/volume_test.go
@@ -9,12 +9,12 @@ import (
 	"time"
 )
 
-func TempUnixVolume(t *testing.T, queue chan *IORequest) UnixVolume {
+func TempUnixVolume(t *testing.T, serialize bool) UnixVolume {
 	d, err := ioutil.TempDir("", "volume_test")
 	if err != nil {
 		t.Fatal(err)
 	}
-	return MakeUnixVolume(d, queue)
+	return MakeUnixVolume(d, serialize)
 }
 
 func _teardown(v UnixVolume) {
@@ -43,7 +43,7 @@ func _store(t *testing.T, vol UnixVolume, filename string, block []byte) {
 }
 
 func TestGet(t *testing.T) {
-	v := TempUnixVolume(t, nil)
+	v := TempUnixVolume(t, false)
 	defer _teardown(v)
 	_store(t, v, TEST_HASH, TEST_BLOCK)
 
@@ -57,7 +57,7 @@ func TestGet(t *testing.T) {
 }
 
 func TestGetNotFound(t *testing.T) {
-	v := TempUnixVolume(t, nil)
+	v := TempUnixVolume(t, false)
 	defer _teardown(v)
 	_store(t, v, TEST_HASH, TEST_BLOCK)
 
@@ -73,7 +73,7 @@ func TestGetNotFound(t *testing.T) {
 }
 
 func TestPut(t *testing.T) {
-	v := TempUnixVolume(t, nil)
+	v := TempUnixVolume(t, false)
 	defer _teardown(v)
 
 	err := v.Put(TEST_HASH, TEST_BLOCK)
@@ -90,7 +90,7 @@ func TestPut(t *testing.T) {
 }
 
 func TestPutBadVolume(t *testing.T) {
-	v := TempUnixVolume(t, nil)
+	v := TempUnixVolume(t, false)
 	defer _teardown(v)
 
 	os.Chmod(v.root, 000)
@@ -115,7 +115,8 @@ func TestPutBadVolume(t *testing.T) {
 // return accurate results.
 //
 func TestGetSerialized(t *testing.T) {
-	v := TempUnixVolume(t, make(chan *IORequest))
+	// Create a volume with I/O serialization enabled.
+	v := TempUnixVolume(t, true)
 	defer _teardown(v)
 
 	_store(t, v, TEST_HASH, TEST_BLOCK)
@@ -163,7 +164,8 @@ func TestGetSerialized(t *testing.T) {
 }
 
 func TestPutSerialized(t *testing.T) {
-	v := TempUnixVolume(t, make(chan *IORequest))
+	// Create a volume with I/O serialization enabled.
+	v := TempUnixVolume(t, true)
 	defer _teardown(v)
 
 	sem := make(chan int)
@@ -223,7 +225,7 @@ func TestPutSerialized(t *testing.T) {
 }
 
 func TestIsFull(t *testing.T) {
-	v := TempUnixVolume(t, nil)
+	v := TempUnixVolume(t, false)
 	defer _teardown(v)
 
 	full_path := v.root + "/full"

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list