private static void transitionToDeleteState(SchemaVersionLifecycleContext context) throws SchemaLifecycleException, SchemaNotFoundException { context.setState(DELETED); context.updateSchemaVersionState(); context.getSchemaVersionService().deleteSchemaVersion(context.getSchemaVersionId()); }
private static void transitionToDeleteState(SchemaVersionLifecycleContext context) throws SchemaLifecycleException, SchemaNotFoundException { context.setState(DELETED); context.updateSchemaVersionState(); context.getSchemaVersionService().deleteSchemaVersion(context.getSchemaVersionId()); }
mergeInfo = details.getMergeInfo(); } catch (IOException e) { throw new RuntimeException(String.format("Failed to serialize state details of schema version : '%s'",context.getSchemaVersionId()),e);
public static void transitionToEnableState(SchemaVersionLifecycleContext context) throws SchemaNotFoundException, IncompatibleSchemaException, SchemaLifecycleException, SchemaBranchNotFoundException { Long schemaVersionId = context.getSchemaVersionId(); SchemaVersionService schemaVersionService = context.getSchemaVersionService();
public static void transitionToEnableState(SchemaVersionLifecycleContext context) throws SchemaNotFoundException, IncompatibleSchemaException, SchemaLifecycleException, SchemaBranchNotFoundException { Long schemaVersionId = context.getSchemaVersionId(); SchemaVersionService schemaVersionService = context.getSchemaVersionService();
private void storeSchemaVersionState(SchemaVersionLifecycleContext schemaVersionLifecycleContext) throws SchemaNotFoundException { // store versions state, sequence SchemaVersionStateStorable stateStorable = new SchemaVersionStateStorable(); Long schemaVersionId = schemaVersionLifecycleContext.getSchemaVersionId(); byte stateId = schemaVersionLifecycleContext.getState().getId(); stateStorable.setSchemaVersionId(schemaVersionId); stateStorable.setSequence(schemaVersionLifecycleContext.getSequence() + 1); stateStorable.setStateId(stateId); stateStorable.setTimestamp(System.currentTimeMillis()); stateStorable.setDetails(schemaVersionLifecycleContext.getDetails()); stateStorable.setId(storageManager.nextId(SchemaVersionStateStorable.NAME_SPACE)); storageManager.add(stateStorable); // store latest state in versions entity StorableKey storableKey = new StorableKey(SchemaVersionStorable.NAME_SPACE, SchemaVersionStorable.getPrimaryKey(schemaVersionId)); SchemaVersionStorable versionedSchema = storageManager.get(storableKey); if (versionedSchema == null) { throw new SchemaNotFoundException("No Schema version exists with id " + schemaVersionId); } versionedSchema.setState(stateId); storageManager.update(versionedSchema); // invalidate schema version from cache SchemaVersionInfoCache.Key schemaVersionCacheKey = SchemaVersionInfoCache.Key.of(new SchemaIdVersion(schemaVersionId)); invalidateSchemaInAllHAServer(schemaVersionCacheKey); }