private void updateStatus(CompactionInfo ci) throws MetaException {
    String strState = CompactionState.fromSqlConst(ci.state).toString();

    LOG.debug("Marking as {}: CompactionInfo: {}", strState, ci);
    CompactionInfo ciActual = jdbcResource.execute(new GetCompactionInfoHandler(ci.id, false)); 

    long endTime = getDbTime().getTime();
    if (ciActual != null) {
      //preserve errorMessage and state
      ciActual.errorMessage = ci.errorMessage;
      ciActual.state = ci.state;

      jdbcResource.execute("DELETE FROM \"COMPACTION_QUEUE\" WHERE \"CQ_ID\" = :id",
          new MapSqlParameterSource("id", ci.id), null);
    } else {
      if (ci.id > 0) {
        //the record with valid CQ_ID has disappeared - this is a sign of something wrong
        throw new IllegalStateException("No record with CQ_ID=" + ci.id + " found in COMPACTION_QUEUE");
      }
      ciActual = ci;
    }
    if (ciActual.id == 0) {
      //The failure occurred before we even made an entry in COMPACTION_QUEUE
      //generate ID so that we can make an entry in COMPLETED_COMPACTIONS
      ciActual.id = new GenerateCompactionQueueIdFunction().execute(jdbcResource);
      //this is not strictly accurate, but 'type' cannot be null.
      if (ciActual.type == null) {
        ciActual.type = CompactionType.MINOR;
      }
      //in case of creating a new entry start and end time will be the same
      ciActual.start = endTime;
      LOG.debug("The failure occurred before we even made an entry in COMPACTION_QUEUE. Generated ID so that we "
          + "can make an entry in COMPLETED_COMPACTIONS. New Id: {}", ciActual.id);
    }

    jdbcResource.execute(new InsertCompactionInfoCommand(ciActual, endTime));
  }
Returns {@code true} if there already exists sufficient number of consecutive failures for
this table/partition so that no new automatic compactions will be scheduled.
User initiated compactions don't do this check.
Do we allow compacting whole table (when it's partitioned)?  No, though perhaps we should.
That would be a meta operations, i.e. first find all partitions for this table (which have
txn info) and schedule each compaction separately.  This avoids complications in this logic.
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/txn/CompactionTxnHandler.java