Commit Graph

53948 Commits

Author SHA1 Message Date
Amnon Heiman
cb535f1fa9 Add file_type method to the reactor
This method check the file type and retrun an optional value, if the
file does not exists no value is return.

On other errors an exception will be thrown.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-03-30 15:38:41 +03:00
Amnon Heiman
6512d7f7fb http support query parameter and url encoding
Http url encode query parameters by adding a question mark after the uri
with pairs of key=value items.

All values in the url are url decoded.

This add the url encoding and query parameters support

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-03-30 15:38:41 +03:00
Amnon Heiman
be33b31ae2 Httpd Adding function handlers
Most of the time, implementing an http handler consist of a small amount
of logic.

Function handlers are a simplified way of adding such a logic, they
accept a lambda expression of various types and eliminate the need to
create a type for the handlers.

The prefered way of creating a handler is by using the
json_request_function, it would use auto-boxing to return a json object.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-03-30 15:38:41 +03:00
Amnon Heiman
950d921df3 Http server handlers to use future
The http server handlers can sometimes need to perform async operation,
specifically, when reading files from the disk.  To support async
behavior the handlers handle function will return a future, that will be
propagate back, when the future will be ready it will return the reply
to be sent.

When switching from direct function call to future, there is also a need
to switch from references to pointers.

Note that while the request will be discarded, the reply will be
propagate back via the future to the caller.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-03-30 15:38:41 +03:00
Amnon Heiman
c420b75e26 remove leading spaces from headers 2015-03-30 15:38:41 +03:00
Amnon Heiman
0faf9cbb56 Adding back, find_last_of and append to sstring
This adds the back method that return a reference or const reference to
the last char in an sstring.

find_last_of, which return the index of the last occurance of a char in
the string.

And append with append C string to a string.

The logic and definition are similiar to the std::string.

Note that following the std::string definition, calling back on an empty
string is forbiden and the results are undefined.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-03-30 15:38:41 +03:00
Tomasz Grabiec
58a075b657 Merge tag 'avi/collections/select/v2'
From Avi:

Wire up the query path for collections
2015-03-30 14:14:46 +02:00
Avi Kivity
f32a9ec123 tests: add collection query path tests 2015-03-30 14:28:16 +03:00
Avi Kivity
b23d23ac9c db: take into account collection tombstone when converting to value 2015-03-30 14:28:16 +03:00
Avi Kivity
18e7ea58d4 db: add collection-typed fields to system keyspace 2015-03-30 14:28:16 +03:00
Avi Kivity
126fa3cd64 transport: serialize collection types 2015-03-30 14:28:16 +03:00
Avi Kivity
9eeb35b5b3 cql3: support collections in result_set 2015-03-30 14:28:16 +03:00
Avi Kivity
56774f5e38 db: add collection_type_impl::to_bytes(collection_mutation::view) helper 2015-03-30 14:28:16 +03:00
Avi Kivity
86f378e4d7 cql3: convert result set to use serialization format rather than protocol_version 2015-03-30 14:28:16 +03:00
Avi Kivity
aab6d7a173 cql3: convert lists::discarder to C++
And wire it up.
2015-03-30 14:28:16 +03:00
Paweł Dziepak
d3504f90a9 memory: fix trimming of allocated spans
Trimmers may request buffers smaller than n_pages, the original value
passed to allocate_large_and_trim(). That's why t.nr_page should be
used as a final size of the allocated span.

Another issue with the handling of span trimming is the order of operations
when pages from the beginning of the buffer are trimmed. In such case
span is updated to point to the actual beginning of the requested buffer,
but afterwards it is used to retrieve span->span_size value which is expected
to be the size of the originally allocated page span. Because the span
pointer was changed the value is invalid and the trimming doesn't free
all trimmed pages.

Signed-off-by: Paweł Dziepak <pdziepak@quarnos.org>
2015-03-30 14:21:36 +03:00
Avi Kivity
a1dab20422 Merge branch 'tgrabiec/deletes' of github.com:cloudius-systems/seastar-dev into db
Delete support, from Tomasz.
2015-03-30 11:24:22 +03:00
Avi Kivity
4d65825f91 Merge branch 'master' of github.com:cloudius-systems/seastar into db 2015-03-30 11:23:02 +03:00
Avi Kivity
7cf25ce492 distributed: fix use-after-move
distributed::stop() passes the pointer to the instance being destroyed
by reference, in an attempt to keep things clean (by nulling the pointer
after deleting it).  This is illegal, however, since the lambda is moved
in the bowels of submit_to().  In release mode this is optimized away so
the code works, but in debug mode it leads to a crash.

Fix by capturing by value instead (could also have been fixed by switching
the enclosing capture to a reference).

Credit to Gleb for identifying the problem.
2015-03-30 11:18:16 +03:00
Tomasz Grabiec
dc019c6da2 tests: Add tests for deletion scenarios 2015-03-30 09:08:26 +02:00
Tomasz Grabiec
a06f195774 tests: Add more existing tests to the automatic suite 2015-03-30 09:07:01 +02:00
Tomasz Grabiec
ff35be339c tests: cql: Improve error reporting in with_rows() 2015-03-30 09:07:01 +02:00
Tomasz Grabiec
51af0ad8cd to_string: Implement to_string() for std::initializer_list<> 2015-03-30 09:07:01 +02:00
Tomasz Grabiec
14fe96c02e to_string: Implement to_string() using join() 2015-03-30 09:07:01 +02:00
Tomasz Grabiec
e50c5f8305 types: Implement operator<<(ostream&, const bytes_opt&) 2015-03-30 09:07:01 +02:00
Tomasz Grabiec
b52cd91281 db: Properly determine row liveness
In CQL a row is considered as present if its row marker is live or it
has any cells live. The 'insert' statement creates a row
marker. Internally Origin handles that by inserting a special cell
whose name shares the prefix with other cells in that row.

