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

fix(paramserver): file is too large error #98

Merged
merged 1 commit into from
Nov 12, 2024

Conversation

pallabpain
Copy link
Member

@pallabpain pallabpain commented Nov 7, 2024

Description

When uploading configurations, if the size of a file is greater than 128 KiB, it is uploaded to a blob store. Otherwise, it is stored in etcd. The two operations have separate APIs that the SDK invokes based on the file size.

The max key value size for etcd is set to 128 KiB, which means that any value greater than that cannot be stored.

When an API call is made to save a file < 128 KiB, the backend stored the entire API payload instead of just the file content. The payload is of the form

{
  "type": "FileNode",
  "content-type": "application/json",
  "data": "STRINGIFIED_DATA_READ_FROM_THE_FILE"
}

Further, the backend also injects a metadata field with timestamp and userid. So, let's say a file that is around 115 KiB on disk becomes > 128 KiB by the time it is saved to etcd. Which leads to the file too large errors.

This PR handles the case by calculating the effective size and adds the metadata size in the calculation before invoking the right API.

Testing

Screen.sharing.-.2024-11-07.7_16_17.PM.mp4

Links

@pallabpain pallabpain requested review from a team as code owners November 7, 2024 11:42
@pallabpain pallabpain self-assigned this Nov 7, 2024
@pallabpain pallabpain added the bug Something isn't working label Nov 7, 2024
@pallabpain pallabpain force-pushed the fix/file-too-large-error branch 2 times, most recently from e229fc4 to 9a2621f Compare November 11, 2024 13:20
@pallabpain pallabpain force-pushed the fix/file-too-large-error branch 2 times, most recently from 970382f to 99e6826 Compare November 12, 2024 09:05
This commit fixes a specific case when a json/yaml file is uploaded to
the paramserver and is stored by the backend in etcd. The issue existed
till date because the SDK performs a stat to check the size of a file
and determine whether to upload a file as blob or not. However, in cases
where the file size is close to the upper limit i.e. 128 KiB, the API
payload may inflate due to additional metadata and string conversion. In
such cases, while the file size may be under 128KiB, the final data to
be stored in etcd is greater than 128KiB and it throws a `file is too
large` error.

Fixes AB#33921
@pallabpain pallabpain force-pushed the fix/file-too-large-error branch from 99e6826 to 8055507 Compare November 12, 2024 09:15
@pallabpain pallabpain merged commit 3f379ee into devel Nov 12, 2024
4 checks passed
rr-github-ci-user pushed a commit that referenced this pull request Nov 12, 2024
## [2.1.1](v2.1.0...v2.1.1) (2024-11-12)

### Bug Fixes

* **paramserver:** file is too large error ([#98](#98)) ([3f379ee](3f379ee)), closes [AB#33921](https://github.com/AB/issues/33921)
@rr-github-ci-user
Copy link

🎉 This PR is included in version 2.1.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants