MCPcopy Create free account
hub / github.com/apache/cloudberry / probeWalRepUpdateConfig

Function probeWalRepUpdateConfig

src/backend/fts/fts.c:176–277  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

174}
175
176void
177probeWalRepUpdateConfig(int16 dbid, int16 segindex, char role,
178 bool IsSegmentAlive, bool IsInSync)
179{
180 AssertImply(IsInSync, IsSegmentAlive);
181
182 /*
183 * Insert new tuple into gp_configuration_history catalog.
184 */
185 {
186 Relation histrel;
187 HeapTuple histtuple;
188 Datum histvals[Natts_gp_configuration_history];
189 bool histnulls[Natts_gp_configuration_history] = { false };
190 char desc[SQL_CMD_BUF_SIZE];
191
192 histrel = table_open(GpConfigHistoryRelationId,
193 RowExclusiveLock);
194
195 histvals[Anum_gp_configuration_history_time-1] =
196 TimestampTzGetDatum(GetCurrentTimestamp());
197 histvals[Anum_gp_configuration_history_dbid-1] =
198 Int16GetDatum(dbid);
199 snprintf(desc, sizeof(desc),
200 "FTS: update role, status, and mode for dbid %d with contentid %d to %c, %c, and %c",
201 dbid, segindex, role,
202 IsSegmentAlive ? GP_SEGMENT_CONFIGURATION_STATUS_UP :
203 GP_SEGMENT_CONFIGURATION_STATUS_DOWN,
204 IsInSync ? GP_SEGMENT_CONFIGURATION_MODE_INSYNC :
205 GP_SEGMENT_CONFIGURATION_MODE_NOTINSYNC
206 );
207 histvals[Anum_gp_configuration_history_desc-1] =
208 CStringGetTextDatum(desc);
209 histtuple = heap_form_tuple(RelationGetDescr(histrel), histvals, histnulls);
210 CatalogTupleInsert(histrel, histtuple);
211
212 SIMPLE_FAULT_INJECTOR("fts_update_config");
213
214 table_close(histrel, RowExclusiveLock);
215 }
216
217 /*
218 * Find and update gp_segment_configuration tuple.
219 */
220 {
221 Relation configrel;
222
223 HeapTuple configtuple;
224 HeapTuple newtuple;
225
226 Datum configvals[Natts_gp_segment_configuration];
227 bool confignulls[Natts_gp_segment_configuration] = { false };
228 bool repls[Natts_gp_segment_configuration] = { false };
229
230 ScanKeyData scankey[2];
231 SysScanDesc sscan;
232
233 configrel = table_open(GpSegmentConfigRelationId,

Callers 1

updateConfigurationFunction · 0.85

Calls 15

table_openFunction · 0.85
GetCurrentTimestampFunction · 0.85
Int16GetDatumFunction · 0.85
heap_form_tupleFunction · 0.85
CatalogTupleInsertFunction · 0.85
table_closeFunction · 0.85
ScanKeyInitFunction · 0.85
ObjectIdGetDatumFunction · 0.85
GetCurrentWarehouseIdFunction · 0.85
systable_beginscanFunction · 0.85
systable_getnextFunction · 0.85
CharGetDatumFunction · 0.85

Tested by

no test coverage detected