From 66b05d1215e9ac341252d74cc182de82edc75638 Mon Sep 17 00:00:00 2001 From: openGaussDev Date: Fri, 4 Mar 2022 11:00:45 +0800 Subject: [PATCH] Global SysCache MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Offering: openGaussDev More detail: lsc内存控制 # Conflicts: # src/test/regress/expected/gsc_func.out Match-id-675c5cad1d601f1e7ca9e318fe82367c9626f4e8 --- .../utils/cache/knl_localsysdbcache.cpp | 63 ++++++++----- .../utils/cache/knl_localsystupcache.cpp | 19 ++-- src/include/utils/knl_localsyscache_common.h | 10 ++ src/include/utils/knl_localsysdbcache.h | 3 +- src/test/regress/expected/gsc_func.out | 92 +++++++++---------- 5 files changed, 109 insertions(+), 78 deletions(-) diff --git a/src/common/backend/utils/cache/knl_localsysdbcache.cpp b/src/common/backend/utils/cache/knl_localsysdbcache.cpp index 11dfb0037..71c956b4d 100644 --- a/src/common/backend/utils/cache/knl_localsysdbcache.cpp +++ b/src/common/backend/utils/cache/knl_localsysdbcache.cpp @@ -593,7 +593,6 @@ void LocalSysDBCache::LocalSysDBCacheClearMyDB(Oid db_id, const char *db_name) MemoryContextResetAndDeleteChildren(lsc_mydb_memcxt); is_inited = false; - other_space = ((AllocSet)lsc_top_memcxt)->totalSpace + ((AllocSet)lsc_share_memcxt)->totalSpace; rel_index_rule_space = 0; } @@ -622,29 +621,26 @@ void LocalSysDBCache::LocalSysDBCacheReSet() UnRegisterRelCacheCallBack(&inval_cxt, RelfilenodeMapInvalidateCallback); UnRegisterSysCacheCallBack(&inval_cxt, TABLESPACEOID, InvalidateTableSpaceCacheCallback); - MemoryContextResetAndDeleteChildren(lsc_mydb_memcxt); - MemoryContextResetAndDeleteChildren(lsc_share_memcxt); + MemoryContextDelete(lsc_mydb_memcxt); + MemoryContextDelete(lsc_share_memcxt); + lsc_share_memcxt = + AllocSetContextCreate(lsc_top_memcxt, "LocalSysCacheShareMemoryContext", ALLOCSET_DEFAULT_MINSIZE, + ALLOCSET_DEFAULT_INITSIZE, ALLOCSET_DEFAULT_MAXSIZE, STANDARD_CONTEXT); + + lsc_mydb_memcxt = + AllocSetContextCreate(lsc_top_memcxt, "LocalSysCacheMyDBMemoryContext", ALLOCSET_DEFAULT_MINSIZE, + ALLOCSET_DEFAULT_INITSIZE, ALLOCSET_DEFAULT_MAXSIZE, STANDARD_CONTEXT); MemoryContext old = MemoryContextSwitchTo(lsc_share_memcxt); knl_u_relmap_init(&relmap_cxt); MemoryContextSwitchTo(old); - other_space = ((AllocSet)lsc_top_memcxt)->totalSpace + ((AllocSet)lsc_share_memcxt)->totalSpace; rel_index_rule_space = 0; is_inited = false; is_closed = false; is_lsc_catbucket_created = false; } -static bool LSCMemroyOverflow(uint64 total_space) -{ - const uint32 kb_bit_double = 10; - if (unlikely(total_space < ((uint64)g_instance.attr.attr_memory.local_syscache_threshold << kb_bit_double))) { - return false; - } - return true; -} - bool LocalSysDBCache::LocalSysDBCacheNeedReBuild() { /* we have recovered from startup, redo may dont tell us inval msgs, so discard all lsc */ @@ -655,15 +651,21 @@ bool LocalSysDBCache::LocalSysDBCacheNeedReBuild() return true; } - /* it seems only fmgr_info_cxt has no resowner to avoid mem leak. - * we assum 1kb memory leaked once */ + /* we assum 1kb memory leaked once */ if (unlikely(abort_count > (uint64)g_instance.attr.attr_memory.local_syscache_threshold)) { return true; } - uint64 total_space = other_space + AllocSetContextUsedSpace((AllocSet)lsc_mydb_memcxt) + - AllocSetContextUsedSpace((AllocSet)u_sess->cache_mem_cxt) + rel_index_rule_space; - return LSCMemroyOverflow(total_space); + uint64 total_space = + ((AllocSet)lsc_top_memcxt)->totalSpace + + ((AllocSet)lsc_share_memcxt)->totalSpace + + ((AllocSet)lsc_mydb_memcxt)->totalSpace + + ((AllocSet)u_sess->cache_mem_cxt)->totalSpace + + rel_index_rule_space; + + uint64 memory_upper_limit = ((uint64)g_instance.attr.attr_memory.local_syscache_threshold) << 10; + + return total_space * (1 - MAX_LSC_FREESIZE_RATIO) > memory_upper_limit; } /* rebuild cache on memcxt of mydb or share, call it only before initsyscache */ @@ -693,8 +695,23 @@ void LocalSysDBCache::LocalSysDBCacheReBuild() bool LocalSysDBCache::LocalSysDBCacheNeedSwapOut() { - uint64 total_space = other_space + rel_index_rule_space + ((AllocSet)lsc_mydb_memcxt)->totalSpace; - return LSCMemroyOverflow(total_space); + uint64 used_space = + AllocSetContextUsedSpace((AllocSet)lsc_top_memcxt) + + AllocSetContextUsedSpace((AllocSet)lsc_share_memcxt) + + AllocSetContextUsedSpace((AllocSet)lsc_mydb_memcxt) + + AllocSetContextUsedSpace((AllocSet)u_sess->cache_mem_cxt) + + rel_index_rule_space; + uint64 memory_upper_limit = + (((uint64)g_instance.attr.attr_memory.local_syscache_threshold) << 10) * cur_swapout_ratio; + bool need_swapout = used_space > memory_upper_limit; + + /* swapout until memory used space is from MAX_LSC_SWAPOUT_RATIO=90% to MIN_LSC_SWAPOUT_RATIO=70% */ + if (unlikely(need_swapout && cur_swapout_ratio == MAX_LSC_SWAPOUT_RATIO)) { + cur_swapout_ratio = MIN_LSC_SWAPOUT_RATIO; + } else if (unlikely(!need_swapout && cur_swapout_ratio == MIN_LSC_SWAPOUT_RATIO)) { + cur_swapout_ratio = MAX_LSC_SWAPOUT_RATIO; + } + return need_swapout; } void LocalSysDBCache::CloseLocalSysDBCache() @@ -717,7 +734,6 @@ void LocalSysDBCache::ClearSysCacheIfNecessary(Oid db_id, const char *db_name) if (unlikely(!is_inited)) { return; } - other_space = ((AllocSet)lsc_top_memcxt)->totalSpace + ((AllocSet)lsc_share_memcxt)->totalSpace; /* rebuild if memory gt double of threshold */ if (unlikely(LocalSysDBCacheNeedReBuild())) { recovery_finished = g_instance.global_sysdbcache.recovery_finished; @@ -769,7 +785,6 @@ void LocalSysDBCache::CreateDBObject() knl_u_relmap_init(&relmap_cxt); MemoryContextSwitchTo(old); m_shared_global_db = g_instance.global_sysdbcache.GetSharedGSCEntry(); - other_space = ((AllocSet)lsc_top_memcxt)->totalSpace + ((AllocSet)lsc_share_memcxt)->totalSpace; rel_index_rule_space = 0; is_lsc_catbucket_created = false; } @@ -782,9 +797,9 @@ void LocalSysDBCache::CreateCatBucket() MemoryContext old = MemoryContextSwitchTo(lsc_share_memcxt); systabcache.CreateCatBuckets(); MemoryContextSwitchTo(old); - other_space = ((AllocSet)lsc_top_memcxt)->totalSpace + ((AllocSet)lsc_share_memcxt)->totalSpace; rel_index_rule_space = 0; is_lsc_catbucket_created = true; + cur_swapout_ratio = MAX_LSC_SWAPOUT_RATIO; } void LocalSysDBCache::SetDatabaseName(const char *db_name) @@ -953,6 +968,8 @@ LocalSysDBCache::LocalSysDBCache() got_pool_reload = false; m_shared_global_db = NULL; + cur_swapout_ratio = MAX_LSC_SWAPOUT_RATIO; + is_lsc_catbucket_created = false; is_closed = false; is_inited = false; diff --git a/src/common/backend/utils/cache/knl_localsystupcache.cpp b/src/common/backend/utils/cache/knl_localsystupcache.cpp index ddf196099..132aefc30 100644 --- a/src/common/backend/utils/cache/knl_localsystupcache.cpp +++ b/src/common/backend/utils/cache/knl_localsystupcache.cpp @@ -356,7 +356,7 @@ void LocalSysTupCache::InitPhase2Impl() { Assert(m_is_inited); Assert(!m_is_inited_phase2); - Assert(m_db_id == InvalidOid); + /* CacheIdGetGlobalSysTupCache maybe fail when memory fault */ Assert(m_global_systupcache == NULL); /* for now we even dont know which db to connect */ if (m_relinfo.cc_relisshared) { @@ -509,7 +509,7 @@ LocalCatCTup *LocalSysTupCache::SearchTupleInternal(int nkeys, Datum v1, Datum v /* if not found, search from global cache */ if (unlikely(!found)) { ct = SearchTupleFromGlobal(arguments, hash_value, hash_index, level); - if (ct == NULL) { + if (unlikely(ct == NULL)) { return NULL; } } @@ -529,8 +529,10 @@ LocalCatCTup *LocalSysTupCache::SearchTupleInternal(int nkeys, Datum v1, Datum v cc_neg_hits++; ct = NULL; } + if (unlikely(!found)) { + RemoveTailTupleElements(hash_index); + } - RemoveTailTupleElements(hash_index); return ct; } @@ -665,15 +667,16 @@ LocalCatCList *LocalSysTupCache::SearchListInternal(int nkeys, Datum v1, Datum v CACHE2_elog(DEBUG2, "SearchLocalCatCacheList(%s): found list", m_relinfo.cc_relname); cc_lhits++; found = true; + ResourceOwnerRememberLocalCatCList(LOCAL_SYSDB_RESOWNER, cl); break; } if (unlikely(!found)) { cl = SearchListFromGlobal(nkeys, arguments, hash_value, level); + ResourceOwnerRememberLocalCatCList(LOCAL_SYSDB_RESOWNER, cl); + RemoveTailListElements(); } - ResourceOwnerRememberLocalCatCList(LOCAL_SYSDB_RESOWNER, cl); - RemoveTailListElements(); return cl; } @@ -817,12 +820,14 @@ LocalCatCTup *LocalSysTupCache::SearchLocalCatCTupleForProcAllArgs( */ if (likely(ct->global_ct != NULL)) { CACHE3_elog(DEBUG2, "SearchLocalCatCache(%s): found in bucket %d", m_relinfo.cc_relname, hash_index); + ResourceOwnerEnlargeLocalCatCTup(LOCAL_SYSDB_RESOWNER); ct->refcount++; cc_hits++; ResourceOwnerRememberLocalCatCTup(LOCAL_SYSDB_RESOWNER, ct); } - - RemoveTailTupleElements(hash_index); + if (unlikely(!found)) { + RemoveTailTupleElements(hash_index); + } pfree_ext(argModes); return ct; diff --git a/src/include/utils/knl_localsyscache_common.h b/src/include/utils/knl_localsyscache_common.h index 55f58071a..6421d3410 100644 --- a/src/include/utils/knl_localsyscache_common.h +++ b/src/include/utils/knl_localsyscache_common.h @@ -136,4 +136,14 @@ struct InvalidBaseEntry { void StreamTxnContextSaveInvalidMsg(void *stc); void StreamTxnContextRestoreInvalidMsg(void *stc); #define EnableLocalSysCache() t_thrd.lsc_cxt.enable_lsc + +/* + * if MAX_LSC_SWAPOUT_RATIO is 0.9, MAX_LSC_FREESIZE_RATIO is 0.8 + * used_space <= threshold * 0.9 < threshold ==> max_used_space = threshold * 0.8 + * total_space > threshold >= total_space * 0.9 ==> max_total_space = threshold / 0.8 + * so max_used_space = max_total_space * 0.72 + * this means 72% memory can be used at the worst sence */ +const double MAX_LSC_FREESIZE_RATIO = 0.2; +const double MAX_LSC_SWAPOUT_RATIO = 0.9; +const double MIN_LSC_SWAPOUT_RATIO = 0.7; #endif \ No newline at end of file diff --git a/src/include/utils/knl_localsysdbcache.h b/src/include/utils/knl_localsysdbcache.h index 590fa74c1..97719c775 100644 --- a/src/include/utils/knl_localsysdbcache.h +++ b/src/include/utils/knl_localsysdbcache.h @@ -214,8 +214,6 @@ public: bool is_closed; /* mark pgxcpoolreload flag, flush relcache's locatorinfo->nodelist */ bool got_pool_reload; - /* record other palloc on lsc */ - int64 other_space; /* record rel's index and rule cxt */ int64 rel_index_rule_space; /* record abort count, which may cause memory leak @@ -223,6 +221,7 @@ public: uint64 abort_count; /* record concurrent rd locks on syscache */ GSCRdLockInfo rdlock_info; + double cur_swapout_ratio; private: void Init(); void CreateCatBucket(); diff --git a/src/test/regress/expected/gsc_func.out b/src/test/regress/expected/gsc_func.out index 63a77c650..2e9de64c2 100644 --- a/src/test/regress/expected/gsc_func.out +++ b/src/test/regress/expected/gsc_func.out @@ -1,24 +1,24 @@ select * from gs_gsc_dbstat_info() limit 1; - database_id | database_name | tup_searches | tup_hits | tup_miss | tup_count | tup_dead | tup_memory | rel_searches | rel_hits | rel_miss | rel_count | rel_dead | rel_memory | part_searches | part_hits | part_miss | part_count | part_dead | part_memory | total_memory | swapout_count | refcount --------------+---------------+--------------+----------+----------+-----------+----------+------------+--------------+----------+----------+-----------+----------+------------+---------------+-----------+-----------+------------+-----------+-------------+--------------+---------------+---------- +--?.* database_id | database_name | tup_searches | tup_hits | tup_miss | tup_count | tup_dead | tup_memory | rel_searches | rel_hits | rel_miss | rel_count | rel_dead | rel_memory | part_searches | part_hits | part_miss | part_count | part_dead | part_memory | total_memory | swapout_count | refcount +--?.*-------------+---------------+--------------+----------+----------+-----------+----------+------------+--------------+----------+----------+-----------+----------+------------+---------------+-----------+-----------+------------+-----------+-------------+--------------+---------------+---------- --?.* 0 | | 40 | 23 | 9 | 7 | 0 | 3760 | 143 | 2 | 25 | 25 | 0 | 106656 | 0 | 0 | 0 | 0 | 0 | 0 | 405848 | 0 | 0 (1 row) select * from gs_gsc_dbstat_info(-1) limit 1; - database_id | database_name | tup_searches | tup_hits | tup_miss | tup_count | tup_dead | tup_memory | rel_searches | rel_hits | rel_miss | rel_count | rel_dead | rel_memory | part_searches | part_hits | part_miss | part_count | part_dead | part_memory | total_memory | swapout_count | refcount --------------+---------------+--------------+----------+----------+-----------+----------+------------+--------------+----------+----------+-----------+----------+------------+---------------+-----------+-----------+------------+-----------+-------------+--------------+---------------+---------- +--?.* database_id | database_name | tup_searches | tup_hits | tup_miss | tup_count | tup_dead | tup_memory | rel_searches | rel_hits | rel_miss | rel_count | rel_dead | rel_memory | part_searches | part_hits | part_miss | part_count | part_dead | part_memory | total_memory | swapout_count | refcount +--?.*-------------+---------------+--------------+----------+----------+-----------+----------+------------+--------------+----------+----------+-----------+----------+------------+---------------+-----------+-----------+------------+-----------+-------------+--------------+---------------+---------- --?.* 0 | | 40 | 23 | 9 | 7 | 0 | 3760 | 143 | 2 | 25 | 25 | 0 | 106656 | 0 | 0 | 0 | 0 | 0 | 0 | 405848 | 0 | 0 (1 row) select * from gs_gsc_dbstat_info(0) limit 1; - database_id | database_name | tup_searches | tup_hits | tup_miss | tup_count | tup_dead | tup_memory | rel_searches | rel_hits | rel_miss | rel_count | rel_dead | rel_memory | part_searches | part_hits | part_miss | part_count | part_dead | part_memory | total_memory | swapout_count | refcount --------------+---------------+--------------+----------+----------+-----------+----------+------------+--------------+----------+----------+-----------+----------+------------+---------------+-----------+-----------+------------+-----------+-------------+--------------+---------------+---------- +--?.* database_id | database_name | tup_searches | tup_hits | tup_miss | tup_count | tup_dead | tup_memory | rel_searches | rel_hits | rel_miss | rel_count | rel_dead | rel_memory | part_searches | part_hits | part_miss | part_count | part_dead | part_memory | total_memory | swapout_count | refcount +--?.*-------------+---------------+--------------+----------+----------+-----------+----------+------------+--------------+----------+----------+-----------+----------+------------+---------------+-----------+-----------+------------+-----------+-------------+--------------+---------------+---------- --?.* 0 | | 40 | 23 | 9 | 7 | 0 | 3760 | 143 | 2 | 25 | 25 | 0 | 106656 | 0 | 0 | 0 | 0 | 0 | 0 | 405848 | 0 | 0 (1 row) select * from gs_gsc_dbstat_info(1) limit 1; - database_id | database_name | tup_searches | tup_hits | tup_miss | tup_count | tup_dead | tup_memory | rel_searches | rel_hits | rel_miss | rel_count | rel_dead | rel_memory | part_searches | part_hits | part_miss | part_count | part_dead | part_memory | total_memory | swapout_count | refcount --------------+---------------+--------------+----------+----------+-----------+----------+------------+--------------+----------+----------+-----------+----------+------------+---------------+-----------+-----------+------------+-----------+-------------+--------------+---------------+---------- +--?.* database_id | database_name | tup_searches | tup_hits | tup_miss | tup_count | tup_dead | tup_memory | rel_searches | rel_hits | rel_miss | rel_count | rel_dead | rel_memory | part_searches | part_hits | part_miss | part_count | part_dead | part_memory | total_memory | swapout_count | refcount +--?.*-------------+---------------+--------------+----------+----------+-----------+----------+------------+--------------+----------+----------+-----------+----------+------------+---------------+-----------+-----------+------------+-----------+-------------+--------------+---------------+---------- --?.* 0 | | 40 | 23 | 9 | 7 | 0 | 3760 | 143 | 2 | 25 | 25 | 0 | 106656 | 0 | 0 | 0 | 0 | 0 | 0 | 405848 | 0 | 0 (1 row) @@ -26,121 +26,121 @@ select * from gs_gsc_dbstat_info(2) limit 1; ERROR: dbOid doesn't exist. DETAIL: dbOid is invalid, please pass valid dbOid. select * from gs_gsc_catalog_detail() limit 1; - database_id | database_name | rel_id | rel_name | cache_id | self | ctid | infomask | infomask2 | hash_value | refcount --------------+---------------+--------+-----------+----------+--------+--------+----------+-----------+------------+---------- +--?.* database_id | database_name | rel_id | rel_name | cache_id | self | ctid | infomask | infomask2 | hash_value | refcount +--?.*-------------+---------------+--------+-----------+----------+--------+--------+----------+-----------+------------+---------- --?.* 0 | | 1260 | pg_authid | 10 | (0, 9) | (0, 9) | 10507 | 26 | 531311568 | 9 (1 row) select * from gs_gsc_catalog_detail(-1) limit 1; - database_id | database_name | rel_id | rel_name | cache_id | self | ctid | infomask | infomask2 | hash_value | refcount --------------+---------------+--------+-----------+----------+--------+--------+----------+-----------+------------+---------- +--?.* database_id | database_name | rel_id | rel_name | cache_id | self | ctid | infomask | infomask2 | hash_value | refcount +--?.*-------------+---------------+--------+-----------+----------+--------+--------+----------+-----------+------------+---------- --?.* 0 | | 1260 | pg_authid | 10 | (0, 9) | (0, 9) | 10507 | 26 | 531311568 | 9 (1 row) select * from gs_gsc_catalog_detail(0) limit 1; - database_id | database_name | rel_id | rel_name | cache_id | self | ctid | infomask | infomask2 | hash_value | refcount --------------+---------------+--------+-----------+----------+--------+--------+----------+-----------+------------+---------- +--?.* database_id | database_name | rel_id | rel_name | cache_id | self | ctid | infomask | infomask2 | hash_value | refcount +--?.*-------------+---------------+--------+-----------+----------+--------+--------+----------+-----------+------------+---------- --?.* 0 | | 1260 | pg_authid | 10 | (0, 9) | (0, 9) | 10507 | 26 | 531311568 | 9 (1 row) select * from gs_gsc_catalog_detail(1) limit 1; - database_id | database_name | rel_id | rel_name | cache_id | self | ctid | infomask | infomask2 | hash_value | refcount --------------+---------------+--------+-----------+----------+--------+--------+----------+-----------+------------+---------- +--?.* database_id | database_name | rel_id | rel_name | cache_id | self | ctid | infomask | infomask2 | hash_value | refcount +--?.*-------------+---------------+--------+-----------+----------+--------+--------+----------+-----------+------------+---------- --?.* 0 | | 1260 | pg_authid | 10 | (0, 9) | (0, 9) | 10507 | 26 | 531311568 | 9 (1 row) select * from gs_gsc_catalog_detail(-1, 1262) limit 1; - database_id | database_name | rel_id | rel_name | cache_id | self | ctid | infomask | infomask2 | hash_value | refcount --------------+---------------+--------+-------------+----------+--------+--------+----------+-----------+------------+---------- +--?.* database_id | database_name | rel_id | rel_name | cache_id | self | ctid | infomask | infomask2 | hash_value | refcount +--?.*-------------+---------------+--------+-------------+----------+--------+--------+----------+-----------+------------+---------- --?.* 0 | | 1262 | pg_database | 27 | (0, 4) | (0, 4) | 10506 | 15 | 361410604 | 1 (1 row) select * from gs_gsc_catalog_detail(0, 1262) limit 1; - database_id | database_name | rel_id | rel_name | cache_id | self | ctid | infomask | infomask2 | hash_value | refcount --------------+---------------+--------+-------------+----------+--------+--------+----------+-----------+------------+---------- +--?.* database_id | database_name | rel_id | rel_name | cache_id | self | ctid | infomask | infomask2 | hash_value | refcount +--?.*-------------+---------------+--------+-------------+----------+--------+--------+----------+-----------+------------+---------- --?.* 0 | | 1262 | pg_database | 27 | (0, 4) | (0, 4) | 10506 | 15 | 361410604 | 1 (1 row) select * from gs_gsc_catalog_detail(1, 1262) limit 1; - database_id | database_name | rel_id | rel_name | cache_id | self | ctid | infomask | infomask2 | hash_value | refcount --------------+---------------+--------+-------------+----------+--------+--------+----------+-----------+------------+---------- +--?.* database_id | database_name | rel_id | rel_name | cache_id | self | ctid | infomask | infomask2 | hash_value | refcount +--?.*-------------+---------------+--------+-------------+----------+--------+--------+----------+-----------+------------+---------- --?.* 0 | | 1262 | pg_database | 27 | (0, 4) | (0, 4) | 10506 | 15 | 361410604 | 1 (1 row) select * from gs_gsc_catalog_detail(-1, 1259) limit 1; ---?.* database_id | database_name | rel_id | rel_name | cache_id | self | ctid | infomask | infomask2 | hash_value | refcount ---?.*-------------+---------------+--------+----------+----------+---------+---------+----------+-----------+------------+---------- +--?.* database_id | database_name | rel_id | rel_name | cache_id | self | ctid | infomask | infomask2 | hash_value | refcount +--?.*-------------+---------------+--------+----------+----------+--------+--------+----------+-----------+------------+---------- --?.* 16299 | postgres | 1259 | pg_class | 84 | (7, 3) | (7, 3) | 10507 | 40 | 1520565747 | 0 (1 row) select * from gs_gsc_catalog_detail(0, 1259) limit 1; - database_id | database_name | rel_id | rel_name | cache_id | self | ctid | infomask | infomask2 | hash_value | refcount --------------+---------------+--------+----------+----------+------+------+----------+-----------+------------+---------- +--?.* database_id | database_name | rel_id | rel_name | cache_id | self | ctid | infomask | infomask2 | hash_value | refcount +--?.*-------------+---------------+--------+----------+----------+------+------+----------+-----------+------------+---------- (0 rows) select * from gs_gsc_catalog_detail(1, 1259) limit 1; - database_id | database_name | rel_id | rel_name | cache_id | self | ctid | infomask | infomask2 | hash_value | refcount --------------+---------------+--------+----------+----------+------+------+----------+-----------+------------+---------- +--?.* database_id | database_name | rel_id | rel_name | cache_id | self | ctid | infomask | infomask2 | hash_value | refcount +--?.*-------------+---------------+--------+----------+----------+------+------+----------+-----------+------------+---------- (0 rows) select * from gs_gsc_catalog_detail(2, 1259) limit 1; ERROR: dbOid doesn't exist. DETAIL: dbOid is invalid, please pass valid dbOid. select * from gs_gsc_table_detail() limit 1; - database_oid | database_name | reloid | relname | relnamespace | reltype | reloftype | relowner | relam | relfilenode | reltablespace | relhasindex | relisshared | relkind | relnatts | relhasoids | relhaspkey | parttype | tdhasuids | attnames | extinfo ---------------+---------------+--------+-------------------------+--------------+---------+-----------+----------+-------+-------------+---------------+-------------+-------------+---------+----------+------------+------------+----------+-----------+-----------+--------- +--?.* database_oid | database_name | reloid | relname | relnamespace | reltype | reloftype | relowner | relam | relfilenode | reltablespace | relhasindex | relisshared | relkind | relnatts | relhasoids | relhaspkey | parttype | tdhasuids | attnames | extinfo +--?.*--------------+---------------+--------+-------------------------+--------------+---------+-----------+----------+-------+-------------+---------------+-------------+-------------+---------+----------+------------+------------+----------+-----------+-----------+--------- --?.* 0 | | 2676 | pg_authid_rolname_index | 11 | 0 | 0 | 10 | 403 | 0 | 1664 | f | t | i | 1 | f | f | n | f | 'rolname' | (1 row) select * from gs_gsc_table_detail(-1) limit 1; - database_oid | database_name | reloid | relname | relnamespace | reltype | reloftype | relowner | relam | relfilenode | reltablespace | relhasindex | relisshared | relkind | relnatts | relhasoids | relhaspkey | parttype | tdhasuids | attnames | extinfo ---------------+---------------+--------+-------------------------+--------------+---------+-----------+----------+-------+-------------+---------------+-------------+-------------+---------+----------+------------+------------+----------+-----------+-----------+--------- +--?.* database_oid | database_name | reloid | relname | relnamespace | reltype | reloftype | relowner | relam | relfilenode | reltablespace | relhasindex | relisshared | relkind | relnatts | relhasoids | relhaspkey | parttype | tdhasuids | attnames | extinfo +--?.*--------------+---------------+--------+-------------------------+--------------+---------+-----------+----------+-------+-------------+---------------+-------------+-------------+---------+----------+------------+------------+----------+-----------+-----------+--------- --?.* 0 | | 2676 | pg_authid_rolname_index | 11 | 0 | 0 | 10 | 403 | 0 | 1664 | f | t | i | 1 | f | f | n | f | 'rolname' | (1 row) select * from gs_gsc_table_detail(0) limit 1; - database_oid | database_name | reloid | relname | relnamespace | reltype | reloftype | relowner | relam | relfilenode | reltablespace | relhasindex | relisshared | relkind | relnatts | relhasoids | relhaspkey | parttype | tdhasuids | attnames | extinfo ---------------+---------------+--------+-------------------------+--------------+---------+-----------+----------+-------+-------------+---------------+-------------+-------------+---------+----------+------------+------------+----------+-----------+-----------+--------- +--?.* database_oid | database_name | reloid | relname | relnamespace | reltype | reloftype | relowner | relam | relfilenode | reltablespace | relhasindex | relisshared | relkind | relnatts | relhasoids | relhaspkey | parttype | tdhasuids | attnames | extinfo +--?.*--------------+---------------+--------+-------------------------+--------------+---------+-----------+----------+-------+-------------+---------------+-------------+-------------+---------+----------+------------+------------+----------+-----------+-----------+--------- --?.* 0 | | 2676 | pg_authid_rolname_index | 11 | 0 | 0 | 10 | 403 | 0 | 1664 | f | t | i | 1 | f | f | n | f | 'rolname' | (1 row) select * from gs_gsc_table_detail(1) limit 1; - database_oid | database_name | reloid | relname | relnamespace | reltype | reloftype | relowner | relam | relfilenode | reltablespace | relhasindex | relisshared | relkind | relnatts | relhasoids | relhaspkey | parttype | tdhasuids | attnames | extinfo ---------------+---------------+--------+-------------------------+--------------+---------+-----------+----------+-------+-------------+---------------+-------------+-------------+---------+----------+------------+------------+----------+-----------+-----------+--------- +--?.* database_oid | database_name | reloid | relname | relnamespace | reltype | reloftype | relowner | relam | relfilenode | reltablespace | relhasindex | relisshared | relkind | relnatts | relhasoids | relhaspkey | parttype | tdhasuids | attnames | extinfo +--?.*--------------+---------------+--------+-------------------------+--------------+---------+-----------+----------+-------+-------------+---------------+-------------+-------------+---------+----------+------------+------------+----------+-----------+-----------+--------- --?.* 0 | | 2676 | pg_authid_rolname_index | 11 | 0 | 0 | 10 | 403 | 0 | 1664 | f | t | i | 1 | f | f | n | f | 'rolname' | (1 row) select * from gs_gsc_table_detail(-1, 1262) limit 1; - database_oid | database_name | reloid | relname | relnamespace | reltype | reloftype | relowner | relam | relfilenode | reltablespace | relhasindex | relisshared | relkind | relnatts | relhasoids | relhaspkey | parttype | tdhasuids | attnames | extinfo ---------------+---------------+--------+-------------+--------------+---------+-----------+----------+-------+-------------+---------------+-------------+-------------+---------+----------+------------+------------+----------+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------- +--?.* database_oid | database_name | reloid | relname | relnamespace | reltype | reloftype | relowner | relam | relfilenode | reltablespace | relhasindex | relisshared | relkind | relnatts | relhasoids | relhaspkey | parttype | tdhasuids | attnames | extinfo +--?.*--------------+---------------+--------+-------------+--------------+---------+-----------+----------+-------+-------------+---------------+-------------+-------------+---------+----------+------------+------------+----------+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------- --?.* 0 | | 1262 | pg_database | 11 | 1248 | 0 | 10 | 0 | 0 | 1664 | t | t | r | 15 | t | f | n | f | 'datname','datdba','encoding','datcollate','datctype','datistemplate','datallowconn','datconnlimit','datlastsysoid','datfrozenxid','dattablespace','datcompatibility','datacl','datfrozenxid64','datminmxid' | (1 row) select * from gs_gsc_table_detail(0, 1262) limit 1; - database_oid | database_name | reloid | relname | relnamespace | reltype | reloftype | relowner | relam | relfilenode | reltablespace | relhasindex | relisshared | relkind | relnatts | relhasoids | relhaspkey | parttype | tdhasuids | attnames | extinfo ---------------+---------------+--------+-------------+--------------+---------+-----------+----------+-------+-------------+---------------+-------------+-------------+---------+----------+------------+------------+----------+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------- +--?.* database_oid | database_name | reloid | relname | relnamespace | reltype | reloftype | relowner | relam | relfilenode | reltablespace | relhasindex | relisshared | relkind | relnatts | relhasoids | relhaspkey | parttype | tdhasuids | attnames | extinfo +--?.*--------------+---------------+--------+-------------+--------------+---------+-----------+----------+-------+-------------+---------------+-------------+-------------+---------+----------+------------+------------+----------+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------- --?.* 0 | | 1262 | pg_database | 11 | 1248 | 0 | 10 | 0 | 0 | 1664 | t | t | r | 15 | t | f | n | f | 'datname','datdba','encoding','datcollate','datctype','datistemplate','datallowconn','datconnlimit','datlastsysoid','datfrozenxid','dattablespace','datcompatibility','datacl','datfrozenxid64','datminmxid' | (1 row) select * from gs_gsc_table_detail(1, 1262) limit 1; - database_oid | database_name | reloid | relname | relnamespace | reltype | reloftype | relowner | relam | relfilenode | reltablespace | relhasindex | relisshared | relkind | relnatts | relhasoids | relhaspkey | parttype | tdhasuids | attnames | extinfo ---------------+---------------+--------+-------------+--------------+---------+-----------+----------+-------+-------------+---------------+-------------+-------------+---------+----------+------------+------------+----------+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------- +--?.* database_oid | database_name | reloid | relname | relnamespace | reltype | reloftype | relowner | relam | relfilenode | reltablespace | relhasindex | relisshared | relkind | relnatts | relhasoids | relhaspkey | parttype | tdhasuids | attnames | extinfo +--?.*--------------+---------------+--------+-------------+--------------+---------+-----------+----------+-------+-------------+---------------+-------------+-------------+---------+----------+------------+------------+----------+-----------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------- --?.* 0 | | 1262 | pg_database | 11 | 1248 | 0 | 10 | 0 | 0 | 1664 | t | t | r | 15 | t | f | n | f | 'datname','datdba','encoding','datcollate','datctype','datistemplate','datallowconn','datconnlimit','datlastsysoid','datfrozenxid','dattablespace','datcompatibility','datacl','datfrozenxid64','datminmxid' | (1 row) select * from gs_gsc_table_detail(-1, 1259) limit 1; - database_oid | database_name | reloid | relname | relnamespace | reltype | reloftype | relowner | relam | relfilenode | reltablespace | relhasindex | relisshared | relkind | relnatts | relhasoids | relhaspkey | parttype | tdhasuids | attnames | extinfo ---------------+---------------+--------+----------+--------------+---------+-----------+----------+-------+-------------+---------------+-------------+-------------+---------+----------+------------+------------+----------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------- +--?.* database_oid | database_name | reloid | relname | relnamespace | reltype | reloftype | relowner | relam | relfilenode | reltablespace | relhasindex | relisshared | relkind | relnatts | relhasoids | relhaspkey | parttype | tdhasuids | attnames | extinfo +--?.*--------------+---------------+--------+----------+--------------+---------+-----------+----------+-------+-------------+---------------+-------------+-------------+---------+----------+------------+------------+----------+-----------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+--------- --?.* 16384 | regression | 1259 | pg_class | 11 | 83 | 0 | 10 | 0 | 0 | 0 | t | f | r | 40 | t | f | n | f | 'relname','relnamespace','reltype','reloftype','relowner','relam','relfilenode','reltablespace','relpages','reltuples','relallvisible','reltoastrelid','reltoastidxid','reldeltarelid','reldeltaidx','relcudescrelid','relcudescidx','relhasindex','relisshared','relpersistence','relkind','relnatts','relchecks','relhasoids','relhaspkey','relhasrules','relhastriggers','relhassubclass','relcmprs','relhasclusterkey','relrowmovement','parttype','relfrozenxid','relacl','reloptions','relreplident','relfrozenxid64','relbucket','relbucketkey','relminmxid' | (1 row) select * from gs_gsc_table_detail(0, 1259) limit 1; - database_oid | database_name | reloid | relname | relnamespace | reltype | reloftype | relowner | relam | relfilenode | reltablespace | relhasindex | relisshared | relkind | relnatts | relhasoids | relhaspkey | parttype | tdhasuids | attnames | extinfo +--?.* database_oid | database_name | reloid | relname | relnamespace | reltype | reloftype | relowner | relam | relfilenode | reltablespace | relhasindex | relisshared | relkind | relnatts | relhasoids | relhaspkey | parttype | tdhasuids | attnames | extinfo --------------+---------------+--------+---------+--------------+---------+-----------+----------+-------+-------------+---------------+-------------+-------------+---------+----------+------------+------------+----------+-----------+----------+--------- (0 rows) select * from gs_gsc_table_detail(1, 1259) limit 1; - database_oid | database_name | reloid | relname | relnamespace | reltype | reloftype | relowner | relam | relfilenode | reltablespace | relhasindex | relisshared | relkind | relnatts | relhasoids | relhaspkey | parttype | tdhasuids | attnames | extinfo +--?.* database_oid | database_name | reloid | relname | relnamespace | reltype | reloftype | relowner | relam | relfilenode | reltablespace | relhasindex | relisshared | relkind | relnatts | relhasoids | relhaspkey | parttype | tdhasuids | attnames | extinfo --------------+---------------+--------+---------+--------------+---------+-----------+----------+-------+-------------+---------------+-------------+-------------+---------+----------+------------+------------+----------+-----------+----------+--------- (0 rows)