[ARVADOS] updated: d5e4ac8e60999f53aaff84b58a1601e8315a9e64
Git user
git at public.curoverse.com
Tue May 10 13:07:18 EDT 2016
Summary of changes:
services/keepstore/azure_blob_volume.go | 16 +++++++++++++---
services/keepstore/volume_generic_test.go | 18 ++++++------------
2 files changed, 19 insertions(+), 15 deletions(-)
via d5e4ac8e60999f53aaff84b58a1601e8315a9e64 (commit)
from d63dda3ff507fc1df4778f34c0e47c909643c6c3 (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 d5e4ac8e60999f53aaff84b58a1601e8315a9e64
Author: radhika <radhika at curoverse.com>
Date: Tue May 10 13:06:15 2016 -0400
8556: check Etag while deleting a block during EmptyTrash routine.
diff --git a/services/keepstore/azure_blob_volume.go b/services/keepstore/azure_blob_volume.go
index 9f29583..7b144ca 100644
--- a/services/keepstore/azure_blob_volume.go
+++ b/services/keepstore/azure_blob_volume.go
@@ -515,21 +515,31 @@ blobListPage:
break blobListPage
}
- metadata, err := v.bsClient.GetBlobMetadata(v.containerName, matches[2])
+ // Get the Etag before checking expires_at, and use it to delete blob
+ props, err := v.bsClient.GetBlobProperties(v.containerName, matches[2])
if err != nil {
- log.Printf("EmptyTrash: %v: GetBlobMetadata(%v): %v", matches[2], err)
+ log.Printf("EmptyTrash: %v: GetBlobProperties(%v): %v", matches[2], err)
continue
}
// Make sure the marker is for the current block, not an older one
+ metadata, err := v.bsClient.GetBlobMetadata(v.containerName, matches[2])
+ if err != nil {
+ log.Printf("EmptyTrash: %v: GetBlobMetadata(%v): %v", matches[2], err)
+ continue
+ }
if metadata["expires_at"] == matches[1] {
- err = v.bsClient.DeleteBlob(v.containerName, matches[2], map[string]string{})
+ err = v.bsClient.DeleteBlob(v.containerName, matches[2], map[string]string{
+ "If-Match": props.Etag,
+ })
if err != nil {
log.Printf("EmptyTrash: %v: DeleteBlob(%v): %v", matches[2], err)
+ continue
}
blocksDeleted++
}
+ // Delete the marker also
err = v.bsClient.DeleteBlob(v.containerName, b.Name, map[string]string{})
if err != nil {
log.Printf("EmptyTrash: %v: DeleteBlob(%v): %v", b.Name, err)
diff --git a/services/keepstore/volume_generic_test.go b/services/keepstore/volume_generic_test.go
index 1765040..6f16844 100644
--- a/services/keepstore/volume_generic_test.go
+++ b/services/keepstore/volume_generic_test.go
@@ -801,6 +801,12 @@ func testTrashEmptyTrashUntrash(t TB, factory TestableVolumeFactory) {
return err
}
+ indexBuf := new(bytes.Buffer)
+ v.IndexTo("", indexBuf)
+ if !strings.Contains(string(indexBuf.Bytes()), TestHash) {
+ return os.ErrNotExist
+ }
+
return nil
}
@@ -829,12 +835,6 @@ func testTrashEmptyTrashUntrash(t TB, factory TestableVolumeFactory) {
t.Fatalf("os.IsNotExist(%v) should have been true", err)
}
- indexBuf := new(bytes.Buffer)
- v.IndexTo("", indexBuf)
- if strings.Contains(string(indexBuf.Bytes()), TestHash) {
- t.Fatalf("Found trashed block in IndexTo")
- }
-
err = v.Touch(TestHash)
if err == nil || !os.IsNotExist(err) {
t.Fatalf("os.IsNotExist(%v) should have been true", err)
@@ -854,12 +854,6 @@ func testTrashEmptyTrashUntrash(t TB, factory TestableVolumeFactory) {
t.Fatal(err)
}
- indexBuf = new(bytes.Buffer)
- v.IndexTo("", indexBuf)
- if !strings.Contains(string(indexBuf.Bytes()), TestHash) {
- t.Fatalf("Found trashed block in IndexTo")
- }
-
err = v.Touch(TestHash)
if err != nil {
t.Fatal(err)
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list