]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
incremental marker
authorMatt Benjamin <mbenjamin@redhat.com>
Wed, 6 Jan 2016 00:23:07 +0000 (19:23 -0500)
committerMatt Benjamin <mbenjamin@redhat.com>
Fri, 12 Feb 2016 17:07:25 +0000 (12:07 -0500)
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
src/test/librgw_file_nfsns.cc

index b410681281913c2cdc546b1354d0d6dc6ad015c7..ee186714128131a8c01fab4e52bedbe199ead779 100644 (file)
@@ -91,7 +91,7 @@ namespace {
   struct dirent_vec
   {
     std::vector<dirent_t> obj_names;
-    uint64_t count;
+    uint32_t count;
     dirent_vec() : count(0) {}
   };
 
@@ -259,19 +259,28 @@ extern "C" {
 
 TEST(LibRGW, MARKER1_READDIR)
 {
-  using std::get;
-
-  dirent_vec dvec;
-  uint64_t offset;
-  bool eof;
-
-  eof = false;
-  do {
-    int ret = rgw_readdir(fs, marker_fh, &offset, r2_cb, &dvec, &eof);
-    ASSERT_EQ(ret, 0);
-    ASSERT_EQ(offset, get<1>(dvec.obj_names.back())); // cookie check
-    ++dvec.count;
-  } while(!eof);
+  if (do_marker1) {
+    using std::get;
+
+    dirent_vec dvec;
+    uint64_t offset;
+    bool eof = false;
+
+    /* because RGWReaddirRequest::default_max is 1000 (XXX make
+     * configurable?) and marker_nobjs is 5*1024, the number
+     * of required rgw_readdir operations N should be
+     * marker_nobjs/1000 < N < marker_nobjs/1000+1, i.e., 6 when
+     * marker_nobjs==5*1024 */
+    uint32_t max_iterations = marker_nobjs/1000+1;
+
+    do {
+      ASSERT_TRUE(dvec.count <= max_iterations);
+      int ret = rgw_readdir(fs, marker_fh, &offset, r2_cb, &dvec, &eof);
+      ASSERT_EQ(ret, 0);
+      ASSERT_EQ(offset, get<1>(dvec.obj_names.back())); // cookie check
+      ++dvec.count;
+    } while(!eof);
+  }
 }
 
 TEST(LibRGW, CLEANUP) {