Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

Update Pre Commit Hooks #249

Merged
merged 2 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ files: >-
)$
repos:
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v15.0.7
rev: v17.0.5
hooks:
- id: clang-format
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: mixed-line-ending
- repo: https://github.com/codespell-project/codespell
rev: v2.2.4
rev: v2.2.6
hooks:
- id: codespell
args:
Expand Down
6 changes: 4 additions & 2 deletions src/rgw/driver/sfs/sfs_lc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ int SFSLifecycle::get_next_entry(
int SFSLifecycle::set_entry(const std::string& oid, LCEntry& entry) {
rgw::sal::sfs::sqlite::SQLiteLifecycle sqlite_lc(store->db_conn);
rgw::sal::sfs::sqlite::DBOPLCEntry db_entry{
oid, entry.get_bucket(), entry.get_start_time(), entry.get_status()};
oid, entry.get_bucket(), entry.get_start_time(), entry.get_status()
};
sqlite_lc.store_entry(db_entry);
return 0;
}
Expand Down Expand Up @@ -96,7 +97,8 @@ int SFSLifecycle::get_head(
int SFSLifecycle::put_head(const std::string& oid, LCHead& head) {
rgw::sal::sfs::sqlite::SQLiteLifecycle sqlite_lc(store->db_conn);
rgw::sal::sfs::sqlite::DBOPLCHead db_head{
oid, head.get_marker(), head.get_start_date()};
oid, head.get_marker(), head.get_start_date()
};
sqlite_lc.store_head(db_head);
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/rgw/driver/sfs/sqlite/retry.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class RetrySQLiteBusy {
return std::nullopt;
};

/// successful returns true if fn finished successful, possilby
/// successful returns true if fn finished successful, possibly
/// after retries
bool successful() { return m_successful; };
/// failed_error returns the non-critical error code of the last
Expand Down
9 changes: 6 additions & 3 deletions src/rgw/driver/sfs/types.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ Object* Object::create_from_db_version(
.size = version.size,
.etag = version.etag,
.mtime = version.mtime,
.delete_at = version.delete_time};
.delete_at = version.delete_time
};
result->attrs = version.attrs;
return result;
}
Expand All @@ -106,7 +107,8 @@ Object* Object::create_from_db_version(
.size = sqlite::get_size(version),
.etag = sqlite::get_etag(version),
.mtime = sqlite::get_mtime(version),
.delete_at = sqlite::get_delete_time(version)};
.delete_at = sqlite::get_delete_time(version)
};
result->attrs = sqlite::get_attrs(version);
return result;
}
Expand Down Expand Up @@ -164,7 +166,8 @@ Object* Object::try_fetch_from_database(
.size = version->size,
.etag = version->etag,
.mtime = version->mtime,
.delete_at = version->delete_time};
.delete_at = version->delete_time
};
result->attrs = version->attrs;

return result;
Expand Down
3 changes: 2 additions & 1 deletion src/rgw/rgw_sal_sfs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,8 @@ SFStore::custom_metric_fns() {
perfcounter_type_d::PERFCOUNTER_U64, "sfs_sqlite_connection_count",
static_cast<double>(sqlite_fds)
);
}};
}
};
return fns;
}

