It compensates for the voltage drop across the upper diode.
In theory the voltage at the inverting input should be the same as the voltage across Ro.
The output of the op amp being one diode drop higher than both.
Without the extra diode the output voltage from the peak detector is a diode forward voltage drop (0.65V) less than the peak input voltage. If the diodes match then the output voltage is the same as the input peak voltage.
Here's an improved peak detector circuit. It has the diode inside the feedback loop, so the forward diode drop is reduced by the open-loop gain (which generally reduces it to a few µV),
Diode D2 is to just keep the op amp from saturating in the negative direction (and slowing its response) when the input voltage is below the peak voltage.
No.
Due to the high open-loop gain of the op amp, the voltage at c will be whatever it takes to make the voltage at b equal to the voltage at a.
Thus the voltage at c will be one diode drop higher than the voltage at a so that the voltage at d equals the voltage at e, b, and a.
The means e (Vo) equals the peak voltage of the input.
No.
If D2 were forward biased when the peak voltage is being measured then the voltages a and b would not be equal, would they?
D2 only conducts when the input is below the peak voltage and the output of A1 starts to go negative.
This closes the feedback loop around A1 and prevents it from going into reverse (negative) saturation.
So the negative feedback loop is through D1 when it is tracking the peak positive voltage and through D2 when the input voltage is below the peak voltage stored in C.
You need to think about how negative feedback works with op amps.
An op amp will generate whatever output voltage is needed (within its saturation limits) to keep the (-) input voltage essentially equal to the (+) input voltage.
Any solution that has the two inputs at a different voltage is an incorrect solution.
You can check the same circuit in Fundamentals of microelectronics by Razavi Chapter 8
He is discussing the peak detector the first stage you are using.