Skip to content

common: inf and NaN are invalid in JSON - #57695

Closed
sajibreadd wants to merge 2 commits into
ceph:mainfrom
sajibreadd:wip-66215
Closed

sajibreadd wants to merge 2 commits into
ceph:mainfrom
sajibreadd:wip-66215

Conversation

@sajibreadd

@sajibreadd sajibreadd commented May 24, 2024 •

Copy link
Copy Markdown
Member

Fixes: https://tracker.ceph.com/issues/66215

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard cephadm
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox
  • jenkins test windows
  • jenkins test rook e2e

Comment thread src/common/Formatter.cc Resolved
@sebastian-philipp

Copy link
Copy Markdown
Contributor

@batrick do you want to review this?

Comment thread src/test/common/test_json_formatter.cc Resolved
Comment thread src/common/Formatter.cc Resolved
Comment thread src/common/Formatter.h Resolved
Comment thread src/common/Formatter.cc Resolved
@sajibreadd
sajibreadd force-pushed the wip-66215 branch 2 times, most recently from 3468f5a to 81e2164 Compare May 24, 2024 17:35

@batrick batrick left a comment

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.

Commit title JSON Parser does not allow inf and NaN. Converted it to null. to common/Formatter: dump inf/nan as strings

@sajibreadd
sajibreadd force-pushed the wip-66215 branch 2 times, most recently from d3a9b4e to b3beee4 Compare May 27, 2024 15:01
@sajibreadd

sajibreadd commented May 29, 2024 •

Copy link
Copy Markdown
Member Author

Is this PR going for the test? Also I think we need to backport this PR. #57392
PR is a dependency for my commit to be backported. So we need to cherr-pick both commits.

Comment thread src/test/common/test_json_formatter.cc Resolved
@batrick batrick changed the title inf and NaN are invalid in JSON common: inf and NaN are invalid in JSON May 31, 2024
@batrick
batrick requested review from a team and removed request for patrakov and sebastian-philipp May 31, 2024 16:07
@batrick

batrick commented May 31, 2024

Copy link
Copy Markdown
Member

jenkins test make check arm64

Comment thread src/common/Formatter.cc Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Would the shorter !std::isfinite(val) form work here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Sorry, missed your comment somehow.
It does work but do you have any special observation for using that instead of std::isinf(val) ?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It's shorter, expresses the intent more directly, enumerates goodness not badness,... i.e. purely aesthetical reasons.

@sajibreadd

Copy link
Copy Markdown
Member Author

jenkins test make check

@sajibreadd

Copy link
Copy Markdown
Member Author

jenkins test docs

@sajibreadd

Copy link
Copy Markdown
Member Author

jenkins test api

@sajibreadd

Copy link
Copy Markdown
Member Author

jenkins test windows

@sajibreadd

Copy link
Copy Markdown
Member Author

jenkins test make check arm64

@sajibreadd

Copy link
Copy Markdown
Member Author

jenkins test api

@batrick batrick left a comment

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.

minor nits, otherwise lgtm

Comment thread src/common/Formatter.h Outdated
void add_value(std::string_view name, double val);

template <class T>
template <typename T>

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.

undo please

Comment thread src/common/Formatter.cc
}
}

template <class T>

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.

undo this change

Comment thread src/test/common/test_json_formatter.cc Outdated
EXPECT_EQ(parser.find_obj("negative_infinity")->get_data(), "null");
EXPECT_EQ(parser.find_obj("nan_val")->get_data(), "null");
EXPECT_EQ(parser.find_obj("nan_val_alt")->get_data(), "null");
} No newline at end of file

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.

missing terminal newline

@sajibreadd

Copy link
Copy Markdown
Member Author

jenkins test make check

1 similar comment
@sajibreadd

Copy link
Copy Markdown
Member Author

jenkins test make check

@sajibreadd

Copy link
Copy Markdown
Member Author

jenkins test api

@sajibreadd

Copy link
Copy Markdown
Member Author

@batrick Is there anything I need to do in this PR?

EXPECT_EQ(parser.find_obj("negative_infinity")->get_data(), "null");
EXPECT_EQ(parser.find_obj("nan_val")->get_data(), "null");
EXPECT_EQ(parser.find_obj("nan_val_alt")->get_data(), "null");
}

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 verify double_max/double_min values as well

@sajibreadd sajibreadd closed this Jul 15, 2024
@sajibreadd
sajibreadd deleted the wip-66215 branch July 15, 2024 14:12
@batrick

batrick commented Jul 15, 2024

Copy link
Copy Markdown
Member

@sajibreadd did you mean to close this? Please reopen?

@sajibreadd

Copy link
Copy Markdown
Member Author

@sajibreadd did you mean to close this? Please reopen?

Here is some mistake I did. I merged main into the branch by mistake(by syncing the fork by mistake). As there is a lot of commit to drop that's why here is the things I have done,

  1. created a new branch.
  2. cherrypicked the commit.
  3. pushed the branch upstream
  4. deleted the old branch named wip-66215
  5. renamed the newly created branch wip-66215

Now github is not allowing me to reopen the PR. Apologies for the mistakes. Now what should be the best things to do? create another PR and have reference of this PR?

@sajibreadd sajibreadd mentioned this pull request Jul 15, 2024
4 of 14 tasks
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.

5 participants