Commit Graph

13669 Commits

Author SHA1 Message Date
Duarte Nunes
ffaa3341c3 tests/sstable_assertions: Fix monotonicity check for promoted indexes
Signed-off-by: Duarte Nunes <duarte@scylladb.com>
2017-11-23 16:45:54 +00:00
Duarte Nunes
24b867adda sstables/sstables: Correctly serialize range tombstones
This patch ensures we correctly serialize range tombstones for dense
non-compound schemas, which until now assumed the bounds were compound
composite. We also fix the reading function, which assumed the same
thing. This affected Apache Cassandra compatibility.

Fixes #2986

Signed-off-by: Duarte Nunes <duarte@scylladb.com>
2017-11-23 16:45:54 +00:00
Duarte Nunes
3368411e03 sstables/sstable_writer: Prepare to control range tombstone serialization
This patch adds support to sstable_writer to be able to control
correct range tombstone serialization.

When range tombstone serialization will be fixed in subsequent
patches, it will only be enabled when the whole cluster supports the
feature to allow for rollbacks.

The feature needs to be enabled for an sstable as a whole, to prevent
problems with it being enabled during an sstable write.

Thus, the sstable writer will pass on this information to the sstable
methods that carry out the actual file writing.

Signed-off-by: Duarte Nunes <duarte@scylladb.com>
2017-11-23 16:45:54 +00:00
Duarte Nunes
19cd65a681 tests/sstable_*: Start the storage service for some cases
We will need to check the cluster's enabled features when writing
range tombstones.

Signed-off-by: Duarte Nunes <duarte@scylladb.com>
2017-11-23 16:45:53 +00:00
Duarte Nunes
ae3a58d7ec service/storage_service: Add feature for correct non-compound RTs
This patch adds a cluster feature to enable correct serialization of
non-compound range tombstones. We thus support rollbacks during an
upgrade, as we will only change range tombstone serialization when the
cluster is fully upgraded and all nodes are capable of reading the new
format.

Signed-off-by: Duarte Nunes <duarte@scylladb.com>
2017-11-23 16:45:53 +00:00
Duarte Nunes
eeacef3089 sstables/sstables: Correctly deserialize range tombstones
This patch changes the range tombstone read path to deal with
correctly written non-compound range tombstones, while also
maintaining backward compatibility and reading old Scylla-generated
range tombstones.

The fix for the write path will activate an sstable feature which will
connect with this patch.

Signed-off-by: Duarte Nunes <duarte@scylladb.com>
2017-11-23 16:45:53 +00:00
Duarte Nunes
e51fc2096b tests/cql_query_test: Verify range deletion constraints
Test that unsupported range deletions against non-compound schemas are
rejected.

Signed-off-by: Duarte Nunes <duarte@scylladb.com>
2017-11-23 16:45:53 +00:00
Duarte Nunes
1c872e2ddc cql3/delete_statement: Constrain range deletions for non-compound schemas
We cannot represent ranged deletions with non-inclusive bounds on our
current storage format for schemas that are non-compound, since the
clustering key won't include the EOC byte.

Refs #2986

Signed-off-by: Duarte Nunes <duarte@scylladb.com>
2017-11-23 16:45:53 +00:00
Duarte Nunes
eea4e349ea cql3/single_column_primary_key_restrictions: Implement is_inclusive()
Signed-off-by: Duarte Nunes <duarte@scylladb.com>
2017-11-23 16:45:53 +00:00
Duarte Nunes
f217dcc0ce sstables/sstables: Don't use incorrectly serialized promoted index
Promoted indexes generated before this patch by Scylla are considered
incorrect if they belong to a non-compound schema, due to #2993.

Signed-off-by: Duarte Nunes <duarte@scylladb.com>
2017-11-23 16:45:53 +00:00
Duarte Nunes
8cdd8e2431 sstables/sstables: Add supported feature list to sstables
This patch adds additional metadata to the scylla sstable component.
Namely, it adds a list of features that the current sstable supports.
The upcoming usages of the feature list are meant for backward
compatibility, but the implementation makes no such assumptions.

Signed-off-by: Duarte Nunes <duarte@scylladb.com>
2017-11-23 16:45:53 +00:00
Duarte Nunes
e81a3d487d sstables/sstables: Writing promoted index entry leverages column_name_writer
This patch refactors writing a promoted index entry to leverage the
column_name_writer. It not only reduces code duplication, but also
solves two important bugs:

