Skip to content
This repository has been archived by the owner on Jun 7, 2024. It is now read-only.

Commit

Permalink
Merge pull request #914 from ferbncode/ARUHA-1736
Browse files Browse the repository at this point in the history
Remove legacy feature toggles
  • Loading branch information
ferbncode authored Jul 31, 2018
2 parents 7a9a6ef + dfcfa48 commit 9a92d5b
Show file tree
Hide file tree
Showing 23 changed files with 34 additions and 680 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

## [2.8.2] - 2018-07-26

### Removed
- Removed Legacy Feature Toggles

## [2.8.1]

### Added
Expand Down
4 changes: 0 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ services:
- NAKADI_FEATURES_DEFAULT_FEATURES_DISABLE_EVENT_TYPE_CREATION
- NAKADI_FEATURES_DEFAULT_FEATURES_DISABLE_EVENT_TYPE_DELETION
- NAKADI_FEATURES_DEFAULT_FEATURES_DISABLE_SUBSCRIPTION_CREATION
- NAKADI_FEATURES_DEFAULT_FEATURES_CHECK_PARTITIONS_KEYS
- NAKADI_FEATURES_DEFAULT_FEATURES_CHECK_OWNING_APPLICATION
- NAKADI_FEATURES_DEFAULT_FEATURES_LIMIT_CONSUMERS_NUMBER
- NAKADI_FEATURES_DEFAULT_FEATURES_SEND_BATCH_VIA_OUTPUT_STREAM
- NAKADI_FEATURES_DEFAULT_FEATURES_REMOTE_TOKENINFO
- NAKADI_FEATURES_DEFAULT_FEATURES_KPI_COLLECTION
- NAKADI_FEATURES_DEFAULT_FEATURES_DISABLE_DB_WRITE_OPERATIONS
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
Expand Down Expand Up @@ -42,14 +41,11 @@
import org.zalando.nakadi.service.AuthorizationValidator;
import org.zalando.nakadi.service.BlacklistService;
import org.zalando.nakadi.service.ClosedConnectionsCrutch;
import org.zalando.nakadi.service.ConnectionSlot;
import org.zalando.nakadi.service.ConsumerLimitingService;
import org.zalando.nakadi.service.CursorConverter;
import org.zalando.nakadi.service.EventStream;
import org.zalando.nakadi.service.EventStreamConfig;
import org.zalando.nakadi.service.EventStreamFactory;
import org.zalando.nakadi.service.EventTypeChangeListener;
import org.zalando.nakadi.service.FeatureToggleService;
import org.zalando.nakadi.service.timeline.TimelineService;
import org.zalando.nakadi.util.FlowIdUtils;
import org.zalando.nakadi.view.Cursor;
Expand Down Expand Up @@ -78,7 +74,6 @@
import static javax.ws.rs.core.Response.Status.PRECONDITION_FAILED;
import static javax.ws.rs.core.Response.Status.SERVICE_UNAVAILABLE;
import static org.zalando.nakadi.metrics.MetricUtils.metricNameFor;
import static org.zalando.nakadi.service.FeatureToggleService.Feature.LIMIT_CONSUMERS_NUMBER;

