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