/** Return key for given object: {workDateDbFormatted}.{startTime24Hour}.{endTime24Hour} */
 private String key(Object o) {
   JournalEntry entry = (JournalEntry) o;
   return entry.getWorkDateDbFormatted()
       + "."
       + entry.getStartTime24Hour()
       + "."
       + entry.getEndTime24Hour();
 }
 @Override
 public void setValueAt(Object object, int row, int col) {
   JournalEntry entry = journals.get(row);
   if (col == 0) {
     entry.name = (String) object;
   } else {
     entry.abbreviation = (String) object;
   }
 }
예제 #3
0
  @Override
  public boolean rollback(final Server server, final RegionServerServices services, User user)
      throws IOException {
    this.server = server;
    this.rsServices = services;
    // Coprocessor callback
    if (this.parent.getCoprocessorHost() != null) {
      this.parent.getCoprocessorHost().preRollBackSplit(user);
    }

    boolean result = true;
    ListIterator<JournalEntry> iterator = this.journal.listIterator(this.journal.size());
    // Iterate in reverse.
    while (iterator.hasPrevious()) {
      JournalEntry je = iterator.previous();

      transition(je.getPhase(), true);

      switch (je.getPhase()) {
        case SET_SPLITTING:
          if (services != null
              && !services.reportRegionStateTransition(
                  TransitionCode.SPLIT_REVERTED, parent.getRegionInfo(), hri_a, hri_b)) {
            return false;
          }
          break;

        case CREATE_SPLIT_DIR:
          this.parent.writestate.writesEnabled = true;
          this.parent.getRegionFileSystem().cleanupSplitsDir();
          break;

        case CLOSED_PARENT_REGION:
          try {
            // So, this returns a seqid but if we just closed and then reopened, we
            // should be ok. On close, we flushed using sequenceid obtained from
            // hosting regionserver so no need to propagate the sequenceid returned
            // out of initialize below up into regionserver as we normally do.
            // TODO: Verify.
            this.parent.initialize();
          } catch (IOException e) {
            LOG.error(
                "Failed rollbacking CLOSED_PARENT_REGION of region "
                    + parent.getRegionInfo().getRegionNameAsString(),
                e);
            throw new RuntimeException(e);
          }
          break;

        case STARTED_REGION_A_CREATION:
          this.parent.getRegionFileSystem().cleanupDaughterRegion(this.hri_a);
          break;

        case STARTED_REGION_B_CREATION:
          this.parent.getRegionFileSystem().cleanupDaughterRegion(this.hri_b);
          break;

        case OFFLINED_PARENT:
          if (services != null) services.addToOnlineRegions(this.parent);
          break;

        case PONR:
          // We got to the point-of-no-return so we need to just abort. Return
          // immediately.  Do not clean up created daughter regions.  They need
          // to be in place so we don't delete the parent region mistakenly.
          // See HBASE-3872.
          return false;

          // Informational only cases
        case STARTED:
        case PREPARED:
        case BEFORE_PRE_SPLIT_HOOK:
        case AFTER_PRE_SPLIT_HOOK:
        case BEFORE_POST_SPLIT_HOOK:
        case AFTER_POST_SPLIT_HOOK:
        case OPENED_REGION_A:
        case OPENED_REGION_B:
        case COMPLETED:
          break;

        default:
          throw new RuntimeException("Unhandled journal entry: " + je);
      }
    }
    // Coprocessor callback
    if (this.parent.getCoprocessorHost() != null) {
      this.parent.getCoprocessorHost().postRollBackSplit(user);
    }
    return result;
  }