Skip to content

Commit

Permalink
NOLINT
Browse files Browse the repository at this point in the history
  • Loading branch information
ban-nobuhiro committed Jan 16, 2025
1 parent bd7fc7f commit ffb2363
Show file tree
Hide file tree
Showing 14 changed files with 49 additions and 49 deletions.
4 changes: 2 additions & 2 deletions src/concurrency_control/bg_work/bg_commit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ void bg_commit::worker() {
std::unique_lock<std::mutex> lk2{mtx_used_ids()};
used_ids().erase(tx_id);
}
goto REFIND; // LINT
goto REFIND; // NOLINT
} // termination was successed
ti->set_result_requested_commit(rc);

Expand All @@ -168,7 +168,7 @@ void bg_commit::worker() {
* リストが空になったら安全に used_ids をクリアする。
*/

goto REFIND; // LINT
goto REFIND; // NOLINT
}

// normal termination, update joined_waiting_resolver
Expand Down
8 changes: 4 additions & 4 deletions src/concurrency_control/bg_work/include/bg_commit.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,19 +86,19 @@ class bg_commit {
* @brief The number of joined threads at last running for resolver threads.
* This is initialized 0 at init. This can be checked after fin.
*/
static inline std::atomic<std::size_t> // LINT
static inline std::atomic<std::size_t> // NOLINT
joined_waiting_resolver_threads_{};

/**
* @brief ltx commit verify threads
*/
static inline worker_cont_type worker_threads_; // LINT
static inline worker_cont_type worker_threads_; // NOLINT

/**
* @brief This is a list what transaction do it be processed now by @a
* worker_threads_ to prevent conflict.
*/
static inline used_ids_type used_ids_; // LINT
static inline used_ids_type used_ids_; // NOLINT

/**
* @brief mutex for @a used_ids_
Expand All @@ -120,7 +120,7 @@ class bg_commit {
/**
* @brief container of long transactions waiting to commit.
*/
static inline cont_type cont_wait_tx_; // LINT
static inline cont_type cont_wait_tx_; // NOLINT
};

} // namespace shirakami::bg_work
2 changes: 1 addition & 1 deletion src/concurrency_control/include/read_plan.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class read_plan {
/**
* @brief container for read area
*/
static inline cont_type cont_; // LINT
static inline cont_type cont_; // NOLINT
};

} // namespace shirakami
2 changes: 1 addition & 1 deletion src/concurrency_control/interface/long_tx/search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ extern Status version_traverse_and_read(session* const ti,
* so this tx must wait unlocking because it may read invalid state with
* locking.
*/
goto RETRY; // LINT
goto RETRY; // NOLINT
}

