use of org.apache.ignite.internal.processors.query.schema.message.SchemaProposeDiscoveryMessage in project ignite by apache.
the class GridQueryProcessor method startIndexOperationDistributed.
/**
* Start distributed index change operation.
*
* @param op Operation.
* @return Future.
*/
private IgniteInternalFuture<?> startIndexOperationDistributed(SchemaAbstractOperation op) {
SchemaOperationClientFuture fut = new SchemaOperationClientFuture(op.id());
SchemaOperationClientFuture oldFut = schemaCliFuts.put(op.id(), fut);
assert oldFut == null;
try {
ctx.discovery().sendCustomEvent(new SchemaProposeDiscoveryMessage(op));
if (log.isDebugEnabled())
log.debug("Sent schema propose discovery message [opId=" + op.id() + ", op=" + op + ']');
boolean disconnected0;
synchronized (stateMux) {
disconnected0 = disconnected;
}
if (disconnected0) {
fut.onDone(new SchemaOperationException("Client node is disconnected (operation result is unknown)."));
schemaCliFuts.remove(op.id());
}
} catch (Exception e) {
if (e instanceof SchemaOperationException)
fut.onDone(e);
else {
fut.onDone(new SchemaOperationException("Failed to start schema change operation due to " + "unexpected exception [opId=" + op.id() + ", op=" + op + ']', e));
}
schemaCliFuts.remove(op.id());
}
return fut;
}
use of org.apache.ignite.internal.processors.query.schema.message.SchemaProposeDiscoveryMessage in project ignite by apache.
the class GridQueryProcessor method onSchemaProposeDiscovery0.
/**
* Process schema propose message from discovery thread (or from cache start routine).
*
* @param msg Message.
* @return {@code True} if exchange should be triggered.
*/
private boolean onSchemaProposeDiscovery0(SchemaProposeDiscoveryMessage msg) {
UUID opId = msg.operation().id();
synchronized (stateMux) {
if (disconnected) {
if (log.isDebugEnabled())
log.debug("Processing discovery schema propose message, but node is disconnected (will ignore) " + "[opId=" + opId + ", msg=" + msg + ']');
return false;
}
if (log.isDebugEnabled())
log.debug("Processing discovery schema propose message [opId=" + opId + ", msg=" + msg + ']');
// Put message to active operations set.
SchemaProposeDiscoveryMessage oldDesc = activeProposals.put(msg.operation().id(), msg);
assert oldDesc == null;
// Create schema operation and either trigger it immediately from exchange thread or append to already
// running operation.
SchemaOperation schemaOp = new SchemaOperation(msg);
String schemaName = msg.schemaName();
SchemaOperation prevSchemaOp = schemaOps.get(schemaName);
if (prevSchemaOp != null) {
prevSchemaOp = prevSchemaOp.unwind();
if (log.isDebugEnabled())
log.debug("Schema change is enqueued and will be executed after previous operation is completed " + "[opId=" + opId + ", prevOpId=" + prevSchemaOp.id() + ']');
prevSchemaOp.next(schemaOp);
return false;
} else {
schemaOps.put(schemaName, schemaOp);
return exchangeReady;
}
}
}
Aggregations