4
4
using System ;
5
5
using System . Collections . Generic ;
6
6
using System . Diagnostics . CodeAnalysis ;
7
+ using System . Diagnostics . ContractsLight ;
8
+ using System . Diagnostics . SymbolStore ;
9
+ using System . Globalization ;
7
10
using System . IO ;
8
11
using System . Linq ;
9
12
using System . Runtime . CompilerServices ;
14
17
using BuildXL . Cache . ContentStore . Distributed . NuCache ;
15
18
using BuildXL . Cache . ContentStore . FileSystem ;
16
19
using BuildXL . Cache . ContentStore . Hashing ;
20
+ using BuildXL . Cache . ContentStore . Interfaces . Extensions ;
17
21
using BuildXL . Cache . ContentStore . Interfaces . FileSystem ;
18
22
using BuildXL . Cache . ContentStore . Interfaces . Results ;
19
23
using BuildXL . Cache . ContentStore . Interfaces . Synchronization ;
28
32
using BuildXL . Native . IO ;
29
33
using BuildXL . Utilities ;
30
34
using BuildXL . Utilities . Collections ;
35
+ using BuildXL . Utilities . Serialization ;
31
36
using BuildXL . Utilities . Tasks ;
32
37
using RocksDbSharp ;
33
- using static BuildXL . Cache . ContentStore . Distributed . MetadataService . RocksDbOperations ;
34
38
using static BuildXL . Engine . Cache . KeyValueStores . RocksDbStore ;
35
39
using AbsolutePath = BuildXL . Cache . ContentStore . Interfaces . FileSystem . AbsolutePath ;
36
40
37
41
#nullable enable
38
42
39
43
namespace BuildXL . Cache . ContentStore . Distributed . MetadataService
40
44
{
45
+ using static RocksDbOperations ;
46
+
41
47
public class RocksDbContentMetadataDatabaseConfiguration : RocksDbContentLocationDatabaseConfiguration
42
48
{
43
49
public RocksDbContentMetadataDatabaseConfiguration ( AbsolutePath storeLocation )
@@ -54,7 +60,7 @@ public RocksDbContentMetadataDatabaseConfiguration(AbsolutePath storeLocation)
54
60
}
55
61
56
62
/// <summary>
57
- /// RocksDb-based version of <see cref="ContentLocationDatabase"/> used by the global location store .
63
+ /// RocksDb-based version of <see cref="ContentLocationDatabase"/>.
58
64
/// </summary>
59
65
public class RocksDbContentMetadataDatabase : ContentLocationDatabase
60
66
{
@@ -283,27 +289,23 @@ private BoolResult Load(OperationContext context, StoreSlot activeSlot, bool cle
283
289
var dbAlreadyExists = Directory . Exists ( storeLocation ) ;
284
290
Directory . CreateDirectory ( storeLocation ) ;
285
291
286
- var settings = new RocksDbStoreConfiguration ( storeLocation )
287
- {
288
- AdditionalColumns = ColumnNames . SelectMany ( n => n ) ,
289
- RotateLogsMaxFileSizeBytes = 0L ,
290
- RotateLogsNumFiles = 60 ,
291
- RotateLogsMaxAge = TimeSpan . FromHours ( 12 ) ,
292
- EnableStatistics = true ,
293
- FastOpen = true ,
294
- LeveledCompactionDynamicLevelTargetSizes = true ,
295
- Compression = Compression . Zstd ,
296
- UseReadOptionsWithSetTotalOrderSeekInDbEnumeration = true ,
297
- UseReadOptionsWithSetTotalOrderSeekInGarbageCollection = true ,
298
- MergeOperators = GetMergeOperators ( )
299
- } ;
300
-
301
- RocksDbUtilities . ConfigureRocksDbTracingIfNeeded ( context , _configuration , settings , Tracer , componentName : nameof ( RocksDbContentMetadataDatabase ) ) ;
302
-
303
- Tracer . Info ( context , $ "Creating RocksDb store at '{ storeLocation } '. Clean={ clean } , Configured Epoch='{ _configuration . Epoch } ', TracingLevel={ _configuration . RocksDbTracingLevel } ") ;
292
+ Tracer . Info ( context , $ "Creating RocksDb store at '{ storeLocation } '. Clean={ clean } , Configured Epoch='{ _configuration . Epoch } '") ;
304
293
305
294
var possibleStore = KeyValueStoreAccessor . Open (
306
- settings ,
295
+ new RocksDbStoreConfiguration ( storeLocation )
296
+ {
297
+ AdditionalColumns = ColumnNames . SelectMany ( n => n ) ,
298
+ RotateLogsMaxFileSizeBytes = 0L ,
299
+ RotateLogsNumFiles = 60 ,
300
+ RotateLogsMaxAge = TimeSpan . FromHours ( 12 ) ,
301
+ EnableStatistics = true ,
302
+ FastOpen = true ,
303
+ LeveledCompactionDynamicLevelTargetSizes = true ,
304
+ Compression = Compression . Zstd ,
305
+ UseReadOptionsWithSetTotalOrderSeekInDbEnumeration = true ,
306
+ UseReadOptionsWithSetTotalOrderSeekInGarbageCollection = true ,
307
+ MergeOperators = GetMergeOperators ( )
308
+ } ,
307
309
// When an exception is caught from within methods using the database, this handler is called to
308
310
// decide whether the exception should be rethrown in user code, and the database invalidated. Our
309
311
// policy is to only invalidate if it is an exception coming from RocksDb, but not from our code.
0 commit comments