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 ;
10
7
using System . IO ;
11
8
using System . Linq ;
12
9
using System . Runtime . CompilerServices ;
17
14
using BuildXL . Cache . ContentStore . Distributed . NuCache ;
18
15
using BuildXL . Cache . ContentStore . FileSystem ;
19
16
using BuildXL . Cache . ContentStore . Hashing ;
20
- using BuildXL . Cache . ContentStore . Interfaces . Extensions ;
21
17
using BuildXL . Cache . ContentStore . Interfaces . FileSystem ;
22
18
using BuildXL . Cache . ContentStore . Interfaces . Results ;
23
19
using BuildXL . Cache . ContentStore . Interfaces . Synchronization ;
32
28
using BuildXL . Native . IO ;
33
29
using BuildXL . Utilities ;
34
30
using BuildXL . Utilities . Collections ;
35
- using BuildXL . Utilities . Serialization ;
36
31
using BuildXL . Utilities . Tasks ;
37
32
using RocksDbSharp ;
33
+ using static BuildXL . Cache . ContentStore . Distributed . MetadataService . RocksDbOperations ;
38
34
using static BuildXL . Engine . Cache . KeyValueStores . RocksDbStore ;
39
35
using AbsolutePath = BuildXL . Cache . ContentStore . Interfaces . FileSystem . AbsolutePath ;
40
36
41
37
#nullable enable
42
38
43
39
namespace BuildXL . Cache . ContentStore . Distributed . MetadataService
44
40
{
45
- using static RocksDbOperations ;
46
-
47
41
public class RocksDbContentMetadataDatabaseConfiguration : RocksDbContentLocationDatabaseConfiguration
48
42
{
49
43
public RocksDbContentMetadataDatabaseConfiguration ( AbsolutePath storeLocation )
@@ -60,7 +54,7 @@ public RocksDbContentMetadataDatabaseConfiguration(AbsolutePath storeLocation)
60
54
}
61
55
62
56
/// <summary>
63
- /// RocksDb-based version of <see cref="ContentLocationDatabase"/>.
57
+ /// RocksDb-based version of <see cref="ContentLocationDatabase"/> used by the global location store .
64
58
/// </summary>
65
59
public class RocksDbContentMetadataDatabase : ContentLocationDatabase
66
60
{
@@ -289,23 +283,27 @@ private BoolResult Load(OperationContext context, StoreSlot activeSlot, bool cle
289
283
var dbAlreadyExists = Directory . Exists ( storeLocation ) ;
290
284
Directory . CreateDirectory ( storeLocation ) ;
291
285
292
- Tracer . Info ( context , $ "Creating RocksDb store at '{ storeLocation } '. Clean={ clean } , Configured Epoch='{ _configuration . Epoch } '") ;
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 } ") ;
293
304
294
305
var possibleStore = KeyValueStoreAccessor . Open (
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
- } ,
306
+ settings ,
309
307
// When an exception is caught from within methods using the database, this handler is called to
310
308
// decide whether the exception should be rethrown in user code, and the database invalidated. Our
311
309
// policy is to only invalidate if it is an exception coming from RocksDb, but not from our code.
0 commit comments