Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better servers cache #1966

Open
manishtomar opened this issue Jan 4, 2017 · 0 comments
Open

Better servers cache #1966

manishtomar opened this issue Jan 4, 2017 · 0 comments

Comments

@manishtomar
Copy link
Contributor

Currently servers cache works based on a timestamp. Each update to the cache is keyed on a timestamp which is expected to be monotonically increasing because get_servers fetches the update with latest timestamp. This is not really an issue since update is always done from same node but can still cause problems when leap seconds creep in. See #1955 (comment). Also the update implementation doesn't take care of reentrancy. It should have a lock around it to avoid corruption.

The interface for this implementation is also very tied to Cassandra. It can be a lot simpler without dependency on certain kind implementation. It should just be a simple get and update (almost like a dict). The implementation for CASS will need to take care of multiple updates via timestamps or locks or ZK clock.

class IScalingGroupServersCache(Interface):
    """
    Cache of servers in scaling groups
    """
    tenant_id = Attribute("Rackspace Tenant ID of the owner of this group.")
    group_id = Attribute("UUID of the scaling group - immutable.")

    def get_servers(only_as_active):
        """
        Return cache of servers in a group.

        :param bool only_as_active: Should it return only otter active servers?

        :return: Effect of servers where servers is list of dict
        :rtype: Effect
        """

    def update_servers(servers):
        """
        Update the servers cache of the group

        :param list servers: List of server dicts with optional "_is_as_active"
            field with boolean value to represent if this server has become
            active from autoscale's perpective. This field will be popped
            before storing the blob

        :return: Effect of None
        """

    def delete_servers():
        """
        Remove all servers of the group
        """
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant