diff --git a/src/gausskernel/dbmind/kernel/hypopg_index.cpp b/src/gausskernel/dbmind/kernel/hypopg_index.cpp index 71b58f431..015d2ff28 100644 --- a/src/gausskernel/dbmind/kernel/hypopg_index.cpp +++ b/src/gausskernel/dbmind/kernel/hypopg_index.cpp @@ -127,6 +127,12 @@ void InitHypopg() } isExplain = false; } +/* +SQLAllocConnect() allocates a connection handle and associated resources within the +environment that is identified by the input environment handle. Call SQLGetInfo() with +fInfoType set to SQL_ACTIVE_CONNECTIONS to query the number of connections that +can be allocated at any one time. SQLAllocEnv() must be called before calling this function.*/ + /* Set_hypopg_prehook function: @@ -185,7 +191,18 @@ static Oid hypo_getNewOid(Oid relid) /* Open the relation on which we want a new OID */ relation = heap_open(relid, AccessShareLock); - + +/*In PostgreSQL, AccessShareLock is a lock type used to +control concurrent access to database objects. It is a read +lock that allows multiple transactions to read from the same +object at the same time, but it prevents concurrent transactions +from acquiring conflicting locks, such as write locks or exclusive locks. +When a transaction obtains AccessShareLock on an object, other +transactions can also obtain AccessShareLock on the same object. +This means that multiple transactions can read objects at the same +time without interfering with each other.*/ + + reltablespace = relation->rd_rel->reltablespace; relpersistence = relation->rd_rel->relpersistence; @@ -300,6 +317,7 @@ List *get_table_indexes(Oid oid) heap_close(rel, NoLock); return indexes; } +/*Read-only here will not cause deadlock, so use NoLock lock.*/ /* Return the names of all the columns involved in the index. */