Forwarding lambda is reused, so we cannot move captures out of it
and we cannot pass references to them either since lambda can be
destroyed before send completes.
Works only if all replicas (participating in CL) has the same live
data. Does not detects mismatch in tombstones (no infrastructure yet).
Does not report timeout yet.
The comment says the directory is created on the local shard only, but when
this code was converted, it ended up being moved inside the invoke_on_all lambda,
which means now it is called from all shards. Fix it by reorganizing the code.
Signed-off-by: Glauber Costa <glommer@cloudius-systems.com>
"These two patches fix handling of replication strategy options: maps are now
serialized and deserialized from json correctly and class name is not stored
together with other replication strategy options."
The class name is stored separately and shouldn't be kept in the map
together with other options.
Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
In C*, every compacted sstable keeps track of its ancestors in the
statistics file. Supposedly, that info is used to discard sstable
files from ancestors which for some odd reason weren't deleted.
Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
metadata_collector was made member of class sstable, such that the
compaction procedure will be able to use the method add_generation
from a sstable object.
Signed-off-by: Raphael S. Carvalho <raphaelsc@cloudius-systems.com>
After compaction, remove the source sstables. This cannot be done
immediately, as ongoing reads might be using them, so we mark the sstable
as "to be deleted", and when all references to this sstable are lost and
the object is destroy, we see this flag and delete the on-disk files.
This patch doesn't change the low-level compact_sstables() (which doesn't
mark its input sstables for deletion), but rather the higher-level example
"strategy" column_family::compact_all_sstables(). I thought we might want
to do this to allow in the future strategies that might only mark the input
sstables for deletion after doing perhaps other steps and to be sure it
doesn't want to abort the compaction and return to the old files. If we
decide this isn't needed, we can easily move the mark_for_deletion() call
to compact_sstables().
Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
This patch adds a "class future" method for handling an exception result
of the future. It is impossible to discard a future's exception while passing
through the value of the result (what will we pass in the case of
exception?), so we discard the result as well.
An example of how this can be used, to log an error (but otherwise do
nothing) if removing a file fails:
remove_file(filename).handle_exception(
[] (std::exception_ptr eptr) {
print("Exception when deleting file: %s", eptr);
});
Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
This patch adds an output operator overload for std::exception_ptr, to
make it easy to log a caught exception. It always shows the exception's
exact type, and for some types of exceptions (subtypes of std::system_error
and std::exception) it prints more information.
For example, the code
try {
throw std::runtime_error("Hello world");
} catch (...) {
sstlog.warn("Exception: {}", std::current_exception());
}
produces the output:
Exception when deleting sstable file: std::runtime_error (Hello world)
Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
"This series aims to add the network_topology_strategy class.
It adds a few things that were missing in the token_metadata and
abstract_replication_strategy classes on the way:
- Full topology (a.k.a. Topology) class implementation.
- ring_range (a.k.a. TokenMetadata.ringIterator). The implementation
is partial since we don't implement the "inclideMin" parameter.
- endpoints caching in the abstract_replication_strategy.
- Add-only Java's LinkedHashSet implementation - sequenced_set.
Then we add the network_topology_strategy class itself and the corresponding
unit test that validates the functionality of both the strategy class and of
the caching mechanism."
Conflicts:
locator/token_metadata.hh
Unit test for NetworkTopologyStrategy class.
Creates a dummy cluster topology: token ring, token_metadata, snitch (RackInferringSnitch).
Then requests a natural endpoints for tokens that lay between each two adjacent ring tokens
and verifies the output.
It also checks the natural_endpoints caching:
1) Verifies that the result is calculated when we query the specific token_ring point
for the first time.
2) Verifies that the result is taken from the cache when we query the specific token_ring
point for the second time.
3) Verifies that the results in (1) and (2) are identical.
4) Verifies that the cache is invalidated after token_metadata::invalidate_cached_rings()
is called.
Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
New in v2:
- Use new location of a sequenced_set.
- Indentation.
- Use all caps in a FIXME word.
This class implements an add-only vector that ensures that the elements are
unique.
As long as items are only added this class does essentially the same what Java's
LinkedHashSet does.
Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
New in v2:
- Moved sequenced_set to its own .hh file.
_keyspace back reference is not used at the moment.
Not deleting since we may need it when we add more code (quite soon).
Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
Returns an iterable range object to traverse the token ring
Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
New in v2:
- Use boost::iterator_range instead of tokens_range class.
- Make tokens_iterator inherit from std::iterator<std::input_iterator_tag, token>.