[ARVADOS] updated: 6f9c7f479d7522d28de80437fa01a2f88a85ad35

git at public.curoverse.com git at public.curoverse.com
Thu Oct 8 13:50:33 EDT 2015


Summary of changes:
 services/keepstore/azure_blob_volume.go      |  8 ++++++++
 services/keepstore/azure_blob_volume_test.go | 14 ++++++++++++++
 2 files changed, 22 insertions(+)

       via  6f9c7f479d7522d28de80437fa01a2f88a85ad35 (commit)
      from  782bcb07365ce13e76640dff9d08266a81489d1f (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 6f9c7f479d7522d28de80437fa01a2f88a85ad35
Author: Tom Clegg <tom at curoverse.com>
Date:   Thu Oct 8 14:00:00 2015 -0400

    7159: Exclude new empty blocks from index.

diff --git a/services/keepstore/azure_blob_volume.go b/services/keepstore/azure_blob_volume.go
index 836b8f1..7545e52 100644
--- a/services/keepstore/azure_blob_volume.go
+++ b/services/keepstore/azure_blob_volume.go
@@ -220,6 +220,14 @@ func (v *AzureBlobVolume) IndexTo(prefix string, writer io.Writer) error {
 			if err != nil {
 				return err
 			}
+			if b.Properties.ContentLength == 0 && t.Add(azureWriteRaceInterval).After(time.Now()) {
+				// A new zero-length blob is probably
+				// just a new non-empty blob that
+				// hasn't committed its data yet (see
+				// Get()), and in any case has no
+				// value.
+				continue
+			}
 			fmt.Fprintf(writer, "%s+%d %d\n", b.Name, b.Properties.ContentLength, t.Unix())
 		}
 		if resp.NextMarker == "" {
diff --git a/services/keepstore/azure_blob_volume_test.go b/services/keepstore/azure_blob_volume_test.go
index 74c94ec..c3fea9a 100644
--- a/services/keepstore/azure_blob_volume_test.go
+++ b/services/keepstore/azure_blob_volume_test.go
@@ -1,6 +1,7 @@
 package main
 
 import (
+	"bytes"
 	"encoding/base64"
 	"encoding/xml"
 	"flag"
@@ -423,6 +424,13 @@ func TestAzureBlobVolumeCreateBlobRaceDeadline(t *testing.T) {
 	azureWriteRacePollTime = 5 * time.Millisecond
 
 	v.PutRaw(TestHash, []byte{})
+
+	buf := new(bytes.Buffer)
+	v.IndexTo("", buf)
+	if buf.Len() != 0 {
+		t.Errorf("Index %+q should be empty", buf.Bytes())
+	}
+
 	v.TouchWithDate(TestHash, time.Now().Add(-1982 * time.Millisecond))
 
 	allDone := make(chan struct{})
@@ -443,6 +451,12 @@ func TestAzureBlobVolumeCreateBlobRaceDeadline(t *testing.T) {
 	case <-time.After(time.Second):
 		t.Error("Get should have stopped waiting for race when block was 2s old")
 	}
+
+	buf.Reset()
+	v.IndexTo("", buf)
+	if !bytes.HasPrefix(buf.Bytes(), []byte(TestHash+"+0")) {
+		t.Errorf("Index %+q should have %+q", buf.Bytes(), TestHash+"+0")
+	}
 }
 
 func (v *TestableAzureBlobVolume) PutRaw(locator string, data []byte) {

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list