SortedSet<LockInfo> lockSet = new TreeSet<LockInfo>(new LockInfoComparator()); while (rs.next()) { lockSet.add(new LockInfo(rs));
private List<LockInfo> getLockInfoFromLockId(Connection dbConn, long extLockId) throws NoSuchLockException, MetaException, SQLException { Statement stmt = null; try { stmt = dbConn.createStatement(); String s = "select hl_lock_ext_id, hl_lock_int_id, hl_db, hl_table, " + "hl_partition, hl_lock_state, hl_lock_type, hl_txnid from HIVE_LOCKS where " + "hl_lock_ext_id = " + extLockId; LOG.debug("Going to execute query <" + s + ">"); ResultSet rs = stmt.executeQuery(s); boolean sawAtLeastOne = false; List<LockInfo> ourLockInfo = new ArrayList<LockInfo>(); while (rs.next()) { ourLockInfo.add(new LockInfo(rs)); sawAtLeastOne = true; } if (!sawAtLeastOne) { throw new MetaException("This should never happen! We already " + "checked the lock existed but now we can't find it!"); } return ourLockInfo; } finally { closeStmt(stmt); } }
private List<LockInfo> getLockInfoFromLockId(Connection dbConn, long extLockId) throws NoSuchLockException, MetaException, SQLException { Statement stmt = null; try { stmt = dbConn.createStatement(); String s = "select hl_lock_ext_id, hl_lock_int_id, hl_db, hl_table, " + "hl_partition, hl_lock_state, hl_lock_type, hl_txnid from HIVE_LOCKS where " + "hl_lock_ext_id = " + extLockId; LOG.debug("Going to execute query <" + s + ">"); ResultSet rs = stmt.executeQuery(s); boolean sawAtLeastOne = false; List<LockInfo> ourLockInfo = new ArrayList<LockInfo>(); while (rs.next()) { ourLockInfo.add(new LockInfo(rs)); sawAtLeastOne = true; } if (!sawAtLeastOne) { throw new MetaException("This should never happen! We already " + "checked the lock existed but now we can't find it!"); } return ourLockInfo; } finally { closeStmt(stmt); } }
private List<LockInfo> getLockInfoFromLockId(Connection dbConn, long extLockId) throws NoSuchLockException, MetaException, SQLException { Statement stmt = null; try { stmt = dbConn.createStatement(); String s = "select hl_lock_ext_id, hl_lock_int_id, hl_db, hl_table, " + "hl_partition, hl_lock_state, hl_lock_type, hl_txnid from HIVE_LOCKS where " + "hl_lock_ext_id = " + extLockId; LOG.debug("Going to execute query <" + s + ">"); ResultSet rs = stmt.executeQuery(s); boolean sawAtLeastOne = false; List<LockInfo> ourLockInfo = new ArrayList<>(); while (rs.next()) { ourLockInfo.add(new LockInfo(rs)); sawAtLeastOne = true; } if (!sawAtLeastOne) { throw new MetaException("This should never happen! We already " + "checked the lock(" + JavaUtils.lockIdToString(extLockId) + ") existed but now we can't find it!"); } return ourLockInfo; } finally { closeStmt(stmt); } }
private LockInfo getTxnIdFromLockId(Connection dbConn, long extLockId) throws NoSuchLockException, MetaException, SQLException { Statement stmt = null; ResultSet rs = null; try { stmt = dbConn.createStatement(); String s = "select hl_lock_ext_id, hl_lock_int_id, hl_db, hl_table, " + "hl_partition, hl_lock_state, hl_lock_type, hl_txnid from HIVE_LOCKS where " + "hl_lock_ext_id = " + extLockId; LOG.debug("Going to execute query <" + s + ">"); rs = stmt.executeQuery(s); if (!rs.next()) { return null; } LockInfo info = new LockInfo(rs); LOG.debug("getTxnIdFromLockId(" + extLockId + ") Return " + JavaUtils.txnIdToString(info.txnId)); return info; } finally { close(rs); closeStmt(stmt); } }
private boolean isPartitionLock() { return !(isDbLock() || isTableLock()); } }