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

Internal refactoring and modernization #720

Merged
merged 73 commits into from
Feb 15, 2024
Merged

Internal refactoring and modernization #720

merged 73 commits into from
Feb 15, 2024

Conversation

ricellis
Copy link
Member

Checklist

  • Added tests for code changes or test/build only changes
  • Updated the change log file (CHANGES.md) or test/build only changes
  • Completed the PR template below:

Description

Merge modernization branch to main.

Fixes i320

Approach

The work has previously been reviewed in: #643 #650 #652 #658 #659 #660 #663 #668 #669 #670 #671 #672 #673 #676 #677 #678 #679 #682 #691 #692 #695 #696 #698 #702 #706 #708 #711

The only additional changes in this PR are from rebasing on main and cleaning up package-lock.json

  • [NEW] Included time in restored API events and CLI output.
  • [NEW] Added metadata to backup files.
  • [FIXED] Double output of errors to stderr when using CLI.
  • [FIXED] Error for broken JSON in backup files.
  • [FIXED] Wrong error code used for incomplete changes item.
  • [FIXED] Error if the log file already exists when starting a new backup.
  • [REMOVED] Dependency on async module.
  • [REMOVED] Dependency on tmp module.
  • [REMOVED] Unused request handling code.
  • [IMPROVED] Increased tolerance to server and network errors when spooling changes (via cloudant-node-sdk changes follower).
  • [IMPROVED] Avoided double parsing of JSON batches when resuming a backup.
  • [IMPROVED] Resumed backups identification of incomplete backup lines during restore.
  • [IMPROVED] Added line numbers to errors from reading backup or log files.
  • [IMPROVED] Replace custom liner with Node built-in readline.
  • [IMPROVED] Added warning that --buffer-size has no effect with --resume.
  • [IMPROVED] Documentation about compatibility.
  • [IMPROVED] Resolved linter warnings.
  • [IMPROVED] Internal enhancements with promises and pipelines replacing callbacks and event emitters.
  • [IMPROVED] Added some new test cases and improved test stability.
  • [NOTE] Versions older than 2.10.0 cannot restore backups created with 2.10.0. See compatibility note.

Schema & API Changes

  • Included time in restored API events and CLI output.
  • Added metadata to backup files.

Security and Privacy

  • "No change"

Testing

  • New tests added and tests refactored for modernization changes as described in PRs listed above.

Monitoring and Logging

  • Logging enhancements as outlined in PRs listed.

ricellis and others added 30 commits February 14, 2024 15:37
* Add a BatchingStream for batching elements into arrays
* Add a SplittingStream for flat-mapping a batch back to elements
* Add a MappingStream for mapping stream elements to something else
* Add tests for the above
Update to use new follower based spoolchanges.
Use httpServer instead of nock for long running tests with
lots of changes requests because nock appears to leak memory
in those situations.

Co-authored-by: Esteban Laver <[email protected]>
ricellis and others added 25 commits February 15, 2024 13:57
Also reduce the amount buffered in memory at once.
Use a Duplex implementation instead of a trasnform.
Allow batching and rebatching (eliminate SplittingStream).
Override the default temporarily when we create mapping streams.
Co-authored-by: Rich Ellis <[email protected]>
Signed-off-by: Esteban Laver <[email protected]>
This ensures tests aren't always using line 0.

Signed-off-by: Esteban Laver <[email protected]>
Co-authored-by: Rich Ellis <[email protected]>
Signed-off-by: Esteban Laver <[email protected]>
Co-authored-by: Rich Ellis <[email protected]>
Signed-off-by: Esteban Laver <[email protected]>
* use JSON object for restore marker

Co-authored-by: Rich Ellis <[email protected]>
Signed-off-by: Esteban Laver <[email protected]>
In an error scenario we might get multiple promise rejections, but we only want to assert the backup or restore promise.
In success cases we should check all the promises to ensure we aren't masking errors.
@ricellis ricellis merged commit 3e06382 into main Feb 15, 2024
4 checks passed
@ricellis ricellis deleted the modernization branch February 15, 2024 14:32
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.

3 participants