/** * Release the cached pages */ public void release() { for (MemoryRowBlock rowBlock : rowBlocks) { rowBlock.release(); } super.clear(); rowBlocks.clear(); totalUsedMem = 0; }
/** * Release the cached pages */ public void release() { for (MemoryRowBlock rowBlock : rowBlocks) { rowBlock.release(); } super.clear(); rowBlocks.clear(); totalUsedMem = 0; }
@Override public void close() { if(rowBlock != null) { rowBlock.release(); rowBlock = null; } if (physicalExec != null) { try { physicalExec.close(); } catch (Exception ignored) {} } physicalExec = null; currentRow = -1; }
@Override public void close() { if(rowBlock != null) { rowBlock.release(); rowBlock = null; } if (physicalExec != null) { try { physicalExec.close(); } catch (Exception ignored) {} } physicalExec = null; currentRow = -1; }
@Override public MemoryRowBlock call() throws Exception { appender.writeRowBlock(taskId, rowBlock); if (release) rowBlock.release(); else rowBlock.clear(); return rowBlock; } });
@Override public MemoryRowBlock call() throws Exception { appender.writeRowBlock(taskId, rowBlock); if (release) rowBlock.release(); else rowBlock.clear(); return rowBlock; } });
public void close() throws IOException { if(isStopped) { return; } isStopped = true; if (scanExec != null) { scanExec.close(); scanExec = null; } if(rowBlock != null) { rowBlock.release(); rowBlock = null; } if(executor != null) { executor.shutdown(); } //remove temporal final output if (!tajoConf.getBoolVar(TajoConf.ConfVars.$DEBUG_ENABLED)) { Path temporalResultDir = TajoConf.getTemporalResultDir(tajoConf, queryId); if (tableDesc.getUri().equals(temporalResultDir.toUri())) { temporalResultDir.getFileSystem(tajoConf).delete(temporalResultDir.getParent(), true); } } LOG.info(String.format("\"Sent result to client for %s, queryId: %s %s rows: %d", sessionId, queryId, codecType != null ? ", compression: " + codecType : "", totalRows )); }
@Override public void close() throws IOException { flush(); if (tableStatsEnabled) { stats.setNumBytes(getOffset()); } if (LOG.isDebugEnabled()) { LOG.debug("RawFileAppender written: " + getOffset() + " bytes, path: " + path); } IOUtils.cleanup(LOG, channel, randomAccessFile, fos); if(!hasExternalBuf && rowBlock != null) { rowBlock.release(); } }
@Override public void close() throws IOException { flush(); if (tableStatsEnabled) { stats.setNumBytes(getOffset()); } if (LOG.isDebugEnabled()) { LOG.debug("RawFileAppender written: " + getOffset() + " bytes, path: " + path); } IOUtils.cleanup(LOG, channel, randomAccessFile, fos); if(!hasExternalBuf && rowBlock != null) { rowBlock.release(); } }
rowBlock.release(); rowBlock = null;
@Test public void testRWForAllTypesWithNextTuple() throws IOException { int rowNum = 10000; MemoryRowBlock rowBlock = createRowBlock(rowNum); TableMeta meta = CatalogUtil.newTableMeta(BuiltinStorages.DRAW, tajoConf); FileStatus outputFile = writeRowBlock(tajoConf, meta, rowBlock); rowBlock.release(); FileFragment fragment = new FileFragment("testRWForAllTypesWithNextTuple", outputFile.getPath(), 0, outputFile.getLen()); DirectRawFileScanner reader = new DirectRawFileScanner(tajoConf, schema, meta, fragment); reader.init(); long readStart = System.currentTimeMillis(); int j = 0; Tuple tuple; while ((tuple = reader.next()) != null) { validateTupleResult(j, tuple); j++; } LOG.info("Total read rows: " + j); long readEnd = System.currentTimeMillis(); LOG.info("reading takes " + (readEnd - readStart) + " msec"); reader.close(); assertEquals(rowNum, j); }
@Test public void testRepeatedScan() throws IOException { int rowNum = 2; MemoryRowBlock rowBlock = createRowBlock(rowNum); TableMeta meta = CatalogUtil.newTableMeta(BuiltinStorages.DRAW, tajoConf); FileStatus outputFile = writeRowBlock(tajoConf, meta, rowBlock); rowBlock.release(); FileFragment fragment = new FileFragment("testRepeatedScan", outputFile.getPath(), 0, outputFile.getLen()); DirectRawFileScanner reader = new DirectRawFileScanner(tajoConf, schema, meta, fragment); reader.init(); int j = 0; while (reader.next() != null) { j++; } assertEquals(rowNum, j); for (int i = 0; i < 5; i++) { assertNull(reader.next()); } reader.close(); }
serializedResBuilder.setRows(rowBlock.rows()); } finally { rowBlock.release();
serializedResBuilder.setRows(rowBlock.rows()); } finally { rowBlock.release();
serializedResBuilder.setRows(rowBlock.rows()); } finally { rowBlock.release();
serializedResBuilder.setRows(rowBlock.rows()); } finally { rowBlock.release();
@Test public void testReset() throws IOException { int rowNum = 2; MemoryRowBlock rowBlock = createRowBlock(rowNum); TableMeta meta = CatalogUtil.newTableMeta(BuiltinStorages.DRAW, tajoConf); FileStatus outputFile = writeRowBlock(tajoConf, meta, rowBlock); rowBlock.release(); FileFragment fragment = new FileFragment("testReset", outputFile.getPath(), 0, outputFile.getLen()); DirectRawFileScanner reader = new DirectRawFileScanner(tajoConf, schema, meta, fragment); reader.init(); int j = 0; while (reader.next() != null) { j++; } assertEquals(rowNum, j); for (int i = 0; i < 5; i++) { assertNull(reader.next()); } reader.reset(); j = 0; while (reader.next() != null) { j++; } assertEquals(rowNum, j); for (int i = 0; i < 5; i++) { assertNull(reader.next()); } reader.close(); }