Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the names of function objects added in PR 12681 #12689

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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