1) Column names for schema types other than compound non-dense were
   not correctly serialized, as the wrong overload of
   write_column_name() was being called, which assumed the specified
   composite to be compound.

2) Before, for some schema types we were passing an empty
   clustering_key to maybe_flush_pi_block(), which caused it to bypass
   appending open range tombstones to the data file, causing wrong
   query results to be returned.

Fixes #2979
Fixes #2992
Fixes #2993

Signed-off-by: Duarte Nunes <duarte@scylladb.com>
2017-11-23 16:45:53 +00:00
Duarte Nunes
51eed140d2 sstables/sstables: Use schema-aware write_column_name() for static row
Signed-off-by: Duarte Nunes <duarte@scylladb.com>
2017-11-23 16:45:53 +00:00
Duarte Nunes
b7624afca6 sstables/sstables: Use schema-aware write_column_name() for row marker
Signed-off-by: Duarte Nunes <duarte@scylladb.com>
2017-11-23 16:45:53 +00:00
Duarte Nunes
42f125c1ef sstables/sstables: Use schema-aware write_column_name() for collections
Eventually all current callers of write_column_name() will move to the
schema-aware one.

Signed-off-by: Duarte Nunes <duarte@scylladb.com>
2017-11-23 16:45:53 +00:00
Duarte Nunes
96daf17f8c sstables/sstables: Lift column name writing logic
This patch lifts the logic to write a column name depending on the
schema's denseness and compoundness into a function, so that it may
later be reused in other places. We still duplicate the same logic
when writing a clustered row because the index writer requires it for
now.

Signed-off-by: Duarte Nunes <duarte@scylladb.com>
2017-11-23 16:45:53 +00:00
Duarte Nunes
594ed2d02a sstables/sstables: A schema with static columns is always compound
A schema can only have static columns if it has at least one
clustering column. A schema with a clustering column is always
compound, unless it is created with compact storage. A schema created
with compact storage cannot have static columns, so we can remove dead
code from the sstable write path.

Signed-off-by: Duarte Nunes <duarte@scylladb.com>
2017-11-23 16:45:53 +00:00
Duarte Nunes
8011f3393e sstables/sstables: Move out tombstone check in write_range_tombstone()
We were incurring in superfluous checks as they were already performed
in some of the callers.

Signed-off-by: Duarte Nunes <duarte@scylladb.com>
2017-11-23 16:45:53 +00:00
Duarte Nunes
1e0f155447 sstables/sstables: Leverage index code upon range tombstone consume
Signed-off-by: Duarte Nunes <duarte@scylladb.com>
2017-11-23 16:45:53 +00:00
Duarte Nunes
989dc1d8c0 sstables/sstables: Lift index writing for row tombstones
This will allow code reuse in the following patches.

Signed-off-by: Duarte Nunes <duarte@scylladb.com>
2017-11-23 16:45:53 +00:00
Duarte Nunes
5dfbdbaa04 sstables/sstables: Reuse write_range_tombstone() for row tombstones
Signed-off-by: Duarte Nunes <duarte@scylladb.com>
2017-11-23 16:45:53 +00:00
Duarte Nunes
d1e1fc928e sstables/sstables: Don't write index entry for a missing row maker
Encapsulate the decision to write the row_marker and to write a
corresponding entry in the promoted index. We now avoid writing the
index entry if there is no row marker, and just start indexing the row
at the first cell.

Signed-off-by: Duarte Nunes <duarte@scylladb.com>
2017-11-23 16:45:53 +00:00
Duarte Nunes
8907c1dfb2 sstables/sstables: Unify column name writers
Signed-off-by: Duarte Nunes <duarte@scylladb.com>
2017-11-23 16:45:53 +00:00
Glauber Costa
881a859b21 transport: enhance reporting of requests blocked in the transport layer
It's hard to make sense of the metric transport.requests_blocked_memory
because it shows a queue size. Specially in production setups scraping
at every 15 seconds, that doesn't tell us much.

We solve that in other layers that record blocking by providing both a
requests_blocked_memory and requests_blocked_memory_current

Fixes #3010

Signed-off-by: Glauber Costa <glauber@scylladb.com>
Message-Id: <20171123033329.32596-1-glauber@scylladb.com>
2017-11-23 12:37:16 +02:00
Amnon Heiman
3f8d9a87ee estimated_histogram: update the sum and count when merging
When merging histograms the count and the sum should be updated.

Signed-off-by: Amnon Heiman <amnon@scylladb.com>
Message-Id: <20171122154822.23855-1-amnon@scylladb.com>
2017-11-22 16:55:55 +01:00
Glauber Costa
6c4e8049a0 estimated_histogram: also fill up sum metric
Prometheus histograms have 3 embedded metrics: count, buckets, and sum.
Currently we fill up count and buckets but sum is left at 0. This is
particularly bad, since according to the prometheus documentation, the
best way to calculate histogram averages is to write:

  rate(metric_sum[5m]) / rate(metric_count[5m])

One way of keeping track of the sum is adding the value we sampled,
every time we sample. However, the interface for the estimated histogram
has a method that allows to add a metric while allowing to adjust the
count for missing metrics (add_nano())

That makes acumulating a sum inaccurate--as we will have no values for
the points that were added. To overcome that, when we call add_nano(),
we pretend we are introducing new_count - _count metrics, all with the
same value.

Long term, doing away with sampling may help us provide more accurate
results.

After this patch, we are able to correctly calculate latency averages
through the data exported in prometheus.

Signed-off-by: Glauber Costa <glauber@scylladb.com>
Message-Id: <20171122144558.7575-1-glauber@scylladb.com>
2017-11-22 16:10:12 +01:00
Tomasz Grabiec
e9ffe36d65 Merge "Remove sstable::read_rows" from Piotr
* seastar-dev.git haaawk/flat_reader_remove_read_rows:
  sstable_mutation_test: use read_rows_flat instead of read_rows
  perf_sstable: use read_rows_flat instead of read_rows
  Remove sstable::read_rows
2017-11-22 15:50:59 +01:00
Piotr Jastrzebski
0fdfd2c5bc Remove sstable::read_rows
It's no longer used. read_rows_flat is used everything instead.

Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
2017-11-22 15:48:57 +01:00
Piotr Jastrzebski
571bac7336 perf_sstable: use read_rows_flat instead of read_rows
Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
2017-11-22 15:48:57 +01:00
Piotr Jastrzebski
da2f2164e9 sstable_mutation_test: use read_rows_flat instead of read_rows
Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
2017-11-22 15:48:57 +01:00
Tomasz Grabiec
aa8c2cbc16 Merge "Migrate sstables to flat_mutation_reader" from Piotr
Introduce sstable::read_row_flat and sstable::read_range_rows_flat methods
and use them in sstable::as_mutation_source.

* https://github.com/scylladb/seastar-dev/tree/haaawk/flat_reader_sstables_v3:
  Introduce conversion from flat_mutation_reader to streamed_mutation
  Add sstables::read_rows_flat and sstables::read_range_rows_flat
  Turn sstable_mutation_reader into a flat_mutation_reader
  sstable: add getter for filter_tracker
  Move mp_row_consumer methods implementations to the bottom
  Remove unused sstable_mutation_reader constructor
  Replace "sm" with "partition" in get_next_sm and on_sm_finished
  Move advance_to_upper_bound above sstable_mutation_reader
  Store sstable_mutation_reader pointer in mp_row_consumer
  Stop using streamed_mutation in consumer and reader
  Stop using streamed_mutation in sstable_data_source
  Delete sstable_streamed_mutation
  Introduce sstable::read_row_flat
  Migrate sstable::as_mutation_source to flat_mutation_reader
  Remove single_partition_reader_adaptor
  Merge data_consume_context::impl into data_consume_context
  Create data_consume_context_opt.
  Merge on_partition_finished into mark_partition_finished
  Check _partition_finished instead of _current_partition_key
  Merge sstable_data_source into sstable_mutation_reader
  Remove sstable_data_source
  Remove get_next_partition and partition_header
2017-11-22 15:45:21 +01:00
Calle Wilund
912d29e79b storage_service: don't use potentially stale iterator in log
Message-Id: <20171121115119.29642-2-calle@scylladb.com>
2017-11-22 15:26:56 +01:00
Piotr Jastrzebski
df110e8b4d Remove get_next_partition and partition_header
Handle next_partition in on_next_partition instead.

Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
2017-11-22 15:24:49 +01:00
Piotr Jastrzebski
a3b69235e3 Remove sstable_data_source
It's not used any more and can be safely removed.

Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
2017-11-22 15:24:49 +01:00
Piotr Jastrzebski
4b9a34a854 Merge sstable_data_source into sstable_mutation_reader
There's no need for sstable_data_source to be separated any more.

Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
2017-11-22 15:24:49 +01:00
Piotr Jastrzebski
f2191e0984 Check _partition_finished instead of _current_partition_key
to check whether partition is finished. In next patch
_current_partition_key will be merged with sstable_data_source::_key
and won't be cleared any more.

Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
2017-11-22 15:24:49 +01:00
Piotr Jastrzebski
be0c9040a6 Merge on_partition_finished into mark_partition_finished
This simplifies code quite a bit.

Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
2017-11-22 15:24:49 +01:00
Piotr Jastrzebski
8afbe0ead0 Create data_consume_context_opt.
This will be used in sstable_mutation_reader before
first fill_buffer is called and a proper data_consume_context
is created.

Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
2017-11-22 15:24:22 +01:00
Duarte Nunes
3d24eed39e service/storage_service: Remove outdated FIXME
Thrift server is now a bit more graceful on shutdown.

Signed-off-by: Duarte Nunes <duarte@scylladb.com>
Message-Id: <20171121214341.31165-1-duarte@scylladb.com>
2017-11-22 10:48:46 +02:00
Piotr Jastrzebski
7f8b62bc0b Merge data_consume_context::impl into data_consume_context
There's no reason to use pimpl in data_consume_context

Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
2017-11-21 20:22:38 +01:00
Takuya ASADA
c1b97d11ea dist/redhat: avoid hardcoding GPG key file path on scylla-epel-7-x86_64.cfg
Since we want to support cross building, we shouldn't hardcode GPG file path,
even these files provided on recent version of mock.

This fixes build error on some older build environment such as CentOS-7.2.

Fixes #3002

Signed-off-by: Takuya ASADA <syuu@scylladb.com>
Message-Id: <1511277722-22917-1-git-send-email-syuu@scylladb.com>
2017-11-21 17:25:39 +02:00
Vladimir Krivopalov
61b1988aa1 Use meaningful error messages when throwing a marshal_exception
Fixes #2977

Signed-off-by: Vladimir Krivopalov <vladimir@scylladb.com>
Message-Id: <20171121005108.23074-1-vladimir@scylladb.com>
2017-11-21 16:05:43 +02:00
Daniel Fiala
21ea05ada1 utils/big_decimal: Fix compilation issue with converion of cpp_int to uint64_t.
Signed-off-by: Daniel Fiala <daniel@scylladb.com>
Message-Id: <20171121134854.16278-1-daniel@scylladb.com>
2017-11-21 15:51:29 +02:00
Tomasz Grabiec
6969a235f3 Merge "Convert queries to flat mutation readers" from Paweł
These patches convert queries (data, mutation and counter) to flat
mutation readers. All of them already use consume_flattened() to
consume a flat stream of data, so the only major missing thing
 was adding support for reversed partitions to
flat_mutation_reader::consume().

* pdziepak flat_mutation_reader-queries/v3-rebased:
  flat_mutation_reader: keep reference to decorated key valid
  flat_muation_reader: support consuming reversed partitions
  tests/flat_mutation_reader: add test for
    flat_mutation_reader::consume()
  mutation_partition: convert queries to flat_mutation_readers
  tests/row_cache_stress_test: do not use consume_flattened()
  mutation_reader: drop consume_flattened()
  streamed_mutation: drop reverse_streamed_mutation()
2017-11-21 12:55:57 +01:00
Paweł Dziepak
8baf682216 streamed_mutation: drop reverse_streamed_mutation() 2017-11-21 11:37:04 +00:00
Paweł Dziepak
5753e85c6b mutation_reader: drop consume_flattened()
consume_flattened() has been fully replaced by
flat_mutation_reader::consume()
2017-11-21 11:37:04 +00:00
Paweł Dziepak
5851b86369 tests/row_cache_stress_test: do not use consume_flattened() 2017-11-21 11:37:04 +00:00
Paweł Dziepak
48c3db54c9 mutation_partition: convert queries to flat_mutation_readers 2017-11-21 11:37:04 +00:00
Paweł Dziepak
00c8b38a88 tests/flat_mutation_reader: add test for flat_mutation_reader::consume() 2017-11-21 11:37:04 +00:00
Paweł Dziepak
cdb30f74a8 flat_muation_reader: support consuming reversed partitions
Some queries may need the fragments that belong to partition to be
emitted in the reversed order. Current support for that is very limited
(see #1413), but should work reasonably well for small partitions.
2017-11-21 11:37:04 +00:00