[
https://issues.apache.org/jira/browse/OAK-8552?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16914136#comment-16914136
]
Amit Jain commented on OAK-8552:
--------------------------------
[~mattvryan]
Regarding the 2 issues above
* #getReference - Tried a few optimizations:
** Removed the need to get a DataRecord instance and use a dummy DataRecord
instance [1]. It fails segment standby test case(s) because of expectation that
non null getReference means available locally [2]. That can be fixed but the
solution seems hacky.
** Another option can be to introduce a new cleaner API Blob#isInlined (name
can be changed) as outlined in the patch [^OAK-8552_ApiChange.patch]. The
changes touch a lot of places but is quite trivial. Test cases still need to be
added.
* #exists check -
** IIUC, the need to check existence is because of asynchronous uploads, then
one option is to actually disable that and remove the existence check. It would
lead to perceived performance drop, perceived because JCR call returns quickly
but time to reach the cloud backend for a binary would be the same as in
synchronous uploads or even little worse.
** Another option is to introduce a in-memory cache locally in the Backend for
ids uploaded. The idea to use BlobTracker does not work because that was only
introduced for DSGC and it also doesn't wait to add the id only after an
asynchronous upload. Also, if DSGC is meant to run outside the server (i.e.
oak-run) then it is most likely the BlobTracker would be disabled.
[~tmueller] wdyt?
[1]
{code:java}
Index:
oak-blob-plugins/src/main/java/org/apache/jackrabbit/oak/plugins/blob/datastore/DataStoreBlobStore.java
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
---
oak-blob-plugins/src/main/java/org/apache/jackrabbit/oak/plugins/blob/datastore/DataStoreBlobStore.java
(revision b4e0a5ba954b7de4b508aa197847223800f1c320)
+++
oak-blob-plugins/src/main/java/org/apache/jackrabbit/oak/plugins/blob/datastore/DataStoreBlobStore.java
(date 1566293954000)
@@ -52,6 +52,8 @@
import com.google.common.io.Closeables;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
+import org.apache.jackrabbit.core.data.AbstractDataRecord;
+import org.apache.jackrabbit.core.data.AbstractDataStore;
import org.apache.jackrabbit.core.data.DataIdentifier;
import org.apache.jackrabbit.core.data.DataRecord;
import org.apache.jackrabbit.core.data.DataStore;
@@ -312,16 +314,34 @@
return null;
}
- DataRecord record;
- try {
- record = delegate.getRecordIfStored(new DataIdentifier(blobId));
- if (record != null) {
- return record.getReference();
- } else {
- log.debug("No blob found for id [{}]", blobId);
- }
- } catch (DataStoreException e) {
- log.warn("Unable to access the blobId for [{}]", blobId, e);
+ // Get reference without possible round-tripping using a dummy data
record
+ if (delegate instanceof AbstractDataStore) {
+ return new AbstractDataRecord((AbstractDataStore) delegate, new
DataIdentifier(blobId)) {
+
+ @Override public long getLength() {
+ return 0;
+ }
+
+ @Override public InputStream getStream() {
+ return null;
+ }
+
+ @Override public long getLastModified() {
+ return 0;
+ }
+ }.getReference();
+ } else {
+ DataRecord record;
+ try {
+ record = delegate.getRecordIfStored(new
DataIdentifier(blobId));
+ if (record != null) {
+ return record.getReference();
+ } else {
+ log.debug("No blob found for id [{}]", blobId);
+ }
+ } catch (DataStoreException e) {
+ log.warn("Unable to access the blobId for [{}]", blobId, e);
+ }
}
return null;
}
{code}
[2]
[https://github.com/apache/jackrabbit-oak/blob/trunk/oak-segment-tar/src/main/java/org/apache/jackrabbit/oak/segment/standby/client/RemoteBlobProcessor.java#L78-L89]
> Minimize network calls required when creating a direct download URI
> -------------------------------------------------------------------
>
> Key: OAK-8552
> URL: https://issues.apache.org/jira/browse/OAK-8552
> Project: Jackrabbit Oak
> Issue Type: Sub-task
> Components: blob-cloud, blob-cloud-azure
> Reporter: Matt Ryan
> Assignee: Matt Ryan
> Priority: Major
> Attachments: OAK-8552_ApiChange.patch
>
>
> We need to isolate and try to optimize network calls required to create a
> direct download URI.
--
This message was sent by Atlassian Jira
(v8.3.2#803003)