コード例 #1
0
ファイル: tablename.py プロジェクト: arsen-movsesyan/pg-Mon
    def stat(self,in_time_id):
	if not super(TableName,self).stat(in_time_id):
	    logger.error("Return from TN.stat False from super.stat()")
	    return False
	idx_sets=self.get_dependants(False)
	if not idx_sets:
	    logger.info("TN.stat no ids_sets returned. Maybe no indexes present. Tabe {0}".format(self.db_fields['tbl_name']))
	    return True
	else:
	    for idx_set in idx_sets:
		idn=IndexName(self.db_conn,self.prod_dsn,idx_set)
		idn.set_prod_conn(self.prod_conn)
		if not idn.stat(in_time_id):
		    logger.error("TN.stat False from idn.stat")
	ttn_id=self.get_toast_id()
	if ttn_id:
	    ttn=TableToastName(self.db_conn,self.prod_dsn,ttn_id)
	    ttn.set_prod_conn(self.prod_conn)
	    if not ttn.stat(in_time_id):
		logger.error("TN.stat False from ttn.stat")
	    tin_id=ttn.get_tindex_id()
	    tin=IndexToastName(self.db_conn,self.prod_dsn,tin_id)
	    tin.set_prod_conn(self.prod_conn)
	    if not tin.stat(in_time_id):
		logger.error("TN.stat False from tin.stat")
	return True
コード例 #2
0
ファイル: stat.py プロジェクト: arsen-movsesyan/pg-Mon
	    for sn_id in dn.get_dependants(obs=True):
		sn=SchemaName(sn_id)
		sn.discover_tables(db_cursor)
		sn.discover_functions(db_cursor)
		for tbl_id in sn.get_tables():
		    tn=TableName(tbl_id)
		    tn.stat(lt.id,db_cursor)
		    tn.va_stat(lt.id,db_cursor)
		    tn.discover_indexes(db_cursor)
		    for ind_id in tn.get_dependants():
			ind=IndexName(ind_id)
			ind.stat(lt.id,db_cursor)
		    tn.discover_toast(db_cursor)
		    toast_id=tn.get_toast_id()
		    if toast_id:
			ttn=TableToastName(toast_id)
			ttn.stat(lt.id,db_cursor)
			ttn.discover_index(db_cursor)
			tin=IndexToastName(ttn.get_tindex_id())
			tin.stat(lt.id,db_cursor)
		if hc.get_track_function():
		    for fnc_id in sn.get_functions():
			func=FunctionName(fnc_id)
			func.stat(lt.id,db_cursor)
	if not db_cursor.closed:
	    db_cursor.close()

work_cursor.close()
database.db_conn.close()