Bug? After the service metadata is successfully updated using the endpoint /v1/txn, it will expire after tens of seconds

After using endpoint /v1/txn to update the service metadata successfully, after tens of seconds, the service metadata returns to the value before updating.The call result is successful, and the metadata of the service is indeed updated successfully through the endpoint /v1/health/service/{name} discovery, and the modifyindex is also updated. After tens of seconds, the metadata becomes the value before updating, and modifyindex is updated again.
Excuse me. Why?

consul version v1.6.9

ops := api.TxnOps{&api.TxnOp{
	Service: &api.ServiceTxnOp{
		Verb: api.ServiceCAS,
		Node: entry.Node.Node,
		Service: api.AgentService{
			Kind:              entry.Service.Kind,
			ID:                entry.Service.ID,
			Service:           entry.Service.Service,
			Tags:              entry.Service.Tags,
			Meta:              map[string]string{"key": "4"},
			Port:              entry.Service.Port,
			Address:           entry.Service.Address,
			TaggedAddresses:   entry.Service.TaggedAddresses,
			Weights:           entry.Service.Weights,
			EnableTagOverride: entry.Service.EnableTagOverride,
			ModifyIndex:       entry.Service.ModifyIndex,
			//CreateIndex:       entry.Service.CreateIndex,
			//ContentHash:       entry.Service.ContentHash,
			Proxy:   entry.Service.Proxy,
			Connect: entry.Service.Connect,
		},
	},
}}

ok, resp, _, err := consul.Txn().Txn(ops, &api.QueryOptions{})

When enable_tag_override is true, the tag of the service can avoid being synchronized to the old value, but other fields will still synchronize the old value.

Issues has been created in GitHub repository

Hi @xiepuhuan,

The behavior you are seeing is actually expected behavior. I provided a rather lengthy response on the GitHub issue as to why these changes are being reverted, and an alternate solution for you to consider. Please see the following comment on the issue for those additional details.