@Deprecated @Nonnull public static TableConfig init(@Nonnull String jsonConfigString) throws IOException { return fromJsonString(jsonConfigString); }
private TableConfig createTableConfig() throws Exception { return TableConfig.fromJsonString(_tableConfigJson); }
if (tableConfigString != null) { try { _tableConfig = TableConfig.fromJsonString(tableConfigString); } catch (IOException e) {
@Deprecated @PUT @Path("/tables/{tableName}/metadataConfigs") @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value = "Update table metadata", notes = "Updates table configuration") @ApiResponses(value = {@ApiResponse(code = 200, message = "Success"), @ApiResponse(code = 500, message = "Internal server error"), @ApiResponse(code = 404, message = "Table not found")}) public SuccessResponse updateTableMetadata(@PathParam("tableName") String tableName, String requestBody) { try { TableConfig tableConfig = TableConfig.fromJsonString(requestBody); pinotHelixResourceManager.updateMetadataConfigFor(tableConfig.getTableName(), tableConfig.getTableType(), tableConfig.getCustomConfig()); return new SuccessResponse("Successfully updated " + tableName + " configuration"); } catch (Exception e) { String errStr = "Error while updating table configuration, table: " + tableName; throw new ControllerApplicationException(LOGGER, errStr, Response.Status.INTERNAL_SERVER_ERROR, e); } } }
@Deprecated @PUT @Path("/tables/{tableName}/indexingConfigs") @ApiOperation(value = "Update table indexing configuration") @Produces(MediaType.APPLICATION_JSON) @ApiResponses(value = {@ApiResponse(code = 200, message = "Success"), @ApiResponse(code = 404, message = "Table not found"), @ApiResponse(code = 500, message = "Server error updating configuration")}) public SuccessResponse updateIndexingConfig( @ApiParam(value = "Table name (without type)", required = true) @PathParam("tableName") String tableName, String body) { try { TableConfig tableConfig = TableConfig.fromJsonString(body); pinotHelixResourceManager.updateIndexingConfigFor(tableConfig.getTableName(), tableConfig.getTableType(), tableConfig.getIndexingConfig()); return new SuccessResponse("Updated indexing config for table " + tableName); } catch (IOException e) { String errStr = "Error converting request to table config for table: " + tableName; throw new ControllerApplicationException(LOGGER, errStr, Response.Status.BAD_REQUEST, e); } catch (Exception e) { String errStr = "Failed to update indexing config for table: " + tableName; throw new ControllerApplicationException(LOGGER, errStr, Response.Status.INTERNAL_SERVER_ERROR, e); } } }
@Deprecated @PUT @Path("/tables/{tableName}/segmentConfigs") @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value = "Update segments configuration", notes = "Updates segmentsConfig section (validation and retention) of a table") @ApiResponses(value = {@ApiResponse(code = 200, message = "Success"), @ApiResponse(code = 404, message = "Table not found"), @ApiResponse(code = 500, message = "Internal server error")}) public SuccessResponse put(@ApiParam(value = "Table name", required = true) @PathParam("tableName") String tableName, String requestBody) { try { TableConfig tableConfig = TableConfig.fromJsonString(requestBody); pinotHelixResourceManager .updateSegmentsValidationAndRetentionConfigFor(tableConfig.getTableName(), tableConfig.getTableType(), tableConfig.getValidationConfig()); return new SuccessResponse("Update segmentsConfig for table: " + tableName); } catch (IOException e) { metrics.addMeteredGlobalValue(ControllerMeter.CONTROLLER_TABLE_SCHEMA_UPDATE_ERROR, 1L); throw new ControllerApplicationException(LOGGER, String.format("Invalid json while updating segments config for table: %s", tableName), Response.Status.BAD_REQUEST, e); } catch (Exception e) { metrics.addMeteredGlobalValue(ControllerMeter.CONTROLLER_TABLE_SCHEMA_UPDATE_ERROR, 1L); throw new ControllerApplicationException(LOGGER, String.format("Failed to update segments config for table: %s", tableName), Response.Status.INTERNAL_SERVER_ERROR, e); } } }
@POST @Path("/tables/validate") @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value = "Validate table config for a table", notes = "This API returns the table config that matches the one you get from 'GET /tables/{tableName}'." + " This allows us to validate table config before apply.") public String checkTableConfig(String tableConfigStr) { try { ObjectNode tableConfigValidateStr = JsonUtils.newObjectNode(); TableConfig tableConfig = TableConfig.fromJsonString(tableConfigStr); if (tableConfig.getTableType() == CommonConstants.Helix.TableType.OFFLINE) { tableConfigValidateStr .set(CommonConstants.Helix.TableType.OFFLINE.name(), TableConfig.toJSONConfig(tableConfig)); } else { tableConfigValidateStr .set(CommonConstants.Helix.TableType.REALTIME.name(), TableConfig.toJSONConfig(tableConfig)); } return tableConfigValidateStr.toString(); } catch (Exception e) { throw new ControllerApplicationException(LOGGER, e.getMessage(), Response.Status.BAD_REQUEST); } }
String tableName; try { tableConfig = TableConfig.fromJsonString(tableConfigStr); tableName = tableConfig.getTableName(); } catch (Exception e) {
try (FileInputStream fis = new FileInputStream(new File(_tableConfigFile))) { String tableConfigString = IOUtils.toString(fis); tableConfig = TableConfig.fromJsonString(tableConfigString); } catch (IOException e) { throw new RuntimeException("Exception in reading table config from file " + _tableConfigFile, e);
TableConfig tableConfig = TableConfig.fromJsonString(tableConfigString);
TableConfig tableConfig; try { tableConfig = TableConfig.fromJsonString(tableConfigStr); } catch (Exception e) { throw new ControllerApplicationException(LOGGER, e.getMessage(), Response.Status.BAD_REQUEST);