Commit Graph

57 Commits

Author SHA1 Message Date
Paweł Dziepak
dce785089a cql3: make modification statement an execution stage 2017-03-09 09:27:43 +00:00
Calle Wilund
0a4edca756 counters/cql: allow wormholing actual counter values (with shards) via cql
Adds yet another magic function "SCYLLA_COUNTER_SHARD_LIST", indicating that
argument value, which must be a list of tuples <int, UUID, long, long>,
should be inserted as an actual counter value, not update.

This of course to allow counters to be read from sstable loader.

Note that we also need to allow timestamps for counter mutations,
as well as convince the counter code itself to treat the data as
already baked. So ugly wormhole galore.

v2:
* Changed flag names
* More explicit wormholing, bypassing normal counter path, to
  avoid read-before-write etc
* throw exceptions on unhandled shard types in marshalling
v3:
* Added counter id ordering check
* Added batch statement check for mixing normal and raw counter updates
Message-Id: <1487683665-23426-2-git-send-email-calle@scylladb.com>
2017-02-22 09:19:46 +00:00
Duarte Nunes
5187fdbb3a modification_statement: Views aren't updated directly
This patch ensures that views cannot be modified directly through an
insert or update statement.

Signed-off-by: Duarte Nunes <duarte@scylladb.com>
2016-12-20 13:06:11 +00:00
Vlad Zolotarov
6e1d27bed1 cql3::query_processor: add a counter for a number of CQL modification requests ("writes")
- Add a inserts, updates, deletes members to cql_stats.
   - Store cql_stats& in a modification_statement and increment the corresponding counter according to the value of a "type" field.
   - Store cql_stats& in a batch_statement and increment the statistics for each BATCH member.

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2016-11-03 11:49:15 -04:00
Vlad Zolotarov
baa6496816 service::storage_proxy: READ instrumentation: store trace state object in abstract_read_executor
Having a trace_state_ptr in the storage_proxy level is needed to trace code bits in this level.

Signed-off-by: Vlad Zolotarov <vladz@cloudius-systems.com>
2016-07-19 18:21:59 +03:00
Tomasz Grabiec
7328a8eff8 cql: modification_statement: Avoid copying keyspace and table names
Message-Id: <1468574135-4701-1-git-send-email-tgrabiec@scylladb.com>
2016-07-15 10:36:53 +01:00
Avi Kivity
10213c4211 cql3: extract raw modification_statement into raw sub-namespace 2016-05-31 20:53:37 +03:00
Avi Kivity
6728454591 cql3: rationalize extract_result_metadata()
Rather than dynamic_cast<>ing the statement to see whether it is a
select statement, add a virtual function to cql_statement to get the
result metadata.

This is faster and easier to follow.
Message-Id: <1464334638-7971-2-git-send-email-avi@scylladb.com>
2016-05-31 09:12:02 +03:00
Avi Kivity
c8f98c5981 cql3: move cf_statement into raw hierarchy
cql3::statements::cf_statement
    -> cql3::statements::raw::cf_statement
Message-Id: <1464609556-3756-3-git-send-email-avi@scylladb.com>
2016-05-31 09:09:21 +03:00
Avi Kivity
caf8d4f0e6 cql3: separate parsed_statement and parsed_statment::prepared
cql3::statements::parsed_statement
    -> cql3::statements::raw::parsed_statement
  cql3::statements::parsed_statement::prepared
    -> cql3::statements::prepared_statement
Message-Id: <1464609556-3756-2-git-send-email-avi@scylladb.com>
2016-05-31 09:09:10 +03:00
Calle Wilund
3906dc9f0d cql3::statements: Change check_access to future<> + implement 2016-04-19 11:49:05 +00:00
Pekka Enberg
38a54df863 Fix pre-ScyllaDB copyright statements
People keep tripping over the old copyrights and copy-pasting them to
new files. Search and replace "Cloudius Systems" with "ScyllaDB".

Message-Id: <1460013664-25966-1-git-send-email-penberg@scylladb.com>
2016-04-08 08:12:47 +03:00
Pekka Enberg
227e517852 cql3: Move modification_statement implementation to source file 2015-12-18 13:29:58 +02:00
Pekka Enberg
1890d276b9 cql3: Add depends_on_{keyspace|column_family} helper to cql_statement
Signed-off-by: Pekka Enberg <penberg@scylladb.com>
2015-10-15 09:18:52 +03:00
Avi Kivity
d5cf0fb2b1 Add license notices 2015-09-20 10:43:39 +03:00
Calle Wilund
41cbd0d267 Implement modification_statement::execute_internal 2015-07-06 08:21:15 +02:00
Calle Wilund
e99ffef141 cql_statement: change signature of execute_internal.
* Use storage_proxy here as well, even though the execution is 
  by definition local. (Since some local ops are better done 
  via SP anyway)
2015-07-06 08:21:15 +02:00
Gleb Natapov
a338407e29 make storage_proxy object distributed
storage_proxy holds per cpu state now to track clustering, so it has to
be distributed otherwise smp setup does not work.
2015-06-17 15:14:06 +02:00
Calle Wilund
1631ce132e Add "storage_proxy&" argument to cql_statement::validate
To make db, schemas etc reachable
2015-06-03 10:13:52 +02:00
Avi Kivity
750543fc04 cql3: fix shared_ptr misuse in modification_statement
A shared_ptr is mutable, so it must be thread_local, not static.
2015-06-01 17:31:57 +02:00
Pekka Enberg
d50139351f cql3: Use pragma once everywhere
There's no benefit to using C include guards so switch to pragma once
everywhere for consistency.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-05-12 16:32:56 +03:00
Tomasz Grabiec
731a63e371 schema: Embed raw_schema inside schema
Public fields got encapsulated.
2015-04-24 18:01:01 +02:00
Avi Kivity
3d38708434 cql3: pass a database& instance to most foo::raw::prepare() variants
To prepare a user-defined type, we need to look up its name in the keyspace.
While we get the keyspace name as an argument to prepare(), it is useless
without the database instance.

Fix the problem by passing a database reference along with the keyspace.
This precolates through the class structure, so most cql3 raw types end up
receiving this treatment.

