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

Introduce single user and seen users sync #30485

Merged
merged 3 commits into from Apr 6, 2018
Merged

Conversation

butonic
Copy link
Member

@butonic butonic commented Feb 14, 2018

Restart of #28212, but without additional logging. Based on #30412

We had to add a findUserIds method to the Account mapper to iterate over all users in batches. callForSeenUserstakes a callback but also initializes the user objects filling caches everywhere, an unwanted side effect that only slows down the sync.

We also introduced Iterators for Iterating over all users of a backend as well as seen users only. The case for a single user uses an ArrayIterator.

One change in behavior: to get a total count you now have to use --showCount. Counting might be expensive. So we disable it by default ...

Tasks for another PR:

  • on single user sync show before & after (requires bypassing the cache in the user manager)
  • show only changed values for synced users or highlight them
  • reflect changes in documentation

@codecov
Copy link

codecov bot commented Feb 20, 2018

Codecov Report

Merging #30485 into master will increase coverage by 0.16%.
The diff coverage is 75.75%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #30485      +/-   ##
============================================
+ Coverage     62.29%   62.46%   +0.16%     
- Complexity    18208    18232      +24     
============================================
  Files          1142     1145       +3     
  Lines         68210    68289      +79     
  Branches       1234     1234              
============================================
+ Hits          42494    42655     +161     
+ Misses        25355    25273      -82     
  Partials        361      361
Flag Coverage Δ Complexity Δ
#javascript 52% <ø> (+0.02%) 0 <ø> (ø) ⬇️
#phpunit 63.65% <75.75%> (+0.17%) 18232 <38> (+24) ⬆️
Impacted Files Coverage Δ Complexity Δ
core/Migrations/Version20170221114437.php 0% <0%> (ø) 2 <1> (ø) ⬇️
lib/private/User/Sync/AllUsersIterator.php 100% <100%> (ø) 4 <4> (?)
lib/private/User/Sync/SeenUsersIterator.php 100% <100%> (ø) 4 <4> (?)
lib/private/User/Sync/UsersIterator.php 100% <100%> (ø) 5 <5> (?)
lib/private/User/AccountMapper.php 77.77% <100%> (+4.3%) 31 <6> (+6) ⬆️
core/Command/User/SyncBackend.php 55.17% <52.38%> (+55.17%) 42 <15> (+6) ⬆️
lib/private/User/SyncService.php 74.83% <92.85%> (+1.71%) 56 <3> (-1) ⬇️
apps/files/lib/App.php 25% <0%> (-12.5%) 3% <0%> (ø)
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 54cd970...c14eb12. Read the comment docs.

@tomneedham
Copy link
Member

Blocked by #30412

@tomneedham
Copy link
Member

I will rebase

@tomneedham
Copy link
Member

Rebased and squashed

@tomneedham tomneedham changed the title [WIP] Introduce single user and seen users sync Introduce single user and seen users sync Mar 13, 2018
@tomneedham
Copy link
Member

@ownclouders rebase

@ownclouders
Copy link
Contributor

Hey! I'm GitMate.io! This pull request is being rebased automatically. Please DO NOT push while rebase is in progress or your changes would be lost permanently ⚠️

@ownclouders
Copy link
Contributor

Automated rebase with GitMate.io was successful! 🎉

@tomneedham
Copy link
Member

We need to add unit tests for the iterators and the accountMapper findByUserIds

@tomneedham tomneedham added this to the development milestone Mar 15, 2018
@tomneedham tomneedham added the p1-urgent Critical issue, need to consider hotfix with just that issue label Mar 26, 2018
@tomneedham
Copy link
Member

Rebased

@tomneedham
Copy link
Member

rebase attempt #4 ......

@PVince81
Copy link
Contributor

PVince81 commented Apr 3, 2018

@ownclouders rebase

@ownclouders
Copy link
Contributor

Hey! I'm GitMate.io! This pull request is being rebased automatically. Please DO NOT push while rebase is in progress or your changes would be lost permanently ⚠️

@ownclouders
Copy link
Contributor

Automated rebase with GitMate.io was successful! 🎉

@PVince81
Copy link
Contributor

PVince81 commented Apr 3, 2018

tests pass now, only codecov is unhappy

@butonic
Copy link
Member Author

butonic commented Apr 4, 2018

@ownclouders rebase please

@ownclouders
Copy link
Contributor

Hey! I'm GitMate.io! This pull request is being rebased automatically. Please DO NOT push while rebase is in progress or your changes would be lost permanently ⚠️

@tomneedham
Copy link
Member

codecov was showing weird results

@ownclouders
Copy link
Contributor

Automated rebase with GitMate.io was successful! 🎉

@PVince81
Copy link
Contributor

PVince81 commented Apr 4, 2018

@tomneedham please review the last additions then merge

Copy link
Contributor

@mrow4a mrow4a left a comment

Choose a reason for hiding this comment

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

I tried this command already, and can confirm it worked properly, at least some time ago. Iterator seemed to work properly, and all tests are there. I just have one doubt in the query itself as mentioned below

$qb = $this->db->getQueryBuilder();
$qb->select('user_id')
->from($this->getTableName())
->orderBy('user_id'); // needed for predictable limit & offset
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

if ($hasLoggedIn === true) {
$qb->andWhere($qb->expr()->gt('last_login', new Literal(0)));
} else if ($hasLoggedIn === false) {
$qb->andWhere($qb->expr()->eq('last_login', new Literal(0)));
Copy link
Contributor

Choose a reason for hiding this comment

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

Is all fine here? In both cases you have Literal(0) @butonic

Copy link
Contributor

@mrow4a mrow4a Apr 6, 2018

Choose a reason for hiding this comment

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

ohh, sorry just noticed gt and eq.

@lock
Copy link

lock bot commented Jul 31, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jul 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
3 - To Review enhancement p1-urgent Critical issue, need to consider hotfix with just that issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants