This Wednesday I’m going to be doing a webinar about RavenDB & Sharding. This is going to be the flagship feature for RavenDB 6.0 and I’m really excited to be talking about it in public finally.
Sharding involves splitting your data into multiple nodes. Similar to having different volumes of a single encyclopedia.
RavenDB’s sharding implementation is something that we have spent the past three or four years working on. That has been quite a saga to get it out. The primary issue is that we want to achieve two competing goals:
Allow you to scale the amount of data you have to near infinite levels.
Ensure that RavenDB remains simple to use and operate.
The first goal is actually fairly easy and straightforward. It is the second part that made things complicated. After a lot of work, I believe that we have a really good solution at hand.
In the webinar, I’m going to be presenting how RavenDB 6.0 implements sharding, the behavior of the system at scale, and all the details you need to know about how it works under the cover.
I’m really excited to finally be able to show off the great work of the team! Join me, it’s going to be really interesting.
I've already talked about preventing breaking changes in the post I fixed a bug. What should I do now?. But things evolve, and now the .NET SDK provides new features to help NuGet package authors to detect breaking changes between two versions of a NuGet package when building a new version.Starting
I posted this code previously:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
using System;
Iterator? it = new Iterator();
while (it.Value.MoveNext())
{
Console.WriteLine(it.Value.Current);
}
public struct Iterator
{
public int Current;
public bool MoveNext()
{
Current++;
return Current < 10;
}
}
view raw
what.cs
hosted with ❤ by GitHub
And asked what it prints. This is actually an infinite loop that will print an endless amount of zeros to the console. The question is why.
The answer is that we are running into two separate features of C# that interact with each other in a surprising way.
The issue is that we are using a nullable iterator here, and accessing the struct using the Value property. The problem is that this is a struct, and using a property will cause it to be copied.
So the way it works, the code actually runs:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
Iterator? it = new Iterator();
while (true)
{
if (it.HasValue == false)
break;
Iterator localIt = it.Value;
if (localIt.MoveNext() == false)
break;
Iterator localIt2 = it.Value;
Console.WriteLine(localIt2.Current);
}
view raw
how.cs
hosted with ❤ by GitHub
And now you can more easily see the temporary copies that are created and how because we are using a value type here, we are using a different instance each time.
Given the following code:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
using System;
Iterator? it = new Iterator();
while (it.Value.MoveNext())
{
Console.WriteLine(it.Value.Current);
}
public struct Iterator
{
public int Current;
public bool MoveNext()
{
Current++;
return Current < 10;
}
}
view raw
what.cs
hosted with ❤ by GitHub
Can you guess what it will do? Can you explain why?I love that this snippet is under 20 lines of code, but being able to explain it shows a lot more knowledge about C# than you would expect.
C# 11 introduced list patterns. List patterns extend pattern matching to match sequences of elements in a list or an array. The goal of this post is not to explain the syntax but to show how to create a compatible type. If you don't know what list patterns are, I recommend reading the following doc
I've recently added a dark theme to this website. The light or dark theme is selected based on the browser / OS settings. In this post, I'll describe how I've added this support!Theme is selected based on browser settings#Step 1: Extracting colors to variablesThe first step is to extract all colors
Although Visual Studio and the dotnet CLI both offer clean commands, neither one really cleans up bin and obj files generated by the build…Keep Reading →
I recently investigated an issue where the tests hang on the CI. It's easier to debug when issues happen on your machine as you can easily attach a debugger and see what's going on. But in this case, the tests were hanging on the CI and I couldn't attach a debugger. I had to find an alternative way
We use cookies to analyze our website traffic and provide a better browsing experience. By
continuing to use our site, you agree to our use of cookies.