Skip to content

Fix cue dirtiness#3544

Closed
xeruf wants to merge 3 commits into
mixxxdj:mainfrom
xeruf:cue-dirtiness
Closed

Fix cue dirtiness#3544
xeruf wants to merge 3 commits into
mixxxdj:mainfrom
xeruf:cue-dirtiness

Conversation

@xeruf
Copy link
Copy Markdown
Contributor

@xeruf xeruf commented Jan 9, 2021

This fixes a regression introduced by #3016 which I am baffled stayed unnoticed for months:

Since new cues are now not assigned a track, they are never marked dirty and thus not saved. I haven't tested it extensively, but it seems that before this patch no new cues were ever saved.

It was fixed by marking cues as dirty upon initialization. It also makes the debug assertion more graceful.

Now that I write this, there would be an alternative solution: Do not mark new cues as dirty, but simply always save them when they don't have a valid id. Why that extra roundtrip?

@xeruf
Copy link
Copy Markdown
Contributor Author

xeruf commented Jan 9, 2021

Alternative solution implemented in 1c18d96 - let me know whether I should revert it, was just an idea.

@xeruf xeruf changed the title Initialize cues dirty Fix cue dirtiness to save t Jan 9, 2021
@xeruf xeruf changed the title Fix cue dirtiness to save t Fix cue dirtiness Jan 9, 2021
DEBUG_ASSERT(pCue->getId().isValid() || pCue->isDirty());
// Update or save cue
if (pCue->isDirty()) {
if (!pCue->getId().isValid() || pCue->isDirty()) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The removed debug assertion was failing very rarely (1 or 2 times) but I was not able to reproduce it nor have any idea what could have caused it.

@Holzhaus Any insights?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I was able to trigger it reliably, that was the exactly why I made this PR ^^ but as said, I can also revert the last commit for the alternative solution.

}

// Delete orphaned cues
// Purge orphaned cues
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please avoid to change code, formatting, or comments based on personal preferences without improving anything. This just causes noise.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I am pretty sure we use the term "purge" whenever something gets removed irrevocably, whereas "delete" is a more broad term. So it seemed sensible to make it more precise here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Purge is used in the UI. It doesn't make sense to rephrase the following SQL "DELETE" command in the comment to "purge". Why should we use 2 different verbs in the same context??

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The SQL command is rather general - for machine-readabilty. Aren't the comments supposed to be as specific and clear as possible (without sacrificing conciseness)?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't see any value and am not going to discuss this again.

Comment thread src/test/cue_test.cpp
true);
auto cueInfo2 = cueObject.getCueInfo(
audio::SampleRate(44100));
const Cue cueObject(cueInfo1, audio::SampleRate(44100));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why did you change this formatting manually?? The arguments have been placed onto single lines intentionally and our code formatting config preserve this style.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If this is caused by your IDE then you are responsible to prevent it doing this.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Or just use git add -p and only stage the hunks for commit that you actually want to change.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@Holzhaus you can stop suggesting that, I almost always look at every single change before committing.

I thought that now with less arguments it might be sensible to compress this, especially as the arguments are not very interesting on their own.

@uklotzde
Copy link
Copy Markdown
Contributor

#3599 should fix the actual cause. I suggest to close this PR.

@uklotzde
Copy link
Copy Markdown
Contributor

Obsolete

@uklotzde uklotzde closed this Jan 25, 2021
@xeruf
Copy link
Copy Markdown
Contributor Author

xeruf commented Jan 26, 2021

@uklotzde so you basically merged what I did here: 04931f7

Except that I deliberately also removed the choice to initialize a cue non-dirty, since this is not a valid thing to do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants