func (w *GCWorker) prepare() (bool, uint64, error) {
	now, err := w.getOracleTime()
	if err != nil {
		return false, 0, errors.Trace(err)
	}
	ok, err := w.checkGCInterval(now)
	if err != nil || !ok {
		return false, 0, errors.Trace(err)
	}
	newSafePoint, err := w.calculateNewSafePoint(now)
	if err != nil || newSafePoint == nil {
		return false, 0, errors.Trace(err)
	}
	err = w.saveTime(gcLastRunTimeKey, now)
	if err != nil {
		return false, 0, errors.Trace(err)
	}
	err = w.saveTime(gcSafePointKey, *newSafePoint)
	if err != nil {
		return false, 0, errors.Trace(err)
	}
	return true, oracle.ComposeTS(oracle.GetPhysical(*newSafePoint), 0), nil
}
// prepare checks required conditions for starting a GC job. It returns a bool
// that indicates whether the GC job should start and the new safePoint.
prepare checks required conditions for starting a GC job. It returns a bool
that indicates whether the GC job should start and the new safePoint.
// prepare checks required conditions for starting a GC job . It returns a bool // that indicates whether the GC job should start and the new safePoint .
func (w *GCWorker) prepare() (bool, uint64, error) {
	now, err := w.getOracleTime()
	if err != nil {
		return false, 0, errors.Trace(err)
	}
	ok, err := w.checkGCInterval(now)
	if err != nil || !ok {
		return false, 0, errors.Trace(err)
	}
	newSafePoint, err := w.calculateNewSafePoint(now)
	if err != nil || newSafePoint == nil {
		return false, 0, errors.Trace(err)
	}
	err = w.saveTime(gcLastRunTimeKey, now)
	if err != nil {
		return false, 0, errors.Trace(err)
	}
	err = w.saveTime(gcSafePointKey, *newSafePoint)
	if err != nil {
		return false, 0, errors.Trace(err)
	}
	return true, oracle.ComposeTS(oracle.GetPhysical(*newSafePoint), 0), nil
}
func ( w * GCWorker ) prepare ( ) ( bool , uint64 , error ) { now , err := w . getOracleTime ( ) if err != nil { return false , 0 , errors . Trace ( err ) } ok , err := w . checkGCInterval ( now ) if err != nil || ! ok { return false , 0 , errors . Trace ( err ) } newSafePoint , err := w . calculateNewSafePoint ( now ) if err != nil || newSafePoint == nil { return false , 0 , errors . Trace ( err ) } err = w . saveTime ( gcLastRunTimeKey , now ) if err != nil { return false , 0 , errors . Trace ( err ) } err = w . saveTime ( gcSafePointKey , * newSafePoint ) if err != nil { return false , 0 , errors . Trace ( err ) } return true , oracle . ComposeTS ( oracle . GetPhysical ( * newSafePoint ) , 0 ) , nil }
prepare checks required conditions for starting a GC job.
prepare checks required conditions for starting a GC job .