flume-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "基勇" <252637...@qq.com>
Subject flume transaction close to begin cost 3-5 seconds
Date Mon, 21 May 2018 15:43:40 GMT
Hi,guys:
     I use flume to read data written to sequoiadb, channel uses kafka channel, sink is developed
to flume sequoiadb sink itself, testing the time to write sequoiadb, but transation close
to begin even takes 3-5 seconds.
     Why does the transaction take so long to close to open?
     Is there a partner who can help me?  3Q


code:
 
@Override
 
	public Status process() throws EventDeliveryException {
 
		// TODO Auto-generated method stub
 
		Channel channel = getChannel();
 
	    Transaction transaction = channel.getTransaction();
 
	    LOG.info("transaction begin timestamp is :"+System.currentTimeMillis());
 
	    transaction.begin();
 
	    boolean success = false;
 
        
 
        try {
 
        	int txnEventCount = drainOne(channel);
 
			
 
			transaction.commit();
 
	        success = true;
 
	        LOG.info("transaction commit timestamp is :"+System.currentTimeMillis());
 
	        if (txnEventCount < 1) {
 
	          return Status.BACKOFF;
 
	        } else {
 
	          return Status.READY;
 
	        }
 
	        
 
		} catch (BaseException e) {
 
			LOG.error(e.getMessage(),e);
 
			return Status.BACKOFF;
 
		} catch (InterruptedException e) {
 
			LOG.error(e.getMessage(),e);
 
			return Status.BACKOFF;
 
		} catch (Exception e){
 
			throw new EventDeliveryException(e);
 
		}finally{
 
			if (!success) {
 
		        transaction.rollback();
 
		      }
 
		      transaction.close();
 
		      LOG.info("transaction close timestamp is :"+System.currentTimeMillis());
 
		}
 
	}
Mime
View raw message