kevinjqliu opened a new issue, #13366:
URL: https://github.com/apache/iceberg/issues/13366

   ### Apache Iceberg version
   
   None
   
   ### Query engine
   
   None
   
   ### Please describe the bug 🐞
   
   The 
[`iceberg-rest-fixture`](https://hub.docker.com/r/apache/iceberg-rest-fixture) 
REST catalog server uses `JdbcCatalog` and specifically sqlite, 
[`jdbc:sqlite::memory:`](https://github.com/apache/iceberg/blob/444fb9518ce4437fd901d9d9442a415391ade295/docker/iceberg-rest-fixture/Dockerfile#L37)
 as the underlying database.
   
   Under high concurrent load, the catalog server errors with:
   
   > Caused by: org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing 
database (no such table: iceberg_tables)
   
   This issue arises because `jdbc:sqlite::memory:` creates a distinct, 
ephemeral in-memory database **for each new JDBC connection**. The 
`JdbcClientPool` [defaults to `client_pool` size of 
2](https://github.com/apache/iceberg/blob/444fb9518ce4437fd901d9d9442a415391ade295/core/src/main/java/org/apache/iceberg/jdbc/JdbcClientPool.java#L63).
 
   When managing more than 2 connections, the `JdbcClientPool` can create new 
connections and thus new in-memory new database, without running the 
initialization logic. Subsequent db operations will fail due to missing tables 
in these newly created database.
   
   Solution:
   In [iceberg-rest-fixture's 
Dockerfile](https://github.com/apache/iceberg/blob/444fb9518ce4437fd901d9d9442a415391ade295/docker/iceberg-rest-fixture/Dockerfile#L37),
 set 
   `CATALOG_URI=jdbc:sqlite:file::memory:?cache=shared`
   
   - Use `file::memory:` to explicitly indicate an in-memory database that 
supports URI parameters.
   - Add the `?cache=shared` parameter to allow SQLite to use a shared 
in-memory cache so that all connections will access the same underlying 
in-memory database.
   
   Additionally, we should replace all subproject using the original 
`jdbc:sqlite::memory:` connection string.
   
   
   
   ### Willingness to contribute
   
   - [ ] I can contribute a fix for this bug independently
   - [ ] I would be willing to contribute a fix for this bug with guidance from 
the Iceberg community
   - [ ] I cannot contribute a fix for this bug at this time


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to