Skip to content

Consult UUIDs when deciding to destroy vizelements.#3838

Merged
islemaster merged 4 commits into
stagingfrom
netsim-visualization-reset
Sep 4, 2015
Merged

Consult UUIDs when deciding to destroy vizelements.#3838
islemaster merged 4 commits into
stagingfrom
netsim-visualization-reset

Conversation

@islemaster

Copy link
Copy Markdown
Contributor

I suspect that a number of bad visualization behaviors after shard reset are the result of IDs being reclaimed by different clients/entities, causing vizelements to be reassigned instead of destroyed and recreated.

Here, we make vizelements consult UUIDs as well so that if a new element shows up with the same entity ID, the client knows it's a different element and will destroy the old element and create a new one. My hope is that this will eliminate a whole class of bugs. I at least know that before this change I was able to recreate some connected router bugs, etc, in local testing, and after this change I was no longer able to do so.

Continuing work on Pivotal #101529076

I suspect that a number of bad visualization behaviors after
shard reset are the result of IDs being reclaimed by different
clients/entities, causing vizelements to be reassigned instead
of destroyed and recreated.

Here, we make vizelements consult UUIDs as well so that if a
new element shows up with the same entity ID, the client
knows it's a different element and will destroy the old
element and create a new one.  My hope is that this will
eliminate a whole class of bugs.  I at least know that
before this change I was able to recreate some connected
router bugs, etc, in local testing, and after this change I was
no longer able to do so.

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.

Could we do either (ID, UUID) or (Id, Uuid)? Mixing feels really weird.

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.

Sure. I think I got this habit from the old MSDN rules for capitalization of acronyms wherein two-character acronyms could be all capitalized but 3+ character acronyms only capitalize the leading letter.

Re-reading those rules, ID is an abbreviation, not an acronym, and should be written id or Id unlike two-letter acronyms. I'll go with Id / Uuid. Maybe I can do a pass to normalize this throughout NetSim soon.

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.

That ... is a pretty cool resource. Sounds good to me!

@Hamms

Hamms commented Sep 2, 2015

Copy link
Copy Markdown
Contributor

I'd love to see some tests

Test to show that the visualization will destroy old entities
and generate new ones when the shard resets, even if the new
entities have the same IDs as old ones.

[ci skip]
@islemaster

Copy link
Copy Markdown
Contributor Author

@Hamms PTAL. That was kind of a tricky test to write.

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.

what kind of entities do not have IDs? seems like a reasonable check though.

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 inheritance chain for stuff in the visualization looks something like this:

NetSimVizElement
  NetSimVizNode
    NetSimVizAutoDnsNode
    NetSimVizSimulationNode
  NetSimVizWire
    NetSimVizSimulationWire

Only the ones with Simulation in the name actually map to simulation entities - they are the only ones that implement getCorrespondingEntityID. This is a place where I'd like to use an interface, but duck typing will have to suffice.

Things are inherited this way because NetSimVizSimulationNode actually has a whole lot more in common with NetSimVizAutoDnsNode than it does with NetSimVizSimulationWire. There might be a good composition solution to this problem though.

@islemaster islemaster assigned davidsbailey and unassigned Hamms Sep 4, 2015

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.

This comment is confusing because it seems like "simulation node" might refer to a NetSimVizSimulationNode, whereas it actually refers to a NetSimNode. It might be easier to read if you just used type names in comments, e.g. by changing "simulation node" to NetSimNode (here and above).

@davidsbailey

Copy link
Copy Markdown
Member

LGTM. I think I follow what's going on well enough. I've noted inline where comments could be changed to make it easier for someone like me with non-expert levels of netsim knowledge to understand what's going on.

@islemaster

Copy link
Copy Markdown
Contributor Author

Thanks Dave! That's some great feedback on comments around this feature. I'll update the write-up and then merge this in.

islemaster added a commit that referenced this pull request Sep 4, 2015
Consult UUIDs when deciding to destroy vizelements.
@islemaster islemaster merged commit fe06578 into staging Sep 4, 2015
@islemaster islemaster deleted the netsim-visualization-reset branch September 4, 2015 20:02
deploy-code-org added a commit that referenced this pull request Sep 4, 2015
commit fe06578
Merge: 4e0de33 fe7e738
Author: Brad Buchanan <bradley.c.buchanan@gmail.com>
Date:   Fri Sep 4 13:02:13 2015 -0700

    Merge pull request #3838 from code-dot-org/netsim-visualization-reset

    Consult UUIDs when deciding to destroy vizelements.

commit fe7e738
Author: Brad Buchanan <brad@code.org>
Date:   Fri Sep 4 12:38:39 2015 -0700

    Better comments.

commit 4e0de33
Merge: 24ae4ae 1c955c3
Author: Will Jordan <wjordan@users.noreply.github.com>
Date:   Fri Sep 4 12:25:55 2015 -0700

    Merge pull request #3877 from code-dot-org/rails_4_2_update

    Rails 4 2 update (extra fixes #2)

commit 1c955c3
Author: Will Jordan <will@code.org>
Date:   Fri Sep 4 12:21:28 2015 -0700

    load i18n locales before application fork

commit 24ae4ae
Merge: 8a999a3 6f3e0a7
Author: Andre Stackhouse <CaptainStack@outlook.com>
Date:   Fri Sep 4 12:12:26 2015 -0700

    Merge pull request #3876 from code-dot-org/automated-workshop-email-reminder-prerequisites

    Much simpler prerequisite calculation (not using activity_constants)
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