MCPcopy Create free account
hub / github.com/MariaDB/server / do_commit

Method do_commit

sql/vector_mhnsw.cc:761–808  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

759}
760
761int MHNSW_Trx::do_commit(THD *thd, bool all)
762{
763 if (!all && thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
764 return 0;
765
766 MHNSW_Trx *trx_next;
767 for (auto trx= static_cast<MHNSW_Trx*>(thd_get_ha_data(thd, &tp));
768 trx; trx= trx_next)
769 {
770 trx_next= trx->next;
771 if (trx->table_id)
772 {
773 const MDL_key *key= trx->table_id->get_key();
774 LEX_CSTRING db= {key->db_name(), key->db_name_length()},
775 tbl= {key->name(), key->name_length()};
776 TABLE_LIST tl;
777 tl.init_one_table(&db, &tbl, nullptr, TL_IGNORE);
778 TABLE_SHARE *share= tdc_acquire_share(thd, &tl, GTS_TABLE, nullptr);
779 if (share)
780 {
781 auto ctx= share->hlindex ? MHNSW_Share::get_from_share(share, nullptr)
782 : nullptr;
783 if (ctx)
784 {
785 mysql_rwlock_wrlock(&ctx->commit_lock);
786 ctx->version++;
787 if (trx->list_of_nodes_is_lost)
788 ctx->reset(share);
789 else
790 {
791 // consider copying nodes from trx to shared cache when it makes
792 // sense. for ann_benchmarks it does not.
793 // also, consider flushing only changed nodes (a flag in the node)
794 for (FVectorNode &from : trx->get_cache())
795 if (FVectorNode *node= ctx->find_node(from.gref()))
796 node->vec= nullptr;
797 ctx->start= nullptr;
798 }
799 ctx->release(true, share);
800 }
801 tdc_release_share(share);
802 }
803 }
804 trx->~MHNSW_Trx();
805 }
806 thd_set_ha_data(current_thd, &tp, nullptr);
807 return 0;
808}
809
810int MHNSW_Trx::do_prepare(THD *thd, bool)
811{

Callers

nothing calls this directly

Calls 15

thd_test_optionsFunction · 0.85
thd_get_ha_dataFunction · 0.85
tdc_acquire_shareFunction · 0.85
tdc_release_shareFunction · 0.85
thd_set_ha_dataFunction · 0.85
db_name_lengthMethod · 0.80
name_lengthMethod · 0.80
init_one_tableMethod · 0.80
find_nodeMethod · 0.80
grefMethod · 0.80
get_keyMethod · 0.45
db_nameMethod · 0.45

Tested by

no test coverage detected