Skip to content
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
41 changes: 26 additions & 15 deletions storage/eloq/eloq_catalog_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -569,12 +569,8 @@ MariaCatalogFactory::CreateTableSchema(const txservice::TableName &table_name,
const std::string &catalog_image,
uint64_t version)
{
if (table_name == txservice::Sequences::table_name_)
{
DLOG(INFO) << "===create sequence table schema";
return std::make_unique<txservice::SequenceTableSchema>(
table_name, catalog_image, version);
}
assert(table_name.Engine() == txservice::TableEngine::EloqSql);

return std::make_unique<MysqlTableSchema>(table_name, catalog_image,
version);
}
Expand All @@ -584,13 +580,7 @@ txservice::CcMap::uptr MariaCatalogFactory::CreatePkCcMap(
const txservice::TableSchema *table_schema, bool ccm_has_full_entries,
txservice::CcShard *shard, txservice::NodeGroupId cc_ng_id)
{
if (table_name == txservice::Sequences::table_name_)
{
return std::make_unique<
txservice::TemplateCcMap<EloqKey, EloqRecord, true, true>>(
shard, cc_ng_id, table_name, table_schema->Version(), table_schema,
ccm_has_full_entries);
}
assert(table_name.Engine() == txservice::TableEngine::EloqSql);

uint64_t key_version= table_schema->KeySchema()->SchemaTs();
return std::make_unique<
Expand Down Expand Up @@ -722,13 +712,34 @@ MariaCatalogFactory::CreateTableStatistics(
table_schema, std::move(sample_pool_map), ccs, cc_ng_id);
}

txservice::TxKey MariaCatalogFactory::NegativeInfKey()
txservice::TxKey MariaCatalogFactory::NegativeInfKey() const
{
return txservice::TxKey(EloqKey::NegativeInfinity());
}

txservice::TxKey MariaCatalogFactory::PositiveInfKey()
txservice::TxKey MariaCatalogFactory::PositiveInfKey() const
{
return txservice::TxKey(EloqKey::PositiveInfinity());
}

txservice::TxKey MariaCatalogFactory::CreateTxKey() const
{
return txservice::TxKey(std::make_unique<EloqKey>());
}
txservice::TxKey MariaCatalogFactory::CreateTxKey(const char *data,
size_t size) const
{
return txservice::TxKey(
std::make_unique<EloqKey>(reinterpret_cast<const uchar *>(data), size));
}
const txservice::TxKey *MariaCatalogFactory::PackedNegativeInfinity() const
{
return EloqKey::PackedNegativeInfinityTxKey();
}
std::unique_ptr<txservice::TxRecord>
MariaCatalogFactory::CreateTxRecord() const
{
return std::make_unique<EloqRecord>();
}

} // namespace MyEloq
9 changes: 7 additions & 2 deletions storage/eloq/eloq_catalog_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,13 @@ class MariaCatalogFactory : public txservice::CatalogFactory
sample_pool_map,
txservice::CcShard *ccs, txservice::NodeGroupId cc_ng_id) override;

txservice::TxKey NegativeInfKey() override;
txservice::TxKey NegativeInfKey() const override;

txservice::TxKey PositiveInfKey() override;
txservice::TxKey PositiveInfKey() const override;

txservice::TxKey CreateTxKey() const override;
txservice::TxKey CreateTxKey(const char *data, size_t size) const override;
const txservice::TxKey *PackedNegativeInfinity() const override;
std::unique_ptr<txservice::TxRecord> CreateTxRecord() const override;
};
} // namespace MyEloq
21 changes: 2 additions & 19 deletions storage/eloq/ha_eloq.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2306,18 +2306,6 @@ static int eloq_init_abort()
DBUG_RETURN(1);
}

static void RegisterFactory()
{
txservice::TxKeyFactory::RegisterCreateTxKeyFunc(EloqKey::Create);
txservice::TxKeyFactory::RegisterCreateDefaultTxKeyFunc(
EloqKey::CreateDefault);
txservice::TxKeyFactory::RegisterNegInfTxKey(EloqKey::NegInfTxKey());
txservice::TxKeyFactory::RegisterPosInfTxKey(EloqKey::PosInfTxKey());
txservice::TxKeyFactory::RegisterPackedNegativeInfinity(
EloqKey::PackedNegativeInfinityTxKey());
txservice::TxRecordFactory::RegisterCreateTxRecordFunc(EloqRecord::Create);
}

#if defined(DATA_STORE_TYPE_ELOQDSS_ELOQSTORE)
/**
* Configure EloqStore settings for the data store service
Expand Down Expand Up @@ -2412,7 +2400,7 @@ static int eloq_init_func(void *p)

PrintEloqConfig();

RegisterFactory();
CatalogFactory *catalog_factory[3]{&maria_catalog_factory, nullptr, nullptr};

sql_print_information("Eloq initializing.");

Expand Down Expand Up @@ -2760,7 +2748,7 @@ static int eloq_init_func(void *p)
data_store_service_->ConnectDataStore(std::move(dss_shards_map));
// setup data store service client
storage_hd= std::make_unique<EloqDS::DataStoreServiceClient>(
ds_config, data_store_service_.get());
catalog_factory, ds_config, data_store_service_.get());

if (!storage_hd->Connect())
{
Expand Down Expand Up @@ -3218,8 +3206,6 @@ static int eloq_init_func(void *p)
tx_service_common_labels["node_port"]= std::to_string(mysqld_port);
tx_service_common_labels["node_id"]= std::to_string(node_id);

CatalogFactory *catalog_factory[3]{&maria_catalog_factory, nullptr,
nullptr};
tx_service= std::make_unique<TxService>(
catalog_factory, &MariaSystemHandler::Instance(), tx_service_conf,
node_id, native_ng_id, &ng_configs, cluster_config_version,
Expand All @@ -3238,9 +3224,6 @@ static int eloq_init_func(void *p)
}
else
{
// Sequence table will use the same catalog factory as elosql table.
CatalogFactory *catalog_factory[4]{&maria_catalog_factory, nullptr,
nullptr, &maria_catalog_factory};
tx_service= std::make_unique<TxService>(
catalog_factory, &MariaSystemHandler::Instance(), tx_service_conf,
node_id, native_ng_id, &ng_configs, cluster_config_version,
Expand Down
2 changes: 1 addition & 1 deletion storage/eloq/log_service
Submodule log_service updated 1 files
+1 −1 tx-log-protos