Commit Graph

6633 Commits

Author SHA1 Message Date
Pekka Enberg
85ffaa5330 database: Add truncate() variant that does not look up CF by name
For drop_column_family(), we want to first remove the column_family from
lookup tables and truncate after that to avoid races. Introduce a
truncate() variant that takes keyspace and column_family references.

Signed-off-by: Pekka Enberg <penberg@scylladb.com>
2015-10-06 11:28:54 +03:00
Pekka Enberg
baff913d91 cql3: Fix capture-by-reference in drop_table_statement
We need to capture the "is_local_only" boolean by value because it's an
argument to the function. Fixes an annoying bug where we failed to update
schema version because we pass "true" accidentally. Spotted by ASan.

Signed-off-by: Pekka Enberg <penberg@scylladb.com>
2015-10-06 11:28:54 +03:00
Pekka Enberg
b74a9d99d5 db/schema_tables: Fix UTF-8 serialization
Use the utf8_type to serialize strings instead of using to_bytes().

Signed-off-by: Pekka Enberg <penberg@scylladb.com>
2015-10-05 09:26:15 +02:00
Avi Kivity
21bb5ea5c7 Add .gitattributes file to classify C++ source
With this, diffs become more pleasant to read, as access specifiers
no longer find their way into the hunk header.
2015-10-05 08:51:51 +02:00
Avi Kivity
7c23ec49ae Merge "Support incremental backups" from Glauber
"Generate backups when the configuration file indicates we should;
toggle behavior on/off through the API."
2015-10-04 13:49:20 +03:00
Avi Kivity
4ca4efbc9c Merge "Add cfstats support" from Amnon
"This series adds the functionality that is required so the nodetool cfstats
would work.

It complete the histogram support for read and write latency and add stub for
functionality that is needed but is not supported yet."
2015-10-04 13:38:30 +03:00
Amnon Heiman
a04401d5a4 API: Column family to return sum of the total read and write
This adds the implementation that return the estimated total latency of
the read and of the write.

First the method that sum the count was renamed to get_cf_stats_count
and a method was added named get_cf_stats_sum to sum the estimated
latencies.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-10-04 11:52:19 +03:00
Amnon Heiman
4145a48335 API: return estimated sum from histogram
The histogram that are used typically only sample the data, so to get an
estimation of the actual sum, we use the estimated mean multiply by the
actuall count.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-10-04 11:52:19 +03:00
Amnon Heiman
7d3a0f0789 histogram: initilization and mean calculation
This patch contains two changes to the histogram implementation. It uses
a simpler method to calculate the estimated mean (simply divide the
estimated sum with the number of samples) and to make sure that there
will always be values in the histogram, it start with taking a sample
(when there are no samples) and then use the mask to decide if to sample
or not.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-10-04 11:52:19 +03:00
Amnon Heiman
1f16765140 column family: setting the read and write latency histogram
This patch contains the following changes, in the definition of the read
and write latency histogram it removes the mask value, so the the
default value will be used.

To support the gothering of the read latency histogram the query method
cannot be const as it modifies the histogram statistics.

The read statistic is sample based and it should have no real impact on
performance, if there will be an impact, we can always change it in the
future to a lower sampling rate.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-10-04 11:52:19 +03:00
Amnon Heiman
8e9729371f API: Add functionality to column family to support nodetool cfstats
This adds the API definition with stub implementation that would make
the nodetool cfstats to run.

After this patch the nodetool cfstats command would work, but with stub
imlementation.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-10-04 11:52:19 +03:00
Amnon Heiman
2b59bb2d2b API: storage proxy definition cas read and write
This patch add some missing definition for cas read an write, the API
definition is for completness only as we do not support cas yet.

It also change a part of the definition from storage_service to
storage_proxy as it should be.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-10-04 11:52:19 +03:00
Glauber Costa
700b37635f api: incremental backups
GET and POST methods are implemented in the API.

Signed-off-by: Glauber Costa <glommer@scylladb.com>
2015-10-02 18:23:27 +02:00
Glauber Costa
d4edb82c9e column_family: incremental backups
Only tables that arise from flushes are backed up. Compacted tables are not.
Therefore, the place for that to happen is right after our flush.

Note that due to our sharded architecture, it is possible that in the face of a
value change some shards will backup sstables while others won't.

This is, in theory, possible to mitigate through a rwlock. However, this
doesn't differ from the situation where all tables are coming from a single
shard and the toggle happens in the middle of them.

The code as is guarantees that we'll never partially backup a single sstable,
so that is enough of a guarantee.

