ignite icon indicating copy to clipboard operation
ignite copied to clipboard

CREATE TABLE is synchronous but INSERT immediately after fails with "Table not found"

Open hyemin-lee24 opened this issue 6 months ago • 0 comments

Summary

After executing a CREATE TABLE command via JDBC (through MyBatis in a Spring Boot application), an immediate INSERT operation fails with a "table not found" error. However, retrying the same INSERT shortly after succeeds. This seems to contradict the documentation which states that CREATE TABLE is synchronous.

Environment

  • Apache Ignite version: [2.17]
  • Mode: Embedded
  • Spring Boot + HikariCP + MyBatis
  • JVM: [OpenJDK 11]
  • Persistence: [Enabled]
  • Number of nodes: [1]

Steps to Reproduce

  1. Start Ignite in embedded mode within a Spring Boot application.
  2. Run CREATE TABLE audit_2510 (...) using sqlSessionTemplate.update(...) via MyBatis.
  3. Immediately attempt to INSERT into the created table.
  4. Observe the error: Table not found: audit_2510
  5. Retry the same INSERT after a few milliseconds → it succeeds.

Expected Behavior

Since CREATE TABLE is documented as synchronous, the table should be available for DML (INSERT) immediately after creation.

Actual Behavior

The first INSERT fails with a "table not found" error. This suggests that although the CREATE TABLE call returns successfully, the table may not yet be fully available in the SQL context.

Reference

"The CREATE TABLE command is synchronous and creates a table with the specified columns."

Additional Notes

  • Introducing a delay or polling INFORMATION_SCHEMA.TABLES before performing the INSERT solves the issue.
  • Possibly related to metadata propagation delay or SQL context sync timing in embedded mode.
  • This behavior can cause flaky tests or production bugs in high-concurrency systems.

Question

Is this behavior expected under certain conditions (e.g., embedded mode, client thread timing), or should CREATE TABLE fully guarantee DML readiness when it returns?

hyemin-lee24 avatar May 27 '25 01:05 hyemin-lee24