code: func compact(ctx context.Context, client *clientv3.Client, t, rev int64) (int64, int64, error) {
  	resp, err := client.KV.Txn(ctx).If(
  		clientv3.Compare(clientv3.Version(compactRevKey), "=", t),
  	).Then(
  		clientv3.OpPut(compactRevKey, strconv.FormatInt(rev, 10)), // Expect side effect: increment Version
  	).Else(
  		clientv3.OpGet(compactRevKey),
  	).Commit()
  	if err != nil {
  		return t, rev, err
  	}
  
  	curRev := resp.Header.Revision
  
  	if !resp.Succeeded {
  		curTime := resp.Responses[0].GetResponseRange().Kvs[0].Version
  		return curTime, curRev, nil
  	}
  	curTime := t + 1
  
  	if rev == 0 {
  		// We don't compact on bootstrap.
  		return curTime, curRev, nil
  	}
  	if _, err = client.Compact(ctx, rev); err != nil {
  		return curTime, curRev, err
  	}
  	klog.V(4).Infof("etcd: compacted rev (%d), endpoints (%v)", rev, client.Endpoints())
  	return curTime, curRev, nil
  }
docs: // compact compacts etcd store and returns current rev.
  // It will return the current compact time and global revision if no error occurred.
  // Note that CAS fail will not incur any error.