utime_t ut_st,
ut_et;
void *handle;
- unsigned shard_id, max_entries = 0;
+ unsigned shard_id, max_entries = LOG_CLASS_LIST_MAX_ENTRIES;
shard_id = (unsigned)strict_strtol(shard.c_str(), 10, &err);
if (!err.empty()) {
http_ret = -EINVAL;
return;
}
- } else
- max_entries = LOG_CLASS_LIST_MAX_ENTRIES;
-
+ }
+
RGWMetadataLog *meta_log = store->meta_mgr->get_log();
meta_log->init_list_entries(shard_id, ut_st, ut_et, marker, &handle);
}
void RGWOp_MDLog_Lock::execute() {
- string shard_id_str, duration_str, lock_id;
+ string shard_id_str, duration_str, locker_id, zone_id;
unsigned shard_id;
http_ret = 0;
shard_id_str = s->info.args.get("id");
duration_str = s->info.args.get("length");
- lock_id = s->info.args.get("lock_id");
+ locker_id = s->info.args.get("locker-id");
+ zone_id = s->info.args.get("zone-id");
if (shard_id_str.empty() ||
(duration_str.empty()) ||
- lock_id.empty()) {
+ locker_id.empty() ||
+ zone_id.empty()) {
dout(5) << "Error invalid parameter list" << dendl;
http_ret = -EINVAL;
return;
return;
}
utime_t time(dur, 0);
- http_ret = meta_log->lock_exclusive(shard_id, time, lock_id);
+ http_ret = meta_log->lock_exclusive(shard_id, time, zone_id, locker_id);
}
void RGWOp_MDLog_Unlock::execute() {
- string shard_id_str, lock_id;
+ string shard_id_str, locker_id, zone_id;
unsigned shard_id;
http_ret = 0;
shard_id_str = s->info.args.get("id");
- lock_id = s->info.args.get("lock_id");
+ locker_id = s->info.args.get("locker-id");
+ zone_id = s->info.args.get("zone-id");
if (shard_id_str.empty() ||
- lock_id.empty()) {
+ locker_id.empty() ||
+ zone_id.empty()) {
dout(5) << "Error invalid parameter list" << dendl;
http_ret = -EINVAL;
return;
}
RGWMetadataLog *meta_log = store->meta_mgr->get_log();
- http_ret = meta_log->unlock(shard_id, lock_id);
+ http_ret = meta_log->unlock(shard_id, zone_id, locker_id);
}
void RGWOp_BILog_List::execute() {
err;
utime_t ut_st,
ut_et;
- unsigned shard_id, max_entries = 0;
+ unsigned shard_id, max_entries = LOG_CLASS_LIST_MAX_ENTRIES;
shard_id = (unsigned)strict_strtol(shard.c_str(), 10, &err);
if (!err.empty()) {
http_ret = -EINVAL;
return;
}
- } else
- max_entries = LOG_CLASS_LIST_MAX_ENTRIES;
-
+ }
+
bool truncated;
do {
http_ret = store->data_log->list_entries(shard_id, ut_st, ut_et,
}
void RGWOp_DATALog_Lock::execute() {
- string shard_id_str, duration_str, lock_id;
+ string shard_id_str, duration_str, locker_id, zone_id;
unsigned shard_id;
http_ret = 0;
shard_id_str = s->info.args.get("id");
duration_str = s->info.args.get("length");
- lock_id = s->info.args.get("lock_id");
+ locker_id = s->info.args.get("locker-id");
+ zone_id = s->info.args.get("zone-id");
if (shard_id_str.empty() ||
(duration_str.empty()) ||
- lock_id.empty()) {
+ locker_id.empty() ||
+ zone_id.empty()) {
dout(5) << "Error invalid parameter list" << dendl;
http_ret = -EINVAL;
return;
return;
}
utime_t time(dur, 0);
- http_ret = store->data_log->lock_exclusive(shard_id, time, lock_id);
+ http_ret = store->data_log->lock_exclusive(shard_id, time, zone_id, locker_id);
}
void RGWOp_DATALog_Unlock::execute() {
- string shard_id_str, lock_id;
+ string shard_id_str, locker_id, zone_id;
unsigned shard_id;
http_ret = 0;
shard_id_str = s->info.args.get("id");
- lock_id = s->info.args.get("lock_id");
+ locker_id = s->info.args.get("locker-id");
+ zone_id = s->info.args.get("zone-id");
if (shard_id_str.empty() ||
- lock_id.empty()) {
+ locker_id.empty() ||
+ zone_id.empty()) {
dout(5) << "Error invalid parameter list" << dendl;
http_ret = -EINVAL;
return;
return;
}
- http_ret = store->data_log->unlock(shard_id, lock_id);
+ http_ret = store->data_log->unlock(shard_id, zone_id, locker_id);
}
void RGWOp_DATALog_Delete::execute() {
ASSERT_EQ(0, user_create(uid, display_name));
ASSERT_EQ(0, caps_add(cname, perm));
- rest_req = "/admin/log?type=data&lock&length=3&lock_id=ceph";
+ rest_req = "/admin/log?type=data&lock&length=3&locker-id=ceph&zone-id=1";
g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
EXPECT_EQ(400U, g_test->get_resp_code()); /*Bad request*/
- rest_req = "/admin/log?type=data&lock&id=3&lock_id=ceph";
+ rest_req = "/admin/log?type=data&lock&id=3&locker-id=ceph&zone-id=1";
g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
EXPECT_EQ(400U, g_test->get_resp_code()); /*Bad request*/
- rest_req = "/admin/log?type=data&lock&length=3&id=1";
+ rest_req = "/admin/log?type=data&lock&length=3&id=1&zone-id=1";
+ g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
+ EXPECT_EQ(400U, g_test->get_resp_code()); /*Bad request*/
+
+ rest_req = "/admin/log?type=data&lock&length=3&id=1&locker-id=1";
g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
EXPECT_EQ(400U, g_test->get_resp_code()); /*Bad request*/
- rest_req = "/admin/log?type=data&unlock&id=1";
+ rest_req = "/admin/log?type=data&unlock&id=1&zone-id=1";
g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
EXPECT_EQ(400U, g_test->get_resp_code()); /*Bad request*/
- rest_req = "/admin/log?type=data&unlock&lock_id=ceph";
+ rest_req = "/admin/log?type=data&unlock&locker-id=ceph&zone-id=1";
+ g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
+ EXPECT_EQ(400U, g_test->get_resp_code()); /*Bad request*/
+
+ rest_req = "/admin/log?type=data&unlock&locker-id=ceph&id=1";
g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
EXPECT_EQ(400U, g_test->get_resp_code()); /*Bad request*/
- rest_req = "/admin/log?type=data&lock&id=1&length=3&lock_id=ceph";
+ rest_req = "/admin/log?type=data&lock&id=1&length=3&locker-id=ceph&zone-id=1";
g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
EXPECT_EQ(200U, g_test->get_resp_code());
- rest_req = "/admin/log?type=data&unlock&id=1&lock_id=ceph";
+ rest_req = "/admin/log?type=data&unlock&id=1&locker-id=ceph&zone-id=1";
g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
EXPECT_EQ(200U, g_test->get_resp_code());
- rest_req = "/admin/log?type=data&lock&id=1&length=3&lock_id=ceph1";
+ rest_req = "/admin/log?type=data&lock&id=1&length=3&locker-id=ceph1&zone-id=1";
g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
EXPECT_EQ(200U, g_test->get_resp_code());
- rest_req = "/admin/log?type=data&unlock&id=1&lock_id=ceph1";
+ rest_req = "/admin/log?type=data&unlock&id=1&locker-id=ceph1&zone-id=1";
g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
EXPECT_EQ(200U, g_test->get_resp_code());
- rest_req = "/admin/log?type=data&lock&id=1&length=3&lock_id=ceph";
+ rest_req = "/admin/log?type=data&lock&id=1&length=3&locker-id=ceph&zone-id=1";
g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
EXPECT_EQ(200U, g_test->get_resp_code());
utime_t sleep_time(3, 0);
- rest_req = "/admin/log?type=data&lock&id=1&length=3&lock_id=ceph1";
+ rest_req = "/admin/log?type=data&lock&id=1&length=3&locker-id=ceph1&zone-id=1";
g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
EXPECT_EQ(500U, g_test->get_resp_code());
- rest_req = "/admin/log?type=data&lock&id=1&length=3&lock_id=ceph";
+ rest_req = "/admin/log?type=data&lock&id=1&length=3&locker-id=ceph1&zone-id=2";
g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
- EXPECT_EQ(409U, g_test->get_resp_code());
+ EXPECT_EQ(500U, g_test->get_resp_code());
+
+ rest_req = "/admin/log?type=data&lock&id=1&length=3&locker-id=ceph&zone-id=1";
+ g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
+ EXPECT_EQ(200U, g_test->get_resp_code());
sleep_time.sleep();
- rest_req = "/admin/log?type=data&lock&id=1&length=3&lock_id=ceph1";
+ rest_req = "/admin/log?type=data&lock&id=1&length=3&locker-id=ceph1&zone-id=1";
g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
EXPECT_EQ(200U, g_test->get_resp_code());
- rest_req = "/admin/log?type=data&unlock&id=1&lock_id=ceph1";
+ rest_req = "/admin/log?type=data&unlock&id=1&locker-id=ceph1&zone-id=1";
g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
EXPECT_EQ(200U, g_test->get_resp_code());
ASSERT_EQ(0, caps_rm(cname, perm));
perm = "read";
ASSERT_EQ(0, caps_add(cname, perm));
- rest_req = "/admin/log?type=data&lock&id=1&length=3&lock_id=ceph";
+ rest_req = "/admin/log?type=data&lock&id=1&length=3&locker-id=ceph&zone-id=1";
g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
EXPECT_EQ(403U, g_test->get_resp_code());
- rest_req = "/admin/log?type=data&unlock&id=1&lock_id=ceph";
+ rest_req = "/admin/log?type=data&unlock&id=1&locker-id=ceph&zone-id=1";
g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
EXPECT_EQ(403U, g_test->get_resp_code());
ASSERT_EQ(0, caps_rm(cname, perm));
perm = "write";
ASSERT_EQ(0, caps_add(cname, perm));
- rest_req = "/admin/log?type=data&lock&id=1&length=3&lock_id=ceph";
+ rest_req = "/admin/log?type=data&lock&id=1&length=3&locker-id=ceph&zone-id=1";
g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
EXPECT_EQ(200U, g_test->get_resp_code());
- rest_req = "/admin/log?type=data&unlock&id=1&lock_id=ceph";
+ rest_req = "/admin/log?type=data&unlock&id=1&locker-id=ceph&zone-id=1";
g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
EXPECT_EQ(200U, g_test->get_resp_code());
ASSERT_EQ(0, caps_rm(cname, perm));
- rest_req = "/admin/log?type=data&lock&id=1&length=3&lock_id=ceph";
+ rest_req = "/admin/log?type=data&lock&id=1&length=3&locker-id=ceph&zone-id=1";
g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
EXPECT_EQ(403U, g_test->get_resp_code());
- rest_req = "/admin/log?type=data&unlock&id=1&lock_id=ceph";
+ rest_req = "/admin/log?type=data&unlock&id=1&locker-id=ceph&zone-id=1";
g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
EXPECT_EQ(403U, g_test->get_resp_code());
ASSERT_EQ(0, user_create(uid, display_name));
ASSERT_EQ(0, caps_add(cname, perm));
- rest_req = "/admin/log?type=metadata&lock&length=3&lock_id=ceph";
+ rest_req = "/admin/log?type=metadata&lock&length=3&locker-id=ceph&zone-id=1";
g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
EXPECT_EQ(400U, g_test->get_resp_code()); /*Bad request*/
- rest_req = "/admin/log?type=metadata&lock&id=3&lock_id=ceph";
+ rest_req = "/admin/log?type=metadata&lock&id=3&locker-id=ceph&zone-id=1";
g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
EXPECT_EQ(400U, g_test->get_resp_code()); /*Bad request*/
- rest_req = "/admin/log?type=metadata&lock&length=3&id=1";
+ rest_req = "/admin/log?type=metadata&lock&length=3&id=1&zone-id=1";
g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
EXPECT_EQ(400U, g_test->get_resp_code()); /*Bad request*/
- rest_req = "/admin/log?type=metadata&unlock&id=1";
+ rest_req = "/admin/log?type=metadata&lock&id=3&locker-id=ceph&length=1";
+ g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
+ EXPECT_EQ(400U, g_test->get_resp_code()); /*Bad request*/
+
+ rest_req = "/admin/log?type=metadata&unlock&id=1&zone-id=1";
g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
EXPECT_EQ(400U, g_test->get_resp_code()); /*Bad request*/
- rest_req = "/admin/log?type=metadata&unlock&lock_id=ceph";
+ rest_req = "/admin/log?type=metadata&unlock&locker-id=ceph&zone-id=1";
+ g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
+ EXPECT_EQ(400U, g_test->get_resp_code()); /*Bad request*/
+
+ rest_req = "/admin/log?type=metadata&unlock&locker-id=ceph&id=1";
g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
EXPECT_EQ(400U, g_test->get_resp_code()); /*Bad request*/
- rest_req = "/admin/log?type=metadata&lock&id=1&length=3&lock_id=ceph";
+ rest_req = "/admin/log?type=metadata&lock&id=1&length=3&locker-id=ceph&zone-id=1";
g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
EXPECT_EQ(200U, g_test->get_resp_code());
- rest_req = "/admin/log?type=metadata&unlock&id=1&lock_id=ceph";
+ rest_req = "/admin/log?type=metadata&unlock&id=1&locker-id=ceph&zone-id=1";
g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
EXPECT_EQ(200U, g_test->get_resp_code());
- rest_req = "/admin/log?type=metadata&lock&id=1&length=3&lock_id=ceph1";
+ rest_req = "/admin/log?type=metadata&lock&id=1&length=3&locker-id=ceph1&zone-id=1";
g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
EXPECT_EQ(200U, g_test->get_resp_code());
- rest_req = "/admin/log?type=metadata&unlock&id=1&lock_id=ceph1";
+ rest_req = "/admin/log?type=metadata&unlock&id=1&locker-id=ceph1&zone-id=1";
g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
EXPECT_EQ(200U, g_test->get_resp_code());
- rest_req = "/admin/log?type=metadata&lock&id=1&length=3&lock_id=ceph";
+ rest_req = "/admin/log?type=metadata&lock&id=1&length=3&locker-id=ceph&zone-id=1";
g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
EXPECT_EQ(200U, g_test->get_resp_code());
utime_t sleep_time(3, 0);
- rest_req = "/admin/log?type=metadata&lock&id=1&length=3&lock_id=ceph1";
+ rest_req = "/admin/log?type=metadata&lock&id=1&length=3&locker-id=ceph1&zone-id=1";
g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
EXPECT_EQ(500U, g_test->get_resp_code());
- rest_req = "/admin/log?type=metadata&lock&id=1&length=3&lock_id=ceph";
+ rest_req = "/admin/log?type=metadata&lock&id=1&length=3&locker-id=ceph&zone-id=2";
g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
- EXPECT_EQ(409U, g_test->get_resp_code());
+ EXPECT_EQ(500U, g_test->get_resp_code());
+
+ rest_req = "/admin/log?type=metadata&lock&id=1&length=3&locker-id=ceph&zone-id=1";
+ g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
+ EXPECT_EQ(200U, g_test->get_resp_code());
sleep_time.sleep();
- rest_req = "/admin/log?type=metadata&lock&id=1&length=3&lock_id=ceph1";
+ rest_req = "/admin/log?type=metadata&lock&id=1&length=3&locker-id=ceph1&zone-id=1";
g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
EXPECT_EQ(200U, g_test->get_resp_code());
- rest_req = "/admin/log?type=metadata&unlock&id=1&lock_id=ceph1";
+ rest_req = "/admin/log?type=metadata&unlock&id=1&locker-id=ceph1&zone-id=1";
g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
EXPECT_EQ(200U, g_test->get_resp_code());
ASSERT_EQ(0, caps_rm(cname, perm));
perm = "read";
ASSERT_EQ(0, caps_add(cname, perm));
- rest_req = "/admin/log?type=metadata&lock&id=1&length=3&lock_id=ceph";
+ rest_req = "/admin/log?type=metadata&lock&id=1&length=3&locker-id=ceph&zone-id=1";
g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
EXPECT_EQ(403U, g_test->get_resp_code());
- rest_req = "/admin/log?type=metadata&unlock&id=1&lock_id=ceph";
+ rest_req = "/admin/log?type=metadata&unlock&id=1&locker-id=ceph&zone-id=1";
g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
EXPECT_EQ(403U, g_test->get_resp_code());
ASSERT_EQ(0, caps_rm(cname, perm));
perm = "write";
ASSERT_EQ(0, caps_add(cname, perm));
- rest_req = "/admin/log?type=metadata&lock&id=1&length=3&lock_id=ceph";
+ rest_req = "/admin/log?type=metadata&lock&id=1&length=3&locker-id=ceph&zone-id=1";
g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
EXPECT_EQ(200U, g_test->get_resp_code());
- rest_req = "/admin/log?type=metadata&unlock&id=1&lock_id=ceph";
+ rest_req = "/admin/log?type=metadata&unlock&id=1&locker-id=ceph&zone-id=1";
g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
EXPECT_EQ(200U, g_test->get_resp_code());
ASSERT_EQ(0, caps_rm(cname, perm));
- rest_req = "/admin/log?type=metadata&lock&id=1&length=3&lock_id=ceph";
+ rest_req = "/admin/log?type=metadata&lock&id=1&length=3&locker-id=ceph&zone-id=1";
g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
EXPECT_EQ(403U, g_test->get_resp_code());
- rest_req = "/admin/log?type=metadata&unlock&id=1&lock_id=ceph";
+ rest_req = "/admin/log?type=metadata&unlock&id=1&locker-id=ceph&zone-id=1";
g_test->send_request(string("POST"), rest_req, read_dummy_post, NULL, sizeof(int));
EXPECT_EQ(403U, g_test->get_resp_code());