Skip to content

Commit

Permalink
Update version to v2.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
olegator77 committed Apr 4, 2019
1 parent 7330591 commit 3de128b
Show file tree
Hide file tree
Showing 112 changed files with 3,282 additions and 696 deletions.
34 changes: 19 additions & 15 deletions bindings/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const (
SET = 7
ALLSET = 8
EMPTY = 9
LIKE = 10

ERROR = 1
WARNING = 2
Expand Down Expand Up @@ -49,21 +50,24 @@ const (
ValueComposite = 10
ValueTuple = 11

QueryCondition = 0
QueryDistinct = 1
QuerySortIndex = 2
QueryJoinOn = 3
QueryLimit = 4
QueryOffset = 5
QueryReqTotal = 6
QueryDebugLevel = 7
QueryAggregation = 8
QuerySelectFilter = 9
QuerySelectFunction = 10
QueryEnd = 11
QueryExplain = 12
QueryEqualPosition = 13
QueryUpdateField = 14
QueryCondition = 0
QueryDistinct = 1
QuerySortIndex = 2
QueryJoinOn = 3
QueryLimit = 4
QueryOffset = 5
QueryReqTotal = 6
QueryDebugLevel = 7
QueryAggregation = 8
QuerySelectFilter = 9
QuerySelectFunction = 10
QueryEnd = 11
QueryExplain = 12
QueryEqualPosition = 13
QueryUpdateField = 14
QueryAggregationLimit = 15
QueryAggregationOffset = 16
QueryAggregationSort = 17

LeftJoin = 0
InnerJoin = 1
Expand Down
1 change: 1 addition & 0 deletions bindings/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type IndexDef struct {
IsSparse bool `json:"is_sparse"`
CollateMode string `json:"collate_mode"`
SortOrder string `json:"sort_order_letters"`
ExpireAfter int `json:"expire_after"`
Config interface{} `json:"config"`
}

Expand Down
20 changes: 20 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,23 @@
# Version 2.0.3 (04.04.2019)

## Core
- [fea] Facets API improoved. Multiply fields and SORT features
- [fea] TTL added
- [fea] `LIKE` condition added
- [fea] Add expressions support in SQL `UPDATE` statement
- [fix] Invalid JSON generation with empty object name
- [fix] Unneccessary updating of tagsmatcher on transactions
- [fix] LRUCache invalidation crash fix

# Reindexer server

- [fea] Added metadata maniplulation methods

## Face

- [fea] Added metadata maniplulation GUI
- [fix] Performance statistics GUI improovements

# Version 2.0.2 (08.03.2019)

## Core
Expand Down
2 changes: 2 additions & 0 deletions connectors/py_reindexer/example/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def create_index_example(db, namespace):
'is_sparse': False,
'collate_mode': 'none',
'sort_order_letters': '',
'expire_after':0,
'config': {},
}

Expand All @@ -35,6 +36,7 @@ def update_index_example(db, namespace):
'is_sparse': False,
'collate_mode': 'none',
'sort_order_letters': '',
'expire_after':0,
'config': {},
}
db.index_update(namespace, index_definition_modified)
Expand Down
2 changes: 1 addition & 1 deletion connectors/py_reindexer/pyreindexer/index_definition.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def update(self, dict_part={}):

def _get_known_attrs(self):
return ['name', 'json_paths', 'field_type', 'index_type', 'is_pk',
'is_array', 'is_dense', 'is_sparse', 'collate_mode', 'sort_order_letters', 'config']
'is_array', 'is_dense', 'is_sparse', 'collate_mode', 'sort_order_letters', 'expire_after', 'config']

def _raise_if_key_error(self, attr):
known_attrs = self._get_known_attrs()
Expand Down
2 changes: 1 addition & 1 deletion cpp_src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ option (WITH_ASAN "Enable AddressSanitized build" OFF)
option (WITH_TSAN "Enable ThreadSanitized build" OFF)
option (WITH_GPERF "Enable GPerfTools build" ON)
option (WITH_GCOV "Enable instrumented code coverage build" OFF)
set (REINDEXER_VERSION_DEFAULT "2.0.2")
set (REINDEXER_VERSION_DEFAULT "2.0.3")

if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "RelWithDebInfo")
Expand Down
18 changes: 12 additions & 6 deletions cpp_src/client/queryresults.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace client {

using namespace reindexer::net;

QueryResults::QueryResults(int fetchFlags) : fetchFlags_(fetchFlags){};
QueryResults::QueryResults(int fetchFlags) : fetchFlags_(fetchFlags), fetchAmount_(0){};
QueryResults::QueryResults(QueryResults &&) = default;
QueryResults &QueryResults::operator=(QueryResults &&obj) noexcept {
if (this != &obj) {
Expand All @@ -20,19 +20,25 @@ QueryResults &QueryResults::operator=(QueryResults &&obj) noexcept {
queryParams_ = std::move(obj.queryParams_);
fetchOffset_ = std::move(obj.fetchOffset_);
fetchFlags_ = std::move(obj.fetchFlags_);
fetchAmount_ = std::move(obj.fetchAmount_);
queryID_ = std::move(obj.queryID_);
status_ = std::move(obj.status_);
cmpl_ = std::move(obj.cmpl_);
}
return *this;
}

QueryResults::QueryResults(net::cproto::ClientConnection *conn, NSArray &&nsArray, Completion cmpl, int fetchFlags)
: conn_(conn), nsArray_(std::move(nsArray)), fetchOffset_(0), fetchFlags_(fetchFlags), cmpl_(std::move(cmpl)) {}
QueryResults::QueryResults(net::cproto::ClientConnection *conn, NSArray &&nsArray, Completion cmpl, int fetchFlags, int fetchAmount)
: conn_(conn),
nsArray_(std::move(nsArray)),
fetchOffset_(0),
fetchFlags_(fetchFlags),
fetchAmount_(fetchAmount),
cmpl_(std::move(cmpl)) {}

QueryResults::QueryResults(net::cproto::ClientConnection *conn, NSArray &&nsArray, Completion cmpl, string_view rawResult, int queryID,
int fetchFlags)
: QueryResults(conn, std::move(nsArray), cmpl, fetchFlags) {
int fetchFlags, int fetchAmount)
: QueryResults(conn, std::move(nsArray), cmpl, fetchFlags, fetchAmount) {
Bind(rawResult, queryID);
}

Expand Down Expand Up @@ -68,7 +74,7 @@ void QueryResults::Bind(string_view rawResult, int queryID) {

void QueryResults::fetchNextResults() {
int flags = fetchFlags_ ? (fetchFlags_ & ~kResultsWithPayloadTypes) : kResultsCJson;
auto ret = conn_->Call(cproto::kCmdFetchResults, queryID_, flags, queryParams_.count + fetchOffset_, 100);
auto ret = conn_->Call(cproto::kCmdFetchResults, queryID_, flags, queryParams_.count + fetchOffset_, fetchAmount_);
if (!ret.Status().ok()) {
throw ret.Status();
}
Expand Down
5 changes: 3 additions & 2 deletions cpp_src/client/queryresults.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ class QueryResults {

private:
friend class RPCClient;
QueryResults(net::cproto::ClientConnection *conn, NSArray &&nsArray, Completion cmpl, int fetchFlags = 0);
QueryResults(net::cproto::ClientConnection *conn, NSArray &&nsArray, Completion cmpl, int fetchFlags,int fetchAmount);
QueryResults(net::cproto::ClientConnection *conn, NSArray &&nsArray, Completion cmpl, string_view rawResult, int queryID,
int fetchFlags = 0);
int fetchFlags,int fetchAmount);
void Bind(string_view rawResult, int queryID);
void fetchNextResults();
void completion(const Error &err) {
Expand All @@ -81,6 +81,7 @@ class QueryResults {
int queryID_;
int fetchOffset_;
int fetchFlags_;
int fetchAmount_;

ResultSerializer::QueryParams queryParams_;
Error status_;
Expand Down
6 changes: 3 additions & 3 deletions cpp_src/client/reindexer.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ class Reindexer {
/// @param nsName - Name of namespace
/// @param keys - std::vector filled with meta keys
Error EnumMeta(string_view nsName, vector<string> &keys);
// Subsribe to updates of database
// @param observer - Observer interface, which will receive updates
// @param subsctibe - true: subsribe, false: unsubsrcibe
/// Subscribe to updates of database
/// @param observer - Observer interface, which will receive updates
/// @param subscribe - true: subscribe, false: unsubscribe
Error SubscribeUpdates(IUpdatesObserver *observer, bool subscribe);
/// Get possible suggestions for token (set by 'pos') in Sql query.
/// @param sqlQuery - sql query.
Expand Down
4 changes: 3 additions & 1 deletion cpp_src/client/reindexerconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ namespace reindexer {
namespace client {

struct ReindexerConfig {
ReindexerConfig(int _ConnPoolSize = 4, int _WorkerThreads = 1) : ConnPoolSize(_ConnPoolSize), WorkerThreads(_WorkerThreads){};
ReindexerConfig(int _ConnPoolSize = 4, int _WorkerThreads = 1, int _FetchAmount = 10000)
: ConnPoolSize(_ConnPoolSize), WorkerThreads(_WorkerThreads), FetchAmount(_FetchAmount){};
int ConnPoolSize;
int WorkerThreads;
int FetchAmount;
};

} // namespace client
Expand Down
17 changes: 9 additions & 8 deletions cpp_src/client/rpcclient.cc
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ Error RPCClient::modifyItem(string_view nsName, Item& item, int mode, Completion
try {
auto args = ret.GetArgs(2);
NSArray nsArray{getNamespace(nsName)};
return QueryResults(conn, std::move(nsArray), nullptr, p_string(args[0]), int(args[1])).Status();
return QueryResults(conn, std::move(nsArray), nullptr, p_string(args[0]), int(args[1]), 0, config_.FetchAmount).Status();
} catch (const Error& err) {
return err;
}
Expand Down Expand Up @@ -190,7 +190,8 @@ Error RPCClient::modifyItemAsync(string_view nsName, Item* item, int mode, Compl
} else
try {
auto args = ret.GetArgs(2);
clientCompl(QueryResults(conn, {getNamespace(ns)}, nullptr, p_string(args[0]), int(args[1])).Status());
clientCompl(
QueryResults(conn, {getNamespace(ns)}, nullptr, p_string(args[0]), int(args[1]), 0, config_.FetchAmount).Status());
} catch (const Error& err) {
clientCompl(err);
}
Expand Down Expand Up @@ -246,7 +247,7 @@ Error RPCClient::Delete(const Query& query, QueryResults& result) {
query.Serialize(ser);
auto conn = getConn();

result = QueryResults(conn, {}, nullptr);
result = QueryResults(conn, {}, nullptr, 0, config_.FetchAmount);

auto icompl = [&result](const RPCAnswer& ret, cproto::ClientConnection*) {
try {
Expand All @@ -270,7 +271,7 @@ Error RPCClient::Update(const Query& query, QueryResults& result) {
query.Serialize(ser);
auto conn = getConn();

result = QueryResults(conn, {}, nullptr);
result = QueryResults(conn, {}, nullptr, 0, config_.FetchAmount);

auto icompl = [&result](const RPCAnswer& ret, cproto::ClientConnection*) {
try {
Expand Down Expand Up @@ -305,7 +306,7 @@ Error RPCClient::Select(string_view query, QueryResults& result, Completion clie

if (!conn) conn = getConn();

result = QueryResults(conn, {}, clientCompl, result.fetchFlags_);
result = QueryResults(conn, {}, clientCompl, result.fetchFlags_, config_.FetchAmount);

auto icompl = [&result](const RPCAnswer& ret, cproto::ClientConnection* /*conn*/) {
try {
Expand Down Expand Up @@ -345,7 +346,7 @@ Error RPCClient::Select(const Query& query, QueryResults& result, Completion cli

if (!conn) conn = getConn();

result = QueryResults(conn, std::move(nsArray), clientCompl, result.fetchFlags_);
result = QueryResults(conn, std::move(nsArray), clientCompl, result.fetchFlags_, config_.FetchAmount);

auto icompl = [&result](const RPCAnswer& ret, cproto::ClientConnection* /*conn*/) {
try {
Expand All @@ -360,11 +361,11 @@ Error RPCClient::Select(const Query& query, QueryResults& result, Completion cli
};

if (!clientCompl) {
auto ret = conn->Call(cproto::kCmdSelect, qser.Slice(), flags, 100, pser.Slice());
auto ret = conn->Call(cproto::kCmdSelect, qser.Slice(), flags, config_.FetchAmount, pser.Slice());
icompl(ret, conn);
return ret.Status();
} else {
conn->Call(icompl, cproto::kCmdSelect, qser.Slice(), flags, 100, pser.Slice());
conn->Call(icompl, cproto::kCmdSelect, qser.Slice(), flags, config_.FetchAmount, pser.Slice());
return errOK;
}
}
Expand Down
1 change: 1 addition & 0 deletions cpp_src/cmake/modules/CMakeRC.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ function(cmrc_add_resource_library name)
static std::once_flag flag;
std::call_once(flag, [] {
cmrc::detail::with_table([](resource_table& table) {
(void)table;
$<JOIN:$<TARGET_PROPERTY:%{libname},CMRC_TABLE_POPULATE>,
>
});
Expand Down
40 changes: 40 additions & 0 deletions cpp_src/cmd/reindexer_server/test/specs/mixins/api_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ class ApiMixin(object):
'not_found': 404
}

SORT_ORDER = {
'desc': -1,
'no_sort': 0,
'asc': 1
}

def _server_request(self, method, url, body=None, headers={}, as_json=True):
self.api = http.client.HTTPConnection('127.0.0.1', 9088)

Expand Down Expand Up @@ -125,6 +131,40 @@ def api_get_sorted_namespaces(self, dbname, dir=''):

return self._api_call('GET', '/db/' + dbname + '/namespaces' + order)

def api_put_namespace_meta(self, dbname, nsname, body):
return self._api_call('PUT', '/db/' + dbname + '/namespaces/' + nsname + '/metabykey', body)

def api_get_namespace_meta(self, dbname, nsname, key):
return self._api_call('GET', '/db/' + dbname + '/namespaces/' + nsname + '/metabykey/' + key)

def api_get_namespace_meta_list(self, dbname, nsname, sort = SORT_ORDER['no_sort'], with_values = False, offset = 0, limit = 0):
query = ''
separator = '?'
if sort == self.SORT_ORDER['asc']:
query += '?sort_order=asc'
separator = '&'
elif sort == self.SORT_ORDER['desc']:
query += '?sort_order=desc'
separator = '&'

if with_values:
query += separator
query += 'with_values=true'
separator = '&'

if offset > 0:
query += separator
query += 'offset='
query += str(offset)
separator = '&'

if limit > 0:
query += separator
query += 'limit='
query += str(limit)

return self._api_call('GET', '/db/' + dbname + '/namespaces/' + nsname + '/metalist' + query)

def api_get_indexes(self, dbname, nsname):
return self._api_call('GET', '/db/' + dbname + '/namespaces/' + nsname + '/indexes')

Expand Down
20 changes: 20 additions & 0 deletions cpp_src/cmd/reindexer_server/test/specs/mixins/helper_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,29 @@ def helper_index_construct(self, name, field_type='int', index_type='hash', is_p
'is_sparse': False,
'collate_mode': 'none',
'sort_order_letters': '',
'expire_after':0,
'config': {}
}

def helper_meta_construct(self, key, value):
return {
'key': key,
'value': value
}

def helper_meta_response_construct(self, value):
return {
'message': value
}

def helper_meta_list_request_construct(self, sort = False, with_values = False, offset = 0, limit = 0):
return {
'sort': sort,
'with_values': with_values,
'offset': offset,
'limit': limit
}

def helper_index_array_construct(self, count=2):
indexes_arr_of_dicts = []

Expand Down
Loading

0 comments on commit 3de128b

Please sign in to comment.