private WriteEntry doWALAppend(WALEdit walEdit, BatchOperation<?> batchOp,
    MiniBatchOperationInProgress<Mutation> miniBatchOp, long now, NonceKey nonceKey)
    throws IOException {
    Preconditions.checkArgument(walEdit != null && !walEdit.isEmpty(), "WALEdit is null or empty!");
    Preconditions.checkArgument(
      !walEdit.isReplay() || batchOp.getOrigLogSeqNum() != SequenceId.NO_SEQUENCE_ID,
      "Invalid replay sequence Id for replay WALEdit!");

    WALKeyImpl walKey = createWALKeyForWALAppend(walEdit.isReplay(), batchOp, now,
      nonceKey.getNonceGroup(), nonceKey.getNonce());
    // don't call the coproc hook for writes to the WAL caused by
    // system lifecycle events like flushes or compactions
    if (this.coprocessorHost != null && !walEdit.isMetaEdit()) {
      this.coprocessorHost.preWALAppend(walKey, walEdit);
    }
    try {
      long txid = this.wal.appendData(this.getRegionInfo(), walKey, walEdit);
      WriteEntry writeEntry = walKey.getWriteEntry();
      // Call sync on our edit.
      if (txid != 0) {
        sync(txid, batchOp.durability);
      }
      /**
       * If above {@link HRegion#sync} throws Exception, the RegionServer should be aborted and
       * following {@link BatchOperation#writeMiniBatchOperationsToMemStore} will not be executed,
       * so there is no need to replicate to secondary replica, for this reason here we attach the
       * region replication action after the {@link HRegion#sync} is successful.
       */
      this.attachRegionReplicationInWALAppend(batchOp, miniBatchOp, walKey, walEdit, writeEntry);
      return writeEntry;
    } catch (IOException ioe) {
      if (walKey.getWriteEntry() != null) {
        mvcc.complete(walKey.getWriteEntry());
      }

      /**
       * If {@link WAL#sync} get a timeout exception, the only correct way is to abort the region
       * server, as the design of {@link WAL#sync}, is to succeed or die, there is no 'failure'. It
       * is usually not a big deal is because we set a very large default value(5 minutes) for
       * {@link AbstractFSWAL#WAL_SYNC_TIMEOUT_MS}, usually the WAL system will abort the region
       * server if it can not finish the sync within 5 minutes.
       */
      if (ioe instanceof WALSyncTimeoutIOException) {
        if (rsServices != null) {
          rsServices.abort("WAL sync timeout,forcing server shutdown", ioe);
        }
      }
      throw ioe;
    }
  }
Returns writeEntry associated with this append
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java