Origin gets along without it by using a singleton.  We can't do this due
to sharding (we could use a thread-local instance, but that's ugly too).

Hopefully the transition to a visitor will clean this up.
2015-04-20 16:15:34 +03:00
Avi Kivity
af4061e372 cql3: make modification_statement::get_mutations() public
batch_statement wants it.
2015-04-13 14:55:47 +03:00
Avi Kivity
0bc505b5ad cql3: remove gunk from modification_statement 2015-04-12 11:18:58 +03:00
Tomasz Grabiec
a57414a7c9 cql3: modification_statement: Take conditions vector by value
It will be moved here.
2015-03-30 09:07:00 +02:00
Avi Kivity
b650383d67 cql3: implement read_required_rows()
Some modification statements require reading rows before modifying them;
implement it.
2015-03-26 12:14:01 +02:00
Tomasz Grabiec
e3422525c0 Use column_definition via const reference 2015-03-24 12:03:00 +01:00
Tomasz Grabiec
bdbd5547e3 db: Cleanup key names
clustering_key::one -> clustering_key
clustering_key::prefix::one -> clustering_key_prefix
partition_key::one -> partition_key
clustering_prefix -> exploded_clustering_prefix
2015-03-20 18:59:29 +01:00
Avi Kivity
bdd188f459 Merge branch 'tgrabiec/select' of github.com:cloudius-systems/seastar-dev into db
Preparation for range queries, from Tomasz:

"This series adds static typic for different key variants.

It also changes clustered row map to boost implementation which allows to use
heterogenous keys, so that we can lookup a row by a full prefix without
reserializing it.

Similar change is made to row prefix tombstones."
2015-03-18 12:58:01 +02:00
Pekka Enberg
b40661c330 cql3: Use shared_ptr for prepared statements
Query processor needs to store prepared statements as part of a client
session for PREPARE and EXECUTE requests. Switch from unique_ptr to
shared_ptr in preparation for that.

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
2015-03-18 10:49:41 +02:00
Tomasz Grabiec
1b1af8cdfd db: Introduce types to hold keys
Holding keys and their prefixes as "bytes" is error prone. It's easy
to mix them up (or use wrong types). This change adds wrappers for
keys with accessors which are meant to make misuses as difficult as
possible.

Prefix and full keys are now distinguished. Places which assumed that
the representation is the same (it currently is) were changed not to
do so. This will allow us to introduce more compact storage for non-prefix
keys.
2015-03-17 15:56:29 +01:00
Tomasz Grabiec
609e893055 unimplemented: Separate subject from behavior
You can now do:

  fail(unimplemented::cause::PAGING);

and:

  warn(unimplemented::cause::PAGING);
2015-02-27 10:48:56 +01:00
Tomasz Grabiec
0f2a1dffb6 cql3: Pass bound term count around as unsigned integer
It's compared with size_t and is set from size_t. To avoid ugly casts
we can store it as unsigned int. It's always positive anyway. Origin
uses signed int ("int") because there is no unsigned int in Java.
2015-02-12 19:40:58 +01:00
Tomasz Grabiec
f3130d395f cql3: Return shared_ptr<result_message> instead of optional
It's polymorphic type in Origin.
2015-02-12 19:40:57 +01:00
Tomasz Grabiec
3d7122dc90 cql3: Do not fail because of unimplemented check_access()
Turn it into a warning.
2015-02-12 19:40:57 +01:00
Tomasz Grabiec
524c6a4e40 cql3: Implement modification_statement::validate() 2015-02-12 19:40:57 +01:00
Tomasz Grabiec
a7cf24b010 cql3: Take cf_name as shared_ptr<>
It's allocated as one in the parser so it's easier to just pass it
along. Later we may decide to change it to unique_ptr or optional<>.
2015-02-12 19:40:57 +01:00
Tomasz Grabiec
9530a372cc cql3: Take reference to storage_proxy and call instance methods 2015-02-09 10:28:44 +01:00
Tomasz Grabiec
800ba79efa db: Drop api:: namespace from mutation model classes
In preparation for merging into database.hh
2015-02-09 10:28:44 +01:00
Tomasz Grabiec
87597ba3a4 cql3: Fix typo in process_where_clause() 2015-02-09 10:28:43 +01:00
Tomasz Grabiec
987cdaa6cb cql3: Optimise includes 2015-02-09 10:28:09 +01:00
Tomasz Grabiec
12af207219 cql3: Add missing virtual/override 2015-02-09 10:28:09 +01:00
Tomasz Grabiec
208fdfab45 cql3: Move methods from header to source file 2015-02-09 10:28:09 +01:00
Tomasz Grabiec
bad22fe50e cql3: Convert ModificationStatement.Parsed.prepare()
Together with ParsedInsert descendant.
2015-02-04 10:29:05 +01:00
Tomasz Grabiec
d243fb7a01 cql3: Pass sstrings as const& where applicable 2015-02-04 10:29:00 +01:00
Tomasz Grabiec
4478da3c45 cql3: make modification_statement::_column_operations mutable
Note: "final" in Java means that the reference can't change, but the
object pointed to by the reference can.
2015-02-04 10:29:00 +01:00
Tomasz Grabiec
8655825a2a cql3: Remove already converted code 2015-02-04 10:28:59 +01:00
Tomasz Grabiec
5710a99f44 cql3: Fix mis-overrides of cql_statement::execute*()
The method may defer so the result is wrapped in future<>.

I think we don't need to wrap arguments in shared_ptr<> because they
may come from the request state object.
2015-02-04 10:28:51 +01:00
Tomasz Grabiec
496e5c651f cql3: Convert more of ModificationStatement 2015-01-29 19:41:00 +01:00