Signed-off-by: Glauber Costa <glommer@scylladb.com>
2015-10-02 18:23:27 +02:00
Glauber Costa
a5fb145084 storage_service: incremental backups
Query and set the state of incremental backups. The initial value comes from
the configuration file through the local db reference. Later on, it can be
changed through the interface.

Signed-off-by: Glauber Costa <glommer@scylladb.com>
2015-10-02 18:23:27 +02:00
Glauber Costa
c2b981cd82 pass db::config to storage service as well
We would like to access configuration, but don't want to poke other services
in order to do so.

Signed-off-by: Glauber Costa <glommer@scylladb.com>
2015-10-02 18:23:26 +02:00
Takuya ASADA
05db25bfc5 dist: fix yum install error on CentOS dependency rpms
Not able to install boost packages one by one, install them all at once.

Signed-off-by: Takuya ASADA <syuu@cloudius-systems.com>
2015-10-01 18:09:39 +03:00
Pekka Enberg
5e27d476d4 database: Improve exception error messages
When we convert exceptions into CQL server errors, type information is
not preserved. Therefore, improve exception error messages to make
debugging dtest failures, for example, slightly easier.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-10-01 11:23:46 +03:00
Avi Kivity
01e01a2bd7 main: fix typo in 'check_direct_io_support()' 2015-09-30 20:16:07 +03:00
Glauber Costa
73a1fab273 sanity check the filesystem
For a lot of users, running Scylla in some kinds of filesystems that do not support
O_DIRECT is quite frustrating: it will fail at some point, with random error messages
that aren't really meaningful.

We should try to check for that, and fail with a good error message. Also, since our
performance claims won't really hold in anything other than XFS, we should warn the user
if that is not the setup we encounter.

Fixes #409

Signed-off-by: Glauber Costa <glommer@scylladb.com>
2015-09-30 17:58:27 +03:00
Avi Kivity
3c72977291 Merge seastar upstream
* seastar 432a771...0c402e1 (1):
  > function to check for direct_io capabilities
2015-09-30 17:58:05 +03:00
Gleb Natapov
2998b891f3 storage_proxy: fix crash during background read repair
Lazy digest calculation code introduced a bug in background read repair.
The problem is that digest_read_resolver::resolve() destroys one data
result (it is moved to a caller to be sent as a reply), so during
background digest match there is no value to calculate a digest from.
Copying data to the caller would be most elegant solution, but also
slowest one, so lets just treat the case where there is only one
target queried and skip digest calculation in this case since we know
digest_match() will do nothing.
2015-09-30 16:35:12 +03:00
Avi Kivity
c7be4911f3 Merge seastar upstream
* seastar 283901a...432a771 (2):
  > provide an api to query the filesystem type
  > modernize reactor::stop()
2015-09-30 16:34:30 +03:00
Avi Kivity
c84ed13dac Merge "CQL truncate" from Calle
"First iteration implementation of CQL truncate, transposed from
Origin.

Includes a workable impl. of snapshots, since that is sort of an integral
part of the origin code.

Note: This is still incomplete/incorrect in two ways:

1.) Since we have no way to ensure sstables are finished writing,
    the flush-snapshots are unreliable. Needs basically the same
    fix as correct commitlog management, namely flush queues and
    the ability to wait-force "active" flushes to finish before
    continuing.
2.) System table truncation record saving does not handle sharding.
    This means we basically save the "last" RP from any of the shards
    truncating, and consequently if we have a crash and do commitlog
    replay, we could resurrect truncated data.
    Fix is to have truncation records be per cf+shard just as RP:s
    are per shard.

However, since some people are waiting for at least a semi-functional
truncate, I'm submitting this without fixing the two above issues,
since they can be dealt with in subsequent patches."
2015-09-30 15:46:37 +03:00
Shlomi Livne
9e86b6273c dist: add dependency on xfsprogs
Signed-off-by: Shlomi Livne <shlomi@cloudius-systems.com>
2015-09-30 12:23:59 +03:00
Avi Kivity
9c5a36efd0 logalloc: fix segment free in debug mode
Must match allocation function.
2015-09-30 09:45:25 +02:00
Avi Kivity
489f737351 build: fix order of libasan on link command
gcc 5.1 requires libasan to be first, humor it.
2015-09-30 09:45:25 +02:00
Pekka Enberg
3cb60556e9 cql3: Implement truncate_statement::execute()
Implement the execute() function by using the underlying
truncate_blocking() API from storage proxy.
2015-09-30 09:09:43 +02:00
Pekka Enberg
455d382bac cql3: Implement check_access() and validate() for truncate_statement
Implement the check_access() and validate() functions as stubs to avoid
tripping over the unimplemented exception from cqlsh.
2015-09-30 09:09:43 +02:00
Pekka Enberg
f1fa2ec758 cql3: Move truncate statement implementation to source file
Clean up the truncate_statement class before we start modifying it.
Saves us from recompilation pain.
2015-09-30 09:09:43 +02:00
Calle Wilund
d0864be20f storage_proxy: Implement "truncate_blocking" 2015-09-30 09:09:43 +02:00
Calle Wilund
a8742cd199 to_string: Add << operator for std::set 2015-09-30 09:09:43 +02:00
Calle Wilund
80ade2e2d3 storage_proxy: Add TRUNCATE verb handler 2015-09-30 09:09:43 +02:00
Calle Wilund
37131fcc05 messaging_service: TRUNCATE verb methods 2015-09-30 09:09:42 +02:00
Calle Wilund
68b8d8f48c database: Implement "truncate" for column family
Including snapshotting.
2015-09-30 09:09:42 +02:00
Pekka Enberg
ac4007153d row_cache: Implement clear() helper
We need to clear the row cache for column family truncate operation.
2015-09-30 09:09:42 +02:00
Calle Wilund
7856d7fe02 config: Change "auto_snapshot" to "used" 2015-09-30 09:09:42 +02:00
Calle Wilund
56228fba24 column family: Add "snapshot" operation. 2015-09-30 09:09:42 +02:00
Calle Wilund
428557a66d sstables: add "create_links" method
Adds hard links in requested directory to all components of the sstable
Used for snapshotting
2015-09-30 09:09:42 +02:00
Calle Wilund
cdaafb0505 sstables: Expose directory, max age and all active files 2015-09-30 09:09:42 +02:00
Calle Wilund
c141e15a4a column family: Add "run_with_compaction_disabled" helper
A'la origin. Could as well been RAII.
2015-09-30 09:09:41 +02:00
Calle Wilund
b3c95ce42d system_keyspace: Change truncation record method to use context qp
Align with rest of file (for better or worse). This allows calls from
entity without query_processor handy (i.e. storage_proxy).

Added "minimal" setup method for the "global" state, to facilitate
tests. Doing a full setup either in cql_test_env or after it is created
breaks badly. (Not sure why). So quick workaround.

Updated the current two users (batchlog_manager and commitlog_replayer)
callsites to conform.
2015-09-30 09:09:41 +02:00
Calle Wilund
3abd8b38b6 query_context: Expose query_processor (local) 2015-09-30 09:09:41 +02:00
Calle Wilund
0444029a16 cql_test_env: expose distributed db and query processor 2015-09-30 09:09:41 +02:00
Calle Wilund
713860602b cql3/maps.cc : implement maps::marker::bind
Needed for system table (truncation pos)
2015-09-30 09:09:41 +02:00
Avi Kivity
4ae6c8c875 Merge seastar upstream
* seastar 5fe596a...283901a (10):
  > Add filesystem "link_file"
  > scripts: posix_net_conf.sh: take care of the case with more than 32 CPUs
  > posix: Add explanatory string to throw_system_error_on()
  > tests: fix memory leak in thread_test test_thread_1
  > tests: fix memory leak in timertest cancellation test
  > README: require xfsprogs-devel
  > file: query dma alignment from OS
  > file: separate disk and memory dma alignment
  > scripts: posix_net_conf.sh: Exclude CPU0 in RDS config for EN.
  > README: Add missing Ubuntu 14.04 dependencies to README.md
2015-09-29 19:06:37 +03:00
Avi Kivity
0ec0e32014 Merge "ommitlog: preallocate segments" from Calle
"Modified version of the initial patch (which was reverted), further
reducing the possible delay states in CL allocation and segment management."
2015-09-29 17:02:54 +03:00
Glauber Costa
91408d3cbc warn users on 100 % CPU usage
Although it is technically a seastar problem, most complains about that is
coming from the Scylla side.  I prefer to keep the message here so we can reference
a Scylla issue.

Signed-off-by: Glauber Costa <glommer@scylladb.com>
2015-09-29 16:40:24 +03:00
Avi Kivity
c30feb714c Merge "gossip heart_beat_version + time to wait for seed" from Asias 2015-09-29 15:49:24 +03:00
Avi Kivity
d5d271a45b Merge "improvement on code that handles temporary TOC" from Raphael 2015-09-29 11:47:35 +03:00