<!-- 
RSS generated by JIRA (9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66) at Thu Feb 08 04:30:11 UTC 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>MongoDB Jira</title>
    <link>https://jira.mongodb.org</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>9.7.1</version>
        <build-number>970001</build-number>
        <build-date>13-04-2023</build-date>
    </build-info>


<item>
            <title>[SERVER-32422] convert StringData to std::string_view</title>
                <link>https://jira.mongodb.org/browse/SERVER-32422</link>
                <project id="10000" key="SERVER">Core Server</project>
                    <description>&lt;p&gt;I want to collect some notes on differences in StringData that could complicate a migration to std::string_view.&lt;/p&gt;

&lt;p&gt;The BIG one: as of its introduction in C++17, std::string_view(cp) is UB for null-valued cp, but this is tolerated for StringData. This will be very difficult to audit for, as this is an implicit constructor.&lt;/p&gt;

&lt;p&gt;Renames:&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;rawData() should be called data().&lt;/li&gt;
	&lt;li&gt;startsWith,endsWith (slated for C++20 as starts_with and ends_with).&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Several public members must be brought outside the class:&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;The range constructor.&lt;/li&gt;
	&lt;li&gt;toString.&lt;/li&gt;
	&lt;li&gt;(&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-48429&quot; title=&quot;Remove StringData::ComparatorInterface from StringData&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-48429&quot;&gt;&lt;del&gt;SERVER-48429&lt;/del&gt;&lt;/a&gt;) &lt;tt&gt;StringData::ComparatorInterface&lt;/tt&gt;.&lt;/li&gt;
	&lt;li&gt;equalCaseInsensitive&lt;/li&gt;
	&lt;li&gt;copyTo&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Behavior:&lt;br/&gt;
  Exception behavior should match. std::string_view throws std::out_of_range.&lt;br/&gt;
  Noexcept and constexpr annotations should be aligned with string_view.&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;char operator[](unsigned) should take size_type and return const_reference.&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Needs more members:&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;Several typedefs need to be added.&lt;/li&gt;
	&lt;li&gt;many more find/rfind variants, and these need offset parameters.&lt;/li&gt;
	&lt;li&gt;remove_prefix / remove_suffix&lt;/li&gt;
	&lt;li&gt;string_view has its own npos&lt;/li&gt;
	&lt;li&gt;(&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-38248&quot; title=&quot;StringMap should be implemented as absl::flat_hash_map&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-38248&quot;&gt;&lt;del&gt;SERVER-38248&lt;/del&gt;&lt;/a&gt;) explicit operator std::string instead of .toString, to approximate the string(string_view) ctor.&lt;/li&gt;
	&lt;li&gt;member swap&lt;/li&gt;
	&lt;li&gt;at, front, back, max_size, length&lt;/li&gt;
	&lt;li&gt;(c?r?)(begin|end) iterator accessors.&lt;/li&gt;
	&lt;li&gt;`explicit operator std::string() const`&lt;/li&gt;
&lt;/ul&gt;


