|
19 | 19 | #include "rocksdb/options.h"
|
20 | 20 | #include "rocksdb/perf_context.h"
|
21 | 21 | #include "rocksdb/utilities/secondary_index.h"
|
| 22 | +#include "rocksdb/utilities/secondary_index_simple.h" |
22 | 23 | #include "rocksdb/utilities/transaction.h"
|
23 | 24 | #include "rocksdb/utilities/transaction_db.h"
|
24 | 25 | #include "table/mock_table.h"
|
@@ -8015,75 +8016,9 @@ TEST_P(TransactionTest, SecondaryIndexPutDelete) {
|
8015 | 8016 | return;
|
8016 | 8017 | }
|
8017 | 8018 |
|
8018 |
| - // A basic secondary index that indexes the default column. |
8019 |
| - class DefaultSecondaryIndex : public SecondaryIndex { |
8020 |
| - public: |
8021 |
| - void SetPrimaryColumnFamily(ColumnFamilyHandle* cfh) override { |
8022 |
| - primary_cfh_ = cfh; |
8023 |
| - } |
8024 |
| - |
8025 |
| - void SetSecondaryColumnFamily(ColumnFamilyHandle* cfh) override { |
8026 |
| - secondary_cfh_ = cfh; |
8027 |
| - } |
8028 |
| - |
8029 |
| - ColumnFamilyHandle* GetPrimaryColumnFamily() const override { |
8030 |
| - return primary_cfh_; |
8031 |
| - } |
8032 |
| - |
8033 |
| - ColumnFamilyHandle* GetSecondaryColumnFamily() const override { |
8034 |
| - return secondary_cfh_; |
8035 |
| - } |
8036 |
| - |
8037 |
| - Slice GetPrimaryColumnName() const override { |
8038 |
| - return kDefaultWideColumnName; |
8039 |
| - } |
8040 |
| - |
8041 |
| - Status UpdatePrimaryColumnValue( |
8042 |
| - const Slice& /* primary_key */, const Slice& /* primary_column_value */, |
8043 |
| - std::optional< |
8044 |
| - std::variant<Slice, std::string>>* /* updated_column_value */) |
8045 |
| - const override { |
8046 |
| - return Status::OK(); |
8047 |
| - } |
8048 |
| - |
8049 |
| - Status GetSecondaryKeyPrefix( |
8050 |
| - const Slice& /* primary_key */, const Slice& primary_column_value, |
8051 |
| - std::variant<Slice, std::string>* secondary_key_prefix) const override { |
8052 |
| - assert(secondary_key_prefix); |
8053 |
| - |
8054 |
| - *secondary_key_prefix = primary_column_value; |
8055 |
| - |
8056 |
| - return Status::OK(); |
8057 |
| - } |
8058 |
| - |
8059 |
| - Status FinalizeSecondaryKeyPrefix( |
8060 |
| - std::variant<Slice, std::string>* secondary_key_prefix) const override { |
8061 |
| - assert(secondary_key_prefix); |
8062 |
| - |
8063 |
| - std::string prefix; |
8064 |
| - PutLengthPrefixedSlice( |
8065 |
| - &prefix, SecondaryIndexHelper::AsSlice(*secondary_key_prefix)); |
8066 |
| - |
8067 |
| - *secondary_key_prefix = std::move(prefix); |
8068 |
| - |
8069 |
| - return Status::OK(); |
8070 |
| - } |
8071 |
| - |
8072 |
| - Status GetSecondaryValue(const Slice& /* primary_key */, |
8073 |
| - const Slice& /* primary_column_value */, |
8074 |
| - const Slice& /* previous_column_value */, |
8075 |
| - std::optional<std::variant<Slice, std::string>>* |
8076 |
| - /* secondary_value */) const override { |
8077 |
| - return Status::OK(); |
8078 |
| - } |
8079 |
| - |
8080 |
| - private: |
8081 |
| - ColumnFamilyHandle* primary_cfh_{}; |
8082 |
| - ColumnFamilyHandle* secondary_cfh_{}; |
8083 |
| - }; |
8084 |
| - |
8085 | 8019 | txn_db_options.secondary_indices.emplace_back(
|
8086 |
| - std::make_shared<DefaultSecondaryIndex>()); |
| 8020 | + std::make_shared<SimpleSecondaryIndex>( |
| 8021 | + kDefaultWideColumnName.ToString())); |
8087 | 8022 |
|
8088 | 8023 | ASSERT_OK(ReOpen());
|
8089 | 8024 |
|
|
0 commit comments