#include "include/Context.h"
#include "common/Mutex.h"
#include "common/safe_io.h"
+#include "os/JournalingObjectStore.h"
Finisher *finisher;
Cond sync_cond;
ASSERT_EQ(0, j.create());
j.make_writeable();
+ list<ObjectStore::Transaction*> tls;
bufferlist bl;
bl.append("small");
- j.submit_entry(1, bl, 0, new C_SafeCond(&wait_lock, &cond, &done));
+ int orig_len = j.prepare_entry(tls, &bl);
+ j.submit_entry(1, bl, orig_len, new C_SafeCond(&wait_lock, &cond, &done));
wait();
j.close();
memset(foo, 1, sizeof(foo));
bl.append(foo, sizeof(foo));
}
- j.submit_entry(1, bl, 0, new C_SafeCond(&wait_lock, &cond, &done));
+ list<ObjectStore::Transaction*> tls;
+ int orig_len = j.prepare_entry(tls, &bl);
+ j.submit_entry(1, bl, orig_len, new C_SafeCond(&wait_lock, &cond, &done));
wait();
-
j.close();
}
}
C_GatherBuilder gb(g_ceph_context, new C_SafeCond(&wait_lock, &cond, &done));
+ list<ObjectStore::Transaction*> tls;
bufferlist bl;
bl.append("small");
uint64_t seq = 1;
for (int i=0; i<100; i++) {
bl.append("small");
- j.submit_entry(seq++, bl, 0, gb.new_sub());
+ int orig_len = j.prepare_entry(tls, &bl);
+ j.submit_entry(seq++, bl, orig_len, gb.new_sub());
}
-
gb.activate();
wait();
bufferlist first;
first.append("small");
- j.submit_entry(1, first, 0, gb.new_sub());
+ list<ObjectStore::Transaction*> tls;
+ int orig_len = j.prepare_entry(tls, &first);
+ j.submit_entry(1, first, orig_len, gb.new_sub());
bufferlist bl;
for (int i=0; i<IOV_MAX * 2; i++) {
bl.append(bp);
}
bufferlist origbl = bl;
- j.submit_entry(2, bl, 0, gb.new_sub());
+ orig_len = j.prepare_entry(tls, &bl);
+ j.submit_entry(2, bl, orig_len, gb.new_sub());
gb.activate();
wait();
g_ceph_context->_conf->set_val("journal_write_header_frequency", "0");
g_ceph_context->_conf->apply_changes(NULL);
+ list<ObjectStore::Transaction*> tls;
+
for (unsigned i = 0 ; i < 3; ++i) {
SCOPED_TRACE(subtests[i].description);
fsid.generate_random();
bufferlist bl;
bl.append("small");
- j.submit_entry(1, bl, 0, gb.new_sub());
+ int orig_len = j.prepare_entry(tls, &bl);
+ j.submit_entry(1, bl, orig_len, gb.new_sub());
bl.append("small");
- j.submit_entry(2, bl, 0, gb.new_sub());
+ orig_len = j.prepare_entry(tls, &bl);
+ j.submit_entry(2, bl, orig_len, gb.new_sub());
bl.append("small");
- j.submit_entry(3, bl, 0, gb.new_sub());
+ orig_len = j.prepare_entry(tls, &bl);
+ j.submit_entry(3, bl, orig_len, gb.new_sub());
gb.activate();
wait();
g_ceph_context->_conf->set_val("journal_write_header_frequency", "0");
g_ceph_context->_conf->apply_changes(NULL);
+ list<ObjectStore::Transaction*> tls;
for (unsigned i = 0 ; i < 3; ++i) {
SCOPED_TRACE(subtests[i].description);
fsid.generate_random();
const char *newneedle = "in a haystack";
bufferlist bl;
bl.append(needle);
- j.submit_entry(1, bl, 0, gb.new_sub());
+ int orig_len = j.prepare_entry(tls, &bl);
+ j.submit_entry(1, bl, orig_len, gb.new_sub());
bl.append(needle);
- j.submit_entry(2, bl, 0, gb.new_sub());
+ orig_len = j.prepare_entry(tls, &bl);
+ j.submit_entry(2, bl, orig_len, gb.new_sub());
bl.append(needle);
- j.submit_entry(3, bl, 0, gb.new_sub());
+ orig_len = j.prepare_entry(tls, &bl);
+ j.submit_entry(3, bl, orig_len, gb.new_sub());
bl.append(needle);
- j.submit_entry(4, bl, 0, gb.new_sub());
+ orig_len = j.prepare_entry(tls, &bl);
+ j.submit_entry(4, bl, orig_len, gb.new_sub());
gb.activate();
wait();
for (unsigned o=0; o < sizeof(buf) - strlen(needle); o++) {
if (memcmp(buf+o, needle, strlen(needle)) == 0) {
if (n >= 2) {
- cout << "replacing at offset " << o << std::endl;
- memcpy(buf+o, newneedle, strlen(newneedle));
+ cout << "replacing at offset " << o << std::endl;
+ memcpy(buf+o, newneedle, strlen(newneedle));
} else {
- cout << "leaving at offset " << o << std::endl;
+ cout << "leaving at offset " << o << std::endl;
}
n++;
}
memset(foo, 1, sizeof(foo));
uint64_t seq = 1, committed = 0;
+ list<ObjectStore::Transaction*> tls;
for (unsigned i=0; i<size_mb*2; i++) {
bl.clear();
bl.push_back(buffer::copy(foo, sizeof(foo)));
bl.zero();
ls.push_back(new C_Sync);
- j.submit_entry(seq++, bl, 0, ls.back()->c);
+ int orig_len = j.prepare_entry(tls, &bl);
+ j.submit_entry(seq++, bl, orig_len, ls.back()->c);
while (ls.size() > size_mb/2) {
delete ls.front();
g_ceph_context->_conf->set_val("journal_ignore_corruption", "false");
g_ceph_context->_conf->set_val("journal_write_header_frequency", "0");
g_ceph_context->_conf->apply_changes(NULL);
+ list<ObjectStore::Transaction*> tls;
for (unsigned i = 0 ; i < 3; ++i) {
SCOPED_TRACE(subtests[i].description);
bl.push_back(buffer::copy(foo, sizeof(foo) / 128));
bl.zero();
ls.push_back(new C_Sync);
- j.submit_entry(seq++, bl, 0, ls.back()->c);
+ int orig_len = j.prepare_entry(tls, &bl);
+ j.submit_entry(seq++, bl, orig_len, ls.back()->c);
while (ls.size() > size_mb/2) {
delete ls.front();
g_ceph_context->_conf->set_val("journal_write_header_frequency", "1");
g_ceph_context->_conf->apply_changes(NULL);
+ list<ObjectStore::Transaction*> tls;
for (unsigned i = 0 ; i < 3; ++i) {
SCOPED_TRACE(subtests[i].description);
fsid.generate_random();
for (unsigned i = 1; i <= 4; ++i) {
bufferlist bl;
bl.append(needle);
- j.submit_entry(i, bl, 0, gb.new_sub());
+ int orig_len = j.prepare_entry(tls, &bl);
+ j.submit_entry(i, bl, orig_len, gb.new_sub());
}
gb.activate();
wait();
bufferlist bl;
bl.append("needle");
- j.submit_entry(5, bl, 0, new C_SafeCond(&wait_lock, &cond, &done));
+ int orig_len = j.prepare_entry(tls, &bl);
+ j.submit_entry(5, bl, orig_len, new C_SafeCond(&wait_lock, &cond, &done));
wait();
j.close();
g_ceph_context->_conf->set_val("journal_write_header_frequency", "1");
g_ceph_context->_conf->apply_changes(NULL);
+ list<ObjectStore::Transaction*> tls;
for (unsigned i = 0 ; i < 3; ++i) {
SCOPED_TRACE(subtests[i].description);
fsid.generate_random();
for (unsigned i = 1; i <= 4; ++i) {
bufferlist bl;
bl.append(needle);
- j.submit_entry(i, bl, 0, gb.new_sub());
+ int orig_len = j.prepare_entry(tls, &bl);
+ j.submit_entry(i, bl, orig_len, gb.new_sub());
}
gb.activate();
wait();
bufferlist bl;
bl.append("needle");
- j.submit_entry(5, bl, 0, new C_SafeCond(&wait_lock, &cond, &done));
+ int orig_len = j.prepare_entry(tls, &bl);
+ j.submit_entry(5, bl, orig_len, new C_SafeCond(&wait_lock, &cond, &done));
wait();
j.close();
g_ceph_context->_conf->set_val("journal_write_header_frequency", "1");
g_ceph_context->_conf->apply_changes(NULL);
+ list<ObjectStore::Transaction*> tls;
for (unsigned i = 0 ; i < 3; ++i) {
SCOPED_TRACE(subtests[i].description);
fsid.generate_random();
for (unsigned i = 1; i <= 4; ++i) {
bufferlist bl;
bl.append(needle);
- j.submit_entry(i, bl, 0, gb.new_sub());
+ int orig_len = j.prepare_entry(tls, &bl);
+ j.submit_entry(i, bl, orig_len, gb.new_sub());
}
gb.activate();
wait();
bufferlist bl;
bl.append("needle");
- j.submit_entry(5, bl, 0, new C_SafeCond(&wait_lock, &cond, &done));
+ int orig_len = j.prepare_entry(tls, &bl);
+ j.submit_entry(5, bl, orig_len, new C_SafeCond(&wait_lock, &cond, &done));
wait();
j.close();