PostgreSQL Source Code: src/backend/utils/cache/relfilenumbermap.c Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

15

23#include "utils/fmgroids.h"

28

29

31

32

34

35typedef struct

36{

40

41typedef struct

42{

46

47

48

49

50

51static void

53{

56

57

59

62 {

63

64

65

66

67

68 if (relid == InvalidOid ||

70 entry->relid == relid)

71 {

73 &entry->key,

75 NULL) == NULL)

76 elog(ERROR, "hash table corrupted");

77 }

78 }

79}

80

81

82

83

84

85static void

87{

89 int i;

90

91

94

95

97

98 for (i = 0; i < 2; i++)

99 {

106 }

107

110

111

112

113

114

115

119

123

124

127}

128

129

130

131

132

133

134

137{

140 bool found;

144 Oid relid;

145

148

149

151 reltablespace = 0;

152

154 key.reltablespace = reltablespace;

155 key.relfilenumber = relfilenumber;

156

157

158

159

160

161

162

163

165

166 if (found)

167 return entry->relid;

168

169

170

171

173

174 if (reltablespace == GLOBALTABLESPACE_OID)

175 {

176

177

178

180 }

181 else

182 {

184

185

186

187

188

189

190

192

193

197

199 ClassTblspcRelfilenodeIndexId,

200 true,

201 NULL,

202 2,

203 skey);

204

205 found = false;

206

208 {

210

211 if (found)

213 "unexpected duplicate for tablespace %u, relfilenumber %u",

214 reltablespace, relfilenumber);

215 found = true;

216

217 Assert(classform->reltablespace == reltablespace);

218 Assert(classform->relfilenode == relfilenumber);

219 relid = classform->oid;

220 }

221

224

225

226 if (!found)

228 }

229

230

231

232

233

234

236 if (found)

237 elog(ERROR, "corrupted hashtable");

238 entry->relid = relid;

239

240 return relid;

241}

#define MemSet(start, val, len)

void CreateCacheMemoryContext(void)

void * hash_search(HTAB *hashp, const void *keyPtr, HASHACTION action, bool *foundPtr)

void * hash_seq_search(HASH_SEQ_STATUS *status)

HTAB * hash_create(const char *tabname, long nelem, const HASHCTL *info, int flags)

void hash_seq_init(HASH_SEQ_STATUS *status, HTAB *hashp)

void fmgr_info_cxt(Oid functionId, FmgrInfo *finfo, MemoryContext mcxt)

void systable_endscan(SysScanDesc sysscan)

HeapTuple systable_getnext(SysScanDesc sysscan)

SysScanDesc systable_beginscan(Relation heapRelation, Oid indexId, bool indexOK, Snapshot snapshot, int nkeys, ScanKey key)

Assert(PointerIsAligned(start, uint64))

#define HeapTupleIsValid(tuple)

static void * GETSTRUCT(const HeapTupleData *tuple)

void CacheRegisterRelcacheCallback(RelcacheCallbackFunction func, Datum arg)

MemoryContext CacheMemoryContext

FormData_pg_class * Form_pg_class

static Datum ObjectIdGetDatum(Oid X)

static ScanKeyData relfilenumber_skey[2]

static void RelfilenumberMapInvalidateCallback(Datum arg, Oid relid)

static void InitializeRelfilenumberMap(void)

static HTAB * RelfilenumberMapHash

Oid RelidByRelfilenumber(Oid reltablespace, RelFileNumber relfilenumber)

Oid RelationMapFilenumberToOid(RelFileNumber filenumber, bool shared)

#define BTEqualStrategyNumber

RelFileNumber relfilenumber

StrategyNumber sk_strategy

void table_close(Relation relation, LOCKMODE lockmode)

Relation table_open(Oid relationId, LOCKMODE lockmode)