-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
NIFI-9892: Updated Azure storage related processors to adhere to NiFi… #5944
Conversation
… best practices and cleaned up code a bit. Fixed several integration tests.
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.
Overall, great updates, @markap14! Using the processors felt much more internally consistent now.
I noted that while ListAzureBlobStorage
does set the filename
attribute, it doesn't set it to a value that can be directly used by FetchAzureBlobStorage
. Instead, the azure.blobname
contains what would be the usable value. For example, filename
contained test.txt
and azure.blobname
contained resources/test.txt
in my test, and it's the latter that is needed by FetchAzureBlobStorage
. Additionally, path
was set to ./
, which I think is not consistent. What do you think about setting path
to the value before the filename, and defaulting the FetchAzureBlobStorage
Blob Name
property to ${path}/${filename}
? Not sure how this would work at the root level, however.
Same issue for the *_12
processors. I have not exercised the ADLS processors yet.
@markap14 I looked these through and they all look like good changes (which you probably don't need to be told). There's one thing I wanted to call out that I think might be relevant with changing the default to See #3906 (comment) |
Oops. Overlapping replies.
|
…tribute within List/Fetch/Delete/Put/Move Blob Storage Processors
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.
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.
@markap14 Thanks for the changes! The old Blob processors needed a facelift definitely. However, the properties in the ADLS and mostly in the Blob_v12 blob processors tried to follow a concept. Please find my comments below.
final boolean accountNameAndKeySet = !credentialsSet && !sasTokenSet && accountNameSet && accountKeySet; | ||
final boolean accountNameAndSasTokenSet = !credentialsSet && !accountKeySet && accountNameSet && sasTokenSet; |
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.
Following the naming concept of onlyCredentialsServiceSet
, these variables could be named onlyAccountNameAndKeySet
and onlyAccountNameAndSasTokenSet
.
@@ -93,6 +92,21 @@ public class PutAzureBlobStorage extends AbstractAzureBlobProcessor { | |||
"will fail if the container does not exist.") | |||
.build(); | |||
|
|||
private static final List<PropertyDescriptor> properties = Collections.unmodifiableList(Arrays.asList( |
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.
Upper case names should be used for static
final
fields => PROPERTIES
AzureBlobClientSideEncryptionUtils.CSE_KEY_TYPE, | ||
AzureBlobClientSideEncryptionUtils.CSE_KEY_ID, | ||
AzureBlobClientSideEncryptionUtils.CSE_SYMMETRIC_KEY_HEX |
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 would consider to move these properties up, just after CREATE_CONTAINER
. They belong to the "upload process / data", similar to CREATE_CONTAINER
.
AzureStorageUtils.PROP_SAS_TOKEN, | ||
AzureStorageUtils.ENDPOINT_SUFFIX, | ||
AzureStorageUtils.PROXY_CONFIGURATION_SERVICE, | ||
DELETE_SNAPSHOTS_OPTION)); |
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 would consider to move this property up, just after BLOB because it is related to the deleted blob.
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.
Agreed that it's related to the blob, but based on importance, it should be low.
AzureStorageUtils.CONTAINER, | ||
LISTING_STRATEGY, | ||
AbstractListProcessor.RECORD_WRITER, | ||
AzureStorageUtils.STORAGE_CREDENTIALS_SERVICE, | ||
AzureStorageUtils.ACCOUNT_NAME, | ||
AzureStorageUtils.ACCOUNT_KEY, | ||
AzureStorageUtils.PROP_SAS_TOKEN, | ||
AzureStorageUtils.ENDPOINT_SUFFIX, | ||
PROP_PREFIX, | ||
AzureStorageUtils.PROXY_CONFIGURATION_SERVICE, | ||
ListedEntityTracker.TRACKING_STATE_CACHE, | ||
ListedEntityTracker.TRACKING_TIME_WINDOW, | ||
ListedEntityTracker.INITIAL_LISTING_TARGET |
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 property ordering could be improved further:
PROP_PREFIX
: just afterCONTAINER
ListedEntityTracker.*
: following LISTING_STRATEGY
CONTAINER, | ||
LISTING_STRATEGY, | ||
RECORD_WRITER, | ||
STORAGE_CREDENTIALS_SERVICE, | ||
BLOB_NAME_PREFIX, | ||
TRACKING_STATE_CACHE, | ||
TRACKING_TIME_WINDOW, | ||
INITIAL_LISTING_TARGET |
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 my opinion, the original ordering was better.
The concept was:
- credential
- what to list (container and prefix)
- listing strategy and its related properties
We can change the order of these groups (e.g. move the credential down, though I always set it first) but I would not split [container + prefix] and [listing strategy + related properties].
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 can agree with keeping the Blob Name Prefix with container. I do think that should come before the credentials. I think I'd tend to put listing strategy before credentials but honestly can go either way. But will move the Blob Name Prefix up to colocate with container, as I regard them as both related to one another and of equal importance.
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.
One more thing to note here: TRACKING_STATE_CACHE
, TRACKING_TIME_WINDOW
and INITIAL_LISTING_TARGET
properties depend on LISTING_STRATEGY
so I believe the best place for them would be immediately after LISTING_STRATEGY
.
AzureStorageUtils.CONTAINER, | ||
BLOB_NAME, | ||
CREATE_CONTAINER, | ||
STORAGE_CREDENTIALS_SERVICE |
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.
Similar to the List processor, the original concept was:
- credential first
- container
- blob
I would rather not split CONTAINER
+ CREATE_CONTAINER
.
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 reviewing this now after a while, I would actually argue that it makes more sense to push the CREATE_CONTAINER lower in the list. When I decide I want to push data to Azure Blob Storage, the first thing I want to configure is the container to push it in and the name of the object. Then I want to configure authentication. Whether or not the container should be auto-created is of secondary importance.
CONTAINER, | ||
BLOB_NAME, | ||
STORAGE_CREDENTIALS_SERVICE, | ||
RANGE_START, | ||
RANGE_LENGTH |
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.
Similar to List / Put, the concept was:
- credential first
- container
- blob (and related)
The credential property can be moved down but I would not split the blob and range properties because they belong together.
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.
@turcsanyip that makes sense from a purely organizational "like things should go together" perspective. When a user goes to configure a processor, though, there are certain things that the user will definitely expect to configure. The first thing that comes to mind is "What data do I want to fetch?" That's configured via the container and blob name. Next is authentication. So that should be the first thing presented to the user. We want to present the most important configuration options first. After that, it makes sense to group things with similar importance by categories. So so RANGE_START should definitely be located with RANGE_LENGTH. But it doesn't really make sense put those before credentials because they are far less important (in terms of what the user will want to configure). And it doesn't make sense to me to configure the Container, then the Credentials, then the Blob, because the Container and Blob together represent "what's the data that I want?"
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.
@markap14 indeed, moving STORAGE_CREDENTIALS_SERVICE
down further, I suggested in the comment, was not a good idea.
Actually, when it was placed at the first position originally, I also followed the "What data do I want to fetch?" approach. In Azure the container name is not globally unique (unlike bucket name on S3) but the container exists within a Storage Account. So, for identifying the data, the user needs: Storage Account > Container > Blob. STORAGE_CREDENTIALS_SERVICE
contains the Storage Account Name
, that's why it was placed before Container
(and also because the credential is a property to be configured always).
FILESYSTEM, | ||
DIRECTORY, | ||
ADLS_CREDENTIALS_SERVICE, | ||
FILE_FILTER, | ||
RECURSE_SUBDIRECTORIES, | ||
PATH_FILTER, |
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 believe DIRECTORY
and RECURSE_SUBDIRECTORIES
belong together and should not be split. Also FILE_FILTER
and PATH_FILTER
.
FILESYSTEM_WITH_DEFAULT, | ||
DIRECTORY_WITH_DEFAULT, | ||
FILE, | ||
ADLS_CREDENTIALS_SERVICE, | ||
RANGE_START, | ||
RANGE_LENGTH, | ||
NUM_RETRIES |
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.
Similar to FetchAzureBlobStorage_v12
: FILE
and RANGE_*
properties should not be split, I believe.
We're marking this PR as stale due to lack of updates in the past few months. If after another couple of weeks the stale label has not been removed this PR will be closed. This stale marker and eventual auto close does not indicate a judgement of the PR just lack of reviewer bandwidth and helps us keep the PR queue more manageable. If you would like this PR re-opened you can do so and a committer can remove the stale tag. Or you can open a new PR. Try to help review other PRs to increase PR review bandwidth which in turn helps yours. |
… best practices and cleaned up code a bit. Fixed several integration tests.
Thank you for submitting a contribution to Apache NiFi.
Please provide a short description of the PR here:
Description of PR
Enables X functionality; fixes bug NIFI-YYYY.
In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:
For all changes:
Is there a JIRA ticket associated with this PR? Is it referenced
in the commit message?
Does your PR title start with NIFI-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
Has your PR been rebased against the latest commit within the target branch (typically
main
)?Is your initial contribution a single, squashed commit? Additional commits in response to PR reviewer feedback should be made on this branch and pushed to allow change tracking. Do not
squash
or use--force
when pushing to allow for clean monitoring of changes.For code changes:
mvn -Pcontrib-check clean install
at the rootnifi
folder?LICENSE
file, including the mainLICENSE
file undernifi-assembly
?NOTICE
file, including the mainNOTICE
file found undernifi-assembly
?.displayName
in addition to .name (programmatic access) for each of the new properties?For documentation related changes:
Note:
Please ensure that once the PR is submitted, you check GitHub Actions CI for build issues and submit an update to your PR as soon as possible.