Commit Graph

17697 Commits

Author SHA1 Message Date
Piotr Sarna
87c23372fb cql3: fix filtering with LIMIT with regard to paging
Previously the limit was erroneously applied per page
instead of being accumulated, which might have caused returning
too many rows. As of now, LIMIT is handled properly inside
restrictions filter.

Fixes #4100
2019-01-17 13:25:09 +01:00
Duarte Nunes
04a14b27e4 Merge 'Add handling staging sstables to /upload dir' from Piotr
"
This series adds generating view updates from sstables added through
/upload directory if their tables have accompanying materialized views.
Said sstables are left in /upload directory until updates are generated
from them and are treated just like staging sstables from /staging dir.
If there are no views for a given tables, sstables are simply moved
from /upload dir to datadir without any changes.

Tests: unit (release)
"

* 'add_handling_staging_sstables_to_upload_dir_5' of https://github.com/psarna/scylla:
  all: rename view_update_from_staging_generator
  distributed_loader: fix indentation
  service: add generating view updates from uploaded sstables
  init: pass view update generator to storage service
  sstables: treat sstables in upload dir as needing view build
  sstables,table: rename is_staging to requires_view_building
  distributed_loader: use proper directory for opening SSTable
  db,view: make throttling optional for view_update_generator
2019-01-15 18:19:27 +00:00
Duarte Nunes
9b79f0f58b Merge 'Add stream phasing' from Piotr
"
This series addresses the problem mentioned in issue 4032, which is a race
between creating a view and streaming sstables to a node. Before this patch
the following scenario is possible:
 - sstable X arrives from a streaming session
 - we decide that view updates won't be generated from an sstable X
   by the view builder
 - new view is created for the table that owns sstable X
 - view builder doesn't generate updates from sstable X, even though the table
   has accompanying views - which is an inconsistency

This race is fixed by making the view builder wait for all ongoing streams,
just like it does for reads and writes. It's implemented with a phaser.

Tests:
unit (release)
dtest(not merged yet: materialized_views_test.TestMaterializedViews.stream_from_repair_during_build_process_test)
"

* 'add_stream_phasing_2' of https://github.com/psarna/scylla:
  repair: add stream phasing to row level repair
  streaming: add phasing incoming streams
  multishard_writer: add phaser operation parameter
  view: wait for stream sessions to finish before view building
  table: wait for pending streams on table::stop
  database: add pending streams phaser
2019-01-15 18:18:40 +00:00
Piotr Sarna
0eb703dc80 all: rename view_update_from_staging_generator
The new name, view_update_generator, is both more concise
and correct, since we now generate from directories
other than "/staging".
2019-01-15 17:31:47 +01:00
Piotr Sarna
a5d24e40e0 distributed_loader: fix indentation
Bad indentation was introduced in the previous commit.
2019-01-15 17:31:37 +01:00
Piotr Sarna
13c8c84045 service: add generating view updates from uploaded sstables
SSTables loaded to the system via /upload dir may sometimes be needed
to generate view updates from them (if their table has accompanying
views).

