Skip to content
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

Add maxEventsPerBatch and fix for deleteAllFilesInBucket #201

Merged
merged 65 commits into from
Oct 29, 2024

Conversation

nbehrens-bz
Copy link
Contributor

Adding new features for the SDK in preparation for the 6.2.2 release.

The large amount of commits in this PR represent git history from the private repo that needs to be added here.

fmbz and others added 30 commits November 2, 2022 10:00
This PR adds support for custom upload timestamp in B2 SDK private so that it can be used in exerciser tests.

Testing: unit tests

Jira Ticket: DEV-16141
* DP-420 update gradle stask checkCode to use `python3`

* DP-420 update shebang for check_code script
This PR reduces lock contention in B2Json, which is the largest source of lock contention I've seen on api servers. The contention also exists to a lesser degree on pods. Please see Jira Ticket for details.

The main fix is in B2JsonHandlerMap.getHandlerMap to not synchronize the whole method, but only synchronize if the handler is not already in a new map that has only handlers that are fully initialized.

Testing: published new version of b2 java sdk private to local maven and tested bzWebTest basic in the bzmono branch. Also, prior to any changes, I made a small test case in S3ObjectTest and B2FileLockTest to convert multiple dynamic configs to and from B2Json in a loop, then ran them concurrently while I profiled. I then did the same test again after the update and saw the contention was reduced.

Jira Ticket: DEV-17289
This PR minimizes lock contention in B2JsonTypeHandlerWithDefaults. Please see Jira Ticket for details.

Testing: published new version of b2 java sdk private to local maven and tested bzWebTest basic in the bzmono branch.

Jira Ticket: DEV-17439
This PR adds support for AtomicLongArray in B2Json. I basically copied B2JsonLongArrayHandler and updated it for AtomicLongArray.

Testing: unit tests, related PR: Backblaze/bzmono#6069

Jira Ticket: [https://backblaze.atlassian.net/browse/DEV-17808]
* Adding support for a serializedName attribute.

The serializedName attribute defines the member name to use when serializing to JSON. This allows for vaid JSON member names that cannot be represented as Java field names.
This PR reduces lock contention in B2AccountAuthorizationCache

Testing: unit tests

Jira Ticket: DEV-19918

---------

Co-authored-by: Fabian Morgan <[email protected]>
Bumps io.github.gradle-nexus.publish-plugin from 1.1.0 to 1.3.0.

---
updated-dependencies:
- dependency-name: io.github.gradle-nexus.publish-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…erializing JSON to Java objects (#43)

Add support to B2Json union types to allow for extra/discarded fields when deserializing JSON to Java objects.

Tested with unit tests.
…rtingToCancelingUnfinishedLargeFiles_to_B2LifecycleRule

DEV-20097 Add daysFromStartingToCancelingUnfinishedLargeFiles to B2LifecycleRule
…g_for_lifecycle_rule

Update CHANGELOG.md for lifecycle rule change
Dev-20097
…ds (#46)

* Added B2StorageClient.storePartsForLargeFile
* Made B2LargeFileStorer.uploadPart public
---------

Co-authored-by: John Leacox <[email protected]>
This PR adds support for event notifications to the bucket classes.

Testing: unit tests

---------

Co-authored-by: Fabian Morgan <[email protected]>
Defines B2EventNotification which is used when sending event notifications to customers and will be used for validation of the messages sent my Backblaze.
Co-authored-by: Fabian Morgan <[email protected]>
Update B2Json fromJson methods to utilizing BufferedReader to increase performance and decrease objects being created. Previously when only using a InputStreamReader, it would allocate a lot of new char[2] when processing the input stream. Using a BufferedReader, it will allocate a 8k char array (and more as needed), which increases performance and decreases objects allocated.

Tested with unit tests
… JSON (#53)

https://backblaze.atlassian.net/browse/DEV-22760

Adds a new B2Json fromJson method that takes a  java.io.Reader as input for JSON. This will allow users to reuse buffers when utilizing B2Json.
…54)

This PR adds the initial request/response structures for the new b2 get/set bucket notification rules APIs.

Testing: unit tests and later follow-on testing

---------

Co-authored-by: Fabian Morgan <[email protected]>
This PR adds the new b2 get/set bucket notifications methods to the storage client.

Testing: unit tests and later follow-on testing

---------

Co-authored-by: Fabian Morgan <[email protected]>
…eaders (#56)

This PR adds separates the request and response structures for Event Notification Rules and adds support for custom headers and isSuspended and suspensionReason fields.

Testing: unit tests
---------

Co-authored-by: Fabian Morgan <[email protected]>
This PR removes event notification rules from Bucket classes since we have 2 new APIs for that.

Testing: unit tests

---------

Co-authored-by: Fabian Morgan <[email protected]>
ab-backblaze and others added 27 commits February 15, 2024 05:54
this helps minimize the size of serialized objects that contain a lot of fields whose value is zero.  omitNull=true isn't a great choice for primitive, numeric types because using it means we have to store unboxed values on the heap (taking more memory) and because it complicates use of the fields.

testing:
  * build which runs all the unit tests, including the new test cases.
testing:
  * build which runs all the unit tests
B2Json.optional[WithDefault] now support omitZero=true (DEV-24225)
…sing_and_signature_validation

DEV-23478: Adding new method to construct and B2 Event Notification.
* Added support to specify B2Json union types using annotations. Annotation support for union types is required since
  Java records do not support inheritance. Example usage:
  ```java
  @B2Json.union(typeField = "type")
  @B2Json.unionSubtypes({
          @B2Json.unionSubtypes.type(name = "email", clazz = Email.class),
          @B2Json.unionSubtypes.type(name = "sms", clazz = Sms.class)
  })
  sealed interface Message permits Email, Sms {
      String subject();
  }

  @B2Json.type
  private record Email(@B2Json.required String subject, @B2Json.required String email) implements Message {
  }

  @B2Json.type
  private record Sms(@B2Json.required String subject,,@B2Json.required String phoneNumber) implements Message {
  }
  ```
* Added `@B2Json.type` annotation that can be used with Java Records. Using `@B2Json.type` allows for the implicit 
  Java constructor of Java records to not require the `@B2Json.constructor` annotation. Example usage:
  ```java
  @B2Json.type
  record Point(@B2Json.required int x, @B2Json.required int y) { }
  ```
* Added `core-test-jdk17` module to test Java Record support. This module is configured to use Java 17 JDK.
DEV-27776 B2StorageClient deleteAllFilesInBucket use fileVersions
Copy link
Collaborator

@kmadsenbz kmadsenbz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@nbehrens-bz nbehrens-bz merged commit 71a3017 into master Oct 29, 2024
2 checks passed
@nbehrens-bz nbehrens-bz deleted the nbehrens/mergePrivateToPublic branch October 29, 2024 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.