Replace empty strings with std::nullopt
This commit is contained in:
parent
6db081395c
commit
f84cdbd4fa
@ -680,8 +680,9 @@ void EncodeTransactionEnd(BaseEncoder *encoder, uint64_t timestamp) {
|
||||
}
|
||||
|
||||
void EncodeOperation(BaseEncoder *encoder, NameIdMapper *name_id_mapper, StorageMetadataOperation operation,
|
||||
const std::string &text_index_name, LabelId label, const std::set<PropertyId> &properties,
|
||||
const LabelIndexStats &stats, const LabelPropertyIndexStats &property_stats, uint64_t timestamp) {
|
||||
const std::optional<std::string> text_index_name, LabelId label,
|
||||
const std::set<PropertyId> &properties, const LabelIndexStats &stats,
|
||||
const LabelPropertyIndexStats &property_stats, uint64_t timestamp) {
|
||||
encoder->WriteMarker(Marker::SECTION_DELTA);
|
||||
encoder->WriteUint(timestamp);
|
||||
switch (operation) {
|
||||
@ -734,8 +735,9 @@ void EncodeOperation(BaseEncoder *encoder, NameIdMapper *name_id_mapper, Storage
|
||||
}
|
||||
case StorageMetadataOperation::TEXT_INDEX_CREATE:
|
||||
case StorageMetadataOperation::TEXT_INDEX_DROP: {
|
||||
MG_ASSERT(text_index_name.has_value(), "Text indices must be named!");
|
||||
encoder->WriteMarker(OperationToMarker(operation));
|
||||
encoder->WriteString(text_index_name);
|
||||
encoder->WriteString(text_index_name.value());
|
||||
encoder->WriteString(name_id_mapper->IdToName(label.AsUint()));
|
||||
break;
|
||||
}
|
||||
@ -1131,8 +1133,8 @@ void WalFile::AppendTransactionEnd(uint64_t timestamp) {
|
||||
UpdateStats(timestamp);
|
||||
}
|
||||
|
||||
void WalFile::AppendOperation(StorageMetadataOperation operation, const std::string &text_index_name, LabelId label,
|
||||
const std::set<PropertyId> &properties, const LabelIndexStats &stats,
|
||||
void WalFile::AppendOperation(StorageMetadataOperation operation, const std::optional<std::string> text_index_name,
|
||||
LabelId label, const std::set<PropertyId> &properties, const LabelIndexStats &stats,
|
||||
const LabelPropertyIndexStats &property_stats, uint64_t timestamp) {
|
||||
EncodeOperation(&wal_, name_id_mapper_, operation, text_index_name, label, properties, stats, property_stats,
|
||||
timestamp);
|
||||
|
@ -214,8 +214,9 @@ void EncodeTransactionEnd(BaseEncoder *encoder, uint64_t timestamp);
|
||||
|
||||
/// Function used to encode non-transactional operation.
|
||||
void EncodeOperation(BaseEncoder *encoder, NameIdMapper *name_id_mapper, StorageMetadataOperation operation,
|
||||
const std::string &text_index_name, LabelId label, const std::set<PropertyId> &properties,
|
||||
const LabelIndexStats &stats, const LabelPropertyIndexStats &property_stats, uint64_t timestamp);
|
||||
const std::optional<std::string> text_index_name, LabelId label,
|
||||
const std::set<PropertyId> &properties, const LabelIndexStats &stats,
|
||||
const LabelPropertyIndexStats &property_stats, uint64_t timestamp);
|
||||
|
||||
/// Function used to load the WAL data into the storage.
|
||||
/// @throw RecoveryFailure
|
||||
@ -246,8 +247,8 @@ class WalFile {
|
||||
|
||||
void AppendTransactionEnd(uint64_t timestamp);
|
||||
|
||||
void AppendOperation(StorageMetadataOperation operation, const std::string &text_index_name, LabelId label,
|
||||
const std::set<PropertyId> &properties, const LabelIndexStats &stats,
|
||||
void AppendOperation(StorageMetadataOperation operation, const std::optional<std::string> text_index_name,
|
||||
LabelId label, const std::set<PropertyId> &properties, const LabelIndexStats &stats,
|
||||
const LabelPropertyIndexStats &property_stats, uint64_t timestamp);
|
||||
|
||||
void Sync();
|
||||
|
@ -2099,7 +2099,7 @@ bool InMemoryStorage::AppendToWal(const Transaction &transaction, uint64_t final
|
||||
}
|
||||
|
||||
void InMemoryStorage::AppendToWalDataDefinition(durability::StorageMetadataOperation operation,
|
||||
const std::string &text_index_name, LabelId label,
|
||||
const std::optional<std::string> text_index_name, LabelId label,
|
||||
const std::set<PropertyId> &properties, LabelIndexStats stats,
|
||||
LabelPropertyIndexStats property_stats,
|
||||
uint64_t final_commit_timestamp) {
|
||||
@ -2112,12 +2112,13 @@ void InMemoryStorage::AppendToWalDataDefinition(durability::StorageMetadataOpera
|
||||
const std::set<PropertyId> &properties,
|
||||
LabelPropertyIndexStats property_stats,
|
||||
uint64_t final_commit_timestamp) {
|
||||
return AppendToWalDataDefinition(operation, "", label, properties, {}, property_stats, final_commit_timestamp);
|
||||
return AppendToWalDataDefinition(operation, std::nullopt, label, properties, {}, property_stats,
|
||||
final_commit_timestamp);
|
||||
}
|
||||
|
||||
void InMemoryStorage::AppendToWalDataDefinition(durability::StorageMetadataOperation operation, LabelId label,
|
||||
LabelIndexStats stats, uint64_t final_commit_timestamp) {
|
||||
return AppendToWalDataDefinition(operation, "", label, {}, stats, {}, final_commit_timestamp);
|
||||
return AppendToWalDataDefinition(operation, std::nullopt, label, {}, stats, {}, final_commit_timestamp);
|
||||
}
|
||||
|
||||
void InMemoryStorage::AppendToWalDataDefinition(durability::StorageMetadataOperation operation, LabelId label,
|
||||
@ -2132,9 +2133,9 @@ void InMemoryStorage::AppendToWalDataDefinition(durability::StorageMetadataOpera
|
||||
}
|
||||
|
||||
void InMemoryStorage::AppendToWalDataDefinition(durability::StorageMetadataOperation operation,
|
||||
const std::string &index_name, LabelId label,
|
||||
const std::optional<std::string> text_index_name, LabelId label,
|
||||
uint64_t final_commit_timestamp) {
|
||||
return AppendToWalDataDefinition(operation, index_name, label, {}, {}, {}, final_commit_timestamp);
|
||||
return AppendToWalDataDefinition(operation, text_index_name, label, {}, {}, {}, final_commit_timestamp);
|
||||
}
|
||||
|
||||
utils::BasicResult<InMemoryStorage::CreateSnapshotError> InMemoryStorage::CreateSnapshot(
|
||||
|
@ -389,12 +389,14 @@ class InMemoryStorage final : public Storage {
|
||||
const std::set<PropertyId> &properties, LabelPropertyIndexStats property_stats,
|
||||
uint64_t final_commit_timestamp);
|
||||
/// Return true in all cases except if any sync replicas have not sent confirmation.
|
||||
void AppendToWalDataDefinition(durability::StorageMetadataOperation operation, const std::string &text_index_name,
|
||||
LabelId label, const std::set<PropertyId> &properties, LabelIndexStats stats,
|
||||
void AppendToWalDataDefinition(durability::StorageMetadataOperation operation,
|
||||
const std::optional<std::string> text_index_name, LabelId label,
|
||||
const std::set<PropertyId> &properties, LabelIndexStats stats,
|
||||
LabelPropertyIndexStats property_stats, uint64_t final_commit_timestamp);
|
||||
/// Return true in all cases except if any sync replicas have not sent confirmation.
|
||||
void AppendToWalDataDefinition(durability::StorageMetadataOperation operation, const std::string &index_name,
|
||||
LabelId label, uint64_t final_commit_timestamp);
|
||||
void AppendToWalDataDefinition(durability::StorageMetadataOperation operation,
|
||||
const std::optional<std::string> text_index_name, LabelId label,
|
||||
uint64_t final_commit_timestamp);
|
||||
|
||||
uint64_t CommitTimestamp(std::optional<uint64_t> desired_commit_timestamp = {});
|
||||
|
||||
|
@ -357,8 +357,8 @@ void ReplicaStream::AppendOperation(durability::StorageMetadataOperation operati
|
||||
const LabelPropertyIndexStats &property_stats, uint64_t timestamp) {
|
||||
replication::Encoder encoder(stream_.GetBuilder());
|
||||
// NOTE: Text search doesn’t have replication in scope yet (Phases 1 and 2) -> text index name not sent here
|
||||
EncodeOperation(&encoder, storage_->name_id_mapper_.get(), operation, "", label, properties, stats, property_stats,
|
||||
timestamp);
|
||||
EncodeOperation(&encoder, storage_->name_id_mapper_.get(), operation, std::nullopt, label, properties, stats,
|
||||
property_stats, timestamp);
|
||||
}
|
||||
|
||||
replication::AppendDeltasRes ReplicaStream::Finalize() { return stream_.AwaitResponse(); }
|
||||
|
@ -252,7 +252,7 @@ class DeltaGenerator final {
|
||||
ASSERT_TRUE(false) << "Unexpected statistics operation!";
|
||||
}
|
||||
}
|
||||
wal_file_.AppendOperation(operation, label_id, property_ids, l_stats, lp_stats, timestamp_);
|
||||
wal_file_.AppendOperation(operation, std::nullopt, label_id, property_ids, l_stats, lp_stats, timestamp_);
|
||||
if (valid_) {
|
||||
UpdateStats(timestamp_, 1);
|
||||
memgraph::storage::durability::WalDeltaData data;
|
||||
|
Loading…
Reference in New Issue
Block a user