You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Michael Weiss <mw...@gmail.com> on 2020/10/14 13:21:31 UTC

Issue with 2.8.1

I'm having a problem with starting a client node of ignite in 2.8.1 (server
also in 2.8.1), it works fine with server and client being 2.7. Shortly
after it connects to my ignite server it dies on creating the bean for
QuartzDataSourceInitializer on it's init method. Sorry I can't really post
much in the way of logs, I don't have an easy way to do that. Caused by is
"org.h2.jdbc.JdbcSQLException: Function "LOCK_MODE" not found; SQL
statement: CALL LOCK_MODE() [90022-197].

Appreciate any help on troubleshooting this.

Re: Issue with 2.8.1

Posted by Iv...@tdameritrade.com.
I am not a developer of Apache Ignite __ You'd better ask them about it. AFAIK - no.

On 10/14/20, 7:26 PM, "mweiss" <mw...@gmail.com> wrote:

    hmm do you know if this will be fixed in 2.9?
    
    
    
    --
    Sent from: https://urldefense.com/v3/__http://apache-ignite-users.70518.x6.nabble.com/__;!!PNmPxbqrAcYR!2ILUaJEbed4qAulRO4_3mK96vmZX07c064axe-dOIWormmLemVW4fPruFv6SMCNnYpjvZqK8fg$
    
    


Re: Issue with 2.8.1

Posted by mweiss <mw...@gmail.com>.
hmm do you know if this will be fixed in 2.9? 



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Issue with 2.8.1

Posted by Iv...@tdameritrade.com.
You can't just inject the created Ignite bean in your application beans. The official documentation mentions the IgniteSpringBean, however it can't be used either, because there is a race condition inside that class. 
In order to use the Ignite instance in my beans I have extended the IgniteSpringBean class the following way (two classes):

/**
 * It is quite complex to explain the reason I have added this class.
 * Basically there is a race between the {@link Service#execute(ServiceContext)},
 * Ignite initialization event {@link LifecycleEventType#AFTER_NODE_START} and {@link IgniteSpringBean}.
 */
public class CustomizedIgniteSpringBean extends IgniteSpringBean {
	private static final long serialVersionUID = 2884332981397959158L;

	private final NodeInitializationWaiter initializationWaiter;

	public CustomizedIgniteSpringBean(NodeInitializationWaiter initializationWaiter) {
		this.initializationWaiter = initializationWaiter;
	}

	@Override
	public void afterSingletonsInstantiated() {
		super.afterSingletonsInstantiated();
		initializationWaiter.onIgniteSpringBeanInitialized();
	}
}

/**
 * Oftentimes, we would like to execute some runnable or execute some cache operation
 * just from the {@link Service#execute(ServiceContext)} method.
 * Ignite, unfortunately, can fail if we are working with IgniteSpringBean and are executing
 * some cache operation, using a bean that has an Ignite instance injected by Spring. In that
 * case an {@link IllegalStateException} exception may be thrown, warning us that we should
 * not use from Spring bean init methods like @PostConstruct. Probably this is a bug, but
 * we have to somehow workaround it.
 * So this waiter allows services to wait until the grid node becomes fully functional and
 * invoke some code afterwards.
 */
public class NodeInitializationWaiter implements LifecycleBean, DisposableBean {
    private static final Set<LifecycleEventType> INITIALIZED_STATE_TYPES = EnumSet.of(
        LifecycleEventType.AFTER_NODE_START,
        LifecycleEventType.BEFORE_NODE_STOP,
        LifecycleEventType.AFTER_NODE_STOP);

    @LoggerResource(categoryClass = NodeInitializationWaiter.class)
    private transient IgniteLogger logger;

	/**
	 * Current node state
     */
    private volatile LifecycleEventType nodeState;

	/**
     * A flag that determines if {@link IgniteSpringBean} has been initialized
     */
    private volatile boolean springBeanInitialized;

    /**
     * Determines if this bean should
     */
    private volatile boolean cancelled;

    @Override
    public synchronized void onLifecycleEvent(LifecycleEventType evt) throws IgniteException {
        nodeState = evt;
        notifyAll();
    }

	/**
	 * @see CustomizedIgniteSpringBean
     */
    public synchronized void onIgniteSpringBeanInitialized() {
        springBeanInitialized = true;
        notifyAll();
    }

	/**
	 * Wait until the grid node is initialized
     */
    public void waitUntilInitialized() {
        while (!cancelled && !isInitialized()) {
            synchronized (this) {
                if (!cancelled && !isInitialized()) {
                    try {
                        wait();
                    } catch (InterruptedException e) {
                        logger.warning("Interrupted", e);
                    }
                }
            }
        }
    }

    private boolean isInitialized() {
        return INITIALIZED_STATE_TYPES.contains(nodeState) && springBeanInitialized;
    }

    @Override
    public void destroy() throws Exception {
        cancelled = true;
    }
} 

Then you will be able to wait in your beans for Ignite to be fully initialized.

Best regards,
Ivan Fedorenkov

On 10/14/20, 6:14 PM, "mweiss" <mw...@gmail.com> wrote:

    yes
    
    
    
    --
    Sent from: https://urldefense.com/v3/__http://apache-ignite-users.70518.x6.nabble.com/__;!!PNmPxbqrAcYR!yG9-oziWdJlTTpyUz0L5CDBdO2a5a3BfH8PdrQqoww8V1ZlNoaBXdlGMoMSfs_SN_LjNGbr0Xg$
    
    


Re: Issue with 2.8.1

Posted by mweiss <mw...@gmail.com>.
yes



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: Issue with 2.8.1

Posted by Iv...@tdameritrade.com.
Are you using Spring to inject the Ignite instance?

On 10/14/20, 5:52 PM, "mweiss" <mw...@gmail.com> wrote:

    So i figured out more info on my problem, I'm doing Ignition.start(cfg) and
    then pretty much right away using the ignite instance and creating caches;
    but Ignite hasn't fully started so it craps out. Is there a way to get the
    status of the system? Adding a sleep for 10secs seems to solve my problem
    but that's a poor way to verify the system is up. Any advice?
    
    Thanks!
    
    
    
    --
    Sent from: https://urldefense.com/v3/__http://apache-ignite-users.70518.x6.nabble.com/__;!!PNmPxbqrAcYR!0Obe-YWKYMLMO90EgbBgS3l9KgRYInNdojv-CSxLEWhVhQVAGFKqq5TrjMoIV3ThlywT6ItO6w$
    
    


Re: Issue with 2.8.1

Posted by mweiss <mw...@gmail.com>.
So i figured out more info on my problem, I'm doing Ignition.start(cfg) and
then pretty much right away using the ignite instance and creating caches;
but Ignite hasn't fully started so it craps out. Is there a way to get the
status of the system? Adding a sleep for 10secs seems to solve my problem
but that's a poor way to verify the system is up. Any advice?

Thanks!



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/