You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2018/05/09 15:17:35 UTC

[GitHub] ivankelly commented on a change in pull request #1746: PIP-17: impl offload() for S3ManagedLedgerOffloader

ivankelly commented on a change in pull request #1746: PIP-17: impl offload() for S3ManagedLedgerOffloader
URL: https://github.com/apache/incubator-pulsar/pull/1746#discussion_r187076087
 
 

 ##########
 File path: pulsar-broker/src/test/java/org/apache/pulsar/broker/s3offload/S3ManagedLedgerOffloaderTest.java
 ##########
 @@ -147,5 +221,28 @@ public void testNoBucketConfigured() throws Exception {
             // correct
         }
     }
+
+    @Test
+    public void testOffload() throws Exception {
+        int entryLength = 10;
+        int entryNumberEachBlock = 10;
+        ServiceConfiguration conf = new ServiceConfiguration();
+        conf.setManagedLedgerOffloadDriver(S3ManagedLedgerOffloader.DRIVER_NAME);
+        conf.setS3ManagedLedgerOffloadBucket(BUCKET);
+        conf.setS3ManagedLedgerOffloadRegion(REGION);
+        conf.setS3ManagedLedgerOffloadServiceEndpoint(endpoint);
+        conf.setS3ManagedLedgerOffloadMaxBlockSizeInBytes(
+            DataBlockHeaderImpl.getDataStartOffset() + (entryLength + 12) * entryNumberEachBlock);
+        LedgerOffloader offloader = new S3ManagedLedgerOffloader(conf, scheduler);
+
+        // offload 30 entries, which will be placed into 3 data blocks.
+        int entryCount = 30;
+        ReadHandle readHandle = buildReadHandle(entryCount);
+        UUID uuid = UUID.randomUUID();
+        offloader.offload(readHandle, uuid, new HashMap<>()).get();
+
+        S3Object obj = client.getObject(BUCKET, S3ManagedLedgerOffloader.offloadKey(readHandle, uuid));
+        verifyS3ObjectRead(obj, readHandle, 3, 30, conf.getS3ManagedLedgerOffloadMaxBlockSizeInBytes());
+    }
 }
 
 Review comment:
   Add a test for the case where an individual ledger entry is larger than the configured block size.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services