OpenMetadata/bin/distributed-test/scripts/start.sh
Mohit Yadav 1fe8a02fde Improve indexing (#26154)
* Add Prometheus metrics for reindexing pipeline via Micrometer                                                       Bridge the existing reindexing atomic counters to Prometheus so operators     can alert on failures, latency spikes, and backpressure without relying      solely on database-flushed stats.

  - Add ReindexingMetrics singleton (initialize/getInstance pattern matching
    CacheMetrics) with job lifecycle counters, stage success/failed/warnings
    counters, bulk request timers with SLA buckets, payload size distribution,
    backpressure and promotion counters, and active/pending gauges
  - Register in MicrometerBundle after StreamableLogsMetrics
  - Instrument ReindexingOrchestrator.run() with job started/completed/failed/stopped
  - Bridge StageStatsTracker.flush() deltas to Prometheus per stage and entity type
  - Add bulk request latency timer and payload size recording in OpenSearchBulkSink
  - Record backpressure events in SearchIndexExecutor.handleBackpressure()
  - Record promotion success/failure in DefaultRecreateHandler
  - Add ReindexingMetricsTest with 24 tests covering all metric types

* Add Improvements

* Auto Gene

* Use Auto Config in distributed

* Fix Partition Claim Spread

* Make partition use config

* Correct total count

* Fix Wait time to 5 mins

* Revert om yaml

* Fix Sink sync

* Add Failure Handling at different stages

* Update script to create entities

* Move to scripts

* Add usage and fix script

* Fix Script

* Update generated TypeScript types

* Fix Staging miss

* Fix Stats reconcilation issue

* Revert workflow handler

* Fix Partition worker early sync

* Update Logs

* Update logs EntityRepository

* Error failure test

* Review Comments fix

* Fix Non Distributed live feed

* Fix Non Distributed stats feed

* Fix Review comments

* Fix Time Series cutt off

* Update generated TypeScript types

* Md

* Benchmark addition

* Fix date time warning

* Update load test to do benchmark analysis

* Disagnostic and update perf test

* Move load test to bin

* Fix Review Comments

* Add numeric values

* Move to localhost by default

* Fix Perf test issues

* Review Comments

* Add Preflight Fixes

* Add Preflight fixes for stale entry

* Remove stale entry on ApplicationHandler

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
(cherry picked from commit b59aa7fc44)
2026-03-03 16:41:16 +05:30

126 lines
3.4 KiB
Bash
Executable file

#!/bin/bash
# Start the distributed test environment
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
ROOT_DIR="$(cd "$PROJECT_DIR/../../.." && pwd)"
cd "$PROJECT_DIR"
# Load environment variables (handle values with spaces properly)
if [ -f .env ]; then
set -a
source .env
set +a
fi
echo "======================================"
echo "Distributed Search Indexing Test Setup"
echo "======================================"
echo ""
echo "Configuration:"
echo " - MySQL Port: ${MYSQL_PORT:-3306}"
echo " - OpenSearch Port: ${OPENSEARCH_PORT:-9200}"
echo " - Server 1: http://localhost:8585"
echo " - Server 2: http://localhost:8587"
echo " - Server 3: http://localhost:8589"
echo ""
# Parse arguments
BUILD_FLAG=""
SKIP_MVN=false
for arg in "$@"; do
case $arg in
--build|-b)
BUILD_FLAG="--build"
;;
--skip-mvn|-s)
SKIP_MVN=true
;;
esac
done
# Check if distribution exists, if not build with Maven
DIST_TAR=$(find "$ROOT_DIR/openmetadata-dist/target" -name "openmetadata-*.tar.gz" 2>/dev/null | head -1)
if [ -z "$DIST_TAR" ] && [ "$SKIP_MVN" != "true" ]; then
echo "OpenMetadata distribution not found. Building with Maven..."
echo "This may take several minutes on first run."
echo ""
cd "$ROOT_DIR"
mvn clean install -DskipTests -Pquickstart -pl '!openmetadata-ui' -am
cd "$PROJECT_DIR"
BUILD_FLAG="--build"
echo ""
echo "Maven build complete."
elif [ "$SKIP_MVN" == "true" ]; then
echo "Skipping Maven build (--skip-mvn flag)"
fi
if [ -n "$BUILD_FLAG" ]; then
echo "Building Docker images..."
fi
# Start the services
echo "Starting services..."
docker compose up -d $BUILD_FLAG
echo ""
echo "Waiting for services to be healthy..."
# Wait for MySQL
echo -n " MySQL: "
until docker compose exec -T mysql mysqladmin ping -h localhost -uroot -p${MYSQL_ROOT_PASSWORD:-password} --silent 2>/dev/null; do
echo -n "."
sleep 2
done
echo " Ready"
# Wait for OpenSearch
echo -n " OpenSearch: "
until curl -s http://localhost:${OPENSEARCH_PORT:-9200}/_cluster/health 2>/dev/null | grep -qE '"status":"(green|yellow)"'; do
echo -n "."
sleep 2
done
echo " Ready"
# Wait for each OM server
for server_num in 1 2 3; do
case $server_num in
1) port=8586 ;;
2) port=8588 ;;
3) port=8590 ;;
esac
echo -n " Server $server_num (admin port $port): "
timeout=120
elapsed=0
until curl -s "http://localhost:$port/healthcheck" >/dev/null 2>&1; do
echo -n "."
sleep 3
elapsed=$((elapsed + 3))
if [ $elapsed -ge $timeout ]; then
echo " Timeout waiting for server $server_num"
echo "Check logs with: ./scripts/logs.sh -f --server $server_num"
exit 1
fi
done
echo " Ready"
done
echo ""
echo "======================================"
echo "All services are up and running!"
echo "======================================"
echo ""
echo "Next steps:"
echo " 1. Load test data: ./scripts/perf-test.sh --tables 10000"
echo " 2. Trigger reindexing: ./scripts/trigger-reindex.sh"
echo " 3. Watch logs: ./scripts/logs.sh -f"
echo ""
echo "Server endpoints:"
echo " - Server 1: http://localhost:8585 (trigger reindex here)"
echo " - Server 2: http://localhost:8587"
echo " - Server 3: http://localhost:8589"
echo ""