| 174 | } |
| 175 | |
| 176 | void |
| 177 | probeWalRepUpdateConfig(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, |
no test coverage detected