- new_state = "released";
- rec->state = WREPL_STATE_RELEASED;
- rec->expire_time= service->config.tombstone_interval + now;
- modify_flags = 0;
+ if (rec->type != WREPL_TYPE_SGROUP || !propagate) {
+ new_state = "released";
+ rec->state = WREPL_STATE_RELEASED;
+ rec->expire_time= service->config.tombstone_interval + now;
+ modify_flags = 0;
+ modify_record = true;
+ break;
+ }
+ /* check if there's any replica address */
+ for (i=0;rec->addresses[i];i++) {
+ if (strcmp(rec->addresses[i]->wins_owner, local_owner) != 0) {
+ has_replicas = true;
+ rec->addresses[i]->expire_time= service->config.renew_interval + now;
+ }
+ }
+ if (has_replicas) {
+ /* if it has replica addresses propagate them */
+ new_state = "active(propagated)";
+ rec->state = WREPL_STATE_ACTIVE;
+ rec->expire_time= service->config.renew_interval + now;
+ modify_flags = WINSDB_FLAG_ALLOC_VERSION | WINSDB_FLAG_TAKE_OWNERSHIP;
+ modify_record = true;
+ break;
+ }
+ /*
+ * if it doesn't have replica addresses, make it a tombstone,
+ * so that the released owned addresses are propagated
+ */
+ new_state = "tombstone";
+ rec->state = WREPL_STATE_TOMBSTONE;
+ rec->expire_time= time(NULL) +
+ service->config.tombstone_interval +
+ service->config.tombstone_timeout;
+ modify_flags = WINSDB_FLAG_ALLOC_VERSION | WINSDB_FLAG_TAKE_OWNERSHIP;