korlov42 commented on code in PR #1754:
URL: https://github.com/apache/ignite-3/pull/1754#discussion_r1132234323
##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/util/BaseQueryContext.java:
##########
@@ -232,6 +235,10 @@ public long plannerTimeout() {
return plannerTimeout;
}
+ public long schemaVersion() {
+ return schemaVersion;
Review Comment:
you could take this version from schema directly
##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/schema/SqlSchemaManagerImpl.java:
##########
@@ -24,23 +24,26 @@
import static org.apache.ignite.lang.ErrorGroups.Common.NODE_STOPPING_ERR;
import static org.apache.ignite.lang.ErrorGroups.Sql.OBJECT_NOT_FOUND_ERR;
import static org.apache.ignite.lang.ErrorGroups.Sql.SCHEMA_EVALUATION_ERR;
-import static org.apache.ignite.lang.ErrorGroups.Sql.TABLE_VER_NOT_FOUND_ERR;
Review Comment:
looks like we can delete TABLE_VER_NOT_FOUND_ERR
##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/message/QueryStartRequest.java:
##########
@@ -54,4 +54,9 @@ public interface QueryStartRequest extends
ExecutionContextAwareMessage {
*/
@Marshallable
TxAttributes txAttributes();
+
+ /**
+ * Return last schema version, just a stub, need to be removed after
IGNITE-18733.
+ */
+ long lastVersion();
Review Comment:
I believe it's better to rename to `schemaVersion`. Firstly, it's not last
version, but version used to prepare the query. Secondly, this field should not
be removed after IGNITE-18733, because general rule remains the same: the
schema should not be changed during transaction's lifespan
##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/ExecutionServiceImpl.java:
##########
@@ -321,13 +320,22 @@ private AsyncCursor<List<Object>>
executeExplain(ExplainPlan plan) {
private void onMessage(String nodeName, QueryStartRequest msg) {
assert nodeName != null && msg != null;
- DistributedQueryManager queryManager =
queryManagerMap.computeIfAbsent(msg.queryId(), key -> {
- BaseQueryContext ctx = createQueryContext(key, msg.schema(),
msg.parameters());
+ CompletableFuture<?> fut =
sqlSchemaManager.waitActualSchema(msg.lastVersion());
- return new DistributedQueryManager(ctx);
- });
+ fut.whenComplete((mgr, e) -> {
+ if (e != null) {
+ LOG.error("Schema operation error", e);
Review Comment:
if we failed to acquire schema of required version, why should be proceed
execution of a query?
##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/ExecutionServiceImpl.java:
##########
@@ -321,13 +320,22 @@ private AsyncCursor<List<Object>>
executeExplain(ExplainPlan plan) {
private void onMessage(String nodeName, QueryStartRequest msg) {
assert nodeName != null && msg != null;
- DistributedQueryManager queryManager =
queryManagerMap.computeIfAbsent(msg.queryId(), key -> {
- BaseQueryContext ctx = createQueryContext(key, msg.schema(),
msg.parameters());
+ CompletableFuture<?> fut =
sqlSchemaManager.waitActualSchema(msg.lastVersion());
- return new DistributedQueryManager(ctx);
- });
+ fut.whenComplete((mgr, e) -> {
Review Comment:
Normally, there should be no need to wait. So, let's cover this case
separately
--
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]