&lt;p&gt;Apparatus:&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;needs std::hash specialization.&lt;/li&gt;
	&lt;li&gt;nonmember swap.&lt;/li&gt;
	&lt;li&gt;(&lt;a href=&quot;https://jira.mongodb.org/browse/SERVER-32434&quot; title=&quot;operator&amp;lt;&amp;lt;(ostream,StringData) ignores stream state.&quot; class=&quot;issue-link&quot; data-issue-key=&quot;SERVER-32434&quot;&gt;&lt;del&gt;SERVER-32434&lt;/del&gt;&lt;/a&gt;) put-to-stream operator&amp;lt;&amp;lt; needs to be made FormattedOutputFunction compliant.&lt;br/&gt;
    See &lt;a href=&quot;https://en.cppreference.com/w/cpp/named_req/FormattedOutputFunction&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://en.cppreference.com/w/cpp/named_req/FormattedOutputFunction&lt;/a&gt;&lt;br/&gt;
    It&apos;s not as simple as the current stream.write(), unfortunately.&lt;/li&gt;
&lt;/ul&gt;
</description>
                <environment></environment>
        <key id="474744">SERVER-32422</key>
            <summary>convert StringData to std::string_view</summary>
                <type id="4" iconUrl="https://jira.mongodb.org/secure/viewavatar?size=xsmall&amp;avatarId=14710&amp;avatarType=issuetype">Improvement</type>
                                            <priority id="4" iconUrl="https://jira.mongodb.org/images/icons/priorities/minor.svg">Minor - P4</priority>
                        <status id="10038" iconUrl="https://jira.mongodb.org/images/icons/subtask.gif" description="">Backlog</status>
                    <statusCategory id="2" key="new" colorName="default"/>
                                    <resolution id="-1">Unresolved</resolution>
                                        <assignee username="backlog-server-servicearch">Backlog - Service Architecture</assignee>
                                    <reporter username="billy.donahue@mongodb.com">Billy Donahue</reporter>
                        <labels>
                            <label>sa-remove-fv-backlog-22</label>
                            <label>techdebt</label>
                    </labels>
                <created>Wed, 20 Dec 2017 16:37:34 +0000</created>
                <updated>Thu, 2 Nov 2023 08:12:16 +0000</updated>
                                                                            <component>Portability</component>
                                        <votes>0</votes>
                                    <watches>10</watches>
                                                                                                                                                            <comments>
                            <comment id="5848525" author="billy.donahue" created="Thu, 2 Nov 2023 08:12:16 +0000"  >&lt;p&gt;Our macOS builds are using XCode 13.2.1 (13 Dec 2021) which doesn&apos;t have a great &lt;tt&gt;std::string_view&lt;/tt&gt;.&lt;br/&gt;
It&apos;s missing some C++20 features:&lt;/p&gt;
&lt;ul class=&quot;alternate&quot; type=&quot;square&quot;&gt;
	&lt;li&gt;No range constructors&lt;/li&gt;
	&lt;li&gt;No &lt;tt&gt;operator&amp;lt;=&amp;gt;&lt;/tt&gt;&lt;/li&gt;
&lt;/ul&gt;

</comment>
                            <comment id="5845330" author="billy.donahue" created="Wed, 1 Nov 2023 05:55:50 +0000"  >&lt;p&gt;Another complication. On Windows, the &lt;tt&gt;std::string_view::iterator&lt;/tt&gt; type is a class, and it is NOT &lt;tt&gt;const char*&lt;/tt&gt;.&lt;/p&gt;

&lt;p&gt;Unsurprisingly we have some code that breaks from this.&lt;/p&gt;

&lt;p/&gt;
&lt;div id=&quot;syntaxplugin&quot; class=&quot;syntaxplugin&quot; style=&quot;border: 1px dashed #bbb; border-radius: 5px !important; overflow: auto; max-height: 30em;&quot;&gt;
&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; border=&quot;0&quot; width=&quot;100%&quot; style=&quot;font-size: 1em; line-height: 1.4em !important; font-weight: normal; font-style: normal; color: black;&quot;&gt;
		&lt;tbody &gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;  margin-top: 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;[2023/11/01 04:59:10.179] C:\data\mci\60fe99ce1a7121b33f58df8d31ceb8af\src\src\mongo/bson/bsonelementvalue.h(151,42): error C2672: &lt;/span&gt;&lt;span style=&quot;color: blue; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;&apos;mongo::OID::from&apos;&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;: no matching overloaded function found&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;[2023/11/01 04:59:10.179]         &lt;/span&gt;&lt;span style=&quot;color: #006699; font-weight: bold; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt; BSONDBRef(ns, mongo::OID::from(ns.end() + kStringTerminatorBytes));&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
				&lt;tr id=&quot;syntaxplugin_code_and_gutter&quot;&gt;
						&lt;td  style=&quot; line-height: 1.4em !important; padding: 0em; vertical-align: top;&quot;&gt;
					&lt;pre style=&quot;font-size: 1em; margin: 0 10px;   margin-bottom: 10px;  width: auto; padding: 0;&quot;&gt;&lt;span style=&quot;color: black; font-family: &apos;Consolas&apos;, &apos;Bitstream Vera Sans Mono&apos;, &apos;Courier New&apos;, Courier, monospace !important;&quot;&gt;[2023/11/01 04:59:10.179]                                          ^&lt;/span&gt;&lt;/pre&gt;
			&lt;/td&gt;
		&lt;/tr&gt;
			&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;p/&gt;


&lt;p&gt;The simplest fix is to replace&lt;br/&gt;
    &lt;tt&gt;s.begin()&lt;/tt&gt; =&amp;gt; &lt;tt&gt;s.data()&lt;/tt&gt;&lt;br/&gt;
and replace&lt;br/&gt;
    &lt;tt&gt;s.end()&lt;/tt&gt; =&amp;gt; &lt;tt&gt;s.data() + s.size()&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;But this is giving up on some of the pretty intense debug-mode instrumentation provided by this iterator class.&lt;br/&gt;
( See &lt;a href=&quot;https://github.com/microsoft/STL/blob/main/stl/inc/xstring#L900&quot; class=&quot;external-link&quot; target=&quot;_blank&quot; rel=&quot;nofollow noopener&quot;&gt;https://github.com/microsoft/STL/blob/main/stl/inc/xstring#L900&lt;/a&gt; )&lt;/p&gt;

&lt;p&gt;Of course, we&apos;re not getting any of that instrumentation with StringData today but it would be nice to get it as a side effect of the std::string_view migration.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10012">
                    <name>Related</name>
                                            <outwardlinks description="related to">
                                        <issuelink>
            <issuekey id="1647780">SERVER-55180</issuekey>
        </issuelink>
                            </outwardlinks>
                                                                <inwardlinks description="is related to">
                                        <issuelink>
            <issuekey id="1363223">SERVER-48429</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                            <subtask id="1363223">SERVER-48429</subtask>
                            <subtask id="475023">SERVER-32434</subtask>
                            <subtask id="2486129">SERVER-82604</subtask>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10050" key="com.atlassian.jira.toolkit:comments">
                        <customfieldname># Replies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2.0</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                <customfield id="customfield_12751" key="com.atlassian.jira.plugin.system.customfieldtypes:multiselect">
                        <customfieldname>Assigned Teams</customfieldname>
                        <customfieldvalues>
                                <customfieldvalue key="25132"><![CDATA[Service Arch]]></customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_10055" key="com.atlassian.jira.ext.charting:firstresponsedate">
                        <customfieldname>Date of 1st Reply</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>Wed, 6 Sep 2023 13:16:55 +0000</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10052" key="com.atlassian.jira.toolkit:dayslastcommented">
                        <customfieldname>Days since reply</customfieldname>
                        <customfieldvalues>
                                        13 weeks, 6 days ago
    
                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_18254" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Dependencies</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue><![CDATA[]]></customfieldvalue>


                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_15850" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        <customfield id="customfield_10057" key="com.atlassian.jira.toolkit:lastusercommented">
                        <customfieldname>Last comment by Customer</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>true</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_10056" key="com.atlassian.jira.toolkit:lastupdaterorcommenter">
                        <customfieldname>Last commenter</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>billy.donahue@mongodb.com</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_11151" key="com.atlassian.jira.toolkit:LastCommentDate">
                        <customfieldname>Last public comment date</customfieldname>
                        <customfieldvalues>
                            13 weeks, 6 days ago
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                    <customfield id="customfield_10051" key="com.atlassian.jira.toolkit:participants">
                        <customfieldname>Participants</customfieldname>
                        <customfieldvalues>
                                        <customfieldvalue>backlog-server-servicearch</customfieldvalue>
            <customfieldvalue>billy.donahue@mongodb.com</customfieldvalue>
    
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        <customfield id="customfield_14254" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Product Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|htmn47:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                <customfield id="customfield_12550" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>2|hr5693:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                <customfield id="customfield_10558" key="com.pyxis.greenhopper.jira:gh-global-rank">
                        <customfieldname>Rank (Obsolete)</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>9223372036854775807</customfieldvalue>
                        </customfieldvalues>
                    </customfield>
                                                                                            <customfield id="customfield_23361" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Requested By</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_22870" key="com.onresolve.jira.groovy.groovyrunner:scripted-field">
                        <customfieldname>Triagers</customfieldname>
                        <customfieldvalues>
                                

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                                                                                                                                                                    <customfield id="customfield_14350" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>serverRank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>1|htm98n:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                    </customfields>
    </item>
</channel>
</rss>