summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Farnum <greg@inktank.com>2013-08-29 15:26:08 -0700
committerGreg Farnum <greg@inktank.com>2013-08-30 14:06:33 -0700
commit13aac48f25f25dd8286b9d3148f99a66b44bd962 (patch)
treeb9f35c9759fc2c032d3f69466f56bd3de5b08a0f
parentdae9a34b4fbb820375f57526655d5dbe10cd4e87 (diff)
downloadceph-13aac48f25f25dd8286b9d3148f99a66b44bd962.tar.gz
workunits: add a test for caching redirects
This may need to change since it exploits some of the loose consistency we currently have with caching pools, but for now it checks that the Objecter does what we want. Signed-off-by: Greg Farnum <greg@inktank.com>
-rwxr-xr-xqa/workunits/rados/caching_redirects.sh59
1 files changed, 59 insertions, 0 deletions
diff --git a/qa/workunits/rados/caching_redirects.sh b/qa/workunits/rados/caching_redirects.sh
new file mode 100755
index 00000000000..a8eda487246
--- /dev/null
+++ b/qa/workunits/rados/caching_redirects.sh
@@ -0,0 +1,59 @@
+#!/bin/bash -x
+
+set -e
+
+expect_false()
+{
+ set -x
+ if "$@"; then return 1; else return 0; fi
+}
+
+
+#create pools, set up tier relationship
+ceph osd pool create base_pool 2
+ceph osd pool create empty_cache 2
+ceph osd pool create data_cache 2
+ceph osd tier add base_pool empty_cache
+ceph osd tier add base_pool data_cache
+
+# populate base_pool and data_cache with some data
+echo "foo" > foo.txt
+echo "bar" > bar.txt
+echo "baz" > baz.txt
+rados -p base_pool put fooobj foo.txt
+rados -p base_pool put barobj bar.txt
+# data_cache is backwards so we can tell we read from it
+rados -p data_cache put fooobj bar.txt
+rados -p data_cache put barobj foo.txt
+
+# get the objects back before setting a caching pool
+rados -p base_pool get fooobj tmp.txt
+diff -q tmp.txt foo.txt
+rados -p base_pool get barobj tmp.txt
+diff -q tmp.txt bar.txt
+
+# set up redirect and make sure we get nothing
+ceph osd tier set-overlay base_pool empty_cache
+expect_false rados -p base_pool get fooobj tmp.txt
+expect_false rados -p base_pool get barobj tmp.txt
+#let's write as well
+rados -p base_pool put fooobj baz.txt
+rados -p base_pool put barobj baz.txt
+#and make sure we can look at the cache pool directly
+rados -p empty_cache get fooobj tmp.txt
+diff -q tmp.txt baz.txt
+
+# switch cache pools and make sure contents differ
+ceph osd tier remove-overlay base_pool
+ceph osd tier set-overlay base_pool data_cache
+rados -p base_pool get fooobj tmp.txt
+diff -q tmp.txt bar.txt
+rados -p base_pool get barobj tmp.txt
+diff -q tmp.txt foo.txt
+
+# drop the cache entirely and make sure contents are still the same
+ceph osd tier remove-overlay base_pool
+rados -p base_pool get fooobj tmp.txt
+diff -q tmp.txt foo.txt
+rados -p base_pool get barobj tmp.txt
+diff -q tmp.txt bar.txt