Expand Down
4 changes: 2 additions & 2 deletions src/rgw/rgw_status_frontend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ RGWStatusFrontend::RGWStatusFrontend(
acceptor(
ioc,
{net::ip::make_address(conf->get_val("bind", "127.0.0.1")),
static_cast<unsigned short>(std::stoi(conf->get_val("port", "9090"))
)}
static_cast<unsigned short>(std::stoi(conf->get_val("port", "9090")))
}
),
socket(ioc),
server_thread(this) {}
Expand Down
6 changes: 4 additions & 2 deletions src/test/rgw/sfs/test_rgw_sfs_object_state_machine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,8 @@ TEST_F(
const std::array<ObjectRef, 3> objects = {
bucket->create_version(rgw_obj_key("foo", "version1")),
bucket->create_version(rgw_obj_key("foo", "version2")),
bucket->create_version(rgw_obj_key("foo", "version3"))};
bucket->create_version(rgw_obj_key("foo", "version3"))
};
ASSERT_EQ(database_object_state(objects[0]), ObjectState::OPEN);
ASSERT_EQ(database_object_state(objects[1]), ObjectState::OPEN);
ASSERT_EQ(database_object_state(objects[2]), ObjectState::OPEN);
Expand All @@ -292,7 +293,8 @@ TEST_F(
const std::array<ObjectRef, 3> objects = {
bucket->create_version(rgw_obj_key("foo", "version1")),
bucket->create_version(rgw_obj_key("foo", "version2")),
bucket->create_version(rgw_obj_key("foo", "version3"))};
bucket->create_version(rgw_obj_key("foo", "version3"))
};
ASSERT_TRUE(objects[0]->metadata_finish(store.get(), true));
ASSERT_EQ(database_object_state(objects[0]), ObjectState::COMMITTED);
ASSERT_EQ(database_object_state(objects[1]), ObjectState::OPEN);
Expand Down
3 changes: 2 additions & 1 deletion src/test/rgw/sfs/test_rgw_sfs_retry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ TEST_F(TestSFSRetrySQLite, retry_non_crit_till_failure) {
TEST_F(TestSFSRetrySQLiteDeathTest, crit_aborts) {
GTEST_FLAG_SET(death_test_style, "threadsafe");
auto exception = std::system_error{
SQLITE_CORRUPT, sqlite_orm::get_sqlite_error_category()};
SQLITE_CORRUPT, sqlite_orm::get_sqlite_error_category()
};
RetrySQLiteBusy<int> uut([&]() {
throw exception;
return 0;
Expand Down
3 changes: 2 additions & 1 deletion src/test/rgw/sfs/test_rgw_sfs_sfs_bucket.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1471,7 +1471,8 @@ TEST_F(TestSFSBucket, ListNamespaceMultipartsBasics) {
.object_name = "object_name",
.path_uuid = uuid,
.meta_str = "metastr",
.mtime = now};
.mtime = now
};
int id = multipart.insert(mpop);
ASSERT_GE(id, 0);

Expand Down
30 changes: 20 additions & 10 deletions src/test/rgw/sfs/test_rgw_sfs_sqlite_list.cc
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,8 @@ TEST_F(TestSFSList, versions__there_is_latest_with_multiple_versions) {
),
create_test_versionedobject(
obj1.uuid, gen_rand_alphanumeric(cct.get(), 23)
)};
)
};
for (size_t i = 0; i < vers_obj1.size(); i++) {
vers_obj1[i].object_state = rgw::sal::sfs::ObjectState::COMMITTED;
vers_obj1[i].commit_time = ceph::real_time(std::chrono::seconds(i));
Expand All @@ -410,7 +411,8 @@ TEST_F(TestSFSList, versions__there_is_latest_with_multiple_versions) {
),
create_test_versionedobject(
obj2.uuid, gen_rand_alphanumeric(cct.get(), 23)
)};
)
};
for (size_t i = 0; i < vers_obj2.size(); i++) {
vers_obj2[i].object_state = rgw::sal::sfs::ObjectState::COMMITTED;
vers_obj2[i].commit_time = ceph::real_time(std::chrono::seconds(i + 10));
Expand Down Expand Up @@ -548,7 +550,8 @@ TEST_F(TestSFSList, roll_up_example) {
make_dentry_with_name("photos/2006/January/sample.jpg"),
make_dentry_with_name("photos/2006/February/sample2.jpg"),
make_dentry_with_name("photos/2006/February/sample3.jpg"),
make_dentry_with_name("photos/2006/February/sample4.jpg")};
make_dentry_with_name("photos/2006/February/sample4.jpg")
};
const auto expected_still_exists = objects[0];
std::map<std::string, bool> prefixes;
std::vector<rgw_bucket_dir_entry> out;
Expand Down Expand Up @@ -577,7 +580,8 @@ TEST_F(TestSFSList, roll_up_no_such_delim_in_equals_out) {
const auto uut = make_uut();
const std::vector<rgw_bucket_dir_entry> objects{
make_dentry_with_name("prefix/aaa"), make_dentry_with_name("prefix/bbb"),
make_dentry_with_name("prefix/ccc")};
make_dentry_with_name("prefix/ccc")
};
const auto expected_still_exists = objects[0];
std::map<std::string, bool> prefixes;
std::vector<rgw_bucket_dir_entry> out;
Expand All @@ -595,7 +599,8 @@ TEST_F(TestSFSList, roll_up_multi_delim_group_by_first) {
const std::vector<rgw_bucket_dir_entry> objects{
make_dentry_with_name("prefix/aaa/1"),
make_dentry_with_name("prefix/bbb/2"),
make_dentry_with_name("prefix/ccc/3")};
make_dentry_with_name("prefix/ccc/3")
};
std::map<std::string, bool> prefixes;
std::vector<rgw_bucket_dir_entry> out;

Expand All @@ -611,7 +616,8 @@ TEST_F(TestSFSList, roll_up_multi_prefixes) {
const auto uut = make_uut();
const std::vector<rgw_bucket_dir_entry> objects{
make_dentry_with_name("a/1"), make_dentry_with_name("b/2"),
make_dentry_with_name("c/3")};
make_dentry_with_name("c/3")
};
std::map<std::string, bool> prefixes;
std::vector<rgw_bucket_dir_entry> out;

Expand All @@ -630,7 +636,8 @@ TEST_F(TestSFSList, roll_up_empty_delimiter_prefix_is_copy) {
const auto uut = make_uut();
const std::vector<rgw_bucket_dir_entry> objects{
make_dentry_with_name("a"), make_dentry_with_name("b"),
make_dentry_with_name("c")};
make_dentry_with_name("c")
};
std::map<std::string, bool> prefixes;
std::vector<rgw_bucket_dir_entry> out;

Expand All @@ -647,7 +654,8 @@ TEST_F(TestSFSList, roll_up_starts_after_prefix) {
const std::vector<rgw_bucket_dir_entry> objects{
make_dentry_with_name("prefix/xxx"),
make_dentry_with_name("prefix/yyy/0"),
make_dentry_with_name("something/else")};
make_dentry_with_name("something/else")
};
std::map<std::string, bool> prefixes;
std::vector<rgw_bucket_dir_entry> out;

Expand All @@ -667,7 +675,8 @@ TEST_F(TestSFSList, roll_up_a_multichar_delimiters_work) {
make_dentry_with_name("photosDeLiM2006DeLiMJanuaryDeLiMsample.jpg"),
make_dentry_with_name("photosDeLiM2006DeLiMFebruaryDeLiMsample2.jpg"),
make_dentry_with_name("photosDeLiM2006DeLiMFebruaryDeLiMsample3.jpg"),
make_dentry_with_name("photosDeLiM2006DeLiMFebruaryDeLiMsample4.jpg")};
make_dentry_with_name("photosDeLiM2006DeLiMFebruaryDeLiMsample4.jpg")
};
const auto expected_still_exists = objects[0];
std::map<std::string, bool> prefixes;
std::vector<rgw_bucket_dir_entry> out;
Expand All @@ -686,7 +695,8 @@ TEST_F(TestSFSList, roll_up_delim_must_follow_prefix) {
const std::vector<rgw_bucket_dir_entry> objects{
make_dentry_with_name("prefix"), make_dentry_with_name("prefixDELIM"),
make_dentry_with_name("prefixDELIMsomething"),
make_dentry_with_name("prefixSOMETHING")};
make_dentry_with_name("prefixSOMETHING")
};
std::map<std::string, bool> prefixes;
std::vector<rgw_bucket_dir_entry> out;

Expand Down
9 changes: 6 additions & 3 deletions src/test/rgw/sfs/test_rgw_sfs_sqlite_users.cc
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,8 @@ TEST_F(TestSFSSQLiteUsers, StoreListUsers) {
ASSERT_EQ(userIds.size(), 3);
std::vector<std::string> users_vector{
std::make_move_iterator(userIds.begin()),
std::make_move_iterator(userIds.end())};
std::make_move_iterator(userIds.end())
};
ASSERT_EQ(users_vector[0], "test1");
ASSERT_EQ(users_vector[1], "test2");
ASSERT_EQ(users_vector[2], "test3");
Expand Down Expand Up @@ -647,7 +648,8 @@ TEST_F(TestSFSSQLiteUsers, StoreRemoveUser) {
ASSERT_EQ(userIds.size(), 3);
std::vector<std::string> users_vector{
std::make_move_iterator(userIds.begin()),
std::make_move_iterator(userIds.end())};
std::make_move_iterator(userIds.end())
};
ASSERT_EQ(users_vector[0], "test1");
ASSERT_EQ(users_vector[1], "test2");
ASSERT_EQ(users_vector[2], "test3");
Expand All @@ -665,7 +667,8 @@ TEST_F(TestSFSSQLiteUsers, StoreRemoveUser) {
ASSERT_EQ(userIds.size(), 2);
std::vector<std::string> users_after_remove_vector{
std::make_move_iterator(userIds.begin()),
std::make_move_iterator(userIds.end())};
std::make_move_iterator(userIds.end())
};
ASSERT_EQ(users_after_remove_vector[0], "test1");
ASSERT_EQ(users_after_remove_vector[1], "test3");
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/rgw/sfs/test_rgw_sfs_wal_checkpoint.cc
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ TEST_F(TestSFSWALCheckpoint, test_wal_checkpoint) {
init_store();

// Using our SFS checkpoint mechanism, the WAL may exceed
// 16MB while writing, because the trunacte checkpoints
// 16MB while writing, because the truncate checkpoints
// don't always succeed, but it shouldn't go over by much.
// We're allowing 32MB here for some extra wiggle room
// just in case.
Expand Down
Loading