29 This is a strong pledge of the promise of God. The sons of this David are the children of the Bridegroom; all Christians therefore are called His sons. But it is much indeed that God promises, that if Christians, that is, “If his children forsake My law, and walk not in My judgments”; “if they profane My statutes, and keep not My commandments”; I will not spurn them, nor will I send them away from Me in perdition: but what will I do? “I will visit their offenses with the rod, and their sin with scourges”.
It is not the mercy of one that calls them only; but also that chastises and scourges them. Let therefore your Father's hand be upon you, and if you are a good son, repel not chastening; for “what son is there, to whom his father gives not chastening?” Let Him chasten him, so long as He takes not from him His mercy: let Him beat him when obstinate, as long as He does not disinherit him. If you have well understood the promises of your Father, fear not to be scourged, but to be disinherited: “for whom the Lord loves He chastens: and scourges every son whom He receives.” Does the sinful son spurn chastening, when he sees the only Son without sin scourged?
“I will visit their offenses with the rod.” Thus too the Apostle threatens: “What will you? Shall I come unto you with a rod?” Let not pious sons say, if You are coming with a rod, come not at all. For it is better to be taught with the Father's rod, than to perish in the caresses of the robber.
Source: The Enarrations, or Expositions, on the Psalms (New Advent)