Skip to content
This repository was archived by the owner on Nov 24, 2025. It is now read-only.

[Backport 4.0.x] Fix ort caching to JSON (#4433)#4435

Closed
rawlinp wants to merge 1 commit intoapache:4.0.xfrom
rawlinp:4.0.x-asttccfg-json-fix
Closed

[Backport 4.0.x] Fix ort caching to JSON (#4433)#4435
rawlinp wants to merge 1 commit intoapache:4.0.xfrom
rawlinp:4.0.x-asttccfg-json-fix

Conversation

@rawlinp
Copy link
Contributor

@rawlinp rawlinp commented Feb 24, 2020

See #4432 - this is an alternative to that PR, using JSON, which make an ORT run ~50% slower than CBOR, but doesn't require upgrading Go to 1.12. I'll let the community decide which to merge.

Fixes ORT caching to JSON. The current Gob encoding is fundamentally broken. See golang/go#4609 . It's not isomorphic: it does not decode what in encodes. In practical terms, default values like 0 become null pointers, resulting in missing remap lines in the config.

This changes the default to JSON.

It also adds a unit test, to verify the default cache format is isomorphic. Gob fails the test, CBOR and JSON pass it.

Includes tests. No docs, no changelog, no interface change.

  • This PR fixes is not related to any other Issue

Which Traffic Control components are affected by this PR?

  • Traffic Ops ORT

What is the best way to verify this PR?

Run unit tests.

Generate remap.config with assigned delivery services of type "HTTP" (which is represented by 0, the default int value). Without this fix, remap lines will be missing. With fix, config file should have appropriate remap lines for HTTP DSes.

If this is a bug fix, what versions of Traffic Control are affected?

  • master
  • 4.0.x

The following criteria are ALL met by this PR

  • This PR includes tests OR I have explained why tests are unnecessary
  • This PR includes documentation OR I have explained why documentation is unnecessary
  • This PR includes an update to CHANGELOG.md OR such an update is not necessary
  • This PR includes any and all required license headers
  • This PR ensures that database migration sequence is correct OR this PR does not include a database migration
  • This PR DOES NOT FIX A SERIOUS SECURITY VULNERABILITY (see the Apache Software Foundation's security guidelines for details)

Additional Information

ORT/atstccfg caching was Gob because it was the fastest option.
Unfortunately, it's also broken. Gob is not isomorphic, resulting
in wrong config files. See golang/go#4609

Also includes tests to verify the default format is isomorphic.
Gob fails the test, CBOR and JSON pass.

(cherry picked from commit 6e4bc2f)
@rawlinp rawlinp added bug something isn't working as intended backport an upstream change merged into an older release Traffic Ops ORT *DEPRECATED* related to the traffic_ops_ort.pl script labels Feb 24, 2020
@rawlinp
Copy link
Contributor Author

rawlinp commented Feb 24, 2020

Whoops, didn't see #4434 -- closing as a duplicate backport.

@rawlinp rawlinp closed this Feb 24, 2020
@rawlinp rawlinp deleted the 4.0.x-asttccfg-json-fix branch February 24, 2020 16:49
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

abandoned backport an upstream change merged into an older release bug something isn't working as intended Traffic Ops ORT *DEPRECATED* related to the traffic_ops_ort.pl script

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants