Skip to content

Commit

Permalink
keep logging module consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
zichanglai committed Sep 29, 2023
1 parent a12463b commit 161cef0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/lib/homestore_backend/hs_homeobject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void HSHomeObject::init_homestore() {
});
}

LOGINFO("Initialize and start HomeStore is successfully");
LOGI("Initialize and start HomeStore is successfully");
}

void HSHomeObject::register_homestore_metablk_callback() {
Expand Down
11 changes: 5 additions & 6 deletions src/lib/homestore_backend/hs_shard_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ ShardManager::Result< ShardInfo > HSHomeObject::_create_shard(pg_id_t pg_owner,
repl_dev->async_alloc_write(header, sisl::blob{}, value, req);
auto info = req->result().get();
if (!bool(info)) {
LOGWARN("create new shard [{}] on pg [{}] is failed with error:{}", new_shard_id & shard_mask, pg_owner,
info.error());
LOGW("create new shard [{}] on pg [{}] is failed with error:{}", new_shard_id & shard_mask, pg_owner,
info.error());
}
return info;
}
Expand Down Expand Up @@ -132,7 +132,7 @@ void HSHomeObject::on_shard_message_commit(int64_t lsn, sisl::blob const& header
ReplicationMessageHeader msg_header = *r_cast< const ReplicationMessageHeader* >(header.bytes);
repl_dev->async_read(blkids, value, value.size).thenValue([this, lsn, msg_header, blkids, value](auto&& err) {
if (err) {
LOGWARNMOD(homeobject, "failed to read data from homestore pba, lsn:{}", lsn);
LOGW(homeobject, "failed to read data from homestore pba, lsn:{}", lsn);
} else {
sisl::blob value_blob(r_cast< uint8_t* >(value.iovs[0].iov_base), value.size);
do_shard_message_commit(lsn, msg_header, blkids, value_blob, nullptr);
Expand All @@ -152,15 +152,14 @@ void HSHomeObject::do_shard_message_commit(int64_t lsn, ReplicationMessageHeader
}

if (header.corrupted()) {
LOGWARNMOD(homeobject, "replication message header is corrupted with crc error, lsn:{}", lsn);
LOGW("replication message header is corrupted with crc error, lsn:{}", lsn);
if (ctx) { ctx->promise_.setValue(folly::makeUnexpected(ShardError::INVALID_ARG)); }
return;
}


if (crc32_ieee(init_crc32, value.bytes, value.size) != header.payload_crc) {
// header & value is inconsistent;
LOGWARNMOD(homeobject, "replication message header is inconsistent with value, lsn:{}", lsn);
LOGW("replication message header is inconsistent with value, lsn:{}", lsn);
if (ctx) { ctx->promise_.setValue(folly::makeUnexpected(ShardError::INVALID_ARG)); }
return;
}
Expand Down
8 changes: 4 additions & 4 deletions src/lib/homestore_backend/tests/test_shard_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ TEST_F(ShardManagerTesting, MockSealShard) {
auto seal_shard_msg = j.dump();

homeobject::HSHomeObject* ho = dynamic_cast< homeobject::HSHomeObject* >(_home_object.get());
auto* pg = s_cast<homeobject::HSHomeObject::HS_PG* >(ho->_pg_map[_pg_id].get());
auto* pg = s_cast< homeobject::HSHomeObject::HS_PG* >(ho->_pg_map[_pg_id].get());
auto repl_dev = pg->repl_dev_;
const auto msg_size = sisl::round_up(seal_shard_msg.size(), repl_dev->get_blk_size());
auto req = homeobject::repl_result_ctx< ShardManager::Result< ShardInfo > >::make(msg_size, 512 /*alignment*/);
Expand Down Expand Up @@ -244,8 +244,8 @@ TEST_F(ShardManagerTestingRecovery, ShardManagerRecovery) {
auto app_with_recovery = dp_cast< FixtureAppWithRecovery >(app);
const std::string fpath = app_with_recovery->path();
if (std::filesystem::exists(fpath)) { std::filesystem::remove(fpath); }
LOGINFO("creating device files with size {} ", homestore::in_bytes(2 * Gi));
LOGINFO("creating {} device file", fpath);
LOGI("creating device files with size {} ", homestore::in_bytes(2 * Gi));
LOGI("creating {} device file", fpath);
std::ofstream ofs{fpath, std::ios::binary | std::ios::out | std::ios::trunc};
std::filesystem::resize_file(fpath, 2 * Gi);

Expand Down Expand Up @@ -282,7 +282,7 @@ TEST_F(ShardManagerTestingRecovery, ShardManagerRecovery) {
// release the homeobject and homestore will be shutdown automatically.
_home_object.reset();

LOGINFO("restart home_object");
LOGI("restart home_object");
// re-create the homeobject and pg infos and shard infos will be recover automatically.
_home_object = homeobject::init_homeobject(std::weak_ptr< homeobject::HomeObjectApplication >(app));
ho = dynamic_cast< homeobject::HSHomeObject* >(_home_object.get());
Expand Down

0 comments on commit 161cef0

Please sign in to comment.