Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
cadaad1
main branch prepared for Interface integration
Riuzan Nov 13, 2019
5d46dd3
main branch prepared for Interface integration
Riuzan Nov 13, 2019
fd959c4
add_data_model, mock classes, tests added
Riuzan Nov 13, 2019
cda67f1
2 missing files
Riuzan Nov 13, 2019
6be87b6
travis modification
Riuzan Nov 13, 2019
51aa636
required options
Riuzan Nov 13, 2019
febf329
fixing travis
Riuzan Nov 14, 2019
bebeabc
fixing travis
Riuzan Nov 14, 2019
c9faf84
fixing travis
Riuzan Nov 18, 2019
00593ae
fixing travis
Riuzan Nov 18, 2019
721e0ce
change in the structure, init initializes storage
Riuzan Nov 18, 2019
897b5be
adding init file
Riuzan Nov 18, 2019
28bbf15
changes requested
Riuzan Nov 19, 2019
28fbedf
Revert setup.py
polsm91 Nov 19, 2019
4f1ec63
requested changes
Riuzan Nov 19, 2019
112f438
Remove unnecessary code
polsm91 Nov 19, 2019
084624d
Remove mocktools
polsm91 Nov 19, 2019
3646766
load array returns a list
Riuzan Nov 20, 2019
a2e9431
load array returns a list / checks inside function
Riuzan Nov 20, 2019
5e447c9
some tests changed, added type check
Riuzan Nov 21, 2019
e4f19e1
compacting code
Riuzan Nov 21, 2019
d071a24
requested changes
Riuzan Nov 21, 2019
dc1adbd
Merge branch 'StorageModules' into StorageModules_add_data_model
Riuzan Nov 21, 2019
1417a5e
Merge pull request #281 from bsc-dd/StorageModules_add_data_model
Riuzan Nov 21, 2019
d6a8755
implementation + tests
Riuzan Nov 22, 2019
2a315c4
fix class
Riuzan Nov 22, 2019
633f9ff
delete persistent added
Riuzan Nov 25, 2019
7be7ebf
initial version, (to be modified)
Riuzan Nov 25, 2019
f799965
create_hcache fixed, added new tests and check
Riuzan Nov 25, 2019
5e3e2d9
create hcache re-structure
Riuzan Nov 25, 2019
f4bf864
we support str->text, only check hcache_by_class and some tests modified
Riuzan Nov 26, 2019
281105d
basic implementation + tests
Riuzan Nov 27, 2019
202d1e6
register modification
Riuzan Nov 27, 2019
9fde14e
basic implementation + tests
Riuzan Nov 27, 2019
03fc691
get record code
Riuzan Nov 28, 2019
1852ddc
Revert "get record code"
Riuzan Nov 28, 2019
a309da3
some functions fixed + tests, 1 will fail
Riuzan Nov 29, 2019
21e7c6b
register pers fixed
Riuzan Nov 29, 2019
9696aa0
register modif
Riuzan Nov 29, 2019
7944f63
register modif
Riuzan Nov 29, 2019
44a86dd
reg changes
Riuzan Dec 2, 2019
1fdf8d3
discuss StorageObj case
Riuzan Dec 2, 2019
9fd1c16
added NameTuple in the tests
Riuzan Dec 3, 2019
a79c7b1
get_record implemented (base) + tests
Riuzan Dec 3, 2019
8c4536b
put_record accepts StorageObj
Riuzan Dec 3, 2019
bd5963d
Merge branch 'StorageModules_put_records' of https://github.com/bsc-d…
Riuzan Dec 3, 2019
c091c64
tests get_record using storageobj
Riuzan Dec 3, 2019
891b61a
create hcache modified, support so
Riuzan Dec 3, 2019
2b68860
abstract method fixed
Riuzan Dec 3, 2019
754aa5c
abstract method fixed
Riuzan Dec 3, 2019
3fae7ea
put record supports less values, some tests fixed
Riuzan Dec 4, 2019
fb3c3eb
cache desactivated
Riuzan Dec 4, 2019
7004dd3
cache desactivated
Riuzan Dec 4, 2019
16eac11
tests working
Riuzan Dec 4, 2019
46f6be9
tests modifying a tuple
Riuzan Dec 4, 2019
066135c
can bind nulls
Riuzan Dec 9, 2019
e9f8260
in python 3.8 dicts are already ordered
Riuzan Dec 9, 2019
fd50c1b
in python 3.8 dicts are already ordered
Riuzan Dec 9, 2019
d313c74
it does not work, we need the values
Riuzan Dec 11, 2019
bea4db5
first approach
Riuzan Dec 16, 2019
0febc58
first approach
Riuzan Dec 16, 2019
2078006
chaging the structure
Riuzan Dec 16, 2019
fdcd475
no check for StorageObj
Riuzan Dec 16, 2019
0807587
removed some uncessary checks
Riuzan Dec 16, 2019
8afb77a
get record simplified
Riuzan Dec 16, 2019
8a870cd
unecessary code removed
Riuzan Dec 17, 2019
418e1bc
split working correctly, typing declaration fixed
Riuzan Dec 17, 2019
aade134
delete persistent deletes istorage entry
Riuzan Dec 17, 2019
284465d
fixes
Riuzan Dec 18, 2019
d059fbe
get data locality first approach
Riuzan Dec 18, 2019
4b2ae32
tools file
Riuzan Dec 18, 2019
ca66777
tools file added, hope now it works
Riuzan Dec 18, 2019
0bee18e
changes requested
Riuzan Dec 18, 2019
b3aac82
changes requested commited
Riuzan Dec 19, 2019
9927806
tuple comparison
Riuzan Dec 19, 2019
80e2edc
origin
Riuzan Dec 19, 2019
d1ebb2f
Merge pull request #284 from bsc-dd/StorageModules_register
Riuzan Dec 19, 2019
3101d01
branch like the base one
Riuzan Dec 19, 2019
3f2503e
merge
Riuzan Jan 7, 2020
1c28670
Update CMakeLists.txt
Riuzan Jan 7, 2020
0f835fb
Revert "Update CMakeLists.txt"
Riuzan Jan 7, 2020
0d95834
Merge pull request #286 from bsc-dd/StorageModules_put_records
Riuzan Jan 7, 2020
0252bba
Merge pull request #287 from bsc-dd/StorageModules_get_records
Riuzan Jan 7, 2020
19d2eb2
cmake updated
Riuzan Jan 8, 2020
3bd0603
Merge branch 'StorageModules' of https://github.com/bsc-dd/hecuba int…
Riuzan Jan 8, 2020
8b9ed62
fix some errors during the merge
Riuzan Jan 8, 2020
14bb946
uuid checking method changed
Riuzan Jan 24, 2020
d64c03b
review
Riuzan Jan 24, 2020
ab85537
req changes
Riuzan Jan 28, 2020
51ca59a
review changes
Riuzan Jan 29, 2020
a54be5c
fix
Riuzan Jan 29, 2020
a4865bc
merge
Riuzan Jan 30, 2020
b839069
merge
Riuzan Jan 30, 2020
4a07575
Merge pull request #290 from bsc-dd/StorageModules_split
Riuzan Jan 30, 2020
54f758f
add more tests
Riuzan Jan 30, 2020
6e7f6aa
Merge branch 'StorageModules' of https://github.com/bsc-dd/hecuba int…
Riuzan Jan 30, 2020
a16240b
testing ..
Riuzan Feb 11, 2020
9631942
validating python / c++
Riuzan Feb 14, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 1 addition & 26 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ env:
matrix:
- TEST_CASSANDRA_VERSION=3.11.4

