In The Sign of Three, both of John’s love interests give him a code word or phrase. His reaction to each of them is very different.
When John realizes that, ‘Beth’, is calling Mary, his reaction is literally the most pissed off he’s ever looked on the show. He is so annoyed, he literally looks at the camera like he’s on the Office and just holds that look. This is how bothered he is. As far as we can tell Mary is being adorable and inventive and he looks positively fed up with her. He then does a deep sigh and seems to have to will himself to get up from his chair. As he enters the kitchen he avoids eye contact and then forces a fake smile; he turns it on like a light, it’s totally synthetic. He’s trying really hard to be nice, there, despite finding this situation really annoying.
When Sherlock says his code phrase, John immediately becomes alert and gets ready to help. He is all in. Whatever Sherlock needs he is doing. He even stands to offer his services. This is so natural to John, to be there when Sherlock needs. This is John in his element.
Now, while in the story we can say that Sherlock’s code is of life or death importance whereas Mary’s is just a trivial, wedding playing related matter, the point is that we have this parallel about codes words. His response to a fairly easy issue with Mary is to be more annoyed than he’s ever looked and his response to Sherlock is that he’s ready to immediately do anything for him.
By the beginning of HLV we can see that John’s marriage is in trouble, for sure. But, even here, before the wedding, I think that we see him being way too annoyed with Mary. At this point in the story she’s done nothing but be cute and supportive, we have no reason to think that John would be this annoyed with her. John is sending us clues as to his unhappiness with Mary even before it becomes really obvious.