Fixes #4047
2019-01-15 17:31:37 +01:00
Piotr Sarna
46305861c3 init: pass view update generator to storage service
Storage service needs to access view update generator in order
to register staging sstables from /upload directory.
2019-01-15 17:31:36 +01:00
Piotr Sarna
13f6453350 sstables: treat sstables in upload dir as needing view build
In some cases, sstables put in the upload dir should have view updates
generated from them. In order to avoid moving them across directories
(which then involves handling failure paths), upload dir will also be
treated as a valid directory where staging sstables reside.
Regular sstables that are not needed for view updates will be
immediately moved from upload/ dir as before.
2019-01-15 16:47:01 +01:00
Piotr Sarna
09401e0e71 sstables,table: rename is_staging to requires_view_building
A generalized name will be more fitting once we treat uploaded sstables
as requiring view building too.
2019-01-15 16:47:01 +01:00
Piotr Sarna
76616f6803 distributed_loader: use proper directory for opening SSTable
Previous implementation assumes that each SSTable resides directly
in table::datadir directory, while what should actually be used
is directory path from SSTable descriptor.
This patch prevents a regression when adding staging sstables support
for upload/ dir.
2019-01-15 16:47:01 +01:00
Piotr Sarna
beb4836726 db,view: make throttling optional for view_update_generator
Currently registering new view updates is throttled by a semaphore,
which makes sense during stream sessions in order to avoid overloading
the queue. Still, registration also occurs during initialization,
where it makes little sense to wait on a semaphore, since view update
generator might not have started at all yet.
2019-01-15 16:47:01 +01:00
Paweł Dziepak
635873639b Merge "Encoding stats enhancements" from Benny
"
Cleanup various cases related to updating of metatdata stats and encoding stats
updating in preparation for 64-bit gc_clock (#3353).

Fixes #4026
Fixes #4033
Fixes #4035
Fixes #4041

Refs #3353
"

* 'projects/encoding-stats-fixes/v6' of https://github.com/bhalevy/scylla:
  sstables: remove duplicated code in data_consume_rows_context CELL_VALUE_BYTES
  sstables: mc: use api::timestamp_type in write_liveness_info
  sstables: mc: sstable_write encoding_stats are const
  mp_row_consumer_k_l::consume_deleted_cell rename ttl param to local_deletion_time
  memtable: don't use encoding_stats epochs as default
  memtable: mc: udpate min_ttl encoding stats for dead row marker
  memtable: mc: add comment regarding updating encoding stats of collection tombstones
  sstables: metadata_collector: add update tombstone stats
  sstables: assert that delete_time is not live when updating stats
  sstables: move update_deletion_time_stats to metadata collector
  sstables: metadata_collector: introduce update_local_deletion_time_and_tombstone_histogram
  sstables: mc: write_liveness_info and write_collection should update tombstone_histogram
  sstables: update_local_deletion_time for row marker deletion_time and expiration
2019-01-15 16:53:36 +02:00
Tomasz Grabiec
32f711ce56 row_cache: Fix crash on memtable flush with LCS
Presence checker is constructed and destroyed in the standard
allocator context, but the presence check was invoked in the LSA
context. If the presence checker allocates and caches some managed
objects, there will be alloc-dealloc mismatch.

That is the case with LeveledCompactionStrategy, which uses
incremental_selector.

Fix by invoking the presence check in the standard allocator context.

Fixes #4063.

Message-Id: <1547547700-16599-1-git-send-email-tgrabiec@scylladb.com>
2019-01-15 16:53:36 +02:00
Piotr Sarna
08a42d47a5 repair: add stream phasing to row level repair
In order to allow other services to wait for incoming streams
to finish, row level repair uses stream phasing when creating
new sstables from incoming data.

Fixes scylladb#4032
2019-01-15 10:28:21 +01:00
Piotr Sarna
7e61f02365 streaming: add phasing incoming streams
Incoming streams are now phased, which can be leveraged later
to wait for all ongoing streams to finish.

Refs #4032
2019-01-15 10:28:15 +01:00
Asias He
1cc7e45f44 database: Make log max_vector_size and internal_count debug level
It is useful for developers but not useful for users. Make it debug
level.

Message-Id: <775ce22d6f8088a44d35601509622a7e73ddeb9b.1547524976.git.asias@scylladb.com>
2019-01-15 11:02:30 +02:00
Piotr Sarna
238003b773 multishard_writer: add phaser operation parameter
Multishard writer can now accept a phaser operation parameter
in order to sustain a phased operation (e.g. a streaming session).
2019-01-15 10:02:22 +01:00
Piotr Sarna
b9203ec4f8 view: wait for stream sessions to finish before view building
During streaming, there's a race between streamed sstables
and view creation, which might result in some tables not being
used to generate view updates, even though they should.
That happens when the decision about view update path for a table
is done before view creation, but after already receiving some sstables
via streaming. These will not be used in view building even though
they should.
Hence, a phaser is used to make the view builder wait for all ongoing
stream sessions for a table to finish before proceeding with build steps.

Refs #4032
2019-01-15 09:36:55 +01:00
Piotr Sarna
d3a8fb378c table: wait for pending streams on table::stop
Stream sessions are now phased, so it's possible to wait for existing
streams to finish gently before stopping a table.
2019-01-15 09:36:55 +01:00
Piotr Sarna
8a5aaf2839 database: add pending streams phaser
This phaser will be used later to wait for all existing stream sessions
to finish before proceeding with view building.
2019-01-15 09:36:55 +01:00
Nadav Har'El
9062750089 scylla_util.py: make view_hints_directory setting optional
It is optional to set "view_hints_directory", so we shouldn't insist that
it is defined in scylla.yaml on upgrade.

Signed-off-by: Nadav Har'El <nyh@scylladb.com>
Message-Id: <20190114125225.10794-1-nyh@scylladb.com>
2019-01-14 14:59:20 +02:00
Benny Halevy
238866228f memtable: rename get_stats to get_encoding_stats
For symmetry reasons to similar sstable and compaction methods.

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
Message-Id: <20190113105155.29118-2-bhalevy@scylladb.com>
2019-01-14 14:58:43 +02:00
Avi Kivity
df090a15ff Merge "Add counters for inactive reads" from Botond
"
This mini-series adds counters for the inactive reads registered in the
reader concurrency semaphore.
"

* 'reader-concurrency-semaphore-counters/v6' of https://github.com/denesb/scylla:
  tests/querier_cache: use stats to get the no. of inactive reads
  reader_concurrency_semaphore: add counters for inactive reads
2019-01-14 11:56:43 +02:00
Rafael Ávila de Espíndola
acd6999ba9 Don't use SEASTAR_HAVE_LZ4_COMPRESS_DEFAULT in scylla
The existence of LZ4_compress_default is a property of the lz4
library, not seastar.

With this patch scylla does its own configure check instead of
depending on the one done by seastar.

Signed-off-by: Rafael Ávila de Espíndola <espindola@scylladb.com>
Message-Id: <20190114013737.5395-1-espindola@scylladb.com>
2019-01-14 11:51:20 +02:00
Rafael Ávila de Espíndola
684fb607c4 sstable: handle missing index entry
This patch fixes a crash when the index file is corrupted and we get
an empty index entry list.

Tests: unit (release)

Fixes: 2532

Signed-off-by: Rafael Ávila de Espíndola <espindola@scylladb.com>
Message-Id: <20190110202833.29333-1-espindola@scylladb.com>
2019-01-14 10:47:21 +01:00
Avi Kivity
f5ee466a1c Merge "Cleanup UDT and tuple names creation" from Piotr
"
Currently the logic is scattered between types.*, cql3_types.* and
sstables/mc/writer.cc.

This patchset places all the logic in types.* and makes sure we
correctly add "frozen<...>" and "FrozenType(...)" to the names of
tuples and UDTs.

Fixes #4087

Tests: unit(release)
"

* 'haaawk/4087_v1' of github.com:scylladb/seastar-dev:
  Add comment explaining tuple type name creation
  Add "FrozenType(...)" to UDT name only when it's frozen
  Move "FrozenType(...)" addition to UDT name to user_type_impl
  Add "frozen<...>" to tuple CQL name only when it's frozen
  Move "frozen<...>" addition to tuple CQL name to tuple_type_impl
  Merge make_cql3_tuple_type into tuple_type_impl::as_cql3_type
  Add "frozen<...>" to UDT CQL name only when it's frozen
  Move "frozen<...>" addition to UDT CQL name to user_type_impl
2019-01-13 15:34:24 +02:00
Benny Halevy
b243852a70 sstables: remove duplicated code in data_consume_rows_context CELL_VALUE_BYTES
Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
2019-01-13 14:17:45 +02:00
Benny Halevy
d9e2aa65fc sstables: mc: use api::timestamp_type in write_liveness_info
Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
2019-01-13 14:17:45 +02:00
Benny Halevy
7ea96aa778 sstables: mc: sstable_write encoding_stats are const
Encoding stats are immutable once statistics are sealed.

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
2019-01-13 14:17:45 +02:00
Benny Halevy
5d2d2bf47a mp_row_consumer_k_l::consume_deleted_cell rename ttl param to local_deletion_time
It is actually the local deletion time rather than the ttl

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
2019-01-13 14:17:45 +02:00
Benny Halevy
2c99eb28d8 memtable: don't use encoding_stats epochs as default
Why default to an artificial minimum when you can do better
with zero effort? Track the actual minima in the memtable instead.

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
2019-01-13 14:17:45 +02:00
Benny Halevy
9b78911379 memtable: mc: udpate min_ttl encoding stats for dead row marker
Update min ttl with expired_liveness_ttl (although it's value of max int32
is not expected to affect the minimum).

Fixes #4041

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
2019-01-13 14:17:45 +02:00
Benny Halevy
47964d9ddc memtable: mc: add comment regarding updating encoding stats of collection tombstones
When the row flag has_complex_deletion is set, some collection columns may have
deletion tombstones and some may not. we don't strictly need to update stats
will not affect the encoding_stats anyway.

Fixes #4035

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
2019-01-13 14:17:45 +02:00
Benny Halevy
75ccd29b6a sstables: metadata_collector: add update tombstone stats
Conditionally update timestamp and local_deletion_time stats based on tombstone

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
2019-01-13 14:17:45 +02:00
Benny Halevy
0ae85a126a sstables: assert that delete_time is not live when updating stats
Be compatible with Cassandra

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
2019-01-13 14:17:45 +02:00
Benny Halevy
12e6b503c9 sstables: move update_deletion_time_stats to metadata collector
Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
2019-01-13 14:17:45 +02:00
Benny Halevy
2989b986ef sstables: metadata_collector: introduce update_local_deletion_time_and_tombstone_histogram
Refs #4026
Refs #4033

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
2019-01-13 14:17:45 +02:00
Benny Halevy
bcb1fcd402 sstables: mc: write_liveness_info and write_collection should update tombstone_histogram
Fixes #4033

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
2019-01-13 14:17:45 +02:00
Benny Halevy
0ca4ae658c sstables: update_local_deletion_time for row marker deletion_time and expiration
Fixes #4026

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
2019-01-13 14:17:45 +02:00
Tomasz Grabiec
f12a3e2066 sstables: index_reader: Rename _promoted_index_size
Message-Id: <1547219234-21182-2-git-send-email-tgrabiec@scylladb.com>
2019-01-13 11:29:13 +02:00
Tomasz Grabiec
6c5f8e0eda sstables: index_reader: Simplify offset calculations
Now that continuous_data_consumer::position() is meaningful (since
36dd660), we can use our position in the stream to calculate offsets
instead of duplicating state machine in offset calculations.

The value of position() - data.size() always holds the current offset
in the stream.
Message-Id: <1547219234-21182-1-git-send-email-tgrabiec@scylladb.com>
2019-01-13 11:29:12 +02:00
Avi Kivity
0d52bdcbad install-dependencies.sh: unwrap long lines
Put package names one per line. This makes it easier to review changes,
and to backport changes to this file. No content changes.

Message-Id: <20190112091024.21878-1-avi@scylladb.com>
2019-01-12 14:23:27 +02:00
Avi Kivity
391d1e0fe0 table: const correctness for table::get_sstables() and related
Do not allow write access to the sstable list via this accessor. Luckily
there are no violations, and now we enforce it.
Message-Id: <20190111151049.16953-1-avi@scylladb.com>
2019-01-11 17:39:17 +01:00
Rafael Ávila de Espíndola
cd9ce18874 sstable: rename the is_boundary predicate
The new name makes it clear what is on either side of the boundary.

Signed-off-by: Rafael Ávila de Espíndola <espindola@scylladb.com>
Message-Id: <20190110221324.33618-1-espindola@scylladb.com>
2019-01-11 14:36:49 +02:00
Piotr Jastrzebski
96b880f81c Add comment explaining tuple type name creation
To keep format compatibiliti we never wrap tuple type name
into "org.apache.cassandra.db.marshal.FrozenType(...)".
Even when the tuple is frozen.
This patch adds a comment in tuple_type_impl::make_name that
explains the situation.

For more details see #4087

Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
2019-01-11 12:14:26 +01:00
Piotr Jastrzebski
57e655d716 Add "FrozenType(...)" to UDT name only when it's frozen
At the moment Scylla supports only frozen UDTs but
the code should be able to handle non-frozen UDTs as well.

Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
2019-01-11 12:08:02 +01:00
Piotr Jastrzebski
fc17bd376b Move "FrozenType(...)" addition to UDT name to user_type_impl
This logic belongs in types.hh/types.cc layer.

Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
2019-01-11 12:07:47 +01:00
Piotr Jastrzebski
1fdfc461b8 Add "frozen<...>" to tuple CQL name only when it's frozen
At the moment Scylla supports only frozen tuples but
the code should be able to handle non-frozen tuples as well.

Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
2019-01-11 11:14:30 +01:00
Piotr Jastrzebski
749eee2711 Move "frozen<...>" addition to tuple CQL name to tuple_type_impl
This logic belongs in types.hh/types.cc layer.

Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
2019-01-11 11:14:30 +01:00
Piotr Jastrzebski
7aba17de2c Merge make_cql3_tuple_type into tuple_type_impl::as_cql3_type
This logic belongs in types.hh/types.cc layer.

Signed-off-by: Piotr Jastrzebski <piotr@scylladb.com>
2019-01-11 11:14:30 +01:00