try { moveDataTaskLock.lock(); ((MultiDataStoreAware) primaryDataStore).deleteRecord(identifier); deleted++; } catch (DataStoreException e) {
try { moveDataTaskLock.lock(); ((MultiDataStoreAware) primaryDataStore).deleteRecord(identifier); deleted++; } catch (DataStoreException e) {
try { moveDataTaskLock.lock(); ((MultiDataStoreAware) primaryDataStore).deleteRecord(identifier); deleted++; } catch (DataStoreException e) {
@Override public long countDeleteChunks(List<String> chunkIds, long maxLastModifiedTime) throws Exception { int count = 0; if (delegate instanceof MultiDataStoreAware) { List<String> deleted = Lists.newArrayListWithExpectedSize(512); for (String chunkId : chunkIds) { String blobId = extractBlobId(chunkId); DataIdentifier identifier = new DataIdentifier(blobId); DataRecord dataRecord = getRecordForId(identifier); boolean success = (maxLastModifiedTime <= 0) || dataRecord.getLastModified() <= maxLastModifiedTime; log.trace("Deleting blob [{}] with last modified date [{}] : [{}]", blobId, dataRecord.getLastModified(), success); if (success) { ((MultiDataStoreAware) delegate).deleteRecord(identifier); deleted.add(blobId); count++; if (count % 512 == 0) { log.info("Deleted blobs {}", deleted); deleted.clear(); } } } if (!deleted.isEmpty()) { log.info("Deleted blobs {}", deleted); } } return count; }
@Override public long countDeleteChunks(List<String> chunkIds, long maxLastModifiedTime) throws Exception { int count = 0; if (delegate instanceof MultiDataStoreAware) { List<String> deleted = Lists.newArrayListWithExpectedSize(512); for (String chunkId : chunkIds) { String blobId = extractBlobId(chunkId); DataIdentifier identifier = new DataIdentifier(blobId); DataRecord dataRecord = getRecordForId(identifier); boolean success = (maxLastModifiedTime <= 0) || dataRecord.getLastModified() <= maxLastModifiedTime; log.trace("Deleting blob [{}] with last modified date [{}] : [{}]", blobId, dataRecord.getLastModified(), success); if (success) { ((MultiDataStoreAware) delegate).deleteRecord(identifier); deleted.add(blobId); count++; if (count % 512 == 0) { log.info("Deleted blobs {}", deleted); deleted.clear(); } } } if (!deleted.isEmpty()) { log.info("Deleted blobs {}", deleted); } } return count; }
@Override public long countDeleteChunks(List<String> chunkIds, long maxLastModifiedTime) throws Exception { int count = 0; if (delegate instanceof MultiDataStoreAware) { List<String> deleted = Lists.newArrayListWithExpectedSize(512); for (String chunkId : chunkIds) { String blobId = extractBlobId(chunkId); DataIdentifier identifier = new DataIdentifier(blobId); DataRecord dataRecord = getRecordForId(identifier); boolean success = (maxLastModifiedTime <= 0) || dataRecord.getLastModified() <= maxLastModifiedTime; log.trace("Deleting blob [{}] with last modified date [{}] : [{}]", blobId, dataRecord.getLastModified(), success); if (success) { ((MultiDataStoreAware) delegate).deleteRecord(identifier); deleted.add(blobId); count++; if (count % 512 == 0) { log.info("Deleted blobs {}", deleted); deleted.clear(); } } } if (!deleted.isEmpty()) { log.info("Deleted blobs {}", deleted); } } return count; }
((MultiDataStoreAware) primaryDataStore).deleteRecord(identifier); moved++;
((MultiDataStoreAware) primaryDataStore).deleteRecord(identifier); moved++;
((MultiDataStoreAware) primaryDataStore).deleteRecord(identifier); moved++;
/** * Test {@link MultiDataStoreAware#deleteRecord(DataIdentifier)}. */ protected void doDeleteRecordTest() throws Exception { Random random = randomGen; byte[] data1 = new byte[dataLength]; random.nextBytes(data1); DataRecord rec1 = ds.addRecord(new ByteArrayInputStream(data1)); byte[] data2 = new byte[dataLength]; random.nextBytes(data2); DataRecord rec2 = ds.addRecord(new ByteArrayInputStream(data2)); byte[] data3 = new byte[dataLength]; random.nextBytes(data3); DataRecord rec3 = ds.addRecord(new ByteArrayInputStream(data3)); ((MultiDataStoreAware)ds).deleteRecord(rec1.getIdentifier()); assertNull("rec1 should be null", ds.getRecordIfStored(rec1.getIdentifier())); assertEquals(new ByteArrayInputStream(data2), ds.getRecord(rec2.getIdentifier()).getStream()); assertEquals(new ByteArrayInputStream(data3), ds.getRecord(rec3.getIdentifier()).getStream()); }
/** * Test {@link MultiDataStoreAware#deleteRecord(DataIdentifier)}. */ protected void doDeleteRecordTest() throws Exception { ds = createDataStore(); Random random = randomGen; byte[] data1 = new byte[dataLength]; random.nextBytes(data1); DataRecord rec1 = ds.addRecord(new ByteArrayInputStream(data1)); byte[] data2 = new byte[dataLength]; random.nextBytes(data2); DataRecord rec2 = ds.addRecord(new ByteArrayInputStream(data2)); byte[] data3 = new byte[dataLength]; random.nextBytes(data3); DataRecord rec3 = ds.addRecord(new ByteArrayInputStream(data3)); ((MultiDataStoreAware)ds).deleteRecord(rec2.getIdentifier()); assertNull("rec2 should be null", ds.getRecordIfStored(rec2.getIdentifier())); assertEquals(new ByteArrayInputStream(data1), ds.getRecord(rec1.getIdentifier()).getStream()); assertEquals(new ByteArrayInputStream(data3), ds.getRecord(rec3.getIdentifier()).getStream()); ds.close(); }