@Override public String restoreBlock(long id, byte[] hash) throws IOException { if (id == -1) { SDFSLogger.getLog().warn("Hash not found for " + StringUtils.getHexString(hash) + " id " + id); return null; } String haName = this.restoreRequests.get(new Long(id)); if (haName == null) haName = EncyptUtils.encHashArchiveName(id, Main.chunkStoreEncryptionEnabled); else { return haName; } try { CloudBlockBlob blob = container.getBlockBlobReference("blocks/" + haName); blob.downloadAttributes(); if (blob.getProperties().getStandardBlobTier().equals(StandardBlobTier.ARCHIVE)) { blob.uploadStandardBlobTier(StandardBlobTier.HOT); bio.removeBlobDataTracker(id, EncyptUtils.encHashArchiveName(Main.DSEID, Main.chunkStoreEncryptionEnabled)); this.restoreRequests.put(new Long(id), haName); return haName; } else { this.restoreRequests.put(new Long(id), null); return null; } } catch (Exception e) { SDFSLogger.getLog().error("unable to restore " + id,e); throw new IOException(e); } }
StandardBlobTier standardBlobTier = StandardBlobTier.parse(value); this.properties.setStandardBlobTier(standardBlobTier); StandardBlobTier standardBlobTier = StandardBlobTier.parse(value); if (!premiumPageBlobTier.equals(PremiumPageBlobTier.UNKNOWN)) { properties.setPremiumPageBlobTier(premiumPageBlobTier); else if (!standardBlobTier.equals(StandardBlobTier.UNKNOWN)) { properties.setStandardBlobTier(standardBlobTier);
/** * Sets the tier on a block blob on a standard storage account. * @param standardBlobTier * A {@link StandardBlobTier} object which represents the tier of the blob. * @param options * A {@link BlobRequestOptions} object that specifies any additional options for the request. Specifying * <code>null</code> will use the default request options from the associated service client ( * {@link CloudBlobClient}). * @param opContext * An {@link OperationContext} object which represents the context for the current operation. This object * is used to track requests to the storage service, and to provide additional runtime information about * the operation. * @throws StorageException * If a storage service error occurred. */ @DoesServiceRequest public void uploadStandardBlobTier(final StandardBlobTier standardBlobTier, BlobRequestOptions options, OperationContext opContext) throws StorageException { assertNoWriteOperationForSnapshot(); Utility.assertNotNull("standardBlobTier", standardBlobTier); if (opContext == null) { opContext = new OperationContext(); } options = BlobRequestOptions.populateAndApplyDefaults(options, BlobType.BLOCK_BLOB, this.blobServiceClient); ExecutionEngine.executeWithRetry(this.blobServiceClient, this, this.uploadBlobTierImpl(standardBlobTier.toString(), options), options.getRetryPolicyFactory(), opContext); }
@Test @Category({ DevFabricTests.class, DevStoreTests.class }) public void testCloudBlockBlobUploadStandardTier() throws StorageException, IOException, URISyntaxException { for (StandardBlobTier standardBlobTier : StandardBlobTier.values()) { if (standardBlobTier == StandardBlobTier.UNKNOWN) { continue; } final String blobName = BlobTestHelper.generateRandomBlobNameWithPrefix("testBlob"); final CloudBlockBlob blob = this.container.getBlockBlobReference(blobName); blob.uploadText("text"); blob.uploadStandardBlobTier(standardBlobTier); assertEquals(standardBlobTier, blob.getProperties().getStandardBlobTier()); assertNull(blob.getProperties().getPremiumPageBlobTier()); assertNull(blob.getProperties().getRehydrationStatus()); CloudBlockBlob blob2 = this.container.getBlockBlobReference(blobName); blob2.downloadAttributes(); assertEquals(standardBlobTier, blob2.getProperties().getStandardBlobTier()); assertNull(blob2.getProperties().getPremiumPageBlobTier()); assertNull(blob2.getProperties().getRehydrationStatus()); CloudBlockBlob blob3 = (CloudBlockBlob)this.container.listBlobs().iterator().next(); assertEquals(standardBlobTier, blob3.getProperties().getStandardBlobTier()); assertNull(blob3.getProperties().getPremiumPageBlobTier()); assertNull(blob3.getProperties().getRehydrationStatus()); blob.deleteIfExists(); } }
StandardBlobTier standardBlobTier = StandardBlobTier.parse(value); this.properties.setStandardBlobTier(standardBlobTier); StandardBlobTier standardBlobTier = StandardBlobTier.parse(value); if (!premiumPageBlobTier.equals(PremiumPageBlobTier.UNKNOWN)) { properties.setPremiumPageBlobTier(premiumPageBlobTier); else if (!standardBlobTier.equals(StandardBlobTier.UNKNOWN)) { properties.setStandardBlobTier(standardBlobTier);
this.uploadBlobTierImpl(standardBlobTier.toString(), options), options.getRetryPolicyFactory(), opContext);
StandardBlobTier standardBlobTier = StandardBlobTier.parse(blobTierString); properties.setStandardBlobTier(standardBlobTier); StandardBlobTier standardBlobTier = StandardBlobTier.parse(blobTierString); if (!premiumPageBlobTier.equals(PremiumPageBlobTier.UNKNOWN)) { properties.setPremiumPageBlobTier(premiumPageBlobTier); else if (!standardBlobTier.equals(StandardBlobTier.UNKNOWN)) { properties.setStandardBlobTier(standardBlobTier);
if (this.tier != null && this.tier.equals(StandardBlobTier.ARCHIVE)) { blob.downloadAttributes(); if (blob.getProperties().getStandardBlobTier().equals(StandardBlobTier.ARCHIVE)) { this.restoreBlock(id, new byte [16]); throw new DataArchivedException(id, null); if (this.tier != null && this.tier.equals(StandardBlobTier.COOL)) { blob.uploadStandardBlobTier(StandardBlobTier.HOT);
StandardBlobTier standardBlobTier = StandardBlobTier.parse(blobTierString); properties.setStandardBlobTier(standardBlobTier); StandardBlobTier standardBlobTier = StandardBlobTier.parse(blobTierString); if (!premiumPageBlobTier.equals(PremiumPageBlobTier.UNKNOWN)) { properties.setPremiumPageBlobTier(premiumPageBlobTier); else if (!standardBlobTier.equals(StandardBlobTier.UNKNOWN)) { properties.setStandardBlobTier(standardBlobTier);
serviceClient = account.createCloudBlobClient(); serviceClient.getDefaultRequestOptions().setConcurrentRequestCount(Main.dseIOThreads * 2); if (tier != null && (tier.equals(StandardBlobTier.ARCHIVE) || tier.equals(StandardBlobTier.COOL))) { this.bio = new BlobDataIO(this.name + "table", this.accessKey, this.secretKey, connectionProtocol);
@Override public Void preProcessResponse(CloudBlob blob, CloudBlobClient client, OperationContext context) throws Exception { if (this.getResult().getStatusCode() != HttpURLConnection.HTTP_OK && this.getResult().getStatusCode() != HttpURLConnection.HTTP_ACCEPTED) { this.setNonExceptionedRetryableFailure(true); return null; } blob.updateEtagAndLastModifiedFromResponse(this.getConnection()); this.getResult().setRequestServiceEncrypted(BaseResponse.isServerRequestEncrypted(this.getConnection())); blob.getProperties().setBlobTierInferred(false); if (blob.getProperties().getBlobType() == BlobType.BLOCK_BLOB) { // For standard accounts when rehydrating a blob from archive, the status code will be 202 instead of 200. StandardBlobTier standardBlobTier = StandardBlobTier.parse(blobTierString); blob.getProperties().setRehydrationStatus(null); if (this.getResult().getStatusCode() == HttpURLConnection.HTTP_OK) { blob.getProperties().setStandardBlobTier(standardBlobTier); } else if (standardBlobTier.equals(StandardBlobTier.COOL)) { blob.getProperties().setStandardBlobTier(StandardBlobTier.ARCHIVE); } else if (standardBlobTier.equals(StandardBlobTier.HOT)) { blob.getProperties().setStandardBlobTier(StandardBlobTier.ARCHIVE); } } return null; }
@Override public Void preProcessResponse(CloudBlob blob, CloudBlobClient client, OperationContext context) throws Exception { if (this.getResult().getStatusCode() != HttpURLConnection.HTTP_OK && this.getResult().getStatusCode() != HttpURLConnection.HTTP_ACCEPTED) { this.setNonExceptionedRetryableFailure(true); return null; } blob.updateEtagAndLastModifiedFromResponse(this.getConnection()); this.getResult().setRequestServiceEncrypted(BaseResponse.isServerRequestEncrypted(this.getConnection())); blob.getProperties().setBlobTierInferred(false); if (blob.getProperties().getBlobType() == BlobType.BLOCK_BLOB) { // For standard accounts when rehydrating a blob from archive, the status code will be 202 instead of 200. StandardBlobTier standardBlobTier = StandardBlobTier.parse(blobTierString); blob.getProperties().setRehydrationStatus(null); if (this.getResult().getStatusCode() == HttpURLConnection.HTTP_OK) { blob.getProperties().setStandardBlobTier(standardBlobTier); } else if (standardBlobTier.equals(StandardBlobTier.COOL)) { blob.getProperties().setStandardBlobTier(StandardBlobTier.ARCHIVE); } else if (standardBlobTier.equals(StandardBlobTier.HOT)) { blob.getProperties().setStandardBlobTier(StandardBlobTier.ARCHIVE); } } return null; }
&& (tier.equals(StandardBlobTier.ARCHIVE) || tier.equals(StandardBlobTier.COOL))) { HashSet<Long> orr = new HashSet<Long>(); String dseID = EncyptUtils.encHashArchiveName(Main.DSEID, Main.chunkStoreEncryptionEnabled); CloudBlockBlob blob = container.getBlockBlobReference("blocks/" + hashString); blob.downloadAttributes(); if (!blob.getProperties().getStandardBlobTier().equals(tier)) { blob.uploadStandardBlobTier(this.tier); SDFSLogger.getLog().info("Moved blocks/" + hashString + " to "
@Override public boolean blockRestored(String id) { try { CloudBlockBlob blob = container.getBlockBlobReference("blocks/" + id); if(!blob.exists()) return true; blob.downloadAttributes(); if (blob.getProperties().getStandardBlobTier().equals(StandardBlobTier.HOT)) { return true; } else { if (blob.getProperties().getRehydrationStatus() == null || blob.getProperties().getRehydrationStatus().equals(RehydrationStatus.UNKNOWN)) { SDFSLogger.getLog().warn("rehydration status unknow for " + id + " will attempt to rehydrate"); blob.uploadStandardBlobTier(StandardBlobTier.HOT); } return false; } } catch (Exception e) { SDFSLogger.getLog().warn("error while checking block [" + id + "] restored", e); return false; } }