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 SnapshotService algorithm trying to insert duplicate raw rules #357

Closed
collinbarrett opened this issue Aug 20, 2018 · 3 comments
Closed
Labels
bug something isn't working url-validation service that validates URLs

Comments

@collinbarrett
Copy link
Owner

Since adding a unique index on rules.Raw in #353 , I can now see exceptions like below from the SnapshotService that represent a flaw in the algorithm. It should not try to insert duplicate raw rules, but it is fairly often for some reason.

Example:

FilterListId: 297 Exception: An error occurred while updating the entries. See the inner exception for details. at Microsoft.EntityFrameworkCore.Update.AffectedCountModificationCommandBatch.ConsumeAsync(RelationalDataReader reader, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(DbContext _, ValueTuple2 parameters, CancellationToken cancellationToken) at Pomelo.EntityFrameworkCore.MySql.Storage.Internal.MySqlExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func4 operation, Func4 verifySucceeded, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(IReadOnlyList1 entriesToSave, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken) at FilterLists.Services.Snapshot.SnapshotBatch.SaveAsync() in /home/travis/build/collinbarrett/FilterLists/src/FilterLists.Services/Snapshot/SnapshotBatch.cs:line 32 at FilterLists.Services.Snapshot.Snapshot.SaveBatches(IEnumerable1 batches) in /home/travis/build/collinbarrett/FilterLists/src/FilterLists.Services/Snapshot/Snapshot.cs:line 122 at FilterLists.Services.Snapshot.Snapshot.SaveInBatches(IEnumerable1 lines) in /home/travis/build/collinbarrett/FilterLists/src/FilterLists.Services/Snapshot/Snapshot.cs:line 114 at FilterLists.Services.Snapshot.Snapshot.SaveAsync() in /home/travis/build/collinbarrett/FilterLists/src/FilterLists.Services/Snapshot/Snapshot.cs:line 65 at FilterLists.Services.Snapshot.Snapshot.TrySaveAsync() in /home/travis/build/collinbarrett/FilterLists/src/FilterLists.Services/Snapshot/Snapshot.cs:line 43 Duplicate entry '###Meebo:AdElement.Root' for key 'IX_rules_Raw' at MySql.Data.MySqlClient.MySqlDataReader.ActivateResultSet(ResultSet resultSet) in C:\projects\mysqlconnector\src\MySqlConnector\MySql.Data.MySqlClient\MySqlDataReader.cs:line 93 at MySql.Data.MySqlClient.MySqlDataReader.NextResultAsync(IOBehavior ioBehavior, CancellationToken cancellationToken) in C:\projects\mysqlconnector\src\MySqlConnector\MySql.Data.MySqlClient\MySqlDataReader.cs:line 62 at Microsoft.EntityFrameworkCore.Update.AffectedCountModificationCommandBatch.ConsumeAsync(RelationalDataReader reader, CancellationToken cancellationToken)

@collinbarrett collinbarrett added bug something isn't working high priority must fix ASAP url-validation service that validates URLs help wanted please help us resolve labels Aug 20, 2018
collinbarrett added a commit that referenced this issue Aug 20, 2018
@collinbarrett
Copy link
Owner Author

collinbarrett commented Aug 20, 2018

Though using the .Contains() method should have worked, trying a Join() instead for these large datasets per this and this.

collinbarrett added a commit that referenced this issue Aug 20, 2018
Join() was super slow...
ref #357
collinbarrett added a commit that referenced this issue Aug 20, 2018
collinbarrett added a commit that referenced this issue Aug 20, 2018
@collinbarrett
Copy link
Owner Author

collinbarrett commented Aug 20, 2018

Seeing escaping issues like below when using .Contains(), likely per this. Trying to go back to join in e3abf39 .

You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'finalsports.com.br##[style="height: 105px; width: 1000px; background-color: rgb(' at line 3 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'finalsports.com.br##[style="height: 105px; width: 1000px; background-color: rgb(' at line 3

Full string from that example (not sure why it seems to break at the parenthesis, and not at a quote):

finalsports.com.br##[style="height: 105px; width: 1000px; background-color: rgb(4, 41, 10); padding-top: 10px;"]

@collinbarrett
Copy link
Owner Author

I believe this is resolved using the Join() for now, though it may make sense to go back to Contains() in the future...

Am seeing this related issue as well, which I didn't see with the Contains(): #363

@collinbarrett collinbarrett removed help wanted please help us resolve high priority must fix ASAP labels Aug 21, 2018
hawkeye116477 pushed a commit to hawkeye116477/FilterLists that referenced this issue Feb 4, 2019
hawkeye116477 pushed a commit to hawkeye116477/FilterLists that referenced this issue Feb 4, 2019
hawkeye116477 pushed a commit to hawkeye116477/FilterLists that referenced this issue Feb 4, 2019
Join() was super slow...
ref collinbarrett#357
hawkeye116477 pushed a commit to hawkeye116477/FilterLists that referenced this issue Feb 4, 2019
hawkeye116477 pushed a commit to hawkeye116477/FilterLists that referenced this issue Feb 4, 2019
hawkeye116477 pushed a commit to hawkeye116477/FilterLists that referenced this issue Feb 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something isn't working url-validation service that validates URLs
Projects
None yet
Development

No branches or pull requests

1 participant