One consequence of this way of things is that when we query a column
slice from sstables we will have to read the whole CQL row, even if
not all columns are queried. We won't have to include the data, but we
will need liveness information in order to commute it with other
mutations, so that we can finally determine if the row is live or not.
2015-03-30 09:07:01 +02:00
Tomasz Grabiec
f155da622f db: Move row limit check to the right place
Could have let in more rows than requested in range queries.
2015-03-30 09:07:01 +02:00
Tomasz Grabiec
f469dd1234 cql3: Fix setter_by_index::execute() to work with empty cells
The list cell may be not set, in which case we should reurn an error
to the user. Current implementation of get_prefetched_list() was
returning collection_mutaion::view in this case, which had an empty
view. Deserialization is not prepared to get an empty view though. I
think we can stick with having non-empty views in the general case and
return an optional in get_prefetched_list().
2015-03-30 09:07:01 +02:00
Tomasz Grabiec
6487e82561 cql3: Fix make_tombstone_just_before()
The timestamp should be decremented, not local deletion time.
2015-03-30 09:07:01 +02:00
Tomasz Grabiec
fb0b2ce159 cql3: Convert grammar rules for 'delete' statement 2015-03-30 09:07:01 +02:00
Tomasz Grabiec
d143f68898 cql3: Convert backend for 'delete' statement 2015-03-30 09:07:01 +02:00
Tomasz Grabiec
30c821d585 tombstone: rename ttl to deletion_time
The current name is confusing to say the least.
2015-03-30 09:07:01 +02:00
Tomasz Grabiec
70341ceb0a db: Return only live cells in query::result::row
The coordinator filters out dead data anyway.
2015-03-30 09:07:01 +02:00
Tomasz Grabiec
4aa74f1312 db: Make mutation_partition::clustered_row() return deletable_row reference 2015-03-30 09:07:00 +02:00
Tomasz Grabiec
808f70b6c3 collection_type_impl: Introduce is_any_live() 2015-03-30 09:07:00 +02:00
Tomasz Grabiec
300bacb3d9 collection_type_impl: Introduce is_empty() 2015-03-30 09:07:00 +02:00
Tomasz Grabiec
95b71f220c types: collection_type_impl: Introduce serialize_mutation_form_only_live()
For serializing only live elements of the collection. Will be needed
by query path.
2015-03-30 09:07:00 +02:00
Tomasz Grabiec
69b4dd76e8 atomic_cell: Add is_live() version which takes a tombstone
It determines if the cell is live given its cointainer has this
tombstone.
2015-03-30 09:07:00 +02:00
Tomasz Grabiec
f30fe80d07 cql3: update_parameters: Add timestamp attribute getter 2015-03-30 09:07:00 +02: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
Tomasz Grabiec
7c104a733e cql3: Optimize binding of a single value
This saves us an allocation of vector for single column restrictions.
2015-03-30 09:07:00 +02:00
Tomasz Grabiec
2902395129 Relax includes 2015-03-30 09:01:59 +02:00
Tomasz Grabiec
ac61d7526e db: Take keyspace name by const& 2015-03-30 09:01:59 +02:00
Tomasz Grabiec
2bcc368138 db: Move implementations to source file 2015-03-30 09:01:59 +02:00
Nadav Har'El
f80ac5a629 sstables: rework compression metadata to fix test.
Previously we had both a "compression" structure (read from the Compression
Info file on disk) and a "compression_metadata" class with additional
information, which std::move()ed parts of the compression structure.
This caused problems for the simplistic sstable-writing test (which does
the non-interesting thing of writing a previously-read sstable).

I'm ashamed to say, fixing this was very hard, because all this code is
built like a house of cards - try to change one thing, and everything
falls apart. After many failed attempts in trying to improve this code, what
I ended up doing is simply *extending* the "compression" structure - the
extended part isn't read or written, but it is in the structure.

We also no longer move a shared pointer to the compression structure,
but rather just an ordinary pointer; The assumption is that the user
will already make sure that the sstable structure will live for the
durations of any processing on it - and the compression structure is just
one part of this sstable structure.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
2015-03-29 16:14:53 +03:00
Shlomi Livne
cbf972c135 tests: set BOOST_TEST_SUITE to the test file name instead of the generic "seastar-tests"
Signed-off-by: Shlomi Livne <shlomi@cloudius-systems.com>
2015-03-29 11:54:01 +03:00
Avi Kivity
abcd745539 tests: add discarder test
UPDATE tab SET my_set_or_map = my_set_or_map - { key1, key2 }
2015-03-27 16:10:35 +01:00
Avi Kivity
5369d6744c cql3: convert operation::subtraction to C++ (for sets, maps) 2015-03-27 16:10:35 +01:00
Avi Kivity
05e03f0b88 cql3: convert sets::discarder to C++ 2015-03-27 16:10:35 +01:00
Avi Kivity
844bdef6ac tests: add sets::setter test
UPDATE tab SET myset = { 1, 2, 3 }
2015-03-27 16:09:41 +01:00