stages:
- test
- build_wheel_manylinux2010
- build_wheel_manylinux1

before_install:
- source .travis/install_openjdk8.sh

Expand All @@ -40,27 +35,7 @@ addons:

# command to run tests
script:
- nosetests --with-coverage -v -s hecuba_py/tests/*.py
- nosetests --with-coverage -v -s hecuba_py/tests/withcassandra

jobs:
include:
- stage: build_wheel_manylinux2010
sudo: required
env:
- DOCKER_IMAGE=quay.io/pypa/manylinux2010_x86_64 PLAT=manylinux2010_x86_64
install:
- docker pull $DOCKER_IMAGE
script:
- docker run --rm -e PLAT=$PLAT -v `pwd`:/io $DOCKER_IMAGE /io/.travis/build-wheels.sh
- stage: build_wheel_manylinux1
sudo: required
env:
- DOCKER_IMAGE=quay.io/pypa/manylinux1_x86_64 PLAT=manylinux1_x86_64
install:
- docker pull $DOCKER_IMAGE
script:
- docker run --rm -e PLAT=$PLAT -v `pwd`:/io $DOCKER_IMAGE /io/.travis/build-wheels.sh
- nosetests --with-coverage -v -s storage/cql_iface/tests/api_tests.py

# Push the results back to codecov
after_success:
Expand Down
1 change: 1 addition & 0 deletions ccm/ccm
Submodule ccm added at 275699
4 changes: 2 additions & 2 deletions hecuba_core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ if (NOT TBB_FOUND)
ExternalProject_Add(
TBB
DOWNLOAD_DIR ${CMAKE_CURRENT_LIST_DIR}/dependencies
URL "https://www.threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb2017_20161128oss_src.tgz"
URL_HASH SHA1=2c451a5bcf6fc31487b98b4b29651c369874277c
URL "https://github.com/intel/tbb/archive/v2020.0.tar.gz"
URL_HASH SHA1=0b8e9db0c7672eea6207e6749e14ec80b1b4eaa7
CMAKE_COMMAND echo
BUILD_COMMAND make tbb tbb_build_prefix=${build_prefix}
BUILD_IN_SOURCE 1
Expand Down
14 changes: 3 additions & 11 deletions hecuba_core/src/TableMetadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ uint16_t TableMetadata::compute_size_of(const ColumnMeta &CM) const {
return sizeof(int32_t);
}
case CASS_VALUE_TYPE_TIMESTAMP: {
//TODO
std::cerr << "Timestamp data type supported yet" << std::endl;
break;
return sizeof(int64_t);
}
case CASS_VALUE_TYPE_UUID: {
return sizeof(uint64_t *);
Expand All @@ -58,16 +56,10 @@ uint16_t TableMetadata::compute_size_of(const ColumnMeta &CM) const {
break;
}
case CASS_VALUE_TYPE_DATE: {
std::cerr << "Date data type supported yet" << std::endl;

//TODO
break;
return sizeof(int64_t);
}
case CASS_VALUE_TYPE_TIME: {
std::cerr << "Time data type supported yet" << std::endl;
//TODO

break;
return sizeof(int64_t);
}
case CASS_VALUE_TYPE_SMALL_INT: {
return sizeof(int16_t);
Expand Down
20 changes: 18 additions & 2 deletions hecuba_core/src/TupleRow.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <stdlib.h>
#include <vector>
#include <cassandra.h>

#include <set>

#include "TableMetadata.h"

Expand All @@ -35,6 +35,10 @@ class TupleRow {


/* Set methods */
inline void set_keys(std::set<std::string> keys) {
this->payload->set_keys(keys);
}

inline void setNull(uint32_t position) {
this->payload->setNull(position);
}
Expand All @@ -47,8 +51,11 @@ class TupleRow {
this->payload->setTimestamp(timestamp);
}


/* Get methods */
inline const std::set<std::string> get_keys() const {
return this->payload->get_keys();
}

inline bool isNull(uint32_t position) const {
return this->payload->isNull(position);
}
Expand Down Expand Up @@ -100,6 +107,7 @@ class TupleRow {
size_t ptr_length;
std::vector<uint32_t> null_values;
int64_t timestamp;
std::set<std::string> keys;


/* Constructors */
Expand All @@ -122,6 +130,11 @@ class TupleRow {
* we need to access the position must be divided by 32. This is accomplished by
* doing bit shifting (5 positions to the right since 2^5=32).
*/

void set_keys(std::set<std::string> keys) {
this->keys = keys;
}

void setNull(uint32_t position) {
if (!null_values.empty()) this->null_values[position >> 5] |= (0x1 << (position % 32));
}
Expand All @@ -144,6 +157,9 @@ class TupleRow {
return this->timestamp;
}

std::set<std::string> get_keys() const {
return this->keys;
}

/* Comparators */
bool operator<(TupleRowData &rhs) {
Expand Down
106 changes: 81 additions & 25 deletions hecuba_core/src/TupleRowFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,32 @@ int TupleRowFactory::cass_to_c(const CassValue *lhs, void *data, int16_t col) co
cass_iterator_free(tuple_iterator);
return 0;
}
case CASS_VALUE_TYPE_DATE: {
cass_uint32_t year_month_day;
CassError rc = cass_value_get_uint32(lhs, &year_month_day);
CHECK_CASS("TupleRowFactory: Cassandra to C parse uint32 unsuccessful, column:" + std::to_string(col));
if (rc == CASS_ERROR_LIB_NULL_VALUE) return -1;
int64_t time = (int64_t) cass_date_time_to_epoch(year_month_day, 0);
memcpy(data, &time, sizeof(int64_t *));
return 0;
}
case CASS_VALUE_TYPE_TIME: {
CassError rc = cass_value_get_int64(lhs, reinterpret_cast<int64_t * >(data));
CHECK_CASS("TupleRowFactory: Cassandra to C parse int64 unsuccessful, column:" + std::to_string(col));
if (rc == CASS_ERROR_LIB_NULL_VALUE) return -1;
return 0;
}
case CASS_VALUE_TYPE_TIMESTAMP: {
cass_int64_t time_of_day;
CassError rc = cass_value_get_int64(lhs, &time_of_day);
CHECK_CASS("TupleRowFactory: Cassandra to C parse int64 unsuccessful, column:" + std::to_string(col));
if (rc == CASS_ERROR_LIB_NULL_VALUE) return -1;
memcpy(data, &time_of_day, sizeof(int64_t *));
return 0;
}
case CASS_VALUE_TYPE_DECIMAL:
case CASS_VALUE_TYPE_TIMESTAMP:
case CASS_VALUE_TYPE_TIMEUUID:
case CASS_VALUE_TYPE_INET:
case CASS_VALUE_TYPE_DATE:
case CASS_VALUE_TYPE_TIME:
case CASS_VALUE_TYPE_LIST:
case CASS_VALUE_TYPE_MAP:
case CASS_VALUE_TYPE_SET:
Expand Down Expand Up @@ -326,12 +346,29 @@ TupleRowFactory::bind(CassTuple *tuple, const TupleRow *row) const {
CHECK_CASS("TupleRowFactory: Cassandra unsuccessful binding a new Tuple to the existing tuple");
break;
}
case CASS_VALUE_TYPE_DATE: {
const time_t time = *((time_t *) element_i);
uint32_t year_month_day = cass_date_from_epoch(time);
CassError rc = cass_tuple_set_uint32(tuple, (size_t) bind_pos, year_month_day);
CHECK_CASS("TupleRowFactory: Cassandra unsuccessful binding int64 to the tuple");
break;
}
case CASS_VALUE_TYPE_TIME: {
int64_t time = *((int64_t *) element_i);
CassError rc = cass_tuple_set_int64(tuple, (size_t) bind_pos, time);
CHECK_CASS("TupleRowFactory: Cassandra unsuccessful binding int64 to the tuple");
break;
}
case CASS_VALUE_TYPE_TIMESTAMP: {
cass_int64_t time = *((int64_t *) element_i);
CassError rc = cass_tuple_set_int64(tuple, (size_t) bind_pos, time);
CHECK_CASS("TupleRowFactory: Cassandra unsuccessful binding int64 to the tuple");
break;

}
case CASS_VALUE_TYPE_DECIMAL:
case CASS_VALUE_TYPE_TIMESTAMP:
case CASS_VALUE_TYPE_TIMEUUID:
case CASS_VALUE_TYPE_INET:
case CASS_VALUE_TYPE_DATE:
case CASS_VALUE_TYPE_TIME:
case CASS_VALUE_TYPE_LIST:
case CASS_VALUE_TYPE_MAP:
case CASS_VALUE_TYPE_SET:
Expand All @@ -353,18 +390,17 @@ TupleRowFactory::bind(CassTuple *tuple, const TupleRow *row) const {
void
TupleRowFactory::bind(CassStatement *statement, const TupleRow *row, u_int16_t offset) const {


if (!row || !statement)
throw ModuleException("Statement bind: Null tuple row or statement received");

if (metadata->size() != row->n_elem())
throw ModuleException("Statement bind: Found " + std::to_string(row->n_elem()) + ", expected " +
std::to_string(metadata->size()));

std::set<std::string> keys = row->get_keys();
for (uint16_t i = 0; i < row->n_elem(); ++i) {
uint16_t bind_pos = offset + i;
const void *element_i = row->get_element(i);
if (element_i != nullptr && !row->isNull(i)) {
if (element_i != nullptr && !row->isNull(i)) { //if the element is null, the bind will use the default behaviour (if the table have data,
//the bind will not touch it, if the table does not have data will insert null)
switch (metadata->at(i).type) {
case CASS_VALUE_TYPE_VARCHAR:
case CASS_VALUE_TYPE_TEXT:
Expand All @@ -373,7 +409,7 @@ TupleRowFactory::bind(CassStatement *statement, const TupleRow *row, u_int16_t o
const char *d = reinterpret_cast<char *>(*addr);
CassError rc = cass_statement_bind_string(statement, bind_pos, d);
CHECK_CASS("TupleRowFactory: Cassandra binding query unsuccessful [text], column:" +
metadata->at(i).info.begin()->second);
metadata->at(i).info.begin()->second);
break;
}
case CASS_VALUE_TYPE_VARINT:
Expand All @@ -382,7 +418,7 @@ TupleRowFactory::bind(CassStatement *statement, const TupleRow *row, u_int16_t o
CassError rc = cass_statement_bind_int64(statement, bind_pos,
*data);//L means long long, K unsigned long long
CHECK_CASS("TupleRowFactory: Cassandra binding query unsuccessful [bigint/varint], column:" +
metadata->at(i).info.begin()->second);
metadata->at(i).info.begin()->second);
break;
}
case CASS_VALUE_TYPE_BLOB: {
Expand Down Expand Up @@ -417,7 +453,7 @@ TupleRowFactory::bind(CassStatement *statement, const TupleRow *row, u_int16_t o
const double *data = static_cast<const double *>(element_i);
CassError rc = cass_statement_bind_double(statement, bind_pos, *data);
CHECK_CASS("TupleRowFactory: Cassandra binding query unsuccessful [double], column:" +
metadata->at(i).info.begin()->second);
metadata->at(i).info.begin()->second);

break;
}
Expand All @@ -426,7 +462,7 @@ TupleRowFactory::bind(CassStatement *statement, const TupleRow *row, u_int16_t o

CassError rc = cass_statement_bind_float(statement, bind_pos, *data);
CHECK_CASS("TupleRowFactory: Cassandra binding query unsuccessful [float], column:" +
metadata->at(i).info.begin()->second);
metadata->at(i).info.begin()->second);

break;
}
Expand All @@ -435,7 +471,7 @@ TupleRowFactory::bind(CassStatement *statement, const TupleRow *row, u_int16_t o

CassError rc = cass_statement_bind_int32(statement, bind_pos, *data);
CHECK_CASS("TupleRowFactory: Cassandra binding query unsuccessful [int32], column:" +
metadata->at(i).info.begin()->second);
metadata->at(i).info.begin()->second);

break;
}
Expand All @@ -449,7 +485,7 @@ TupleRowFactory::bind(CassStatement *statement, const TupleRow *row, u_int16_t o

CassError rc = cass_statement_bind_uuid(statement, bind_pos, cass_uuid);
CHECK_CASS("TupleRowFactory: Cassandra binding query unsuccessful [UUID], column:" +
metadata->at(i).info.begin()->second);
metadata->at(i).info.begin()->second);

break;
}
Expand All @@ -466,8 +502,7 @@ TupleRowFactory::bind(CassStatement *statement, const TupleRow *row, u_int16_t o
const int8_t *data = static_cast<const int8_t *>(element_i);
CassError rc = cass_statement_bind_int8(statement, bind_pos, *data);
CHECK_CASS("TupleRowFactory: Cassandra binding query unsuccessful [tiny int as int8], column:" +
metadata->at(i).info.begin()->second);

metadata->at(i).info.begin()->second);
break;
}
case CASS_VALUE_TYPE_TUPLE: {
Expand All @@ -481,12 +516,31 @@ TupleRowFactory::bind(CassStatement *statement, const TupleRow *row, u_int16_t o
cass_tuple_free(tuple);
break;
}
case CASS_VALUE_TYPE_DATE: {
const time_t time = *((time_t *) element_i);
cass_uint32_t year_month_day = cass_date_from_epoch(time);
CassError rc = cass_statement_bind_uint32(statement, bind_pos, year_month_day);
CHECK_CASS("TupleRowFactory: Cassandra binding query unsuccessful [date as int64], column:" +
metadata->at(i).info.begin()->second);
break;
}
case CASS_VALUE_TYPE_TIME: {
int64_t time = *((int64_t *) element_i);
CassError rc = cass_statement_bind_int64(statement, bind_pos, time);
CHECK_CASS("TupleRowFactory: Cassandra binding query unsuccessful [time as int64], column:" +
metadata->at(i).info.begin()->second);
break;
}
case CASS_VALUE_TYPE_TIMESTAMP: {
cass_int64_t time = *((int64_t *) element_i);
CassError rc = cass_statement_bind_int64(statement, bind_pos, time);
CHECK_CASS("TupleRowFactory: Cassandra binding query unsuccessful [timestamp as int64], column:" +
metadata->at(i).info.begin()->second);
break;
}
case CASS_VALUE_TYPE_DECIMAL:
case CASS_VALUE_TYPE_TIMESTAMP:
case CASS_VALUE_TYPE_TIMEUUID:
case CASS_VALUE_TYPE_INET:
case CASS_VALUE_TYPE_DATE:
case CASS_VALUE_TYPE_TIME:
case CASS_VALUE_TYPE_LIST:
case CASS_VALUE_TYPE_MAP:
case CASS_VALUE_TYPE_SET:
Expand All @@ -497,10 +551,12 @@ TupleRowFactory::bind(CassStatement *statement, const TupleRow *row, u_int16_t o
throw ModuleException("Default behaviour not supported");
}
} else {
//Element is a nullptr
CassError rc = cass_statement_bind_null(statement, bind_pos);
CHECK_CASS("TupleRowFactory: Cassandra binding query unsuccessful [Null value], column:" +
metadata->at(i).info.begin()->second);
if (keys.find(metadata->at(i).info.find("name")->second) != keys.end()) {
//Element is a nullptr
CassError rc = cass_statement_bind_null(statement, bind_pos);
CHECK_CASS("TupleRowFactory: Cassandra binding query unsuccessful [Null value], column:" +
metadata->at(i).info.begin()->second);
}
}
}
}
Loading