}
};
-bool sorted(const vector<ghobject_t> &in) {
+bool sorted(const vector<ghobject_t> &in, bool bitwise) {
ghobject_t start;
for (vector<ghobject_t>::const_iterator i = in.begin();
i != in.end();
++i) {
- if (start > *i) return false;
+ if (cmp(start, *i, bitwise) > 0) {
+ cout << start << " should follow " << *i << std::endl;
+ return false;
+ }
start = *i;
}
return true;
r = store->apply_transaction(t);
ASSERT_EQ(r, 0);
}
- set<ghobject_t> all, saw;
+ set<ghobject_t> all;
{
ObjectStore::Transaction t;
for (int i=0; i<200; ++i) {
r = store->apply_transaction(t);
ASSERT_EQ(r, 0);
}
- {
+ for (int bitwise=0; bitwise<2; ++bitwise) {
+ set<ghobject_t> saw;
vector<ghobject_t> objects;
ghobject_t next, current;
while (!next.is_max()) {
- int r = store->collection_list(cid, current, ghobject_t::get_max(), 50,
+ int r = store->collection_list(cid, current, ghobject_t::get_max(),
+ (bool)bitwise, 50,
&objects, &next);
+ if (r == -EOPNOTSUPP) {
+ ++bitwise; // skip nibblewise test
+ continue;
+ }
ASSERT_EQ(r, 0);
+ ASSERT_TRUE(sorted(objects, (bool)bitwise));
cout << " got " << objects.size() << " next " << next << std::endl;
for (vector<ghobject_t>::iterator p = objects.begin(); p != objects.end();
++p) {
+ if (saw.count(*p)) {
+ cout << "got DUP " << *p << std::endl;
+ } else {
+ //cout << "got new " << *p << std::endl;
+ }
saw.insert(*p);
}
objects.clear();
current = next;
}
+ ASSERT_EQ(saw.size(), all.size());
ASSERT_EQ(saw, all);
}
{
vector<ghobject_t> objects;
ghobject_t next, current;
while (!next.is_max()) {
- int r = store->collection_list(cid, current, ghobject_t::get_max(), 50,
+ int r = store->collection_list(cid, current, ghobject_t::get_max(),
+ true, 50,
&objects, &next);
ASSERT_EQ(r, 0);
cout << " got " << objects.size() << " next " << next << std::endl;
ASSERT_TRUE(!store->stat(cid, *i, &buf));
}
- set<ghobject_t> listed;
+ set<ghobject_t> listed, listed2;
vector<ghobject_t> objects;
- r = store->collection_list(cid, ghobject_t(), ghobject_t::get_max(), INT_MAX, &objects, 0);
+ r = store->collection_list(cid, ghobject_t(), ghobject_t::get_max(), true, INT_MAX, &objects, 0);
ASSERT_EQ(r, 0);
cerr << "objects.size() is " << objects.size() << std::endl;
cid,
ghobject_t::get_max(),
ghobject_t::get_max(),
- 60,
+ true,
+ 50,
&objects,
&next
);
objects.clear();
listed.clear();
+ ghobject_t start2, next2;
while (1) {
- r = store->collection_list(cid, start,
- ghobject_t::get_max(),
- 60,
+ // nibblewise
+ r = store->collection_list(cid, start2, ghobject_t::get_max(), false,
+ 50,
+ &objects,
+ &next2);
+ if (r != -EOPNOTSUPP) {
+ ASSERT_TRUE(sorted(objects, false));
+ ASSERT_EQ(r, 0);
+ listed2.insert(objects.begin(), objects.end());
+ if (objects.size() < 50) {
+ ASSERT_TRUE(next2.is_max());
+ }
+ objects.clear();
+ start2 = next2;
+ }
+
+ // bitwise
+ r = store->collection_list(cid, start, ghobject_t::get_max(), true,
+ 50,
&objects,
&next);
- ASSERT_TRUE(sorted(objects));
+ ASSERT_TRUE(sorted(objects, true));
ASSERT_EQ(r, 0);
listed.insert(objects.begin(), objects.end());
if (objects.size() < 50) {
break;
}
objects.clear();
+
start = next;
}
cerr << "listed.size() is " << listed.size() << std::endl;
ASSERT_TRUE(listed.size() == created.size());
+ if (listed2.size())
+ ASSERT_EQ(listed.size(), listed2.size());
for (set<ghobject_t>::iterator i = listed.begin();
i != listed.end();
++i) {
ghobject_t next, current;
while (1) {
cerr << "scanning..." << std::endl;
- int r = store->collection_list(cid, current, ghobject_t::get_max(), 100,
+ int r = store->collection_list(cid, current, ghobject_t::get_max(),
+ true, 100,
&objects, &next);
ASSERT_EQ(r, 0);
- ASSERT_TRUE(sorted(objects));
+ ASSERT_TRUE(sorted(objects, true));
objects_set.insert(objects.begin(), objects.end());
objects.clear();
if (next.is_max()) break;
ASSERT_GT(available_objects.count(*i), (unsigned)0);
}
- int r = store->collection_list(cid, ghobject_t(), ghobject_t::get_max(), INT_MAX, &objects, 0);
+ int r = store->collection_list(cid, ghobject_t(), ghobject_t::get_max(), true, INT_MAX, &objects, 0);
ASSERT_EQ(r, 0);
objects_set2.insert(objects.begin(), objects.end());
ASSERT_EQ(objects_set2.size(), available_objects.size());
}
}
vector<ghobject_t> objects;
- r = store->collection_list(cid, ghobject_t(), ghobject_t::get_max(), INT_MAX, &objects, 0);
+ r = store->collection_list(cid, ghobject_t(), ghobject_t::get_max(), true, INT_MAX, &objects, 0);
ASSERT_EQ(r, 0);
set<ghobject_t> listed(objects.begin(), objects.end());
cerr << "listed.size() is " << listed.size() << " and created.size() is " << created.size() << std::endl;
listed.clear();
ghobject_t current, next;
while (1) {
- r = store->collection_list(cid, current, ghobject_t::get_max(), 60,
+ r = store->collection_list(cid, current, ghobject_t::get_max(), true, 60,
&objects, &next);
ASSERT_EQ(r, 0);
- ASSERT_TRUE(sorted(objects));
+ ASSERT_TRUE(sorted(objects, true));
for (vector<ghobject_t>::iterator i = objects.begin();
i != objects.end();
++i) {
}
vector<ghobject_t> objects;
- r = store->collection_list(cid, ghobject_t(), ghobject_t::get_max(), INT_MAX,
- &objects, 0);
+ r = store->collection_list(cid, ghobject_t(), ghobject_t::get_max(), true,
+ INT_MAX, &objects, 0);
ASSERT_EQ(r, 0);
set<ghobject_t> listed(objects.begin(), objects.end());
cerr << "listed.size() is " << listed.size() << " and created.size() is " << created.size() << std::endl;
listed.clear();
ghobject_t current, next;
while (1) {
- r = store->collection_list(cid, current, ghobject_t::get_max(), 60,
+ r = store->collection_list(cid, current, ghobject_t::get_max(), true, 60,
&objects, &next);
ASSERT_EQ(r, 0);
- ASSERT_TRUE(sorted(objects));
+ ASSERT_TRUE(sorted(objects, true));
for (vector<ghobject_t>::iterator i = objects.begin();
i != objects.end(); ++i) {
if (listed.count(*i))
ObjectStore::Transaction t;
vector<ghobject_t> objects;
- r = store->collection_list(cid, ghobject_t(), ghobject_t::get_max(), INT_MAX,
- &objects, 0);
+ r = store->collection_list(cid, ghobject_t(), ghobject_t::get_max(), true,
+ INT_MAX, &objects, 0);
ASSERT_EQ(r, 0);
ASSERT_EQ(objects.size(), num_objects);
for (vector<ghobject_t>::iterator i = objects.begin();
}
objects.clear();
- r = store->collection_list(tid, ghobject_t(), ghobject_t::get_max(), INT_MAX,
- &objects, 0);
+ r = store->collection_list(tid, ghobject_t(), ghobject_t::get_max(), true,
+ INT_MAX, &objects, 0);
ASSERT_EQ(r, 0);
ASSERT_EQ(objects.size(), num_objects);
for (vector<ghobject_t>::iterator i = objects.begin();
{
vector<ghobject_t> objects;
- r = store->collection_list(cid, ghobject_t(), ghobject_t::get_max(), INT_MAX,
- &objects, 0);
+ r = store->collection_list(cid, ghobject_t(), ghobject_t::get_max(), true,
+ INT_MAX, &objects, 0);
ASSERT_EQ(r, 0);
ASSERT_EQ(objects.size(), 1u);
ASSERT_EQ(objects[0], oid2);