-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change: Make ManagedStreamingQueuingPolicy internal, expose just a factor #413
base: master
Are you sure you want to change the base?
Conversation
Expose just a factor instead of the whole managed policy
Test Results149 tests - 183 149 ✅ - 174 6s ⏱️ - 3m 25s Results for commit 49888c1. ± Comparison against base commit 9884e0a. This pull request removes 183 tests.
♻️ This comment has been updated with latest results. |
/* | ||
* For internal usage, adding blobExactSize | ||
*/ | ||
public static BlobSourceInfo fromFile(String blobPath, FileSourceInfo fileSourceInfo, CompressionType sourceCompressionType, boolean gotCompressed) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it's for internal use - can we lower the visibility?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no because its used outside the pacakge
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, so maybe we want to document it like a public function?
Not sure what the right call is ehre
/* | ||
* For internal usage, adding blobExactSize | ||
*/ | ||
public static BlobSourceInfo fromFile(String blobPath, FileSourceInfo fileSourceInfo, CompressionType sourceCompressionType, boolean gotCompressed) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The param on the outside is "shouldCompress", but here it's called "gotCompressed" - any reason?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Client should care if it should compress
. file naming should care only that it was compressed .
@@ -23,14 +23,8 @@ public FileSourceInfo(String filePath) { | |||
this.filePath = filePath; | |||
} | |||
|
|||
// An estimation of the raw (uncompressed, un-indexed) size of the data, for binary formatted files - use only if known | |||
public FileSourceInfo(String filePath, long rawSizeInBytes) { | |||
public FileSourceInfo(String filePath, UUID sourceId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In V2 SourceID is not UUID, so maybe we already want to treat it as a string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
its not v2 here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but just not to break the interface when we move
ingest/src/main/java/com/microsoft/azure/kusto/ingest/source/FileSourceInfo.java
Show resolved
Hide resolved
@@ -39,22 +39,7 @@ public static StreamSourceInfo fileToStream(FileSourceInfo fileSourceInfo, boole | |||
} | |||
|
|||
CompressionType compression = getCompression(filePath); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We no longer rely on format.isCompressible?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not here - in the policy
ingest/src/main/java/com/microsoft/azure/kusto/ingest/AzureStorageClient.java
Show resolved
Hide resolved
} | ||
} | ||
|
||
private void copyStream(InputStream inputStream, OutputStream outputStream, int bufferSize) throws IOException { | ||
// Returns original stream size | ||
private int copyStream(InputStream inputStream, OutputStream outputStream, int bufferSize) throws IOException { | ||
byte[] buffer = new byte[bufferSize]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there is an helper in apache for copy stream, you should check.
ingest/src/main/java/com/microsoft/azure/kusto/ingest/AzureStorageClient.java
Show resolved
Hide resolved
* {@link ManagedStreamingQueuingPolicy.Default} which is created with no factor. | ||
* @param factor - Default is 1. | ||
**/ | ||
public void setQueuingPolicyFactor(double factor) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update CHANGELOG.md with all the changes, mention this specifically as a breaking change
@@ -83,12 +84,13 @@ public static void postToQueueWithRetries(ResourceManager resourceManager, Azure | |||
Collections.singletonMap("blob", SecurityUtils.removeSecretsFromUrl(blob.getBlobPath()))); | |||
} | |||
|
|||
public static String uploadStreamToBlobWithRetries(ResourceManager resourceManager, AzureStorageClient azureStorageClient, InputStream stream, | |||
public static Pair<String, Integer> uploadStreamToBlobWithRetries(ResourceManager resourceManager, AzureStorageClient azureStorageClient, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the previous comment, maybe you should just have an UploadResult type with the string and size, it's clearer for both here and the inner methods that return int
@Nullable String clientRequestId) | ||
throws IngestionClientException, IngestionServiceException { | ||
String blobPath = blobSourceInfo.getBlobPath(); | ||
try { | ||
// No need to check blob size if it was given to us that it's not empty | ||
if (blobSourceInfo.getRawSizeInBytes() == 0 && cloudBlockBlob.getProperties().getBlobSize() == 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we check for empty blob elsewhere?
managedStreamingIngestClientSpy = spy( | ||
new ManagedStreamingIngestClient(mock(StreamingIngestClient.class), queuedIngestClientMock, new ExponentialRetry(1))); | ||
} | ||
// @BeforeAll |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is everything commented out
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments
Change: