| 230 | } |
| 231 | |
| 232 | static void Schema_ActivateExactMatchIndex |
| 233 | ( |
| 234 | Schema *s // schema to activate index on |
| 235 | ) { |
| 236 | Index active = ACTIVE_EXACTMATCH_IDX(s); |
| 237 | Index pending = PENDING_EXACTMATCH_IDX(s); |
| 238 | |
| 239 | ASSERT(Index_Enabled(pending) == true); |
| 240 | |
| 241 | // drop active if exists |
| 242 | if(active != NULL) { |
| 243 | Index_Free(active); |
| 244 | } |
| 245 | |
| 246 | // set pending index as active |
| 247 | ACTIVE_EXACTMATCH_IDX(s) = pending; |
| 248 | |
| 249 | // clear pending index |
| 250 | PENDING_EXACTMATCH_IDX(s) = NULL; |
| 251 | |
| 252 | //-------------------------------------------------------------------------- |
| 253 | // update unique constraint private data |
| 254 | //-------------------------------------------------------------------------- |
| 255 | |
| 256 | active = ACTIVE_EXACTMATCH_IDX(s); |
| 257 | |
| 258 | // uniqie constraint rely on exact-match indicies |
| 259 | // whenever such an index is updated |
| 260 | // we need to update the relevant uniqie constraint |
| 261 | uint n = array_len(s->constraints); |
| 262 | for(uint i = 0; i < n; i++) { |
| 263 | Constraint c = s->constraints[i]; |
| 264 | Constraint_SetPrivateData(c, active); |
| 265 | } |
| 266 | } |
| 267 | |
| 268 | static void Schema_ActivateFullTextIdx |
| 269 | ( |
no test coverage detected