Tabnine Logo
NoSuchTxnException.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
org.apache.hadoop.hive.metastore.api.NoSuchTxnException
constructor

Best Java code snippets using org.apache.hadoop.hive.metastore.api.NoSuchTxnException.<init> (Showing top 13 results out of 315)

origin: apache/hive

public NoSuchTxnException deepCopy() {
 return new NoSuchTxnException(this);
}
origin: apache/hive

private void heartbeatTxn(Connection dbConn, long txnid)
 throws NoSuchTxnException, TxnAbortedException, SQLException, MetaException {
 // If the txnid is 0, then there are no transactions in this heartbeat
 if (txnid == 0) return;
 Statement stmt = null;
 try {
  stmt = dbConn.createStatement();
  long now = getDbTime(dbConn);
  String s = "update TXNS set txn_last_heartbeat = " + now +
   " where txn_id = " + txnid + " and txn_state = '" + TXN_OPEN + "'";
  LOG.debug("Going to execute update <" + s + ">");
  int rc = stmt.executeUpdate(s);
  if (rc < 1) {
   ensureValidTxn(dbConn, txnid, stmt); // This should now throw some useful exception.
   LOG.warn("Can neither heartbeat txn nor confirm it as invalid.");
   dbConn.rollback();
   throw new NoSuchTxnException("No such txn: " + txnid);
  }
  LOG.debug("Going to commit");
  dbConn.commit();
 } finally {
  closeStmt(stmt);
 }
}
origin: apache/hive

/**
 * Used to raise an informative error when the caller expected a txn in a particular TxnStatus
 * but found it in some other status
 */
private static void raiseTxnUnexpectedState(TxnStatus actualStatus, long txnid) 
 throws NoSuchTxnException, TxnAbortedException {
 switch (actualStatus) {
  case ABORTED:
   throw new TxnAbortedException("Transaction " + JavaUtils.txnIdToString(txnid) + " already aborted");
  case COMMITTED:
   throw new NoSuchTxnException("Transaction " + JavaUtils.txnIdToString(txnid) + " is already committed.");
  case UNKNOWN:
   throw new NoSuchTxnException("No such transaction " + JavaUtils.txnIdToString(txnid));
  case OPEN:
   throw new NoSuchTxnException(JavaUtils.txnIdToString(txnid) + " is " + TxnStatus.OPEN);
  default:
   throw new IllegalArgumentException("Unknown TxnStatus " + actualStatus);
 }
}
/**
origin: apache/hive

if (alreadyCommitted) {
 throw new NoSuchTxnException("Transaction " + JavaUtils.txnIdToString(txnid)
   + " is already committed.");
throw new NoSuchTxnException("No such transaction " + JavaUtils.txnIdToString(txnid));
origin: apache/hive

@Test
public void testRunHeartbeatFailsNoSuchTxnException() throws Exception {
 NoSuchTxnException exception = new NoSuchTxnException();
 doThrow(exception).when(mockMetaStoreClient).heartbeat(TRANSACTION_ID, LOCK_ID);
 task.run();
 verify(mockListener).lockFailed(LOCK_ID, TRANSACTION_ID, Arrays.asList("DB.TABLE"), exception);
}
origin: apache/hive

@Test
public void testHeartbeatFailsNoSuchTxnException() throws Exception {
 Throwable t = new NoSuchTxnException();
 doThrow(t).when(mockMetaStoreClient).heartbeat(TRANSACTION_ID, LOCK_ID);
 HeartbeatTimerTask task = new HeartbeatTimerTask(mockMetaStoreClient, mockListener, TRANSACTION_ID, SOURCES,
   LOCK_ID);
 task.run();
 verify(mockListener).lockFailed(LOCK_ID, TRANSACTION_ID, Lock.asStrings(SOURCES), t);
}
origin: com.facebook.presto.hive/hive-apache

public NoSuchTxnException deepCopy() {
 return new NoSuchTxnException(this);
}
origin: org.apache.hive/hive-standalone-metastore

public NoSuchTxnException deepCopy() {
 return new NoSuchTxnException(this);
}
origin: org.spark-project.hive/hive-metastore

public NoSuchTxnException deepCopy() {
 return new NoSuchTxnException(this);
}
origin: org.spark-project.hive/hive-metastore

LOG.debug("Going to rollback");
dbConn.rollback();
throw new NoSuchTxnException("No such transaction: " + txnid);
origin: com.facebook.presto.hive/hive-apache

LOG.debug("Going to rollback");
dbConn.rollback();
throw new NoSuchTxnException("No such transaction: " + txnid);
origin: org.spark-project.hive/hive-metastore

public void abortTxn(AbortTxnRequest rqst) throws NoSuchTxnException, MetaException {
 long txnid = rqst.getTxnid();
 try {
  Connection dbConn = null;
  try {
   dbConn = getDbConn(Connection.TRANSACTION_SERIALIZABLE);
   if (abortTxns(dbConn, Collections.singletonList(txnid)) != 1) {
    LOG.debug("Going to rollback");
    dbConn.rollback();
    throw new NoSuchTxnException("No such transaction: " + txnid);
   }
   LOG.debug("Going to commit");
   dbConn.commit();
  } catch (SQLException e) {
   LOG.debug("Going to rollback");
   rollbackDBConn(dbConn);
   checkRetryable(dbConn, e, "abortTxn(" + rqst + ")");
   throw new MetaException("Unable to update transaction database "
    + StringUtils.stringifyException(e));
  } finally {
   closeDbConn(dbConn);
  }
 } catch (RetryException e) {
  abortTxn(rqst);
 }
}
origin: com.facebook.presto.hive/hive-apache

public void abortTxn(AbortTxnRequest rqst) throws NoSuchTxnException, MetaException {
 long txnid = rqst.getTxnid();
 try {
  Connection dbConn = null;
  try {
   dbConn = getDbConn(Connection.TRANSACTION_SERIALIZABLE);
   if (abortTxns(dbConn, Collections.singletonList(txnid)) != 1) {
    LOG.debug("Going to rollback");
    dbConn.rollback();
    throw new NoSuchTxnException("No such transaction: " + txnid);
   }
   LOG.debug("Going to commit");
   dbConn.commit();
  } catch (SQLException e) {
   LOG.debug("Going to rollback");
   rollbackDBConn(dbConn);
   checkRetryable(dbConn, e, "abortTxn(" + rqst + ")");
   throw new MetaException("Unable to update transaction database "
    + StringUtils.stringifyException(e));
  } finally {
   closeDbConn(dbConn);
  }
 } catch (RetryException e) {
  abortTxn(rqst);
 }
}
org.apache.hadoop.hive.metastore.apiNoSuchTxnException<init>

Javadoc

Performs a deep copy on other.

Popular methods of NoSuchTxnException

  • getMessage
  • equals
  • isSetMessage
    Returns true if field message is set (has been assigned a value) and false otherwise
  • read
  • setMessage
  • setMessageIsSet
  • unsetMessage
  • validate
  • write

Popular in Java

  • Reading from database using SQL prepared statement
  • setRequestProperty (URLConnection)
  • setContentView (Activity)
  • getResourceAsStream (ClassLoader)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • String (java.lang)
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now