<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>FDS:  Iterating through found records</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/24370/fds-iterating-through-found-records</link><description>In the documentation it says the order in which the records are returned is undefined. However in my observations FDS always appears to work upwards in terms of record_id so older records are returned first. Can I ask when is it the case that it is not</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 16 Aug 2017 12:40:04 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/24370/fds-iterating-through-found-records" /><item><title>RE: FDS:  Iterating through found records</title><link>https://devzone.nordicsemi.com/thread/95947?ContentTypeID=1</link><pubDate>Wed, 16 Aug 2017 12:40:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:82ae075f-0b58-40ed-9ce4-21b56b8b7875</guid><dc:creator>RichieJH</dc:creator><description>&lt;p&gt;Understood, thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FDS:  Iterating through found records</title><link>https://devzone.nordicsemi.com/thread/95946?ContentTypeID=1</link><pubDate>Wed, 16 Aug 2017 11:01:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:728c6c7f-15b3-4253-b52b-66ca2bf8705b</guid><dc:creator>emdi</dc:creator><description>&lt;p&gt;There are several things to consider, for instance:&lt;/p&gt;
&lt;ol start="2"&gt;
&lt;li&gt;how many pages you are using&lt;/li&gt;
&lt;li&gt;how many times you have run GC&lt;/li&gt;
&lt;li&gt;the length of the records&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Internally, fds maps &lt;em&gt;physical&lt;/em&gt; pages to so called &lt;em&gt;virtual&lt;/em&gt; pages.
The &lt;em&gt;physical&lt;/em&gt; page to which a &lt;em&gt;virtual&lt;/em&gt; page is mapped changes after GC.
Because fds looks through pages using their &lt;em&gt;virtual&lt;/em&gt; index, the order with which records are iterated does not change.&lt;/p&gt;
&lt;p&gt;It might happen though, that when one page is almost full (e.g. page A) and you attempt to write a new record, it will get written to another virtual page which has enough space instead (e.g. page B). If a smaller record is written afterwards, it will be written to page A if it fits.&lt;/p&gt;
&lt;p&gt;Then you&amp;#39;d have a situation where you&amp;#39;d iterate a more recent record before an older one.
But once that order is estabilished, it does not change.&lt;/p&gt;
&lt;p&gt;emdi&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>