Skip to content

Conversation

@amotl
Copy link
Member

@amotl amotl commented Dec 9, 2025

About

Explore Pgpool-II's In Memory Query Cache with CrateDB.

References

/cc @surister

@coderabbitai
Copy link

coderabbitai bot commented Dec 9, 2025

Walkthrough

Adds a new Pgpool-II integration for CrateDB: Docker Compose orchestration, Pgpool configuration, a test orchestration script, documentation, and a GitHub Actions workflow to run the test stack.

Changes

Cohort / File(s) Change Summary
CI / Workflow
.github/workflows/application-pgpool.yml
New GitHub Actions workflow "Pgpool-II" that runs on push/PR, schedule, and manual dispatch; runs a single matrix job that checks out the repo and runs application/pgpool/test.sh.
Compose / Orchestration
application/pgpool/compose.yml
New docker-compose configuration defining cratedb, pgpool, healthchecks, utility/task containers (provision-functions, cratedb-query-data, pgpool-query-data, crash, start-dependencies), volumes, env vars, and startup dependency ordering.
Pgpool Configuration
application/pgpool/pgpool.conf
New Pgpool-II configuration file including listen/port and in-memory query cache settings (memqcache backend, host/port, sizing, expiration, block size, table list comments).
Test orchestration
application/pgpool/test.sh
New shell script to bring up the compose stack, run provisioning (provision-functions), and execute data queries via the pgpool-query-data task.
Documentation
application/pgpool/README.md
New README describing the Pgpool-II + CrateDB setup, components included, operations examples, status notes, and external links.

Sequence Diagram(s)

sequenceDiagram
    participant CI as GitHub Actions
    participant Runner as Test host
    participant Compose as Docker Compose
    participant Pgpool as Pgpool-II
    participant Crate as CrateDB

    CI->>Runner: checkout + run application/pgpool/test.sh
    Runner->>Compose: docker compose up --detach (cratedb, pgpool)
    Compose->>Crate: start CrateDB (healthcheck)
    Compose->>Pgpool: start Pgpool-II (healthcheck)
    Compose->>Compose: run provision-functions after Crate & Pgpool healthy
    Compose->>Pgpool: run pgpool-query-data (client query via Pgpool)
    Pgpool->>Crate: forward queries
    Crate-->>Pgpool: query responses
    Pgpool-->>Runner: return query results (task exit)
    Runner-->>CI: test.sh exits (status)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

  • Pay attention to:
    • application/pgpool/compose.yml healthchecks, service dependency ordering, and volume mounts
    • application/pgpool/pgpool.conf memqcache parameters and host/port correctness
    • application/pgpool/test.sh commands and use of docker compose flags

Poem

🐰 With twitching nose I hopped to play,

I stitched the pools where queries stay.
Crate hums low, Pgpool sings along,
In compose and config, we belong.
A tiny rabbit cheers: cache on! 🥕

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding a Pgpool-II example demonstrating the In Memory Query Cache feature with CrateDB.
Description check ✅ Passed The description is directly related to the changeset, explaining the purpose of the example (exploring Pgpool-II's In Memory Query Cache with CrateDB) and providing relevant references.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch pgpool

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@amotl amotl marked this pull request as ready for review December 9, 2025 05:20
@amotl amotl requested review from matriv and seut December 9, 2025 05:23
Comment on lines 63 to 87
# BACKEND Error: "Unknown function: pg_catalog.has_function_privilege('crate', 'pgpool_regclass(cstring)', 'execute')"
provision-functions:
image: docker.io/crate/crate:nightly
entrypoint: /bin/bash -c
command:
- |
crash --hosts "http://cratedb:4200" <<SQL
CREATE OR REPLACE FUNCTION pg_catalog.has_function_privilege(string, string, string)
RETURNS BOOLEAN
LANGUAGE JAVASCRIPT
AS 'function has_function_privilege(foo, bar, baz) { return true; }';
SQL
deploy:
replicas: 0
depends_on:
cratedb:
condition: service_healthy

Copy link
Member Author

@amotl amotl Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This detail about missing pg_catalog.has_function_privilege() needs to be reported to crate/crate.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

coderabbitai[bot]

This comment was marked as spam.

Comment on lines 15 to 19
```
LOG: get_query_result: do_query failed
LOG: get_query_result: no result returned
ERROR : Unknown function: pg_catalog.pg_is_in_recovery()
```
Copy link
Member Author

@amotl amotl Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Substitute and/or implement pg_catalog.pg_is_in_recovery(), i.e. also report to crate/crate?

Copy link
Member Author

@amotl amotl Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Substituted as UDF with 327350a, and reported to the database issue tracker.

Comment on lines 9 to 11
```
WARNING: is_temp_table: unexpected PostgreSQL version: CrateDB 6.2.0-SNAPSHOT (built 9e707bd/NA, Linux 6.12.54-linuxkit amd64, OpenJDK 64-Bit Server VM 25.0.1+8-LTS)
```
Copy link
Member Author

@amotl amotl Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is is_temp_table also a missing function, or is that message just some other spurious side effect? Is it actionable or ignorable?

Copy link
Member Author

@amotl amotl Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a function in Pgpool-II: Because the PostgreSQL implementation is based on the server version, the code needs to do a version inquiry first. That's where this warning is coming from, because CrateDB's version string doesn't parse like PostgreSQL's.

https://github.com/pgpool/pgpool2/blob/55b6b9a9d4d82d4635dfd588c4869f3b252d94aa/src/utils/pool_select_walker.c#L760-L774

Copy link
Member Author

@amotl amotl Dec 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it advisable to submit a patch to make Pgpool also accept non-PostgreSQL servers (e.g. CrateDB) here with a reasonable default implementation?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's unlikely that Pgpool-II will accept a patch for CrateDB, and it's only a WARNING, so let's ignore it?

@seut seut removed the request for review from matriv December 9, 2025 13:17
coderabbitai[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as spam.

@amotl amotl changed the title Pgpool-II: Example about In Memory Query Cache Pgpool-II: Example about "In Memory Query Cache" Dec 9, 2025
coderabbitai[bot]

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants