Skip to content

Commit

Permalink
Fix the names of function objects added in PR 12681
Browse files Browse the repository at this point in the history
Summary: These should be in `snake_case` (not `camelCase`) per our style guide.

Differential Revision: D57676418
  • Loading branch information
ltamasi authored and facebook-github-bot committed May 22, 2024
1 parent 1827f3f commit 0aeaa41
Showing 1 changed file with 25 additions and 24 deletions.
49 changes: 25 additions & 24 deletions db/write_batch.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2124,12 +2124,12 @@ class MemTableInserter : public WriteBatch::Handler {
template <typename RebuildTxnOp>
Status PutCFImpl(uint32_t column_family_id, const Slice& key,
const Slice& value, ValueType value_type,
RebuildTxnOp rebuildTxnOp,
RebuildTxnOp rebuild_txn_op,
const ProtectionInfoKVOS64* kv_prot_info) {
// optimize for non-recovery mode
if (UNLIKELY(write_after_commit_ && rebuilding_trx_ != nullptr)) {
// TODO(ajkr): propagate `ProtectionInfoKVOS64`.
return rebuildTxnOp(rebuilding_trx_, column_family_id, key, value);
return rebuild_txn_op(rebuilding_trx_, column_family_id, key, value);
// else insert the values to the memtable right away
}

Expand All @@ -2141,7 +2141,7 @@ class MemTableInserter : public WriteBatch::Handler {
// need to keep track of the keys for upcoming rollback/commit.
// TODO(ajkr): propagate `ProtectionInfoKVOS64`.
ret_status =
rebuildTxnOp(rebuilding_trx_, column_family_id, key, value);
rebuild_txn_op(rebuilding_trx_, column_family_id, key, value);
if (ret_status.ok()) {
MaybeAdvanceSeq(IsDuplicateKeySeq(column_family_id, key));
}
Expand Down Expand Up @@ -2265,7 +2265,8 @@ class MemTableInserter : public WriteBatch::Handler {
if (UNLIKELY(ret_status.ok() && rebuilding_trx_ != nullptr)) {
assert(!write_after_commit_);
// TODO(ajkr): propagate `ProtectionInfoKVOS64`.
ret_status = rebuildTxnOp(rebuilding_trx_, column_family_id, key, value);
ret_status =
rebuild_txn_op(rebuilding_trx_, column_family_id, key, value);
}
return ret_status;
}
Expand All @@ -2275,8 +2276,8 @@ class MemTableInserter : public WriteBatch::Handler {
const auto* kv_prot_info = NextProtectionInfo();
Status ret_status;

auto rebuildTxnOp = [](WriteBatch* rebuilding_trx, uint32_t cf_id,
const Slice& k, const Slice& v) -> Status {
auto rebuild_txn_op = [](WriteBatch* rebuilding_trx, uint32_t cf_id,
const Slice& k, const Slice& v) -> Status {
return WriteBatchInternal::Put(rebuilding_trx, cf_id, k, v);
};

Expand All @@ -2285,10 +2286,10 @@ class MemTableInserter : public WriteBatch::Handler {
auto mem_kv_prot_info =
kv_prot_info->StripC(column_family_id).ProtectS(sequence_);
ret_status = PutCFImpl(column_family_id, key, value, kTypeValue,
rebuildTxnOp, &mem_kv_prot_info);
rebuild_txn_op, &mem_kv_prot_info);
} else {
ret_status = PutCFImpl(column_family_id, key, value, kTypeValue,
rebuildTxnOp, nullptr /* kv_prot_info */);
rebuild_txn_op, nullptr /* kv_prot_info */);
}
// TODO: this assumes that if TryAgain status is returned to the caller,
// the operation is actually tried again. The proper way to do this is to
Expand All @@ -2308,21 +2309,21 @@ class MemTableInserter : public WriteBatch::Handler {
Slice packed_value =
PackValueAndWriteTime(value, unix_write_time, &value_buf);

auto rebuildTxnOp = [](WriteBatch* /* rebuilding_trx */,
uint32_t /* cf_id */, const Slice& /* k */,
const Slice& /* v */) -> Status {
auto rebuild_txn_op = [](WriteBatch* /* rebuilding_trx */,
uint32_t /* cf_id */, const Slice& /* k */,
const Slice& /* v */) -> Status {
return Status::NotSupported();
};

if (kv_prot_info != nullptr) {
auto mem_kv_prot_info =
kv_prot_info->StripC(column_family_id).ProtectS(sequence_);
ret_status =
PutCFImpl(column_family_id, key, packed_value,
kTypeValuePreferredSeqno, rebuildTxnOp, &mem_kv_prot_info);
ret_status = PutCFImpl(column_family_id, key, packed_value,
kTypeValuePreferredSeqno, rebuild_txn_op,
&mem_kv_prot_info);
} else {
ret_status = PutCFImpl(column_family_id, key, packed_value,
kTypeValuePreferredSeqno, rebuildTxnOp,
kTypeValuePreferredSeqno, rebuild_txn_op,
nullptr /* kv_prot_info */);
}

Expand All @@ -2342,8 +2343,8 @@ class MemTableInserter : public WriteBatch::Handler {

Status s;

auto rebuildTxnOp = [](WriteBatch* rebuilding_trx, uint32_t cf_id,
const Slice& k, Slice entity) -> Status {
auto rebuild_txn_op = [](WriteBatch* rebuilding_trx, uint32_t cf_id,
const Slice& k, Slice entity) -> Status {
WideColumns columns;
const Status st = WideColumnSerialization::Deserialize(entity, columns);
if (!st.ok()) {
Expand All @@ -2358,10 +2359,10 @@ class MemTableInserter : public WriteBatch::Handler {
auto mem_kv_prot_info =
kv_prot_info->StripC(column_family_id).ProtectS(sequence_);
s = PutCFImpl(column_family_id, key, value, kTypeWideColumnEntity,
rebuildTxnOp, &mem_kv_prot_info);
rebuild_txn_op, &mem_kv_prot_info);
} else {
s = PutCFImpl(column_family_id, key, value, kTypeWideColumnEntity,
rebuildTxnOp,
rebuild_txn_op,
/* kv_prot_info */ nullptr);
}

Expand Down Expand Up @@ -2806,9 +2807,9 @@ class MemTableInserter : public WriteBatch::Handler {
const auto* kv_prot_info = NextProtectionInfo();
Status ret_status;

auto rebuildTxnOp = [](WriteBatch* /* rebuilding_trx */,
uint32_t /* cf_id */, const Slice& /* k */,
const Slice& /* v */) -> Status {
auto rebuild_txn_op = [](WriteBatch* /* rebuilding_trx */,
uint32_t /* cf_id */, const Slice& /* k */,
const Slice& /* v */) -> Status {
return Status::NotSupported();
};

Expand All @@ -2818,10 +2819,10 @@ class MemTableInserter : public WriteBatch::Handler {
kv_prot_info->StripC(column_family_id).ProtectS(sequence_);
// Same as PutCF except for value type.
ret_status = PutCFImpl(column_family_id, key, value, kTypeBlobIndex,
rebuildTxnOp, &mem_kv_prot_info);
rebuild_txn_op, &mem_kv_prot_info);
} else {
ret_status = PutCFImpl(column_family_id, key, value, kTypeBlobIndex,
rebuildTxnOp, nullptr /* kv_prot_info */);
rebuild_txn_op, nullptr /* kv_prot_info */);
}
if (UNLIKELY(ret_status.IsTryAgain())) {
DecrementProtectionInfoIdxForTryAgain();
Expand Down

0 comments on commit 0aeaa41

Please sign in to comment.