Permalink
Browse files

Merge branch 'master' of github.com:ayende/ravendb

Conflicts:
	Raven.Database/Storage/IndexDefinitionStorage.cs
  • Loading branch information...
2 parents e9eab1c + ee108c1 commit 9eab01ed8f20ca0421b9717c5ec4c9440d591bd0 @ayende ayende committed Dec 12, 2011
Showing 821 changed files with 119,847 additions and 46,928 deletions.
View
@@ -31,42 +31,13 @@ VERSION
*.nupkg
/Raven.Abstractions/Raven.Abstractions.g.3.5.csproj
/Raven.Client.Lightweight/Raven.Client.Lightweight.g.3.5.csproj
-/Samples/Raven.Samples.IndexReplication/Server/Tenants/Northwind/IndexDefinitions/Raven%2fDocumentsByEntityName.index
-/Samples/Raven.Samples.IndexReplication/Server/Tenants/Northwind/Indexes/Raven%2fDocumentsByEntityName/segments.gen
-/Samples/Raven.Samples.IndexReplication/Server/Tenants/Northwind/Indexes/Raven%2fDocumentsByEntityName/segments_1
-/Samples/Raven.Samples.IndexReplication/Server/Tenants/Northwind/Raven.ravendb
-/Samples/Raven.Samples.IndexReplication/Server/Tenants/Northwind/desktop.ini
-/Samples/Raven.Samples.IndexReplication/Server/Tenants/Northwind/raven-data.ico
-/Samples/Raven.Samples.IndexReplication/Server/Tenants/SoHo/IndexDefinitions/Raven%2fDocumentsByEntityName.index
-/Samples/Raven.Samples.IndexReplication/Server/Tenants/SoHo/Indexes/Raven%2fDocumentsByEntityName/segments.gen
-/Samples/Raven.Samples.IndexReplication/Server/Tenants/SoHo/Indexes/Raven%2fDocumentsByEntityName/segments_1
-/Samples/Raven.Samples.IndexReplication/Server/Tenants/SoHo/Raven.ravendb
-/Samples/Raven.Samples.IndexReplication/Server/Tenants/SoHo/desktop.ini
-/Samples/Raven.Samples.IndexReplication/Server/Tenants/SoHo/raven-data.ico
-/Samples/Raven.Samples.IndexReplication/Server/Tenants/Brisbane/IndexDefinitions/Raven%2fDocumentsByEntityName.index
-/Samples/Raven.Samples.IndexReplication/Server/Tenants/Brisbane/Indexes/Raven%2fDocumentsByEntityName/segments.gen
-/Samples/Raven.Samples.IndexReplication/Server/Tenants/Brisbane/Indexes/Raven%2fDocumentsByEntityName/segments_1
-/Samples/Raven.Samples.IndexReplication/Server/Tenants/Brisbane/Raven.ravendb
-/Samples/Raven.Samples.IndexReplication/Server/Tenants/Brisbane/desktop.ini
-/Samples/Raven.Samples.IndexReplication/Server/Tenants/Brisbane/raven-data.ico
-/Samples/Raven.Samples.IndexReplication/Server/Tenants/Melbroune/IndexDefinitions/Raven%2fDocumentsByEntityName.index
-/Samples/Raven.Samples.IndexReplication/Server/Tenants/Melbroune/Indexes/Raven%2fDocumentsByEntityName/segments.gen
-/Samples/Raven.Samples.IndexReplication/Server/Tenants/Melbroune/Indexes/Raven%2fDocumentsByEntityName/segments_1
-/Samples/Raven.Samples.IndexReplication/Server/Tenants/Melbroune/Raven.ravendb
-/Samples/Raven.Samples.IndexReplication/Server/Tenants/Melbroune/desktop.ini
-/Samples/Raven.Samples.IndexReplication/Server/Tenants/Melbroune/raven-data.ico
-/Samples/Raven.Samples.IndexReplication/Server/Tenants/Sidney/IndexDefinitions/Raven%2fDocumentsByEntityName.index
-/Samples/Raven.Samples.IndexReplication/Server/Tenants/Sidney/Indexes/Raven%2fDocumentsByEntityName/segments.gen
-/Samples/Raven.Samples.IndexReplication/Server/Tenants/Sidney/Indexes/Raven%2fDocumentsByEntityName/segments_1
-/Samples/Raven.Samples.IndexReplication/Server/Tenants/Sidney/Raven.ravendb
-/Samples/Raven.Samples.IndexReplication/Server/Tenants/Sidney/desktop.ini
-/Samples/Raven.Samples.IndexReplication/Server/Tenants/Sidney/raven-data.ico
+/Samples/Raven.Samples.IndexReplication/Server/*
+/Samples/Raven.Sample.Replication/Servers/*
ClientBin/
/Raven.Tests.Silverlight.Results.xml
/Raven.Json/Raven.Json.g.3.5.csproj
/Modules/Json/Raven.Json/Raven.Json.g.3.5.csproj
*.docstates
StyleCop.Cache
-/Raven.Studio/Settings.dat
-*.vs10x
+
*.dotCover
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -1,74 +1,86 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>8.0.30703</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{53DA3AE4-1648-43B9-A814-BAFD89AEBF2A}</ProjectGuid>
- <OutputType>Library</OutputType>
- <AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>Raven.Bundles.Authentication</RootNamespace>
- <AssemblyName>Raven.Bundles.Authentication</AssemblyName>
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- <FileAlignment>512</FileAlignment>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug\</OutputPath>
- <DefineConstants>DEBUG;TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DebugType>pdbonly</DebugType>
- <Optimize>true</Optimize>
- <OutputPath>bin\Release\</OutputPath>
- <DefineConstants>TRACE</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- <StyleCopTreatErrorsAsWarnings>false</StyleCopTreatErrorsAsWarnings>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="Newtonsoft.Json">
- <HintPath>..\..\SharedLibs\Newtonsoft.Json.dll</HintPath>
- </Reference>
- <Reference Include="NLog">
- <HintPath>..\..\SharedLibs\NLog.dll</HintPath>
- </Reference>
- <Reference Include="System" />
- <Reference Include="System.Core" />
- <Reference Include="System.Xml.Linq" />
- <Reference Include="System.Data.DataSetExtensions" />
- <Reference Include="Microsoft.CSharp" />
- <Reference Include="System.Data" />
- <Reference Include="System.Xml" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="AuthenticationUser.cs" />
- <Compile Include="AuthorizeClient.cs" />
- <Compile Include="EnsureAtLeastOneUserExists.cs" />
- <Compile Include="Properties\AssemblyInfo.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\Raven.Abstractions\Raven.Abstractions.csproj">
- <Project>{41AC479E-1EB2-4D23-AAF2-E4C8DF1BC2BA}</Project>
- <Name>Raven.Abstractions</Name>
- </ProjectReference>
- <ProjectReference Include="..\..\Raven.Database\Raven.Database.csproj">
- <Project>{212823CD-25E1-41AC-92D1-D6DF4D53FC85}</Project>
- <Name>Raven.Database</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <Import Project="$(MSBuildProjectDirectory)\..\..\Tools\StyleCop\StyleCop.Targets" />
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.30703</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{53DA3AE4-1648-43B9-A814-BAFD89AEBF2A}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Raven.Bundles.Authentication</RootNamespace>
+ <AssemblyName>Raven.Bundles.Authentication</AssemblyName>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <StyleCopTreatErrorsAsWarnings>false</StyleCopTreatErrorsAsWarnings>
+ </PropertyGroup>
+ <PropertyGroup>
+ <SignAssembly>true</SignAssembly>
+ </PropertyGroup>
+ <PropertyGroup>
+ <AssemblyOriginatorKeyFile>..\..\Raven.Database\RavenDB.snk</AssemblyOriginatorKeyFile>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="Newtonsoft.Json, Version=4.0.3.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\SharedLibs\Newtonsoft.Json\Net\Newtonsoft.Json.dll</HintPath>
+ </Reference>
+ <Reference Include="NLog">
+ <HintPath>..\..\SharedLibs\NLog.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="AuthenticationUser.cs" />
+ <Compile Include="AuthorizeClient.cs" />
+ <Compile Include="EnsureAtLeastOneUserExists.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\Raven.Abstractions\Raven.Abstractions.csproj">
+ <Project>{41AC479E-1EB2-4D23-AAF2-E4C8DF1BC2BA}</Project>
+ <Name>Raven.Abstractions</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\..\Raven.Database\Raven.Database.csproj">
+ <Project>{212823CD-25E1-41AC-92D1-D6DF4D53FC85}</Project>
+ <Name>Raven.Database</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\Raven.Database\RavenDB.snk">
+ <Link>RavenDB.snk</Link>
+ </None>
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <Import Project="$(MSBuildProjectDirectory)\..\..\Tools\StyleCop\StyleCop.Targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
- -->
+ -->
</Project>
@@ -31,9 +31,16 @@
<WarningLevel>4</WarningLevel>
<StyleCopTreatErrorsAsWarnings>false</StyleCopTreatErrorsAsWarnings>
</PropertyGroup>
+ <PropertyGroup>
+ <SignAssembly>true</SignAssembly>
+ </PropertyGroup>
+ <PropertyGroup>
+ <AssemblyOriginatorKeyFile>..\..\Raven.Database\RavenDB.snk</AssemblyOriginatorKeyFile>
+ </PropertyGroup>
<ItemGroup>
- <Reference Include="Newtonsoft.Json">
- <HintPath>..\..\SharedLibs\Newtonsoft.Json.dll</HintPath>
+ <Reference Include="Newtonsoft.Json, Version=4.0.3.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\SharedLibs\Newtonsoft.Json\Net\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
@@ -71,6 +78,11 @@
<Name>Raven.Database</Name>
</ProjectReference>
</ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\Raven.Database\RavenDB.snk">
+ <Link>RavenDB.snk</Link>
+ </None>
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildProjectDirectory)\..\..\Tools\StyleCop\StyleCop.Targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
@@ -16,12 +16,14 @@ public override void OnDelete(string key, TransactionInformation transactionInfo
if (CascadeDeleteContext.IsInCascadeDeleteContext)
return;
- var document = Database.Get(key, transactionInformation);
- if (document == null)
- return;
-
+ using(Database.DisableAllTriggersForCurrentThread())
using (CascadeDeleteContext.Enter())
{
+ var document = Database.Get(key, transactionInformation);
+ if (document == null)
+ return;
+
+
var documentsToDelete = document.Metadata.Value<RavenJArray>(MetadataKeys.DocumentsToCascadeDelete);
if (documentsToDelete != null)
@@ -31,10 +31,13 @@
<WarningLevel>4</WarningLevel>
<StyleCopTreatErrorsAsWarnings>false</StyleCopTreatErrorsAsWarnings>
</PropertyGroup>
+ <PropertyGroup>
+ <SignAssembly>true</SignAssembly>
+ </PropertyGroup>
+ <PropertyGroup>
+ <AssemblyOriginatorKeyFile>..\..\Raven.Database\RavenDB.snk</AssemblyOriginatorKeyFile>
+ </PropertyGroup>
<ItemGroup>
- <Reference Include="Newtonsoft.Json">
- <HintPath>..\..\SharedLibs\Newtonsoft.Json.dll</HintPath>
- </Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
@@ -59,6 +62,11 @@
<Name>Raven.Database</Name>
</ProjectReference>
</ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\Raven.Database\RavenDB.snk">
+ <Link>RavenDB.snk</Link>
+ </None>
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildProjectDirectory)\..\..\Tools\StyleCop\StyleCop.Targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
@@ -17,6 +17,8 @@ public class ExpirationReadTrigger : AbstractReadTrigger
public override ReadVetoResult AllowRead(string key, RavenJObject metadata, ReadOperation operation,
TransactionInformation transactionInformation)
{
+ if (operation == ReadOperation.Index)
+ return ReadVetoResult.Allowed; // we have to allow indexing, because we are deleting using the index
if(metadata == null)
return ReadVetoResult.Allowed;
var property = metadata[RavenExpirationDate];
@@ -4,7 +4,6 @@
// </copyright>
//-----------------------------------------------------------------------
using System;
-using System.Diagnostics;
using System.Linq;
using System.Threading;
using NLog;
@@ -18,7 +17,7 @@ namespace Raven.Bundles.Expiration
{
public class ExpiredDocumentsCleaner : IStartupTask, IDisposable
{
- private const string RavenDocumentsByExpirationDate = "Raven/DocumentsByExpirationDate";
+ public const string RavenDocumentsByExpirationDate = "Raven/DocumentsByExpirationDate";
private Logger logger = LogManager.GetCurrentClassLogger();
private Timer timer;
public DocumentDatabase Database { get; set; }
@@ -48,7 +47,7 @@ public void Execute(DocumentDatabase database)
var deleteFrequencyInSeconds = database.Configuration.GetConfigurationValue<int>("Raven/Expiration/DeleteFrequencySeconds") ?? 300;
logger.Info("Initialied expired document cleaner, will check for expired documents every {0} seconds",
- deleteFrequencyInSeconds);
+ deleteFrequencyInSeconds);
timer = new Timer(TimerCallback, null, TimeSpan.FromSeconds(deleteFrequencyInSeconds), TimeSpan.FromSeconds(deleteFrequencyInSeconds));
}
@@ -61,11 +60,14 @@ private void TimerCallback(object state)
executing = true;
try
{
- var currentTime = ExpirationReadTrigger.GetCurrentUtcDate();
- var nowAsStr = DateTools.DateToString(currentTime, DateTools.Resolution.SECOND);
+ string nowAsStr;
+ DateTime currentTime;
+ UpdateTimes(out nowAsStr, out currentTime);
+
while (true)
{
+
var queryResult = Database.Query(RavenDocumentsByExpirationDate, new IndexQuery
{
PageSize = 1024,
@@ -87,13 +89,16 @@ private void TimerCallback(object state)
logger.Debug(()=> string.Format("Deleting {0} expired documents: [{1}]", queryResult.Results.Count, string.Join(", ", docIds)));
+ var deleted = false;
Database.TransactionalStorage.Batch(accessor => // delete all expired items in a single tx
{
- foreach (var docId in docIds)
- {
- Database.Delete(docId, null, null);
- }
+ deleted = docIds.Aggregate(deleted, (current, docId) => current | Database.Delete(docId, null, null));
});
+
+ if (deleted == false)
+ return;
+
+ UpdateTimes(out nowAsStr, out currentTime); // update the staleness cutoff point for the index, to reflect the newly deleted documents
}
}
catch (Exception e)
@@ -107,6 +112,12 @@ private void TimerCallback(object state)
}
+ private static void UpdateTimes(out string nowAsStr, out DateTime currentTime)
+ {
+ currentTime = ExpirationReadTrigger.GetCurrentUtcDate();
+ nowAsStr = DateTools.DateToString(currentTime, DateTools.Resolution.SECOND);
+ }
+
/// <summary>
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
/// </summary>
@@ -31,10 +31,13 @@
<WarningLevel>4</WarningLevel>
<StyleCopTreatErrorsAsWarnings>false</StyleCopTreatErrorsAsWarnings>
</PropertyGroup>
+ <PropertyGroup>
+ <SignAssembly>true</SignAssembly>
+ </PropertyGroup>
+ <PropertyGroup>
+ <AssemblyOriginatorKeyFile>..\..\Raven.Database\RavenDB.snk</AssemblyOriginatorKeyFile>
+ </PropertyGroup>
<ItemGroup>
- <Reference Include="Newtonsoft.Json">
- <HintPath>..\..\SharedLibs\Newtonsoft.Json.dll</HintPath>
- </Reference>
<Reference Include="NLog, Version=2.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL" />
<Reference Include="System" />
<Reference Include="System.Core" />
@@ -59,6 +62,11 @@
<Name>Raven.Database</Name>
</ProjectReference>
</ItemGroup>
+ <ItemGroup>
+ <None Include="..\..\Raven.Database\RavenDB.snk">
+ <Link>RavenDB.snk</Link>
+ </None>
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildProjectDirectory)\..\..\Tools\StyleCop\StyleCop.Targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Oops, something went wrong.

0 comments on commit 9eab01e

Please sign in to comment.