Closed PavelShilin89 closed 3 days ago
Can you remove unnecessary code and leave only code that related to issue?
@djklim87 this is exactly the code that has to do with the problem and how to reproduce it. If the code is different, or the location of the problem part is changed, the error will not be reproduced.
For clarity, the example itself is shown here Current result
.
Test your MRE before put it into the issue.
grep -m1 "REPLACE+INTO+destination_kafka"
however your table calls destination_kafka_alter
so you should get results as provided below
Data processing completed.
0
+----------+
| count(*) |
+----------+
| 0 |
+----------+
+----------+
| count(*) |
+----------+
| 0 |
+----------+
0
Data processing completed.
+----------+
| count(*) |
+----------+
| 57 |
+----------+
@djklim87 MRE updated
Reproducible MRE
Run dind
docker run -it --privileged --name dind manticoresearch/dind:v1
All commands
docker exec -it dind bash
cd /tmp
wget https://raw.githubusercontent.com/manticoresoftware/manticoresearch/refs/heads/test/native-support-for-message-queues/test/clt-tests/integrations/kafka/import.sh
wget https://raw.githubusercontent.com/manticoresoftware/manticoresearch/refs/heads/test/native-support-for-message-queues/test/clt-tests/integrations/kafka/dump.json
chmod +x ./import.sh
docker network create app-network --driver bridge > /dev/null; echo $?
docker run -it -e EXTRA=1 --network=app-network --platform linux/amd64 --name manticore -d ghcr.io/manticoresoftware/manticoresearch:test-kit-latest bash ; echo $?
docker exec manticore sed -i '/data_dir = \/var\/lib\/manticore/a\ buddy_path = manticore-executor -n /usr/share/manticore/modules/manticore-buddy/src/main.php --debugv\n' /etc/manticoresearch/manticore.conf
docker exec manticore searchd
docker run -it -d -e EXTRA=1 --network=app-network --name kafka -v /tmp/import.sh:/import.sh -v /tmp/dump.json:/tmp/dump.json -e KAFKA_CFG_NODE_ID=0 -e KAFKA_CFG_PROCESS_ROLES=controller,broker -e KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=0@kafka:9093 -e KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093 -e KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://:9092 -e KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT -e KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER -e KAFKA_CFG_INTER_BROKER_LISTENER_NAME=PLAINTEXT bitnami/kafka:3.7.0 ; echo $?
docker exec kafka kafka-topics.sh --create --topic my-data --partitions 4 --bootstrap-server localhost:9092 2>&1 | grep -o 'Created topic my-data\.' | head -n 1
docker exec manticore mysql -h0 -P9306 -e "CREATE SOURCE kafka (id bigint, term text, abbrev text, GlossDef json) type='kafka' broker_list='kafka:9092' topic_list='my-data' consumer_group='manticore' num_consumers='1' batch=50;"; echo $?
docker exec manticore mysql -h0 -P9306 -e "CREATE TABLE destination_kafka (id bigint, name text, short_name text, received_at text, size multi);"; echo $?
docker exec manticore mysql -h0 -P9306 -e "CREATE MATERIALIZED VIEW view_table TO destination_kafka AS SELECT id, term as name, abbrev as short_name, UTC_TIMESTAMP() as received_at, GlossDef.size as size FROM kafka"; echo $?
docker exec kafka ./import.sh; echo $?
timeout 60 bash -c 'docker exec manticore bash -c "tail -f /var/log/manticore/searchd.log" | grep -m2 "REPLACE+INTO+destination_kafka" > /dev/null && echo "Data processing completed."' || echo "Data processing failed."
docker exec manticore mysql -h0 -P9306 -e "DROP SOURCE kafka;"; echo $?
docker exec manticore mysql -h0 -P9306 -e "DROP table destination_kafka;"; echo $?
echo "----------------------------------------------- RUN ------------------------------------------"
docker exec kafka kafka-consumer-groups.sh --bootstrap-server localhost:9092 --group manticore_alter --reset-offsets --to-latest --topic my-data --execute > /dev/null; echo $?
docker exec manticore mysql -h0 -P9306 -e "CREATE SOURCE kafka_alter (id bigint, term text, abbrev text, GlossDef json, metadata json) type='kafka' broker_list='kafka:9092' topic_list='my-data' consumer_group='manticore_alter' num_consumers='1' batch=50;"; echo $?
docker exec manticore mysql -h0 -P9306 -e "CREATE TABLE destination_kafka_alter (id bigint, name text, short_name text, received_at text, size multi, views bigint);"; echo $?
docker exec manticore mysql -h0 -P9306 -e "CREATE MATERIALIZED VIEW view_table_alter TO destination_kafka_alter AS SELECT id, term as name, abbrev as short_name, UTC_TIMESTAMP() as received_at, GlossDef.size as size, metadata.views as views FROM kafka_alter;"; echo $?
docker exec kafka ./import.sh; echo $?
timeout 60 bash -c 'docker exec manticore bash -c "tail -f /var/log/manticore/searchd.log" | grep -m1 "REPLACE+INTO+destination_kafka_alter" > /dev/null && echo "Data processing completed."' || echo "Data processing failed."
docker exec manticore mysql -h0 -P9306 -e "ALTER MATERIALIZED VIEW view_table_alter suspended=1;"; echo $?
echo "----------------------------------------------- Should be 50 ------------------------------------------"
docker exec manticore mysql -h0 -P9306 -e "SELECT COUNT(*) FROM destination_kafka_alter;"
echo "----------------------------------------------- Should be 50 ------------------------------------------"
sleep 10; docker exec manticore mysql -h0 -P9306 -e "SELECT COUNT(*) FROM destination_kafka_alter;"
docker exec manticore mysql -h0 -P9306 -e "ALTER MATERIALIZED VIEW view_table_alter suspended=0;"; echo $?
echo "----------------------------------------------- Should be 57 ------------------------------------------"
timeout 120 bash -c 'while [[ $(docker exec manticore mysql -h0 -P9306 -e "SELECT COUNT(*) FROM destination_kafka_alter;" | grep -o "[0-9]*") -ne 57 ]]; do sleep 1; done && echo "Data processing completed."'
docker exec manticore mysql -h0 -P9306 -e "SELECT COUNT(*) FROM destination_kafka_alter;"
Blocked by https://github.com/manticoresoftware/manticoresearch-buddy/issues/360
That's done.
In the kafka and manticore integration test, suspended=1 does not stop data processing. It should be noted that detection of this problem is possible under certain conditions. I discovered this problem this way:
MRE
Expected result:
Current result:
Test data: dump.json
The test start command: