Skip to content

DBHammer/Panacea

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Panacea

Panacea is an automated testing framework for detecting logic bugs in HTAP (Hybrid Transactional/Analytical Processing) database systems.

Features

  • Multiple Database Support: TiDB, PolarDB, TDSQL, MySQL, MySQL HeatWave
  • Multiple Testing Modes:
    • htap-logic - HTAP logical consistency testing
    • htap-mixed - HTAP mixed workload testing
  • Smart Deduplication: Structural query analysis-based error deduplication
  • LLM Feedback: Optional LLM integration for test strategy optimization
  • Concurrent Testing: Multi-threaded execution support

Requirements

  • JDK 11+
  • Maven 3.6+
  • Accessible target database instance(s)

Quick Start

1. Build

mvn -DskipTests package

2. Configure Database Connection

Edit a config file (e.g., config/tidb/config-tidb.yaml):

provider: tidb

base:
  connections:
    tidb-local:
      host: 127.0.0.1
      port: 4000
      username: root
      password: ''
  defaultConnection: tidb-local
  taskType: htap-logic

3. Run

# Use specific config file
java -jar target/panacea-0.1.0.jar --config config/tidb/config-tidb.yaml

# Or pass config path directly
java -jar target/panacea-0.1.0.jar config/tidb/config-tidb.yaml

# Use default config.yaml in current directory
java -jar target/panacea-0.1.0.jar

Configuration

Core Settings

provider: tidb|polardb|tdsql|mysql

base:
  # Testing mode
  taskType: mysql|htap-logic|htap-mixed

  # Database connections
  connections:
    <connection-name>:
      host: <host>
      port: <port>
      username: <user>
      password: <password>

  # Execution parameters
  threads: 1                    # Concurrent threads
  maxFailures: 100              # Max failure count
  runtimeDuration: "1h"         # Runtime duration (e.g., "30m", "2h")
  logPath: ./logs               # Log output path

Deduplication System

deduplication:
  enabled: true
  feedbackMode: local_only      # local_only | llm_only
  frequencyScope: global        # run | global

LLM Feedback (Optional)

llmFeedback:
  enabled: false                # Disabled by default
  apiKeyEnv: OPEN_ROUTER_KEY
  model: qwen/qwen3.5-flash-02-23

When LLM is enabled, set the environment variable:

export OPEN_ROUTER_KEY=your_api_key

Example Configs

The project provides several example configurations:

  • config/config.yaml - Generic config template
  • config/tidb/config-tidb.yaml - TiDB config
  • config/tdsql/config-tdsql-enable.yaml - TDSQL config

Output

After running, the following files are generated in the logPath directory:

  • logs_<timestamp>/ - Current run log directory
    • *.sql - SQL execution logs
    • exceptions/ - Exception information
    • llm_feedback.jsonl - LLM feedback records (if enabled)
  • decision_frequency.json - Decision frequency statistics (global mode)

License

MIT License - See LICENSE.md

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages