You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently , RaftGroupMetadata class has a unique_ptr to a TableInfo object. The problem is that this object sometimes needs to be kept alive to avoid race conditions, so when an AlterTable or a remote bootstrap happens, a TableInfo objects is stored in a vector called old_tables just in case someone is referencing it through a raw pointer. We should redesign this to use shared_ptrs instead.
Another problem is that the RaftGroupMetadata class provides reference access to fields from the main's table TableInfo object, e.g. schema(), partition_schema(), so if we make the change described above, we also need to make sure that these methods don't return a const reference because by doing so, we won't increase the ref count of the TableInfo object, and the caller could end up with a dangling reference if the TableInfo object is suddenly destroyed. We should solve this by returning shared_ptrs to such fields from TableInfo. These fields could also be changed to be shared_ptrs, or we could construct these shared_ptrs on the fly by using the aliasing shared_ptr constructor:
template< class Y >
shared_ptr( const shared_ptr<Y>& r, element_type* ptr ) noexcept;
The text was updated successfully, but these errors were encountered:
…nfo objects in memory
Summary:
Currently , `RaftGroupMetadata` class has a unique_ptr to a TableInfo object.
The problem is that this object sometimes needs to be kept alive to avoid race
conditions, so when an AlterTable or a remote bootstrap happens, a TableInfo
objects is stored in a vector called `old_tables` just in case someone is
referencing it through a raw pointer. Changing this to use shared_ptrs instead.
Another problem is that the `RaftGroupMetadata` class provides reference
access to fields from the main's table TableInfo object, e.g. `schema()`,
`partition_schema()`, so if we make the change described above, we also need
to make sure that these methods don't return a const reference because by
doing so, we won't increase the ref count of the TableInfo object, and the caller
could end up with a dangling reference if the TableInfo object is suddenly destroyed.
Changing this to return a shared_ptr for such fields from `RaftGroupMetadata`.
Test Plan: Unit tests
Reviewers: timur, bogdan, sergei
Reviewed By: sergei
Subscribers: ybase
Differential Revision: https://phabricator.dev.yugabyte.com/D8403
Summary:
Access TableInfo object explicitly for any call that gets the IndexMap. This fixes ASAN issues created by https://detective-gcp.dev.yugabyte.com/D8403.
Test Plan: ybd asan --cxx-test integration-tests_cassandra_cpp_driver-test --gtest_filter CppCassandraDriverTest.TestTableCreateIndexUserEnforced -n 100
Reviewers: amitanand, sergei, bogdan
Reviewed By: sergei
Subscribers: ybase
Differential Revision: https://phabricator.dev.yugabyte.com/D8467
Currently ,
RaftGroupMetadata
class has a unique_ptr to a TableInfo object. The problem is that this object sometimes needs to be kept alive to avoid race conditions, so when an AlterTable or a remote bootstrap happens, a TableInfo objects is stored in a vector calledold_tables
just in case someone is referencing it through a raw pointer. We should redesign this to use shared_ptrs instead.Another problem is that the
RaftGroupMetadata
class provides reference access to fields from the main's table TableInfo object, e.g.schema()
,partition_schema()
, so if we make the change described above, we also need to make sure that these methods don't return a const reference because by doing so, we won't increase the ref count of the TableInfo object, and the caller could end up with a dangling reference if the TableInfo object is suddenly destroyed. We should solve this by returning shared_ptrs to such fields from TableInfo. These fields could also be changed to be shared_ptrs, or we could construct these shared_ptrs on the fly by using the aliasing shared_ptr constructor:The text was updated successfully, but these errors were encountered: