Atomically update the new slots configuration. */
| 1390 | |
| 1391 | /* Atomically update the new slots configuration. */ |
| 1392 | static void updateClusterSlotsConfiguration() { |
| 1393 | pthread_mutex_lock(&config.is_updating_slots_mutex); |
| 1394 | atomicSet(config.is_updating_slots, 1); |
| 1395 | int i; |
| 1396 | for (i = 0; i < config.cluster_node_count; i++) { |
| 1397 | clusterNode *node = config.cluster_nodes[i]; |
| 1398 | if (node->updated_slots != NULL) { |
| 1399 | int *oldslots = node->slots; |
| 1400 | node->slots = node->updated_slots; |
| 1401 | node->slots_count = node->updated_slots_count; |
| 1402 | node->current_slot_index = 0; |
| 1403 | node->updated_slots = NULL; |
| 1404 | node->updated_slots_count = 0; |
| 1405 | zfree(oldslots); |
| 1406 | } |
| 1407 | } |
| 1408 | atomicSet(config.is_updating_slots, 0); |
| 1409 | atomicIncr(config.slots_last_update, 1); |
| 1410 | pthread_mutex_unlock(&config.is_updating_slots_mutex); |
| 1411 | } |
| 1412 | |
| 1413 | /* Generate random data for redis benchmark. See #7196. */ |
| 1414 | static void genBenchmarkRandomData(char *data, int count) { |
no test coverage detected