Pekka Enberg
07e73bdb26
cql3/Cql.g: Implement convert_property_map() helper
...
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com >
2015-03-12 10:29:51 +02:00
Pekka Enberg
6f15c18f0a
cql3: Convert KSPropDefs to C++, take #2
...
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com >
2015-03-12 10:29:51 +02:00
Pekka Enberg
57e6c63b7a
cql3: Convert statements.PropertyDefinitions to C++, take 3
...
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com >
2015-03-12 10:29:51 +02:00
Tomasz Grabiec
40d3e6c349
Cql.g: Convert rules for select statement
2015-03-11 16:01:14 +01:00
Tomasz Grabiec
09f0c5bb6d
Cql.g: Fix result of unaliasedSelector rule not being set
2015-03-11 16:01:14 +01:00
Tomasz Grabiec
f7aa2a58bd
cql3: Convert SelectStatement and SelectStatement.RawStatement
2015-03-11 16:01:13 +01:00
Tomasz Grabiec
5458d7bf7f
cql3: Convert StatementRestrictions
2015-03-11 16:01:10 +01:00
Tomasz Grabiec
e202a13fff
cql3: Convert SingleColumnPrimaryKeyRestrictions
2015-03-11 14:56:11 +01:00
Tomasz Grabiec
f2b9bbe74a
cql3: Convert ReversePrimaryKeyRestrictions
2015-03-11 14:56:11 +01:00
Tomasz Grabiec
ff8adf93a2
cql3: Convert ForwardingPrimaryKeyRestrictions
2015-03-11 14:56:11 +01:00
Tomasz Grabiec
b49dc80eb5
cql3: Convert SingleColumnRestrictions
2015-03-11 14:56:11 +01:00
Tomasz Grabiec
25db056a8b
cql3: Convert SingleColumnRestriction.Contains
2015-03-11 14:56:10 +01:00
Tomasz Grabiec
3e1c3a6b09
cql3: Convert Restrictions and PrimaryKeyRestrictions
2015-03-11 14:56:10 +01:00
Tomasz Grabiec
2946bff496
cql3: Remove AbstractPrimaryKeyRestrictions.java
...
It will not be used in converted code.
2015-03-11 14:56:10 +01:00
Tomasz Grabiec
3556ee9d45
cql3: Expose restricion::merge_with()
2015-03-11 14:56:10 +01:00
Tomasz Grabiec
a80a9a7253
cql3: Add restriction::to_string()
2015-03-11 14:56:10 +01:00
Tomasz Grabiec
bbe32bf26b
cql3: Take vector by const& in abstract_restricion::uses_function()
2015-03-11 14:56:10 +01:00
Tomasz Grabiec
71756de650
cql3: single_column_restriction: keep column_definition& as const
2015-03-11 14:56:10 +01:00
Tomasz Grabiec
8912417dd0
cql3: Convert classes from org.cassandra.cql3.selection package
2015-03-11 14:56:10 +01:00
Tomasz Grabiec
335f69070a
cql3: Convert ResultSet and Metadata
2015-03-11 14:56:10 +01:00
Tomasz Grabiec
7596a735f2
cql3: Add term::to_string()
...
There is some code which tries to print a term. Some terms are
printable, but not all of them. Those who don't override to_string()
will get the default implementation.
2015-03-11 14:56:10 +01:00
Tomasz Grabiec
137a192779
cql3: Add missing include to abstract_restriction.hh
2015-03-11 14:56:10 +01:00
Tomasz Grabiec
f7c425fdd9
cql3: Introduce column_identifier::name()
2015-03-11 14:56:10 +01:00
Tomasz Grabiec
fe12ad6ae1
cql3: Move argument in column_identifier constructor
2015-03-11 14:56:10 +01:00
Tomasz Grabiec
243d1959c9
cql3: Support for moving data from variable_specifications
2015-03-11 14:56:10 +01:00
Tomasz Grabiec
0a63919d21
cql3: Fix names in declaration of restriction::uses_function()
2015-03-11 14:56:10 +01:00
Tomasz Grabiec
4c7480ce3b
cql3: Introduce to_identifier(column_definition&)
2015-03-11 14:56:09 +01:00
Tomasz Grabiec
70059ac1d4
cql3: Add to_identifiers()
...
Converts org.apache.cassandra.config.ColumnDefinition#toIdentifiers(List<ColumnDefinition>);
2015-03-11 14:56:09 +01:00
Tomasz Grabiec
3db3207b85
Merge branch seastar-dev.git 'collections'
...
Collections support from Avi.
2015-03-05 20:25:48 +01:00
Avi Kivity
a6b692612a
cql3: convert grammer for setting a collection element
2015-03-05 18:11:37 +02:00
Avi Kivity
1fcce7cdcb
cql3: convert operation::set_element
2015-03-05 18:11:37 +02:00
Avi Kivity
7a94b0c0a3
cql3: convert maps::setter_by_key
...
Basic operation to set a single map element to a value.
2015-03-05 18:11:31 +02:00
Avi Kivity
4602d86dc9
cql3: convert maps::key_spec_of/maps::value_spec_of
2015-03-05 15:31:52 +02:00
Pekka Enberg
817486d27f
cql3: Convert schema_altering_statement::execute() to C++
...
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com >
2015-03-05 15:06:31 +02:00
Avi Kivity
bb58deadc0
cql3: add virtual destructor to class operation
2015-03-05 14:03:36 +02:00
Pekka Enberg
c72f5796c4
cql3: Fix create_keyspace_statement::prepare()
...
Move enable_shared_from_this to the concrete create_keyspace_statement
class to make sure prepare() instantiates the right type. Fixes "pure
virtual method called" errors when calling create_keyspace_statement
methods that are pure virtual in the base class.
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com >
2015-03-05 12:20:39 +01:00
Avi Kivity
a49330095a
db: wrap bytes in atomic_cell format
...
We use bytes for many different things, and it is easy to get confused as
to what format the data is actually in.
Fix that for atomic_cell by proving wrappers. atomic_cell::one corresponds
to a bytes object holding exactly one atomic cell, and atomic_cell::view is
a bytes_view to an atomic_cell. The static functions of atomic_cell itself
are privatized to prevent the unwashed masses from using them on the wrong
objects.
Since a row entry can hold either a an atomic cell, or a collection,
depending on the schema, also introduce a variant type
atomic_cell_or_collection and allow the user to pick the type explicitly.
Internally both are stored as bytes object.
2015-03-04 15:49:35 +02:00
Nadav Har'El
6f2a2529a2
add "double" and "float" types
...
Implement "double" and "float" cql types.
This implementation doesn't touch serialization.hh (which should be
eventually removed) and rather follows the other examples in types.cc.
It is relatively ugly, because of all the cleverness of our "general"
byte swapping implementation actually works only for integer types, and
we need to get it to work for float/double as well.
Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com >
2015-03-04 10:54:19 +01:00
Pekka Enberg
6751f7a305
cql3/Cql.g: Create keyspace statement
...
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com >
2015-03-03 11:57:43 +02:00
Pekka Enberg
4b384ef705
cql3/Cql.g: Properties
...
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com >
2015-03-03 11:57:43 +02:00
Pekka Enberg
79caf1bc95
cql3: Fix schema_altering_statement::uses_function()
...
The schema_altering_statement class must implement
cql_statement::uses_function() to be instantiable.
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com >
2015-03-03 11:57:43 +02:00
Pekka Enberg
8e0903fdbd
cql3: Convert statements.CreateKeyspaceStatement to C++
...
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com >
2015-03-03 11:57:43 +02:00
Pekka Enberg
48f21ff39b
cql3: Convert statements.PropertyDefinitions to C++, take 2
...
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com >
2015-03-03 11:30:18 +02:00
Tomasz Grabiec
74295a9759
db: Use opaque bytes for cell values instead of boost::any
...
Storing cells as boost::any objects makes us use expensive
boost::any_cast to access the data. This change replaces boost::any
with bytes object which holds the value in serialized form (the same
as will be used for on-wire format).
If the cell type is atomic, you use fields accessors defined in
atomic_cell class, eg like this:
if (column.type.is_atomic()) {
if (atomic_cell::is_live(c) {
auto timestamp = atomic_cell::timestamp(c);
...
}
}
Eventually we could switch to a more officient semi-serialized form
with native byte order but I don't want to introduce it just yet for
simplicity.
2015-02-27 10:59:43 +01:00
Tomasz Grabiec
1a0ffdfb99
schema: Encapsulate column sets
2015-02-27 10:48:56 +01:00
Tomasz Grabiec
b77367dabe
cql3: Simplify primary key membership checks
2015-02-27 10:48:56 +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
1dfc7267db
cql3: Fix formatting in relation.hh
2015-02-27 10:46:05 +01:00
Nadav Har'El
8701273006
Add inet type
...
In v2: rebase, and add a more descriptive exception if trying to deserialize
an ipv6 address.
Add to list of types the Internet address type, known as INET in CQL
or as InetAddressType in the Cassandra code.
I based this code on stuff I found in InetAddressType and
InetAddressSerializer in the Cassandra code.
Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com >
2015-02-25 15:57:05 +01:00
Tomasz Grabiec
ec262ab3e9
cql3: Fix use-after-free on statement
...
Reported by Pekka:
READ of size 8 at 0x611000062ee8 thread T6
#0 0x64d20f in std::unique_ptr<cql3::attributes, std::default_delete<cql3::attributes> >::get() const /usr/include/c++/4.9.2/bits/unique_ptr.h:305
#1 0x641532 in std::unique_ptr<cql3::attributes, std::default_delete<cql3::attributes> >::operator->() const /usr/include/c++/4.9.2/bits/unique_ptr.h:299
#2 0x63af5b in cql3::statements::modification_statement::get_time_to_live(cql3::query_options const&) const cql3/statements/modification_statement.hh:190
#3 0x61e072 in _ZZN4cql310statements22modification_statement22make_update_parametersE13lw_shared_ptrISt6vectorI13basic_sstringIcjLj31EESaIS5_EEES2_IS3_INSt12experimental8optionalIS5_EESaISB_EEERKNS_13query_optionsEblENKUlT_E_clINSA_ISt13unordered_mapIS5_St3mapIjN5boost3anyESt4lessIjESaISt4pairIKjSO_EEE15serialized_hash16serialized_equalSaISR_IKS5_SV_EEEEEEEDaSI_ (/home/penberg/urchin/build/debug/seastar+0x61e072)
#4 0x625ce1 in apply core/apply.hh:34
#5 0x625df4 in apply<cql3::statements::modification_statement::make_update_parameters(lw_shared_ptr<std::vector<basic_sstring<char, unsigned int, 31u> > >, lw_shared_ptr<std::vector<std::experimental::optional<basic_sstring<char, unsigned int, 31u> > > >, const cql3::query_options&, bool, int64_t)::<lambda(auto:18)>, std::experimental::optional<std::unordered_map<basic_sstring<char, unsigned int, 31u>, std::map<unsigned int, boost::any, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, boost::any> > >, serialized_hash, serialized_equal, std::allocator<std::pair<const basic_sstring<char, unsigned int, 31u>, std::map<unsigned int, boost::any, std::less<unsigned int>, std::allocator<std::pair<unsigned int const, boost::any> > > > > > > > core/apply.hh:41
#6 0x628354 in _ZZN6futureIINSt12experimental8optionalISt13unordered_mapI13basic_sstringIcjLj31EESt3mapIjN5boost3anyESt4lessIjESaISt4pairIKjS7_EEE15serialized_hash16serialized_equalSaISA_IKS4_SE_EEEEEEE4thenIZN4cql310statements22modification_statement22make_update_parametersE13lw_shared_ptrISt6vectorIS4_SaIS4_EEESR_ISS_INS1_IS4_EESaISW_EEERKNSO_13query_optionsEblEUlT_E_EENSt9result_ofIFT_OSL_EE4typeEOS16_NSt9enable_ifIXsr9is_futureIIS1A_EE5valueEPvE4typeEENUlRS13_E_clI12future_stateIISL_EEEEDaRS16_ (/home/penberg/urchin/build/debug/seastar+0x628354)
#7 0x628503 in _ZZN6futureIINSt12experimental8optionalISt13unordered_mapI13basic_sstringIcjLj31EESt3mapIjN5boost3anyESt4lessIjESaISt4pairIKjS7_EEE15serialized_hash16serialized_equalSaISA_IKS4_SE_EEEEEEE8scheduleIZNSM_4thenIZN4cql310statements22modification_statement22make_update_parametersE13lw_shared_ptrISt6vectorIS4_SaIS4_EEESS_IST_INS1_IS4_EESaISX_EEERKNSP_13query_optionsEblEUlT_E_EENSt9result_ofIFT_OSL_EE4typeEOS17_NSt9enable_ifIXsr9is_futureIIS1B_EE5valueEPvE4typeEEUlRS14_E_EEvS1C_EN21task_with_ready_state3runEv (/home/penberg/urchin/build/debug/seastar+0x628503)
#8 0x7a6600 in reactor::run_tasks(circular_buffer<std::unique_ptr<task, std::default_delete<task> >, std::allocator<std::unique_ptr<task, std::default_delete<task> > > >&, unsigned long) core/reactor.cc:691
#9 0x7a8ccc in reactor::run() core/reactor.cc:785
#10 0x7b0bef in smp::configure(boost::program_options::variables_map)::{lambda()#1}::operator()() const (/home/penberg/urchin/build/debug/seastar+0x7b0bef)
#11 0x84011d in _M_invoke /usr/include/c++/4.9.2/functional:2039
#12 0x860c97 in std::function<void ()>::operator()() const /usr/include/c++/4.9.2/functional:2439
#13 0x8e45fa in posix_thread::start_routine(void*) core/posix.cc:50
#14 0x7f25abb05529 in start_thread (/lib64/libpthread.so.0+0x7529)
#15 0x7f25ab84179c in __clone (/lib64/libc.so.6+0x10079c)
0x611000062ee8 is located 40 bytes inside of 216-byte region [0x611000062ec0,0x611000062f98)
freed by thread T6 here:
#0 0x7f25af4bf64f in operator delete(void*) (/lib64/libasan.so.1+0x5864f)
#1 0x684dbf in shared_ptr_count_for<cql3::statements::update_statement>::~shared_ptr_count_for() core/shared_ptr.hh:261
#2 0x63de36 in shared_ptr<cql3::cql_statement>::~shared_ptr() core/shared_ptr.hh:326
#3 0x772711 in cql3::statements::parsed_statement::prepared::~prepared() cql3/statements/parsed_statement.hh:60
#4 0x77591d in std::default_delete<cql3::statements::parsed_statement::prepared>::operator()(cql3::statements::parsed_statement::prepared*) const /usr/include/c++/4.9.2/bits/unique_ptr.h:76
#5 0x772cef in std::unique_ptr<cql3::statements::parsed_statement::prepared, std::default_delete<cql3::statements::parsed_statement::prepared> >::~unique_ptr() /usr/include/c++/4.9.2/bits/unique_ptr.h:236
#6 0x76c8ea in cql3::query_processor::process(std::experimental::basic_string_view<char, std::char_traits<char> > const&, service::query_state&, cql3::query_options&) cql3/query_processor.cc:51
#7 0x554e9c in cql_server::connection::process_query(unsigned short, temporary_buffer<char>) transport/server.cc:408
#8 0x553a7a in cql_server::connection::process_request()::{lambda(future<std::experimental::optional<cql_binary_frame_v3> >&&)#1}::operator()(future<std::experimental::optional<cql_binary_frame_v3> >&&) const::{lambda(temporary_buffer<char>)#1}::operator()(temporary_buffer) const (/home/penberg/urchin/build/debug/seastar+0x553a7a)
#9 0x55df9e in apply core/apply.hh:34
#10 0x55e0b1 in apply<cql_server::connection::process_request()::<lambda(future<std::experimental::optional<cql_binary_frame_v3> >&&)>::<lambda(temporary_buffer<char>)>, temporary_buffer<char> > core/apply.hh:41
#11 0x55e43b in then<cql_server::connection::process_request()::<lambda(future<std::experimental::optional<cql_binary_frame_v3> >&&)>::<lambda(temporary_buffer<char>)> > core/future.hh:480
#12 0x5542c1 in cql_server::connection::process_request()::{lambda(future<std::experimental::optional<cql_binary_frame_v3> >&&)#1}::operator()(future<std::experimental::optional<cql_binary_frame_v3> >&&) const (/home/penberg/urchin/build/debug/seastar+0x5542c1)
#13 0x564846 in _ZZNO6futureIINSt12experimental8optionalI19cql_binary_frame_v3EEEE12then_wrappedIZN10cql_server10connection15process_requestEvEUlOS4_E_EENSt9result_ofIFT_S4_EE4typeEOSB_ENUlRT_E_clI12future_stateIIS3_EEEEDaRSB_ (/home/penberg/urchin/build/debug/seastar+0x564846)
#14 0x5649c7 in _ZZN7promiseIINSt12experimental8optionalI19cql_binary_frame_v3EEEE8scheduleIZNO6futureIIS3_EE12then_wrappedIZN10cql_server10connection15process_requestEvEUlOS7_E_EENSt9result_ofIFT_S7_EE4typeEOSE_EUlRT_E_EEvSI_EN15task_with_state3runEv (/home/penberg/urchin/build/debug/seastar+0x5649c7)
#15 0x7a6600 in reactor::run_tasks(circular_buffer<std::unique_ptr<task, std::default_delete<task> >, std::allocator<std::unique_ptr<task, std::default_delete<task> > > >&, unsigned long) core/reactor.cc:691
#16 0x7a8ccc in reactor::run() core/reactor.cc:785
#17 0x7b0bef in smp::configure(boost::program_options::variables_map)::{lambda()#1}::operator()() const (/home/penberg/urchin/build/debug/seastar+0x7b0bef)
#18 0x84011d in _M_invoke /usr/include/c++/4.9.2/functional:2039
#19 0x860c97 in std::function<void ()>::operator()() const /usr/include/c++/4.9.2/functional:2439
#20 0x8e45fa in posix_thread::start_routine(void*) core/posix.cc:50
#21 0x7f25abb05529 in start_thread (/lib64/libpthread.so.0+0x7529)
Signed-off-by: Tomasz Grabiec <tgrabiec@cloudius-systems.com >
2015-02-25 12:48:54 +01:00