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

Remove the primary_key parameter of SecondaryIndex::GetSecondary{KeyPrefix,Value} #13207

Closed
wants to merge 1 commit into from
Closed
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
5 changes: 2 additions & 3 deletions include/rocksdb/utilities/secondary_index.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class SecondaryIndex {
// index id or length indicator). Returning a non-OK status rolls back all
// operations in the transaction related to this primary key-value.
virtual Status GetSecondaryKeyPrefix(
const Slice& primary_key, const Slice& primary_column_value,
const Slice& primary_column_value,
std::variant<Slice, std::string>* secondary_key_prefix) const = 0;

// Get the optional secondary value for a given primary key-value. This method
Expand All @@ -93,8 +93,7 @@ class SecondaryIndex {
// Returning a non-OK status rolls back all operations in the transaction
// related to this primary key-value.
virtual Status GetSecondaryValue(
const Slice& primary_key, const Slice& primary_column_value,
const Slice& previous_column_value,
const Slice& primary_column_value, const Slice& previous_column_value,
std::optional<std::variant<Slice, std::string>>* secondary_value)
const = 0;
};
Expand Down
5 changes: 2 additions & 3 deletions utilities/secondary_index/faiss_ivf_index.cc
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ Status FaissIVFIndex::UpdatePrimaryColumnValue(
}

Status FaissIVFIndex::GetSecondaryKeyPrefix(
const Slice& /* primary_key */, const Slice& primary_column_value,
const Slice& primary_column_value,
std::variant<Slice, std::string>* secondary_key_prefix) const {
assert(secondary_key_prefix);

Expand All @@ -180,8 +180,7 @@ Status FaissIVFIndex::GetSecondaryKeyPrefix(
}

Status FaissIVFIndex::GetSecondaryValue(
const Slice& /* primary_key */, const Slice& primary_column_value,
const Slice& original_column_value,
const Slice& primary_column_value, const Slice& original_column_value,
std::optional<std::variant<Slice, std::string>>* secondary_value) const {
assert(secondary_value);

Expand Down
5 changes: 2 additions & 3 deletions utilities/secondary_index/faiss_ivf_index.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,10 @@ class FaissIVFIndex : public SecondaryIndex {
const override;

Status GetSecondaryKeyPrefix(
const Slice& primary_key, const Slice& primary_column_value,
const Slice& primary_column_value,
std::variant<Slice, std::string>* secondary_key_prefix) const override;

Status GetSecondaryValue(const Slice& primary_key,
const Slice& primary_column_value,
Status GetSecondaryValue(const Slice& primary_column_value,
const Slice& original_column_value,
std::optional<std::variant<Slice, std::string>>*
secondary_value) const override;
Expand Down
7 changes: 3 additions & 4 deletions utilities/secondary_index/secondary_index_mixin.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ class SecondaryIndexMixin : public Txn {
std::variant<Slice, std::string> secondary_key_prefix;

const Status s = secondary_index->GetSecondaryKeyPrefix(
primary_key, existing_primary_column_value, &secondary_key_prefix);
existing_primary_column_value, &secondary_key_prefix);
if (!s.ok()) {
return s;
}
Expand Down Expand Up @@ -268,7 +268,7 @@ class SecondaryIndexMixin : public Txn {

{
const Status s = secondary_index->GetSecondaryKeyPrefix(
primary_key, primary_column_value, &secondary_key_prefix);
primary_column_value, &secondary_key_prefix);
if (!s.ok()) {
return s;
}
Expand All @@ -278,8 +278,7 @@ class SecondaryIndexMixin : public Txn {

{
const Status s = secondary_index->GetSecondaryValue(
primary_key, primary_column_value, previous_column_value,
&secondary_value);
primary_column_value, previous_column_value, &secondary_value);
if (!s.ok()) {
return s;
}
Expand Down
5 changes: 2 additions & 3 deletions utilities/transactions/transaction_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8054,7 +8054,7 @@ TEST_P(TransactionTest, SecondaryIndex) {
}

Status GetSecondaryKeyPrefix(
const Slice& /* primary_key */, const Slice& primary_column_value,
const Slice& primary_column_value,
std::variant<Slice, std::string>* secondary_key_prefix) const override {
assert(secondary_key_prefix);

Expand All @@ -8068,8 +8068,7 @@ TEST_P(TransactionTest, SecondaryIndex) {
return Status::OK();
}

Status GetSecondaryValue(const Slice& /* primary_key */,
const Slice& primary_column_value,
Status GetSecondaryValue(const Slice& primary_column_value,
const Slice& previous_column_value,
std::optional<std::variant<Slice, std::string>>*
secondary_value) const override {
Expand Down
Loading