Skip to content

Commit

Permalink
Correcting problem of bulk inserting so many documents that it overfl…
Browse files Browse the repository at this point in the history
…ows the maximum size of a message.
  • Loading branch information
unknown authored and unknown committed Mar 11, 2010
1 parent 41aae7e commit e9661ea
Show file tree
Hide file tree
Showing 18 changed files with 861 additions and 730 deletions.
86 changes: 43 additions & 43 deletions MongoDB.Driver.Benchmark/MongoDB.Driver.Benchmark.csproj
@@ -1,44 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{5ACD68A0-0F2E-452A-90E3-3D1CB82C055B}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>MongoDB.Driver.Benchmark</RootNamespace>
<AssemblyName>MongoDB.Driver.Benchmark</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
<Compile Include="Main.cs" />
<Compile Include="AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MongoDBDriver\MongoDB.Driver.csproj">
<Project>{B125BBA6-BFFD-44FA-9254-9B1754CD8AF3}</Project>
<Name>MongoDB.Driver</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{5ACD68A0-0F2E-452A-90E3-3D1CB82C055B}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>MongoDB.Driver.Benchmark</RootNamespace>
<AssemblyName>MongoDB.Driver.Benchmark</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
<Compile Include="Main.cs" />
<Compile Include="AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MongoDBDriver\MongoDB.Driver.csproj">
<Project>{B125BBA6-BFFD-44FA-9254-9B1754CD8AF3}</Project>
<Name>MongoDB.Driver</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>
126 changes: 61 additions & 65 deletions MongoDB.GridFS.Tests/MongoDB.GridFS.Tests.csproj
@@ -1,66 +1,62 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{0C293FE9-F670-4FEF-A60F-20F8C978B1CD}</ProjectGuid>
<OutputType>Library</OutputType>
<AssemblyName>MongoDB.GridFS.Tests</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<RootNamespace>MongoDB.GridFS.Tests</RootNamespace>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="nunit.framework, Version=2.4.3.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\redist\nunit.framework.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.cs" />
<Compile Include="GridFileInfoTest.cs" />
<Compile Include="GridFileStreamTest.cs" />
<Compile Include="GridFileTest.cs" />
<Compile Include="GridTestBase.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MongoDBDriver\MongoDB.Driver.csproj">
<Project>{B125BBA6-BFFD-44FA-9254-9B1754CD8AF3}</Project>
<Name>MongoDB.Driver</Name>
</ProjectReference>
<ProjectReference Include="..\MongoDB.GridFS\MongoDB.GridFS.csproj">
<Project>{B42DBBF9-0A1F-4749-9787-013BF8D8F435}</Project>
<Name>MongoDB.GridFS</Name>
</ProjectReference>
<ProjectReference Include="..\MongoDB.Net-Tests\MongoDB.Driver.Tests.csproj">
<Project>{C8BC95AB-25C6-4133-BC9F-8B6BB782CA02}</Project>
<Name>MongoDB.Driver.Tests</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<None Include="MongoDB.GridFS.Tests.dll.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{0C293FE9-F670-4FEF-A60F-20F8C978B1CD}</ProjectGuid>
<OutputType>Library</OutputType>
<AssemblyName>MongoDB.GridFS.Tests</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<RootNamespace>MongoDB.GridFS.Tests</RootNamespace>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="nunit.framework, Version=2.4.3.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\redist\nunit.framework.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.cs" />
<Compile Include="GridFileInfoTest.cs" />
<Compile Include="GridFileStreamTest.cs" />
<Compile Include="GridFileTest.cs" />
<Compile Include="GridTestBase.cs" />
<None Include="MongoDB.GridFS.Tests.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MongoDB.Net-Tests\MongoDB.Driver.Tests.csproj">
<Project>{C8BC95AB-25C6-4133-BC9F-8B6BB782CA02}</Project>
<Name>MongoDB.Driver.Tests</Name>
</ProjectReference>
<ProjectReference Include="..\MongoDBDriver\MongoDB.Driver.csproj">
<Project>{B125BBA6-BFFD-44FA-9254-9B1754CD8AF3}</Project>
<Name>MongoDB.Driver</Name>
</ProjectReference>
<ProjectReference Include="..\MongoDB.GridFS\MongoDB.GridFS.csproj">
<Project>{B42DBBF9-0A1F-4749-9787-013BF8D8F435}</Project>
<Name>MongoDB.GridFS</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>
96 changes: 48 additions & 48 deletions MongoDB.GridFS/MongoDB.GridFS.csproj
@@ -1,49 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{B42DBBF9-0A1F-4749-9787-013BF8D8F435}</ProjectGuid>
<OutputType>Library</OutputType>
<AssemblyName>MongoDB.GridFS</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<RootNamespace>MongoDB.GridFS</RootNamespace>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.cs" />
<Compile Include="GridFile.cs" />
<Compile Include="GridFileInfo.cs" />
<Compile Include="GridFileStream.cs" />
<Compile Include="GridException.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MongoDBDriver\MongoDB.Driver.csproj">
<Project>{B125BBA6-BFFD-44FA-9254-9B1754CD8AF3}</Project>
<Name>MongoDB.Driver</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.21022</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{B42DBBF9-0A1F-4749-9787-013BF8D8F435}</ProjectGuid>
<OutputType>Library</OutputType>
<AssemblyName>MongoDB.GridFS</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<RootNamespace>MongoDB.GridFS</RootNamespace>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>none</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.cs" />
<Compile Include="GridFile.cs" />
<Compile Include="GridFileInfo.cs" />
<Compile Include="GridFileStream.cs" />
<Compile Include="GridException.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\MongoDBDriver\MongoDB.Driver.csproj">
<Project>{B125BBA6-BFFD-44FA-9254-9B1754CD8AF3}</Project>
<Name>MongoDB.Driver</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</Project>
2 changes: 1 addition & 1 deletion MongoDB.Linq.Tests/MongoDB.Linq.Tests.csproj
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
Expand Down
2 changes: 1 addition & 1 deletion MongoDB.Linq/MongoDB.Linq.csproj
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
Expand Down
21 changes: 20 additions & 1 deletion MongoDB.Net-Tests/Bson/TestBsonWriter.cs
Expand Up @@ -87,7 +87,7 @@ public class TestBsonWriter
}

[Test]
public void TestNullsDontThrowExceptionsExceptions(){
public void TestNullsDontThrowExceptions(){
MemoryStream ms = new MemoryStream();
BsonWriter writer = new BsonWriter(ms);
Document doc = new Document().Append("n", null);
Expand All @@ -97,5 +97,24 @@ public class TestBsonWriter
Assert.Fail("Null Reference Exception was thrown on trying to serialize a null value");
}
}

[Test]
public void TestWritingTooLargeDocument(){
MemoryStream ms = new MemoryStream();
BsonWriter writer = new BsonWriter(ms);
Binary b = new Binary(new byte[BsonInfo.MaxDocumentSize]);
Document big = new Document().Append("x", b);
bool thrown = false;
try{
writer.Write(big);
}catch(ArgumentException){
thrown = true;
}catch(Exception e){
Assert.Fail("Wrong Exception thrown " + e.GetType().Name);
}

Assert.IsTrue(thrown, "Shouldn't be able to write large document");
}

}
}

0 comments on commit e9661ea

Please sign in to comment.