@RestController
public class EventStreamController {
Expand All @@ -93,8 +88,6 @@ public class EventStreamController {
private final MetricRegistry metricRegistry;
private final ClosedConnectionsCrutch closedConnectionsCrutch;
private final BlacklistService blacklistService;
private final ConsumerLimitingService consumerLimitingService;
private final FeatureToggleService featureToggleService;
private final CursorConverter cursorConverter;
private final MetricRegistry streamMetrics;
private final AuthorizationValidator authorizationValidator;
Expand All @@ -110,8 +103,6 @@ public EventStreamController(final EventTypeRepository eventTypeRepository,
@Qualifier("streamMetricsRegistry") final MetricRegistry streamMetrics,
final ClosedConnectionsCrutch closedConnectionsCrutch,
final BlacklistService blacklistService,
final ConsumerLimitingService consumerLimitingService,
final FeatureToggleService featureToggleService,
final CursorConverter cursorConverter,
final AuthorizationValidator authorizationValidator,
final EventTypeChangeListener eventTypeChangeListener,
Expand All @@ -124,8 +115,6 @@ public EventStreamController(final EventTypeRepository eventTypeRepository,
this.streamMetrics = streamMetrics;
this.closedConnectionsCrutch = closedConnectionsCrutch;
this.blacklistService = blacklistService;
this.consumerLimitingService = consumerLimitingService;
this.featureToggleService = featureToggleService;
this.cursorConverter = cursorConverter;
this.authorizationValidator = authorizationValidator;
this.eventTypeChangeListener = eventTypeChangeListener;
Expand Down Expand Up @@ -219,7 +208,6 @@ public StreamingResponseBody streamEvents(
final AtomicBoolean connectionReady = closedConnectionsCrutch.listenForConnectionClose(request);
Counter consumerCounter = null;
EventStream eventStream = null;
List<ConnectionSlot> connectionSlots = ImmutableList.of();
final AtomicBoolean needCheckAuthorization = new AtomicBoolean(false);

LOG.info("[X-NAKADI-CURSORS] \"{}\" {}", eventTypeName, Optional.ofNullable(cursorsStr).orElse("-"));
Expand All @@ -243,15 +231,6 @@ public StreamingResponseBody streamEvents(
.withMaxMemoryUsageBytes(maxMemoryUsageBytes)
.build();

// acquire connection slots to limit the number of simultaneous connections from one client
if (featureToggleService.isFeatureEnabled(LIMIT_CONSUMERS_NUMBER)) {
final List<String> partitions = streamConfig.getCursors().stream()
.map(NakadiCursor::getPartition)
.collect(Collectors.toList());
connectionSlots = consumerLimitingService.acquireConnectionSlots(
client.getClientId(), eventTypeName, partitions);
}

consumerCounter = metricRegistry.counter(metricNameFor(eventTypeName, CONSUMERS_COUNT_METRIC_NAME));
consumerCounter.inc();

Expand Down Expand Up @@ -305,7 +284,6 @@ public StreamingResponseBody streamEvents(
writeProblemResponse(response, outputStream, INTERNAL_SERVER_ERROR, e.getMessage());
} finally {
connectionReady.set(false);
consumerLimitingService.releaseConnectionSlots(connectionSlots);
if (consumerCounter != null) {
consumerCounter.dec();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
import java.util.List;

import static org.springframework.http.ResponseEntity.status;
import static org.zalando.nakadi.service.FeatureToggleService.Feature.CHECK_OWNING_APPLICATION;
import static org.zalando.nakadi.service.FeatureToggleService.Feature.DISABLE_EVENT_TYPE_CREATION;
import static org.zalando.nakadi.service.FeatureToggleService.Feature.DISABLE_EVENT_TYPE_DELETION;

Expand Down Expand Up @@ -96,12 +95,6 @@ public ResponseEntity<?> create(@Valid @RequestBody final EventTypeBase eventTyp
return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED);
}

if (featureToggleService.isFeatureEnabled(CHECK_OWNING_APPLICATION)
&& !applicationService.exists(eventType.getOwningApplication())) {
return Responses.create(Problem.valueOf(MoreStatus.UNPROCESSABLE_ENTITY,
"owning_application doesn't exist"), request);
}

if (errors.hasErrors()) {
return Responses.create(new ValidationProblem(errors), request);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
import javax.ws.rs.core.Response;

import static org.springframework.http.HttpStatus.OK;
import static org.zalando.nakadi.service.FeatureToggleService.Feature.CHECK_OWNING_APPLICATION;
import static org.zalando.nakadi.service.FeatureToggleService.Feature.DISABLE_SUBSCRIPTION_CREATION;


Expand Down Expand Up @@ -67,12 +66,6 @@ public ResponseEntity<?> createOrGetSubscription(@Valid @RequestBody final Subsc
return Responses.create(new ValidationProblem(errors), request);
}

if (featureToggleService.isFeatureEnabled(CHECK_OWNING_APPLICATION)
&& !applicationService.exists(subscriptionBase.getOwningApplication())) {
return Responses.create(Problem.valueOf(MoreStatus.UNPROCESSABLE_ENTITY,
"owning_application doesn't exist"), request);
}

try {
return ok(subscriptionService.getExistingSubscription(subscriptionBase));
} catch (final NoSubscriptionException e) {
Expand Down
Loading

0 comments on commit 9a92d5b

Please sign in to comment.