-
Notifications
You must be signed in to change notification settings - Fork 19
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
refactoring: Move insert_documents to execute ql #259
Conversation
eb43337
to
a82b13a
Compare
43e5e37
to
1f1d995
Compare
* Now insert_one and insert_many are part of the execute_ql * Now we have to wait on wal response for all mutable operations * For update and delete we don't wait (will be fixed soon) * Now when wal is off we correctly process on empty manager_wal_replicate * Remove waiting signal from disk on remove collection
1f1d995
to
4cc1e5b
Compare
load_count_answers_ = records.size(); | ||
void dispatcher_t::load_from_wal_result(components::session::session_id_t& session, std::vector<services::wal::record_t> in_records) { | ||
// TODO think what to do with records | ||
records_ = std::move(in_records); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kotbegemot @makeyavelly plz pay attention to this. We decided to add this with @makeyavelly because before we got it as non const reference
void dispatcher_t::load_from_wal_result(components::session::session_id_t& session, std::vector<services::wal::record_t>& in_records)
This potentially can lead to danling references.
@@ -195,96 +198,83 @@ namespace services::dispatcher { | |||
} | |||
|
|||
void dispatcher_t::execute_ql_finish(components::session::session_id_t& session, const result_t& result) { | |||
result_storage_[session] = result; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kotbegemot @makeyavelly I've added this to be able to unlock wrapper_dsipathcer
form wal_success
auto result = result_storage_[session];
actor_zeta::send(session_obj.address(), dispatcher_t::address(), handler_id(route::execute_ql_finish), session, result);
I don't know how effective is it.
void execute_ql(components::session::session_id_t& session, components::ql::ql_statement_t* ql, actor_zeta::address_t address); | ||
void execute_ql_finish(components::session::session_id_t& session, const components::result::result_t& result); | ||
void drop_collection_finish_from_disk(components::session::session_id_t& session, std::string& collection_name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This no longer need -> we don't wait response form disk
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done!
auto session_obj = find_session(session_to_address_, session); | ||
const bool is_from_wal = session_obj.address().get() == manager_wal_.get(); | ||
if(is_from_wal){ | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to clean session`s storage:
remove_session(session_to_address_, session);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure - session will be removed here, isn't it?
if (!check_load_from_wal(session)) {
actor_zeta::send(s.address(), dispatcher_t::address(), handler_id(route::execute_ql_finish), session, result);
remove_session(session_to_address_, session);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And looks like in this case one of the test is fail
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ottergon/integration/cpp/test/test_save_load.cpp:167: FAILED:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -64,7 +64,9 @@ namespace ottergon { | |||
auto doc = to_document(document); | |||
generate_document_id_if_not_exists(doc); | |||
auto session_tmp = ottergon::session_id_t(); | |||
auto result = ptr_->insert_one(session_tmp, database_, name_, doc); | |||
auto result_variant = ptr_->insert_one(session_tmp, database_, name_, doc); | |||
assert(result_variant.is_type<components::result::result_insert>() && "wrapper_collection::insert_one result error"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possible error_result_t
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How I should process it in this case? raise exception?
Added check
if(result_variant.is_error()){
debug(log_, "wrapper_collection::insert_one has result error while insert");
throw std::runtime_error("wrapper_collection::insert_one error_result");
}
@makeyavelly @makeyavelly PTAL
Main task Insert, delete and update should be part of execute_ql