Giter VIP home page Giter VIP logo

consul-recipes's People

Contributors

adamdubiel avatar arkadiuszbielewicz avatar automaat avatar ferdudas97 avatar fkowal avatar jakubdyszkiewicz avatar malfoj89 avatar mzawirski avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

consul-recipes's Issues

Escape URLs

URLs should be escaped in every place we construct an URL

Watches: Reset the index if it goes backwards

According to the Consul docs https://www.consul.io/api/features/blocking.html

Reset the index if it goes backwards. While indexes in general are monotonically increasing(i.e. they should only ever increase as time passes), there are several real-world scenarios in which they can go backwards for a given query. Implementations must check to see if a returned index is lower than the previous value, and if it is, should reset index to 0 - effectively restarting their blocking loop. Failure to do so may cause the client to miss future updates for an unbounded time, or to use an invalid index value that causes no blocking and increases load on the servers. Cases where this can occur include:

  • If a raft snapshot is restored on the servers with older version of the data.
  • KV list operations where an item with the highest index is removed.
  • A Consul upgrade changes the way watches work to optimize them with more granular indexes.

watcher cancel running watches

ConsulWatcher.stopWatchingEndpoint(String endpoint) limits the possibility to use the watcher concurrently.

When 2 threads start watches for the same endpoint, and one decides to cancel the "subscription" by running .stopWatchingEndpoint(String Endpoint) it results in canceling both subscriptions.

Or it introduces a race condition that results in leaving both subscriptions running.

Watches. Reset index after connection error.

Description

Due to bug in consul. When consul agent restart, we can get wrong state - consul updates index without updating state for watched service. ( bug is already fixed in newer versions, but is present in consul 1.8.3)

Contributing section

There should be section that explains that consul-recipes should contain minimal number of dependencies.

BackoffRunner can overflow

With big enough initialBackoff and retry, the backoff variable can be negative.

AC:

  • backoff cannot be be negative. We should set the result of initialBackoff << retry to Integer.MAX_INT if it's negative.

Watches: allowStale is not enabled by default

Although allowing stale on watches is nice because we don't have to ask a leader for a data, it can introduce many bugs.

Example.
We've got empty list of services, then we've observe new service
Events: [], [service1].
Then for a new service we run watch on its instances and if service is removed we remove the watch.

But what if we receive events in different order
Events: [service1], []
We first watch the service but we immediately unwatch it even that it's in the Consul.

Watches: Document races on worker pool

Even if events are properly ordered from Consul. We can still process them in a different order. When we've got multiple threads of worker pool and synchronized operation of consuming events, the thread that got second event can run before the thread that got first event.

We should recommend for users that they either should use single threaded worker pool or save last consumed index.

Close consul watcher in LeaderElector

The default way of creating LeaderElector described in README is:

LeaderElector elector = consulRecipes
        .leaderElector("myservice")
        .build();

This creates default consul watcher that is not closed when elector is closed. We should either close it or change the API to force user to provide external watcher.

[question] How to decrease time of electing a new leader?

Hi! Thank you for open sourcing this project.

I've created a Clojure wrapper around the Leader Election parts - everything is working great so far during my initial testing. One thing that I'm not sure how to change though is how long it takes to elect a new leader in a 3 node group when the leader is terminated. Currently it takes ~2 minutes for the election process to happen.
For most of our use cases that's ok, but there's a couple of scenarios where 2 minutes is way too long.

How would you go about this? Do I have to create my own instance of Session class which sets a really short session expiry (10s?)?

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.