Răsfoiți Sursa

automatische speicherabbild erstellung bei server crashes

Kolja Strohm 7 ani în urmă
părinte
comite
ed9894bd59
3 a modificat fișierele cu 22 adăugiri și 13 ștergeri
  1. 7 7
      PatchServer/Datenbank.cpp
  2. 10 6
      PatchServer/PatchServer.vcxproj
  3. 5 0
      PatchServer/main.cpp

+ 7 - 7
PatchServer/Datenbank.cpp

@@ -221,9 +221,9 @@ Result PSDatenbank::getSystemListe()
 
 Result PSDatenbank::getDateiListe( int system, int gruppe )
 {
-	Text *befehl = new Text( "SELECT a.pfad, a.version FROM datei a LEFT JOIN datei_loeschen b ON a.id = b.datei_id WHERE b.datei_id IS NULL AND ( a.system_id = " );
+	Text *befehl = new Text( "SELECT pfad, version FROM datei WHERE geloescht = false AND ( system_id = " );
 	befehl->append( system );
-	befehl->append( " OR a.system_id IS NULL ) AND a.datei_gruppe_id = " );
+	befehl->append( " OR system_id IS NULL ) AND datei_gruppe_id = " );
 	befehl->append( gruppe );
 	lock();
 	if( !datenbank->befehl( befehl->getText() ) )
@@ -241,10 +241,10 @@ Result PSDatenbank::getDateiListe( int system, int gruppe )
 
 Result PSDatenbank::getDateiListeOhneOrdner( int system, int gruppe )
 {
-	Text *befehl = new Text( "SELECT a.pfad, a.version FROM datei a LEFT JOIN datei_loeschen b ON a.id = b.datei_id "
-							 "WHERE b.datei_id IS NULL AND a.aenderung_dat IS NOT NULL AND ( a.system_id = " );
+	Text *befehl = new Text( "SELECT pfad, version FROM datei "
+							 "WHERE geloescht = false AND aenderung_dat IS NOT NULL AND ( system_id = " );
 	befehl->append( system );
-	befehl->append( " OR a.system_id IS NULL ) AND a.datei_gruppe_id = " );
+	befehl->append( " OR system_id IS NULL ) AND datei_gruppe_id = " );
 	befehl->append( gruppe );
 	lock();
 	if( !datenbank->befehl( befehl->getText() ) )
@@ -262,9 +262,9 @@ Result PSDatenbank::getDateiListeOhneOrdner( int system, int gruppe )
 
 Result PSDatenbank::getDeletedFiles( int system, int gruppe )
 {
-	Text *befehl = new Text( "SELECT a.pfad FROM datei a, datei_loeschen b WHERE a.id = b.datei_id AND ( a.system_id = " );
+	Text *befehl = new Text( "SELECT pfad FROM datei WHERE geloescht = true AND ( system_id = " );
 	befehl->append( system );
-	befehl->append( " OR a.system_id IS NULL ) AND a.datei_gruppe_id = " );
+	befehl->append( " OR system_id IS NULL ) AND datei_gruppe_id = " );
 	befehl->append( gruppe );
 	lock();
 	if( !datenbank->befehl( befehl->getText() ) )

+ 10 - 6
PatchServer/PatchServer.vcxproj

@@ -36,13 +36,17 @@
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
     <TargetExt />
-    <RemoteProjectDir>$(RemoteRootDir)/Server/$(ProjectName)/Release</RemoteProjectDir>
-    <IncludePath>..\..\..\..\Allgemein\Framework;../../../Framework/Release;..\..\..\..\Allgemein\Network\Network;../../../Network/Release;..\..\..\..\Allgemein\sql\sql;../../../sql/Release;$(IncludePath)</IncludePath>
+    <RemoteProjectDir>$(RemoteRootDir)/Server/$(ProjectName)/release</RemoteProjectDir>
+    <IncludePath>..\..\..\..\Allgemein\Framework;../../../Framework/release;..\..\..\..\Allgemein\Network\Network;../../../Network/release;..\..\..\..\Allgemein\sql\sql;../../../sql/release;$(IncludePath)</IncludePath>
+    <OutDir>$(ProjectDir)bin\$(Platform)\release\</OutDir>
+    <IntDir>$(ProjectDir)obj\$(Platform)\release\</IntDir>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
     <TargetExt />
-    <RemoteProjectDir>$(RemoteRootDir)/Server/$(ProjectName)/Debug</RemoteProjectDir>
-    <IncludePath>..\..\..\..\Allgemein\Framework;../../../Framework/Debug;..\..\..\..\Allgemein\Network\Network;../../../Network/Debug;..\..\..\..\Allgemein\sql\sql;../../../sql/Debug;$(IncludePath)</IncludePath>
+    <RemoteProjectDir>$(RemoteRootDir)/Server/$(ProjectName)/debug</RemoteProjectDir>
+    <IncludePath>..\..\..\..\Allgemein\Framework;../../../Framework/debug;..\..\..\..\Allgemein\Network\Network;../../../Network/debug;..\..\..\..\Allgemein\sql\sql;../../../sql/debug;$(IncludePath)</IncludePath>
+    <OutDir>$(ProjectDir)bin\$(Platform)\debug\</OutDir>
+    <IntDir>$(ProjectDir)obj\$(Platform)\debug\</IntDir>
   </PropertyGroup>
   <ItemGroup>
     <ClInclude Include="Datenbank.h" />
@@ -55,14 +59,14 @@
   </ItemGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
     <Link>
-      <AdditionalLibraryDirectories>$(RemoteRootDir)/sql/Release/bin/x64/release;$(RemoteRootDir)/Network/Release/bin/x64/release;$(RemoteRootDir)/Framework/Release/bin/x64/release;/usr/lib/;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <AdditionalLibraryDirectories>$(RemoteRootDir)/sql/release/bin/x64/release;$(RemoteRootDir)/Network/release/bin/x64/release;$(RemoteRootDir)/Framework/release/bin/x64/release;/usr/lib/;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <LibraryDependencies>Framework;Network;SQL;pq;pthread</LibraryDependencies>
       <AdditionalOptions>-Wl,-rpath,../lib %(AdditionalOptions)</AdditionalOptions>
     </Link>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
     <Link>
-      <AdditionalLibraryDirectories>$(RemoteRootDir)/sql/Debug/bin/x64/debug;$(RemoteRootDir)/Network/Debug/bin/x64/debug;$(RemoteRootDir)/Framework/Debug/bin/x64/debug;/usr/lib/;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <AdditionalLibraryDirectories>$(RemoteRootDir)/sql/debug/bin/x64/debug;$(RemoteRootDir)/Network/debug/bin/x64/debug;$(RemoteRootDir)/Framework/debug/bin/x64/debug;/usr/lib/;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <LibraryDependencies>dbgFramework;dbgNetwork;dbgSQL;pq;pthread</LibraryDependencies>
       <AdditionalOptions>-Wl,-rpath,../lib %(AdditionalOptions)</AdditionalOptions>
     </Link>

+ 5 - 0
PatchServer/main.cpp

@@ -3,9 +3,14 @@
 #include <iostream>
 #include <fstream>
 #include <Globals.h>
+#include <sys/resource.h>
 
 int main()
 {
+	struct rlimit core_limits;
+	core_limits.rlim_cur = core_limits.rlim_max = RLIM_INFINITY;
+	setrlimit(RLIMIT_CORE, &core_limits);
+
     Framework::initFramework();
 	Zeit *z = getZeit();
 	Text *pfad = new Text( "../log/patch/" );