Skip to content

Commit

Permalink
[upd] Update build images
Browse files Browse the repository at this point in the history
force-build-all
  • Loading branch information
reindexer-bot committed Oct 31, 2024
1 parent b48ad89 commit 70f18bf
Show file tree
Hide file tree
Showing 117 changed files with 5,450 additions and 1,785 deletions.
2 changes: 1 addition & 1 deletion bindings/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package bindings

const CInt32Max = int(^uint32(0) >> 1)

const ReindexerVersion = "v4.17.2"
const ReindexerVersion = "v4.18.0"

// public go consts from type_consts.h and reindexer_ctypes.h
const (
Expand Down
10 changes: 10 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# Version 4.18.0 (XX.10.2024) *beta*
## Replication
- [fix] Fixed possible LSN missmatch in snapshots during WAL/Force syncs

## Reindexer server
- [fix] Fixed logical operations (`or`, `not`) parsining in JSON DSL joined queries

## Ported
- [fea/fix] Ported all the fixes and features from [v3.29.0](https://github.com/Restream/reindexer/releases/tag/v3.25.0), [v3.26.0](https://github.com/Restream/reindexer/releases/tag/v3.29.0)

# Version 4.17.2 *beta* (19.09.2024)
## Core
- [fix] Fixed data race in cached comparators (`joins cache` may cause incorrect comparators deletion)
Expand Down
6 changes: 3 additions & 3 deletions cjson/creflect.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ type payloadIface struct {
func (pl *payloadIface) ptr(field, idx, typ int) unsafe.Pointer {

if pl.p == 0 {
panic(fmt.Errorf("Null pointer derefernce"))
panic(fmt.Errorf("Null pointer dereference"))
}

f := &pl.t.Fields[field]
Expand All @@ -98,7 +98,7 @@ func (pl *payloadIface) ptr(field, idx, typ int) unsafe.Pointer {

if !f.IsArray {
if idx != 0 {
panic(fmt.Errorf("Trying to acces by index '%d' to non array field '%s'", idx, f.Name))
panic(fmt.Errorf("Trying to access by index '%d' to non array field '%s'", idx, f.Name))
}
return p
}
Expand Down Expand Up @@ -217,7 +217,7 @@ func (pl *payloadIface) getArrayLen(field int) int {
return int((*ArrayHeader)(p).len)
}

// get c reflect value and set to go reflect valie
// get c reflect value and set to go reflect value
func (pl *payloadIface) getValue(field int, idx int, v reflect.Value) {

k := v.Type().Kind()
Expand Down
9 changes: 2 additions & 7 deletions cpp_src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ else()
option(LINK_RESOURCES "Link web resources as binary data" ON)
endif()

set (REINDEXER_VERSION_DEFAULT "4.17.2")
set (REINDEXER_VERSION_DEFAULT "4.18.0")

if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "RelWithDebInfo")
Expand Down Expand Up @@ -88,7 +88,7 @@ endif()

if(MSVC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -wd4244 -wd4267 -wd4996 -wd4717 -MP -MD")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd4244 -wd4267 -wd4996 -wd4717 -wd4800 -wd4396 -wd4503 -MP -MD")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd4244 -wd4267 -wd4996 -wd4717 -wd4800 -wd4396 -wd4503 -MP -MD /bigobj")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -SAFESEH:NO")
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror -Wswitch-enum")
Expand Down Expand Up @@ -629,8 +629,3 @@ add_custom_target(collect_coverage
COMMAND genhtml coverage_filtered.info -o coverage_output
COMMENT "Collecting Reindexer coverage"
)

# Configure compile options extra
if(MSVC)
target_compile_options(${TARGET} PRIVATE /bigobj)
endif()
3 changes: 2 additions & 1 deletion cpp_src/client/cororeindexer.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class CoroReindexer {
using ConnectionStateHandlerT = std::function<void(const Error&)>;

/// Create Reindexer database object
CoroReindexer(const ReindexerConfig& = ReindexerConfig());
explicit CoroReindexer(const ReindexerConfig& = ReindexerConfig());
/// Destroy Reindexer database object
~CoroReindexer();
CoroReindexer(const CoroReindexer&) = delete;
Expand Down Expand Up @@ -264,6 +264,7 @@ class CoroReindexer {
typedef CoroQueryResults QueryResultsT;
typedef Item ItemT;
typedef ReindexerConfig ConfigT;
typedef CoroTransaction TransactionT;

private:
CoroReindexer(RPCClient* impl, InternalRdxContext&& ctx) : impl_(impl), ctx_(std::move(ctx)) {}
Expand Down
6 changes: 2 additions & 4 deletions cpp_src/client/corotransaction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
#include "core/keyvalue/p_string.h"
#include "net/cproto/coroclientconnection.h"

namespace reindexer {
namespace client {
namespace reindexer::client {

CoroTransaction::~CoroTransaction() {
if (!IsFree()) {
Expand Down Expand Up @@ -226,5 +225,4 @@ CoroTransaction::Impl::Impl(CoroTransaction::Impl&&) noexcept = default;
CoroTransaction::Impl& CoroTransaction::Impl::operator=(CoroTransaction::Impl&&) noexcept = default;
CoroTransaction::Impl::~Impl() = default;

} // namespace client
} // namespace reindexer
} // namespace reindexer::client
19 changes: 9 additions & 10 deletions cpp_src/client/corotransaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@

namespace reindexer {

namespace net {
namespace cproto {
namespace net::cproto {
class CoroClientConnection;
} // namespace cproto
} // namespace net
} // namespace net::cproto

namespace client {

Expand Down Expand Up @@ -58,7 +56,7 @@ class CoroTransaction {
friend class RPCClient;
friend class ReindexerImpl;
friend class Transaction;
CoroTransaction(Error status) noexcept : i_(std::move(status)) {}
explicit CoroTransaction(Error status) noexcept : i_(std::move(status)) {}
CoroTransaction(RPCClient* rpcClient, int64_t txId, std::chrono::milliseconds requestTimeout, std::chrono::milliseconds execTimeout,
Namespace* ns) noexcept
: i_(rpcClient, txId, requestTimeout, execTimeout, ns) {}
Expand All @@ -82,18 +80,19 @@ class CoroTransaction {
Impl& operator=(Impl&&) noexcept;
~Impl();

int64_t txId_ = -1;
RPCClient* rpcClient_ = nullptr;
std::chrono::milliseconds requestTimeout_ = std::chrono::milliseconds{0};
std::chrono::milliseconds execTimeout_ = std::chrono::milliseconds{0};
int64_t txId_{-1};
RPCClient* rpcClient_{nullptr};
std::chrono::milliseconds requestTimeout_{0};
std::chrono::milliseconds execTimeout_{0};
Error status_;
std::unique_ptr<TagsMatcher> localTm_;
Namespace* ns_ = nullptr;
Namespace* ns_{nullptr};
steady_clock_w::time_point sessionTs_;
};

Impl i_;
};

} // namespace client

} // namespace reindexer
1 change: 0 additions & 1 deletion cpp_src/client/rpcclient.cc
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ Error RPCClient::modifyItemCJSON(std::string_view nsName, Item& item, CoroQueryR
// Add new names missing in JSON from tm
newItem.impl_->addTagNamesFrom(item.impl_->tagsMatcher());
}

item = std::move(newItem);
}
}
Expand Down
2 changes: 1 addition & 1 deletion cpp_src/cluster/replication/replicationthread.cc
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ Error ReplThread<BehaviourParamT>::syncNamespace(Node& node, const NamespaceName
return err;
}
if (snapshot.HasRawData()) {
logInfo("%d:%d:%s Snapshot has raw data, creating tmp namespace", serverId_, node.uid, nsName);
logInfo("%d:%d:%s Snapshot has RAW data, creating tmp namespace", serverId_, node.uid, nsName);
createTmpNamespace = true;
} else if (snapshot.NsVersion().Server() != requiredLsn.NsVersion().Server() ||
snapshot.NsVersion().Counter() != requiredLsn.NsVersion().Counter()) {
Expand Down
2 changes: 1 addition & 1 deletion cpp_src/cluster/replication/roleswitcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ void RoleSwitcher::Run(std::vector<std::string>&& dsns, RoleSwitcher::Config&& c

nodes_.reserve(dsns.size());
for (auto&& dsn : dsns) {
nodes_.emplace_back(Node{std::move(dsn), {clientCfg}});
nodes_.emplace_back(Node{std::move(dsn), client::CoroReindexer{clientCfg}});
}
assert(cfg_.onRoleSwitchDone);

Expand Down
197 changes: 197 additions & 0 deletions cpp_src/cmd/reindexer_server/test/test_storage_compatibility.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
#!/bin/bash
# Task: https://github.com/restream/reindexer/-/issues/1188
set -e

function KillAndRemoveServer {
local pid=$1
kill $pid
wait $pid
yum remove -y 'reindexer*' > /dev/null
}

function WaitForDB {
# wait until DB is loaded
set +e # disable "exit on error" so the script won't stop when DB's not loaded yet
is_connected=$(reindexer_tool --dsn $ADDRESS --command '\databases list');
while [[ $is_connected != "test" ]]
do
sleep 2
is_connected=$(reindexer_tool --dsn $ADDRESS --command '\databases list');
done
set -e
}

function CompareNamespacesLists {
local ns_list_actual=$1
local ns_list_expected=$2
local pid=$3

diff=$(echo ${ns_list_actual[@]} ${ns_list_expected[@]} | tr ' ' '\n' | sort | uniq -u) # compare in any order
if [ "$diff" == "" ]; then
echo "## PASS: namespaces list not changed"
else
echo "##### FAIL: namespaces list was changed"
echo "expected: $ns_list_expected"
echo "actual: $ns_list_actual"
KillAndRemoveServer $pid;
exit 1
fi
}

function CompareMemstats {
local actual=$1
local expected=$2
local pid=$3
diff=$(echo ${actual[@]} ${expected[@]} | tr ' ' '\n' | sed 's/\(.*\),$/\1/' | sort | uniq -u) # compare in any order
if [ "$diff" == "" ]; then
echo "## PASS: memstats not changed"
else
echo "##### FAIL: memstats was changed"
echo "expected: $expected"
echo "actual: $actual"
KillAndRemoveServer $pid;
exit 1
fi
}


RX_SERVER_CURRENT_VERSION_RPM="$(basename build/reindexer-*server*.rpm)"
VERSION_FROM_RPM=$(echo "$RX_SERVER_CURRENT_VERSION_RPM" | grep -o '.*server-..')
VERSION=$(echo ${VERSION_FROM_RPM: -2:1}) # one-digit version

echo "## choose latest release rpm file"
if [ $VERSION == 3 ]; then
LATEST_RELEASE=$(python3 cpp_src/cmd/reindexer_server/test/get_last_rx_version.py -v 3)
namespaces_list_expected=$'purchase_options_ext_dict\nchild_account_recommendations\n#config\n#activitystats\nradio_channels\ncollections\n#namespaces\nwp_imports_tasks\nepg_genres\nrecom_media_items_personal\nrecom_epg_archive_default\n#perfstats\nrecom_epg_live_default\nmedia_view_templates\nasset_video_servers\nwp_tasks_schedule\nadmin_roles\n#clientsstats\nrecom_epg_archive_personal\nrecom_media_items_similars\nmenu_items\naccount_recommendations\nkaraoke_items\nmedia_items\nbanners\n#queriesperfstats\nrecom_media_items_default\nrecom_epg_live_personal\nservices\n#memstats\nchannels\nmedia_item_recommendations\nwp_tasks_tasks\nepg'
elif [ $VERSION == 4 ]; then
LATEST_RELEASE=$(python3 cpp_src/cmd/reindexer_server/test/get_last_rx_version.py -v 4)
# replicationstats ns added for v4
namespaces_list_expected=$'purchase_options_ext_dict\nchild_account_recommendations\n#config\n#activitystats\n#replicationstats\nradio_channels\ncollections\n#namespaces\nwp_imports_tasks\nepg_genres\nrecom_media_items_personal\nrecom_epg_archive_default\n#perfstats\nrecom_epg_live_default\nmedia_view_templates\nasset_video_servers\nwp_tasks_schedule\nadmin_roles\n#clientsstats\nrecom_epg_archive_personal\nrecom_media_items_similars\nmenu_items\naccount_recommendations\nkaraoke_items\nmedia_items\nbanners\n#queriesperfstats\nrecom_media_items_default\nrecom_epg_live_personal\nservices\n#memstats\nchannels\nmedia_item_recommendations\nwp_tasks_tasks\nepg'
else
echo "Unknown version"
exit 1
fi

echo "## downloading latest release rpm file: $LATEST_RELEASE"
curl "http://repo.itv.restr.im/itv-api-ng/7/x86_64/$LATEST_RELEASE" --output $LATEST_RELEASE;
echo "## downloading example DB"
curl "https://github.com/restream/reindexer_testdata/-/raw/main/dump_demo.zip" --output dump_demo.zip;
unzip -o dump_demo.zip # unzips into demo_test.rxdump;

ADDRESS="cproto://127.0.0.1:6534/"
DB_NAME="test"

memstats_expected=$'[
{"name":"account_recommendations","replication":{"data_hash":6833710705,"data_count":1}},
{"name":"admin_roles","replication":{"data_hash":1896088071,"data_count":2}},
{"name":"asset_video_servers","replication":{"data_hash":7404222244,"data_count":97}},
{"name":"banners","replication":{"data_hash":0,"data_count":0}},
{"name":"channels","replication":{"data_hash":457292509431319,"data_count":3941}},
{"name":"child_account_recommendations","replication":{"data_hash":6252344969,"data_count":1}},
{"name":"collections","replication":{"data_hash":0,"data_count":0}},
{"name":"epg","replication":{"data_hash":-7049751653258,"data_count":1623116}},
{"name":"epg_genres","replication":{"data_hash":8373644068,"data_count":1315}},
{"name":"karaoke_items","replication":{"data_hash":5858155773472,"data_count":4500}},
{"name":"media_item_recommendations","replication":{"data_hash":-6520334670,"data_count":35886}},
{"name":"media_items","replication":{"data_hash":-1824301168479972392,"data_count":65448}},
{"name":"media_view_templates","replication":{"data_hash":0,"data_count":0}},
{"name":"menu_items","replication":{"data_hash":0,"data_count":0}},
{"name":"purchase_options_ext_dict","replication":{"data_hash":24651210926,"data_count":3}},
{"name":"radio_channels","replication":{"data_hash":37734732881,"data_count":28}},
{"name":"recom_epg_archive_default","replication":{"data_hash":0,"data_count":0}},
{"name":"recom_epg_archive_personal","replication":{"data_hash":0,"data_count":0}},
{"name":"recom_epg_live_default","replication":{"data_hash":0,"data_count":0}},
{"name":"recom_epg_live_personal","replication":{"data_hash":0,"data_count":0}},
{"name":"recom_media_items_default","replication":{"data_hash":8288213744,"data_count":3}},
{"name":"recom_media_items_personal","replication":{"data_hash":0,"data_count":0}},
{"name":"recom_media_items_similars","replication":{"data_hash":-672103903,"data_count":33538}},
{"name":"services","replication":{"data_hash":0,"data_count":0}},
{"name":"wp_imports_tasks","replication":{"data_hash":777859741066,"data_count":1145}},
{"name":"wp_tasks_schedule","replication":{"data_hash":12595790956,"data_count":4}},
{"name":"wp_tasks_tasks","replication":{"data_hash":28692716680,"data_count":281}}
]
Returned 27 rows'

echo "##### Forward compatibility test #####"

DB_PATH=$(pwd)"/rx_db"

echo "Database: "$DB_PATH

echo "## installing latest release: $LATEST_RELEASE"
yum install -y $LATEST_RELEASE > /dev/null;
# run RX server with disabled logging
reindexer_server -l warning --httplog=none --rpclog=none --db $DB_PATH &
server_pid=$!
sleep 2;

reindexer_tool --dsn $ADDRESS$DB_NAME -f demo_test.rxdump --createdb;
sleep 1;

namespaces_1=$(reindexer_tool --dsn $ADDRESS$DB_NAME --command '\namespaces list');
echo $namespaces_1;
CompareNamespacesLists "${namespaces_1[@]}" "${namespaces_list_expected[@]}" $server_pid;

memstats_1=$(reindexer_tool --dsn $ADDRESS$DB_NAME --command 'select name, replication.data_hash, replication.data_count from #memstats order by name');
CompareMemstats "${memstats_1[@]}" "${memstats_expected[@]}" $server_pid;

KillAndRemoveServer $server_pid;

echo "## installing current version: $RX_SERVER_CURRENT_VERSION_RPM"
yum install -y build/*.rpm > /dev/null;
reindexer_server -l0 --corelog=none --httplog=none --rpclog=none --db $DB_PATH &
server_pid=$!
sleep 2;

WaitForDB

namespaces_2=$(reindexer_tool --dsn $ADDRESS$DB_NAME --command '\namespaces list');
echo $namespaces_2;
CompareNamespacesLists "${namespaces_2[@]}" "${namespaces_1[@]}" $server_pid;


memstats_2=$(reindexer_tool --dsn $ADDRESS$DB_NAME --command 'select name, replication.data_hash, replication.data_count from #memstats order by name');
CompareMemstats "${memstats_2[@]}" "${memstats_1[@]}" $server_pid;

KillAndRemoveServer $server_pid;
rm -rf $DB_PATH;
sleep 1;

echo "##### Backward compatibility test #####"

echo "## installing current version: $RX_SERVER_CURRENT_VERSION_RPM"
yum install -y build/*.rpm > /dev/null;
reindexer_server -l warning --httplog=none --rpclog=none --db $DB_PATH &
server_pid=$!
sleep 2;

reindexer_tool --dsn $ADDRESS$DB_NAME -f demo_test.rxdump --createdb;
sleep 1;

namespaces_3=$(reindexer_tool --dsn $ADDRESS$DB_NAME --command '\namespaces list');
echo $namespaces_3;
CompareNamespacesLists "${namespaces_3[@]}" "${namespaces_list_expected[@]}" $server_pid;


memstats_3=$(reindexer_tool --dsn $ADDRESS$DB_NAME --command 'select name, replication.data_hash, replication.data_count from #memstats order by name');
CompareMemstats "${memstats_3[@]}" "${memstats_expected[@]}" $server_pid;

KillAndRemoveServer $server_pid;

echo "## installing latest release: $LATEST_RELEASE"
yum install -y $LATEST_RELEASE > /dev/null;
reindexer_server -l warning --httplog=none --rpclog=none --db $DB_PATH &
server_pid=$!
sleep 2;

WaitForDB

namespaces_4=$(reindexer_tool --dsn $ADDRESS$DB_NAME --command '\namespaces list');
echo $namespaces_4;
CompareNamespacesLists "${namespaces_4[@]}" "${namespaces_3[@]}" $server_pid;

memstats_4=$(reindexer_tool --dsn $ADDRESS$DB_NAME --command 'select name, replication.data_hash, replication.data_count from #memstats order by name');
CompareMemstats "${memstats_4[@]}" "${memstats_3[@]}" $server_pid;

KillAndRemoveServer $server_pid;
rm -rf $DB_PATH;
Loading

0 comments on commit 70f18bf

Please sign in to comment.