<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Maurizio Merli on Medium]]></title>
        <description><![CDATA[Stories by Maurizio Merli on Medium]]></description>
        <link>https://medium.com/@dash1e?source=rss-bc013f294589------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*rCQyiTQbOfCg0nv3.jpg</url>
            <title>Stories by Maurizio Merli on Medium</title>
            <link>https://medium.com/@dash1e?source=rss-bc013f294589------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 05:55:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dash1e/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Embed another story…]]></title>
            <link>https://medium.com/@dash1e/embed-another-story-ef2dcc5d3810?source=rss-bc013f294589------2</link>
            <guid isPermaLink="false">https://medium.com/p/ef2dcc5d3810</guid>
            <dc:creator><![CDATA[Maurizio Merli]]></dc:creator>
            <pubDate>Fri, 03 Oct 2014 19:18:10 GMT</pubDate>
            <atom:updated>2014-10-03T19:19:57.311Z</atom:updated>
            <content:encoded><![CDATA[<p>I want to try the Medium story embedding feature inside Medium itself…</p><p><a href="https://medium.com/p/4360d9417714"></a></p><p>… and it looks great!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ef2dcc5d3810" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MongoDB: merge all empty chunks]]></title>
            <link>https://medium.com/@dash1e/mongodb-merge-all-empty-chunks-6e367680f78d?source=rss-bc013f294589------2</link>
            <guid isPermaLink="false">https://medium.com/p/6e367680f78d</guid>
            <dc:creator><![CDATA[Maurizio Merli]]></dc:creator>
            <pubDate>Wed, 09 Jul 2014 17:36:58 GMT</pubDate>
            <atom:updated>2014-07-09T17:38:31.219Z</atom:updated>
            <content:encoded><![CDATA[<h4>How to merge all empty chunks on a sharded cluster.</h4><p>Here is how to merge all empty chunks on a MongoDB sharded cluster.</p><p>Access the cluster through `mongos`:</p><pre># mongos —port 61017</pre><p>Now dump all chunks:</p><pre>&gt; sh.status(true)</pre><p>Chunks are sorted by shard key and mongos splits the key domain in many parts on different nodes.</p><p>We can verify if there are empty chunks in this way:</p><pre>db.getSiblingDB(“config”)<br>    .chunks<br>    .find({ns: “test.users”})<br>    .sort({shard: 1})<br>    .forEach(function(chunk) {</pre><pre>        var ds = db.getSiblingDB(“test”).runCommand({<br>            datasize: “test.users”,<br>            keyPattern: { “_id”: 1 },<br>            min: chunk.min,<br>            max: chunk.max });</pre><pre>        if (ds.size == 0) {<br>            print(“empty chunk: “ + chunk._id + &quot;/&quot; + chunk.shard);<br>        }<br>})</pre><p>This command dump all empty chunks.</p><p>Now what we can do is to merge all empty chunks with their next one to collapse the key domain fragment, if they are on the same shard.</p><p>And we can do this creating this function:</p><pre>function mergeEmptyChunks() {<br>    var minchunk = null;<br>    var count = 0;<br>    print(“stop balancer”);<br>    sh.stopBalancer();<br>    try {<br>        db.getSiblingDB(“config”).chunks<br>            .find({ns : “test.users”})<br>            .sort({min: 1})<br>            .forEach(function(chunk) {<br>                var ds = db<br>                    .getSiblingDB(“test”)<br>                    .runCommand({<br>                        datasize: “test.users”,<br>                        keyPattern: { “_id”: 1 },<br>                        min: chunk.min,<br>                        max: chunk.max });<br>                if (minchunk != null <br>                    &amp;&amp; minchunk.shard == chunk.shard) {<br>                    db.getSiblingDB(“admin”)<br>                        .runCommand({<br>                            mergeChunks: “test.users”,<br>                            bounds: [ minchunk.min, chunk.max ] });<br>                    print(“merge chunk: “ + chunk._id <br>                          + “ shard: “ + chunk.shard <br>                          + “ size: “ + ds.size <br>                          + “ #” + count);<br>                }<br>                if (ds.size == 0) {<br>                    if (minchunk == null <br>                        || minchunk.shard != chunk.shard) {<br>                        ds.shard = chunk.shard;<br>                        ds.min = chunk.min;<br>                        ds.max = chunk.max;<br>                        minchunk = ds;<br>                        count = 1;<br>                        print(“min chunk: “ + tojsononeline(ds));<br>                    } else {<br>                        count++;<br>                    }<br>                } else {<br>                    minchunk = null;<br>                }<br>            });<br>    } finally {<br>        print(“start balancer”);<br>        sh.startBalancer();<br>    }<br>}</pre><p>And using it:</p><pre>&gt; mergeEmptyChunks()</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6e367680f78d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>