summaryrefslogtreecommitdiff
path: root/verify_dmap_output.sh
blob: 1b88cddb68196eebbb06e652d35006b07f2d281c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash

# Verification script for dmap turbo mode output
set -e

echo "=== DTail dmap Output Verification ==="
echo "Comparing regular mode vs turbo mode output"
echo

# Create test data if it doesn't exist
TEST_DATA="/tmp/dtail_test_data.log"
if [ ! -f "$TEST_DATA" ]; then
    echo "Creating test data..."
    for i in {1..1000}; do
        echo "2023-12-27 10:00:00 integrationtest mapreduce=TestData goroutines=34.5 lifetimeConnections=0" >> $TEST_DATA
    done
fi

# Test query - simple aggregation without where clause
QUERY='select count($hostname),$hostname,avg($goroutines),sum($lifetimeConnections) from - group by $hostname order by count($hostname)'

# Run in regular mode
echo "Running in regular mode..."
OUTPUT_REGULAR=$(./dmap -servers localhost:2222 -files "$TEST_DATA" -query "$QUERY" 2>/dev/null | head -20)

# Run in turbo mode
echo "Running in turbo mode..."
export DTAIL_TURBOBOOST_ENABLE=yes
OUTPUT_TURBO=$(./dmap -servers localhost:2222 -files "$TEST_DATA" -query "$QUERY" 2>/dev/null | head -20)
unset DTAIL_TURBOBOOST_ENABLE

# Compare outputs
echo
echo "=== Regular Mode Output ==="
echo "$OUTPUT_REGULAR" | head -5
echo "Lines: $(echo "$OUTPUT_REGULAR" | wc -l)"
echo

echo "=== Turbo Mode Output ==="
echo "$OUTPUT_TURBO" | head -5
echo "Lines: $(echo "$OUTPUT_TURBO" | wc -l)"
echo

# Check if outputs match
if [ "$OUTPUT_REGULAR" = "$OUTPUT_TURBO" ]; then
    echo "✓ PASS: Outputs match exactly!"
else
    echo "✗ FAIL: Outputs differ!"
    echo
    echo "Difference:"
    diff <(echo "$OUTPUT_REGULAR") <(echo "$OUTPUT_TURBO") || true
fi