Package co.cask.cdap.api.dataset

Examples of co.cask.cdap.api.dataset.DatasetAdmin.upgrade()


    // Upgrade all datasets
    for (DatasetSpecification spec : framework.getInstances()) {
      System.out.println(String.format("Upgrading dataset: %s, spec: %s", spec.getName(), spec.toString()));
      DatasetAdmin admin = framework.getAdmin(spec.getName(), null);
      // we know admin is not null, since we are looping over existing datasets
      admin.upgrade();
      System.out.println(String.format("Upgraded dataset: %s", spec.getName()));
    }
  }

  public static void main(String[] args) throws Exception {
View Full Code Here


          public void create() throws IOException {
            // no-op
            throw new UnsupportedOperationException("This DatasetAdmin is only used for upgrade() operation");
          }
        };
        admin.upgrade();
        System.out.println(String.format("Upgraded hbase table: %s", tableName));
      }
    }
  }
}
View Full Code Here

  }

  public void upgrade() throws Exception {
    DatasetAdmin admin = dsFramework.getAdmin(getMetaTableName(), null);
    if (admin != null) {
      admin.upgrade();
    }
  }

  /**
   * Returns the name of the metadata table to be used.
View Full Code Here

  @POST
  @Path("/data/datasets/{name}/admin/upgrade")
  public void upgrade(HttpRequest request, HttpResponder responder, @PathParam("name") String instanceName) {
    try {
      DatasetAdmin datasetAdmin = getDatasetAdmin(instanceName);
      datasetAdmin.upgrade();
      responder.sendJson(HttpResponseStatus.OK, new DatasetAdminOpResponse(null, null));
    } catch (HandlerException e) {
      LOG.debug("Got handler exception", e);
      responder.sendError(e.getFailureStatus(), StringUtils.defaultIfEmpty(e.getMessage(), ""));
    } catch (Exception e) {
View Full Code Here

      // See if it is timeseries or aggregates table

      if (dsName.contains(metricsPrefix + ".ts.") || dsName.contains(metricsPrefix + ".agg")) {
        DatasetAdmin admin = dsFramework.getAdmin(dsName, null);
        if (admin != null) {
          admin.upgrade();
        } else {
          LOG.error("Could not obtain admin to upgrade metrics table: " + dsName);
          // continue to best effort
        }
      }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.