// read non-latest version after version function
Expand Down
6 changes: 3 additions & 3 deletions src/concurrency_control/interface/scan/read_kv_from_scan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ Status read_from_scan(Token token, ScanHandle handle, bool key_read,
auto& scan_buf = std::get<scan_handler::scan_cache_vec_pos>(
sh.get_scan_cache()[handle]);
std::size_t& scan_index = sh.get_scan_cache_itr()[handle];
auto itr = scan_buf.begin() + scan_index; // LINT
auto itr = scan_buf.begin() + scan_index; // NOLINT
nv = std::get<1>(*itr);
nv_ptr = std::get<2>(*itr);
if (scan_buf.size() <= scan_index) { return Status::WARN_SCAN_LIMIT; }
Expand Down Expand Up @@ -220,7 +220,7 @@ Status read_from_scan(Token token, ScanHandle handle, bool key_read,
return Status::ERR_FATAL;
}

Status read_key_from_scan(Token const token, ScanHandle const handle, // LINT
Status read_key_from_scan(Token const token, ScanHandle const handle, // NOLINT
std::string& key) {
shirakami_log_entry << "read_key_from_scan, token: " << token
<< ", handle: " << handle;
Expand All @@ -237,7 +237,7 @@ Status read_key_from_scan(Token const token, ScanHandle const handle, // LINT
return ret;
}

Status read_value_from_scan(Token const token, // LINT
Status read_value_from_scan(Token const token, // NOLINT
ScanHandle const handle, std::string& value) {
shirakami_log_entry << "read_value_from_scan, token: " << token
<< ", handle: " << handle;
Expand Down
4 changes: 2 additions & 2 deletions src/concurrency_control/interface/short_tx/termination.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ Status sert_process_at_write_lock(write_set_obj* wso) {
// for fail safe
wso->get_rec_ptr()->unlock();
wso->set_rec_ptr(rec_ptr);
goto RE_LOCK; // LINT
goto RE_LOCK; // NOLINT
}
} else {
// already unhooked
Expand Down Expand Up @@ -614,7 +614,7 @@ Status write_phase(session* ti, epoch::epoch_t ce) {
* To be larger than LTX.
* Ltx's minor version is ltx id.
*/
minor_version <<= 63; // LINT
minor_version <<= 63; // NOLINT
minor_version |= update_tid.get_tid();
}
ti->get_lpwal_handle().push_log(shirakami::lpwal::log_record(
Expand Down
22 changes: 11 additions & 11 deletions src/concurrency_control/interface/storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ void write_storage_metadata(std::string_view key, Storage st,
while (enter(s) != Status::OK) { _mm_pause(); }
std::string value{};
// value = Storage + id + payload
value.append(reinterpret_cast<char*>(&st), sizeof(st)); // LINT
value.append(reinterpret_cast<char*>(&st), sizeof(st)); // NOLINT
storage_option::id_t id = options.id();
value.append(reinterpret_cast<char*>(&id), sizeof(id)); // LINT
value.append(reinterpret_cast<char*>(&id), sizeof(id)); // NOLINT
std::string payload{options.payload()};
value.append(payload);
auto ret = tx_begin({s, transaction_options::transaction_type::SHORT});
Expand All @@ -51,7 +51,7 @@ void write_storage_metadata(std::string_view key, Storage st,
#ifdef PWAL
auto* ti = static_cast<session*>(s);
// reuse mrc_tid of previous commit to calculate the write-version
lpwal::write_version_type wv{ti->get_mrc_tid().get_epoch(), ti->get_mrc_tid().get_tid() | (1UL << 63)}; // LINT
lpwal::write_version_type wv{ti->get_mrc_tid().get_epoch(), ti->get_mrc_tid().get_tid() | (1UL << 63)}; // NOLINT
{
std::unique_lock<std::mutex> lk{ti->get_lpwal_handle().get_mtx_logs()};
ti->get_lpwal_handle().push_log(lpwal::log_record(log_operation::ADD_STORAGE, wv, st, {}, {}));
Expand Down Expand Up @@ -85,7 +85,7 @@ void remove_storage_metadata(std::string_view key, [[maybe_unused]] Storage st)
#ifdef PWAL
auto* ti = static_cast<session*>(s);
// reuse mrc_tid of previous commit to calculate the write-version
lpwal::write_version_type wv{ti->get_mrc_tid().get_epoch(), ti->get_mrc_tid().get_tid() | (1UL << 63)}; // LINT
lpwal::write_version_type wv{ti->get_mrc_tid().get_epoch(), ti->get_mrc_tid().get_tid() | (1UL << 63)}; // NOLINT
// note: this write-version is calculated without reading any Records in this storage,
// so it may be smaller than that of concurrent transactions writing this storage.
{
Expand Down Expand Up @@ -219,7 +219,7 @@ Status storage_get_options_body(Storage storage, storage_option& options) {
// Someone may executed storage_set_options and it occurs occ error.
_mm_pause();
++try_num;
if (try_num > 100) { // LINT
if (try_num > 100) { // NOLINT
LOG(INFO) << "strange statement";
leave(s);
return Status::WARN_ILLEGAL_OPERATION;
Expand All @@ -228,11 +228,11 @@ Status storage_get_options_body(Storage storage, storage_option& options) {
leave(s);
// value = Storage + id + payload
storage_option::id_t id{};
memcpy(&id, value.data() + sizeof(Storage), // LINT
memcpy(&id, value.data() + sizeof(Storage), // NOLINT
sizeof(storage_option::id_t));
std::string payload{};
if (value.size() > sizeof(Storage) + sizeof(storage_option::id_t)) {
payload.append(value.data() + sizeof(Storage) + // LINT
payload.append(value.data() + sizeof(Storage) + // NOLINT
sizeof(storage_option::id_t), // LINT
value.size() - sizeof(Storage) -
sizeof(storage_option::id_t));
Expand Down Expand Up @@ -264,9 +264,9 @@ Status storage_set_options_body(Storage storage,
while (enter(s) != Status::OK) { _mm_pause(); }
std::string value{};
// value = Storage + id + payload
value.append(reinterpret_cast<char*>(&storage), sizeof(storage)); // LINT
value.append(reinterpret_cast<char*>(&storage), sizeof(storage)); // NOLINT
storage_option::id_t id = options.id();
value.append(reinterpret_cast<char*>(&id), sizeof(id)); // LINT
value.append(reinterpret_cast<char*>(&id), sizeof(id)); // NOLINT
std::string payload{options.payload()};
value.append(payload);
// store and log information
Expand Down Expand Up @@ -321,7 +321,7 @@ Status storage::register_storage(Storage storage, storage_option options) {
new wp::page_set_meta(std::move(options))};
auto rc = yakushima::put<wp::page_set_meta*>(
ytoken,
{reinterpret_cast<char*>(&page_set_meta_storage), // LINT
{reinterpret_cast<char*>(&page_set_meta_storage), // NOLINT
sizeof(page_set_meta_storage)},
storage_view, &page_set_meta_ptr,
sizeof(page_set_meta_ptr)); // LINT

Check warning on line 327 in src/concurrency_control/interface/storage.cpp

View workflow job for this annotation

GitHub Actions / Clang-Tidy

bugprone-sizeof-expression

suspicious usage of 'sizeof(A*)'; pointer to aggregate
Expand Down Expand Up @@ -375,7 +375,7 @@ Status storage::create_storage(Storage& storage,

Status storage::exist_storage(Storage storage) {
auto ret = yakushima::find_storage(
{reinterpret_cast<char*>(&storage), sizeof(storage)}); // LINT
{reinterpret_cast<char*>(&storage), sizeof(storage)}); // NOLINT
if (ret == yakushima::status::OK) { return Status::OK; }
return Status::WARN_NOT_FOUND;
}
Expand Down
2 changes: 1 addition & 1 deletion src/concurrency_control/local_set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ void local_write_set::push(Token token, write_set_obj&& elem) {
}
} else {
cont_for_occ_.emplace_back(std::move(elem)); // LINT
if (cont_for_occ_.size() > 100) { // LINT
if (cont_for_occ_.size() > 100) { // NOLINT
// swtich to use cont_for_bt_ for performance
set_for_batch(true);
for (auto&& elem_occ : cont_for_occ_) {
Expand Down
4 changes: 2 additions & 2 deletions src/concurrency_control/read_by.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void point_read_by_long::push(body_elem_type const elem) {
}
// erase in bulk
if (erase_count > 0) {
body_.erase(body_.begin(), body_.begin() + erase_count); // LINT
body_.erase(body_.begin(), body_.begin() + erase_count); // NOLINT
}

// push info
Expand Down Expand Up @@ -156,7 +156,7 @@ void range_read_by_long::push(body_elem_type const& elem) {

// erase in bulk
if (erase_count > 0) {
body_.erase(body_.begin(), body_.begin() + erase_count); // LINT
body_.erase(body_.begin(), body_.begin() + erase_count); // NOLINT
}

// push info
Expand Down
2 changes: 1 addition & 1 deletion src/concurrency_control/read_plan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ bool read_plan::check_potential_read_anti(std::size_t const tx_id,
std::get<3>(p_elem); // LINT
std::string r_rkey = std::get<4>(p_elem); // LINT
scan_endpoint r_rpoint =
std::get<5>(p_elem); // LINT
std::get<5>(p_elem); // NOLINT
// define write range [], read range ()
if (
// case: [(])
Expand Down
16 changes: 8 additions & 8 deletions src/concurrency_control/sequence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Status create_sequence(SequenceId* const id) {
return ret;
}

Status update_sequence(Token const token, SequenceId const id, // LINT
Status update_sequence(Token const token, SequenceId const id, // NOLINT
SequenceVersion const version,
SequenceValue const value) {
shirakami_log_entry << "update_sequence, token: " << token << ", id: " << id
Expand Down Expand Up @@ -283,16 +283,16 @@ Status sequence::create_sequence(SequenceId* id) {
// logging sequence operation
// gen key
std::string key{};
key.append(reinterpret_cast<char*>(id), sizeof(*id)); // LINT
key.append(reinterpret_cast<char*>(id), sizeof(*id)); // NOLINT
// gen value
std::tuple<SequenceVersion, SequenceValue> initial_pair =
sequence::initial_value;
SequenceVersion initial_version{std::get<0>(initial_pair)};
SequenceValue initial_value{std::get<1>(initial_pair)};
std::string value{}; // value is version + value
value.append(reinterpret_cast<char*>(&initial_version), // LINT
value.append(reinterpret_cast<char*>(&initial_version), // NOLINT
sizeof(initial_version));
value.append(reinterpret_cast<char*>(&initial_value), // LINT
value.append(reinterpret_cast<char*>(&initial_value), // NOLINT
sizeof(initial_value));
ret = tx_begin({token, transaction_options::transaction_type::SHORT});
if (ret != Status::OK) {
Expand Down Expand Up @@ -328,7 +328,7 @@ Status sequence::create_sequence(SequenceId* id) {
return Status::OK;
}

Status sequence::update_sequence(Token const token, // LINT
Status sequence::update_sequence(Token const token, // NOLINT
SequenceId const id,
SequenceVersion const version,
SequenceValue const value) {
Expand Down Expand Up @@ -394,16 +394,16 @@ Status sequence::delete_sequence(SequenceId const id) {
// logging sequence operation
// gen key
std::string key{};
key.append(reinterpret_cast<const char*>(&id), sizeof(id)); // LINT
key.append(reinterpret_cast<const char*>(&id), sizeof(id)); // NOLINT
// gen value
std::tuple<SequenceVersion, SequenceValue> new_tuple =
sequence::non_exist_value;
SequenceVersion version = std::get<0>(new_tuple);
SequenceValue value = std::get<1>(new_tuple);
std::string new_value{}; // value is version + value
new_value.append(reinterpret_cast<const char*>(&version), // LINT
new_value.append(reinterpret_cast<const char*>(&version), // NOLINT
sizeof(version));
new_value.append(reinterpret_cast<const char*>(&value), // LINT
new_value.append(reinterpret_cast<const char*>(&value), // NOLINT
sizeof(value));
ret = tx_begin({token, transaction_options::transaction_type::SHORT});
if (ret != Status::OK) {
Expand Down
6 changes: 3 additions & 3 deletions src/concurrency_control/session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,13 @@ void session::commit_sequence(tid_word ctid) {
// This entry is valid. it generates log.
// gen key
std::string key{};
key.append(reinterpret_cast<const char*>(&id), // LINT
key.append(reinterpret_cast<const char*>(&id), // NOLINT
sizeof(id));
// gen value
std::string new_value{}; // value is version + value
new_value.append(reinterpret_cast<const char*>(&version), // LINT
new_value.append(reinterpret_cast<const char*>(&version), // NOLINT
sizeof(version));
new_value.append(reinterpret_cast<const char*>(&value), // LINT
new_value.append(reinterpret_cast<const char*>(&value), // NOLINT
sizeof(value));
log_operation lo{log_operation::UPSERT};
// log to local to reduce contention for locks
Expand Down
16 changes: 8 additions & 8 deletions src/concurrency_control/wp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,19 +164,19 @@ Status fin() {
Status find_page_set_meta(Storage st, page_set_meta*& ret) {
Storage page_set_meta_storage = get_page_set_meta_storage();
std::string_view page_set_meta_storage_view = {
reinterpret_cast<char*>(&page_set_meta_storage), // LINT
reinterpret_cast<char*>(&page_set_meta_storage), // NOLINT
sizeof(page_set_meta_storage)};
std::string_view storage_view = {
reinterpret_cast<const char*>(&st), // LINT
reinterpret_cast<const char*>(&st), // NOLINT
sizeof(st)};
std::pair<page_set_meta**, std::size_t> out{};
auto rc{yakushima::get<page_set_meta*>(page_set_meta_storage_view, // LINT
auto rc{yakushima::get<page_set_meta*>(page_set_meta_storage_view, // NOLINT
storage_view, out)};
if (rc != yakushima::status::OK) {
ret = nullptr;
return Status::WARN_NOT_FOUND;
}
ret = reinterpret_cast<page_set_meta*>(out.first); // LINT
ret = reinterpret_cast<page_set_meta*>(out.first); // NOLINT
// by inline optimization
return Status::OK;
}
Expand Down Expand Up @@ -234,14 +234,14 @@ Status write_preserve(Token token, std::vector<Storage> storage,
for (auto&& wp_target : storage) {
Storage page_set_meta_storage = get_page_set_meta_storage();
std::string_view page_set_meta_storage_view = {
reinterpret_cast<char*>( // LINT
reinterpret_cast<char*>( // NOLINT
&page_set_meta_storage),
sizeof(page_set_meta_storage)};
std::string_view storage_view = {
reinterpret_cast<char*>(&wp_target), // LINT
reinterpret_cast<char*>(&wp_target), // NOLINT
sizeof(wp_target)};
std::pair<page_set_meta**, std::size_t> out{};
auto rc{yakushima::get<page_set_meta*>( // LINT
auto rc{yakushima::get<page_set_meta*>( // NOLINT
page_set_meta_storage_view, // LINT
storage_view, out)};

Expand All @@ -263,7 +263,7 @@ Status write_preserve(Token token, std::vector<Storage> storage,
return Status::WARN_INVALID_ARGS;
}
wp_meta* target_wp_meta =
(reinterpret_cast<page_set_meta*>(out.first)) // LINT
(reinterpret_cast<page_set_meta*>(out.first)) // NOLINT
->get_wp_meta_ptr();
if (target_wp_meta->register_wp(valid_epoch, long_tx_id) !=
Status::OK) {
Expand Down
4 changes: 2 additions & 2 deletions src/index/yakushima/include/interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ namespace shirakami {

template<class Record>
Status get(Storage st, std::string_view const key, Record*& rec_ptr,
std::pair<yakushima::node_version64_body, // LINT
std::pair<yakushima::node_version64_body, // NOLINT
yakushima::node_version64*>* checked_version = // NOLINT
nullptr) { // LINT
std::pair<Record**, std::size_t> out{};
auto rc{yakushima::get<Record*>({reinterpret_cast<char*>(&st), // NOLINT
sizeof(st)},
key, out, checked_version)};
if (rc == yakushima::status::OK) {
rec_ptr = reinterpret_cast<Record*>(out.first); // LINT
rec_ptr = reinterpret_cast<Record*>(out.first); // NOLINT
// by inline optimization
return Status::OK;
}
Expand Down

0 comments on commit ffb2363

Please sign in to comment.