2424import org .apache .commons .io .FileUtils ;
2525import org .eclipse .rdf4j .collection .factory .api .CollectionFactory ;
2626import org .eclipse .rdf4j .collection .factory .mapdb .MapDb3CollectionFactory ;
27+ import org .eclipse .rdf4j .common .annotation .Experimental ;
2728import org .eclipse .rdf4j .common .annotation .InternalUseOnly ;
2829import org .eclipse .rdf4j .common .concurrent .locks .Lock ;
2930import org .eclipse .rdf4j .common .concurrent .locks .LockManager ;
@@ -275,85 +276,105 @@ public void setNamespaceIDCacheSize(int namespaceIDCacheSize) {
275276 this .namespaceIDCacheSize = namespaceIDCacheSize ;
276277 }
277278
279+ @ Experimental
278280 public void setWalMaxSegmentBytes (long walMaxSegmentBytes ) {
279281 this .walMaxSegmentBytes = walMaxSegmentBytes ;
280282 }
281283
284+ @ Experimental
282285 public long getWalMaxSegmentBytes () {
283286 return walMaxSegmentBytes ;
284287 }
285288
289+ @ Experimental
286290 public void setWalQueueCapacity (int walQueueCapacity ) {
287291 this .walQueueCapacity = walQueueCapacity ;
288292 }
289293
294+ @ Experimental
290295 public int getWalQueueCapacity () {
291296 return walQueueCapacity ;
292297 }
293298
299+ @ Experimental
294300 public void setWalBatchBufferBytes (int walBatchBufferBytes ) {
295301 this .walBatchBufferBytes = walBatchBufferBytes ;
296302 }
297303
304+ @ Experimental
298305 public int getWalBatchBufferBytes () {
299306 return walBatchBufferBytes ;
300307 }
301308
309+ @ Experimental
302310 public void setWalSyncPolicy (ValueStoreWalConfig .SyncPolicy walSyncPolicy ) {
303311 this .walSyncPolicy = walSyncPolicy ;
304312 }
305313
314+ @ Experimental
306315 public ValueStoreWalConfig .SyncPolicy getWalSyncPolicy () {
307316 return walSyncPolicy ;
308317 }
309318
319+ @ Experimental
310320 public void setWalSyncIntervalMillis (long walSyncIntervalMillis ) {
311321 this .walSyncIntervalMillis = walSyncIntervalMillis ;
312322 }
313323
324+ @ Experimental
314325 public long getWalSyncIntervalMillis () {
315326 return walSyncIntervalMillis ;
316327 }
317328
329+ @ Experimental
318330 public void setWalIdlePollIntervalMillis (long walIdlePollIntervalMillis ) {
319331 this .walIdlePollIntervalMillis = walIdlePollIntervalMillis ;
320332 }
321333
334+ @ Experimental
322335 public long getWalIdlePollIntervalMillis () {
323336 return walIdlePollIntervalMillis ;
324337 }
325338
339+ @ Experimental
326340 public void setWalDirectoryName (String walDirectoryName ) {
327341 this .walDirectoryName = walDirectoryName ;
328342 }
329343
344+ @ Experimental
330345 public String getWalDirectoryName () {
331346 return walDirectoryName ;
332347 }
333348
334349 /** Ensure WAL bootstrap is synchronous during open (before new values are added). */
350+ @ Experimental
335351 public void setWalSyncBootstrapOnOpen (boolean walSyncBootstrapOnOpen ) {
336352 this .walSyncBootstrapOnOpen = walSyncBootstrapOnOpen ;
337353 }
338354
355+ @ Experimental
339356 public boolean isWalSyncBootstrapOnOpen () {
340357 return walSyncBootstrapOnOpen ;
341358 }
342359
343360 /** Enable automatic ValueStore recovery from WAL during open. */
361+ @ Experimental
344362 public void setWalAutoRecoverOnOpen (boolean walAutoRecoverOnOpen ) {
345363 this .walAutoRecoverOnOpen = walAutoRecoverOnOpen ;
346364 }
347365
366+ @ Experimental
348367 public boolean isWalAutoRecoverOnOpen () {
349368 return walAutoRecoverOnOpen ;
350369 }
351370
352371 /** Enable or disable the ValueStore WAL entirely. */
372+ @ Experimental
353373 public void setWalEnabled (boolean walEnabled ) {
354374 this .walEnabled = walEnabled ;
355375 }
356376
377+ @ Experimental
357378 public boolean isWalEnabled () {
358379 return walEnabled ;
359380 }
@@ -442,8 +463,13 @@ protected void initializeInternal() throws SailException {
442463
443464 try {
444465 Path versionPath = new File (dataDir , "nativerdf.ver" ).toPath ();
445- String version = versionPath .toFile ().exists () ? Files .readString (versionPath , StandardCharsets .UTF_8 )
446- : null ;
466+ String version ;
467+ try {
468+ version = Files .readString (versionPath , StandardCharsets .UTF_8 );
469+ } catch (Exception e ) {
470+ version = null ;
471+ }
472+
447473 if (!VERSION .equals (version ) && upgradeStore (dataDir , version )) {
448474 logger .debug ("Data store upgraded to version " + VERSION );
449475 Files .writeString (versionPath , VERSION , StandardCharsets .UTF_8 ,
@@ -467,7 +493,7 @@ protected void initializeInternal() throws SailException {
467493 walSyncBootstrapOnOpen ,
468494 walAutoRecoverOnOpen ,
469495 walEnabled );
470- this .store = new SnapshotSailStore (mainStore , () -> new MemoryOverflowIntoNativeStore () ) {
496+ this .store = new SnapshotSailStore (mainStore , MemoryOverflowIntoNativeStore :: new ) {
471497
472498 @ Override
473499 public SailSource getExplicitSailSource () {
0 commit comments