Skip to content

Commit

Permalink
OSD: drop parameter t from proc_replica_log()
Browse files Browse the repository at this point in the history
Which is definitely unnecessary.

Signed-off-by: xie xingguo <[email protected]>
  • Loading branch information
xiexingguo committed Mar 11, 2017
1 parent 520e139 commit 65e0492
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 36 deletions.
7 changes: 2 additions & 5 deletions src/osd/PG.cc
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,6 @@ void PG::proc_master_log(
}

void PG::proc_replica_log(
ObjectStore::Transaction& t,
pg_info_t &oinfo,
const pg_log_t &olog,
pg_missing_t& omissing,
Expand All @@ -348,7 +347,7 @@ void PG::proc_replica_log(
dout(10) << "proc_replica_log for osd." << from << ": "
<< oinfo << " " << olog << " " << omissing << dendl;

pg_log.proc_replica_log(t, oinfo, olog, omissing, from);
pg_log.proc_replica_log(oinfo, olog, omissing, from);

peer_info[from] = oinfo;
dout(10) << " peer osd." << from << " now " << oinfo << " " << omissing << dendl;
Expand Down Expand Up @@ -6958,7 +6957,6 @@ boost::statechart::result PG::RecoveryState::Active::react(const MLogRec& logevt
ldout(pg->cct, 10) << "searching osd." << logevt.from
<< " log for unfound items" << dendl;
pg->proc_replica_log(
*context<RecoveryMachine>().get_cur_transaction(),
logevt.msg->info, logevt.msg->log, logevt.msg->missing, logevt.from);
bool got_missing = pg->search_for_missing(
pg->peer_info[logevt.from],
Expand Down Expand Up @@ -7887,8 +7885,7 @@ boost::statechart::result PG::RecoveryState::GetMissing::react(const MLogRec& lo
PG *pg = context< RecoveryMachine >().pg;

peer_missing_requested.erase(logevt.from);
pg->proc_replica_log(*context<RecoveryMachine>().get_cur_transaction(),
logevt.msg->info, logevt.msg->log, logevt.msg->missing, logevt.from);
pg->proc_replica_log(logevt.msg->info, logevt.msg->log, logevt.msg->missing, logevt.from);

if (peer_missing_requested.empty()) {
if (pg->need_up_thru) {
Expand Down
3 changes: 1 addition & 2 deletions src/osd/PG.h
Original file line number Diff line number Diff line change
Expand Up @@ -968,8 +968,7 @@ class PG : protected DoutPrefixProvider {

virtual void calc_trim_to() = 0;

void proc_replica_log(ObjectStore::Transaction& t,
pg_info_t &oinfo, const pg_log_t &olog,
void proc_replica_log(pg_info_t &oinfo, const pg_log_t &olog,
pg_missing_t& omissing, pg_shard_t from);
void proc_master_log(ObjectStore::Transaction& t, pg_info_t &oinfo, pg_log_t &olog,
pg_missing_t& omissing, pg_shard_t from);
Expand Down
1 change: 0 additions & 1 deletion src/osd/PGLog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ void PGLog::trim(
}

void PGLog::proc_replica_log(
ObjectStore::Transaction& t,
pg_info_t &oinfo,
const pg_log_t &olog,
pg_missing_t& omissing,
Expand Down
3 changes: 1 addition & 2 deletions src/osd/PGLog.h
Original file line number Diff line number Diff line change
Expand Up @@ -703,8 +703,7 @@ struct PGLog : DoutPrefixProvider {
log.last_requested = 0;
}

void proc_replica_log(ObjectStore::Transaction& t,
pg_info_t &oinfo,
void proc_replica_log(pg_info_t &oinfo,
const pg_log_t &olog,
pg_missing_t& omissing, pg_shard_t from) const;

Expand Down
33 changes: 7 additions & 26 deletions src/test/osd/TestPGLog.cc
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,6 @@ class PGLogTest : public ::testing::Test, protected PGLog {
};
void test_proc_replica_log(const TestCase &tcase) {
clear();
ObjectStore::Transaction t;
log = tcase.get_fullauth();
pg_info_t info = tcase.get_authinfo();

Expand All @@ -248,7 +247,7 @@ class PGLogTest : public ::testing::Test, protected PGLog {
pg_info_t oinfo = tcase.get_divinfo();

proc_replica_log(
t, oinfo, olog, omissing, pg_shard_t(1, shard_id_t(0)));
oinfo, olog, omissing, pg_shard_t(1, shard_id_t(0)));

assert(oinfo.last_update >= log.tail);

Expand Down Expand Up @@ -1223,7 +1222,6 @@ TEST_F(PGLogTest, proc_replica_log) {
{
clear();

ObjectStore::Transaction t;
pg_log_t olog;
pg_info_t oinfo;
pg_missing_t omissing;
Expand All @@ -1234,14 +1232,12 @@ TEST_F(PGLogTest, proc_replica_log) {
eversion_t last_complete(1, 1);
oinfo.last_complete = last_complete;

EXPECT_TRUE(t.empty());
EXPECT_FALSE(omissing.have_missing());
EXPECT_EQ(last_update, oinfo.last_update);
EXPECT_EQ(last_complete, oinfo.last_complete);

proc_replica_log(t, oinfo, olog, omissing, from);
proc_replica_log(oinfo, olog, omissing, from);

EXPECT_TRUE(t.empty());
EXPECT_FALSE(omissing.have_missing());
EXPECT_EQ(last_update, oinfo.last_update);
EXPECT_EQ(last_update, oinfo.last_complete);
Expand Down Expand Up @@ -1275,7 +1271,6 @@ TEST_F(PGLogTest, proc_replica_log) {
{
clear();

ObjectStore::Transaction t;
pg_log_t olog;
pg_info_t oinfo;
pg_missing_t omissing;
Expand Down Expand Up @@ -1310,21 +1305,18 @@ TEST_F(PGLogTest, proc_replica_log) {
oinfo.last_complete = olog.head;
}

EXPECT_TRUE(t.empty());
EXPECT_FALSE(omissing.have_missing());
EXPECT_EQ(olog.head, oinfo.last_update);
EXPECT_EQ(olog.head, oinfo.last_complete);

proc_replica_log(t, oinfo, olog, omissing, from);
proc_replica_log(oinfo, olog, omissing, from);

EXPECT_TRUE(t.empty());
EXPECT_FALSE(omissing.have_missing());
}

{
clear();

ObjectStore::Transaction t;
pg_log_t olog;
pg_info_t oinfo;
pg_missing_t omissing;
Expand Down Expand Up @@ -1414,14 +1406,12 @@ TEST_F(PGLogTest, proc_replica_log) {
oinfo.last_complete = olog.head;
}

EXPECT_TRUE(t.empty());
EXPECT_FALSE(omissing.have_missing());
EXPECT_EQ(olog.head, oinfo.last_update);
EXPECT_EQ(olog.head, oinfo.last_complete);

proc_replica_log(t, oinfo, olog, omissing, from);
proc_replica_log(oinfo, olog, omissing, from);

EXPECT_TRUE(t.empty());
EXPECT_TRUE(omissing.have_missing());
EXPECT_TRUE(omissing.is_missing(divergent_object));
EXPECT_EQ(eversion_t(1, 2), omissing.get_items().at(divergent_object).need);
Expand Down Expand Up @@ -1456,7 +1446,6 @@ TEST_F(PGLogTest, proc_replica_log) {
{
clear();

ObjectStore::Transaction t;
pg_log_t olog;
pg_info_t oinfo;
pg_missing_t omissing;
Expand Down Expand Up @@ -1503,14 +1492,12 @@ TEST_F(PGLogTest, proc_replica_log) {
oinfo.last_complete = olog.head;
}

EXPECT_TRUE(t.empty());
EXPECT_FALSE(omissing.have_missing());
EXPECT_EQ(olog.head, oinfo.last_update);
EXPECT_EQ(olog.head, oinfo.last_complete);

proc_replica_log(t, oinfo, olog, omissing, from);
proc_replica_log(oinfo, olog, omissing, from);

EXPECT_TRUE(t.empty());
EXPECT_TRUE(omissing.have_missing());
EXPECT_TRUE(omissing.is_missing(divergent_object));
EXPECT_EQ(omissing.get_items().at(divergent_object).have, eversion_t(0, 0));
Expand Down Expand Up @@ -1545,7 +1532,6 @@ TEST_F(PGLogTest, proc_replica_log) {
{
clear();

ObjectStore::Transaction t;
pg_log_t olog;
pg_info_t oinfo;
pg_missing_t omissing;
Expand Down Expand Up @@ -1593,16 +1579,14 @@ TEST_F(PGLogTest, proc_replica_log) {
oinfo.last_complete = olog.head;
}

EXPECT_TRUE(t.empty());
EXPECT_TRUE(omissing.have_missing());
EXPECT_TRUE(omissing.is_missing(divergent_object));
EXPECT_EQ(eversion_t(1, 3), omissing.get_items().at(divergent_object).need);
EXPECT_EQ(olog.head, oinfo.last_update);
EXPECT_EQ(olog.head, oinfo.last_complete);

proc_replica_log(t, oinfo, olog, omissing, from);
proc_replica_log(oinfo, olog, omissing, from);

EXPECT_TRUE(t.empty());
EXPECT_TRUE(omissing.have_missing());
EXPECT_TRUE(omissing.is_missing(divergent_object));
EXPECT_EQ(omissing.get_items().at(divergent_object).have, eversion_t(0, 0));
Expand Down Expand Up @@ -1638,7 +1622,6 @@ TEST_F(PGLogTest, proc_replica_log) {
{
clear();

ObjectStore::Transaction t;
pg_log_t olog;
pg_info_t oinfo;
pg_missing_t omissing;
Expand Down Expand Up @@ -1689,16 +1672,14 @@ TEST_F(PGLogTest, proc_replica_log) {
oinfo.last_complete = olog.head;
}

EXPECT_TRUE(t.empty());
EXPECT_TRUE(omissing.have_missing());
EXPECT_TRUE(omissing.is_missing(divergent_object));
EXPECT_EQ(divergent_version, omissing.get_items().at(divergent_object).need);
EXPECT_EQ(olog.head, oinfo.last_update);
EXPECT_EQ(olog.head, oinfo.last_complete);

proc_replica_log(t, oinfo, olog, omissing, from);
proc_replica_log(oinfo, olog, omissing, from);

EXPECT_TRUE(t.empty());
EXPECT_TRUE(omissing.have_missing());
EXPECT_TRUE(omissing.get_items().begin()->second.need == eversion_t(1, 1));
EXPECT_EQ(last_update, oinfo.last_update);
Expand Down

0 comments on commit 65e0492

Please sign in to comment.