Skip to content

Commit

Permalink
feat(#41): automatic submission publisher recreation
Browse files Browse the repository at this point in the history
Also removed duplicate max queue configuration for transactions.
  • Loading branch information
novoj committed Jun 19, 2024
1 parent 6404895 commit 312b5e0
Show file tree
Hide file tree
Showing 11 changed files with 251 additions and 151 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@
* that the buffer will be full and will have to be copied to the disk.
* @param walFileSizeBytes Size of the Write-Ahead Log (WAL) file in bytes before it is rotated.
* @param walFileCountKept Number of WAL files to keep.
* @param maxQueueSize Size of the catalog queue for parallel transaction. If there are more
* transaction than the number of free threads in the pool, the transaction
* are queued. If the queue is full, the transaction is rejected.
* @param flushFrequencyInMillis The frequency of flushing the transactional data to the disk when they
* are sequentially processed. If database process the (small) transaction
* very quickly, it may decide to process next transaction before flushing
Expand All @@ -66,15 +63,13 @@ public record TransactionOptions(
int transactionMemoryRegionCount,
long walFileSizeBytes,
int walFileCountKept,
int maxQueueSize,
long flushFrequencyInMillis
) {
public static final Path DEFAULT_TX_DIRECTORY = Paths.get(System.getProperty("java.io.tmpdir"), "evita/transaction");
public static final long DEFAULT_TRANSACTION_MEMORY_BUFFER_LIMIT_SIZE = 16_777_216;
public static final int DEFAULT_TRANSACTION_MEMORY_REGION_COUNT = 256;
public static final int DEFAULT_WAL_SIZE_BYTES = 16_777_216;
public static final int DEFAULT_WAL_FILE_COUNT_KEPT = 8;
public static final int DEFAULT_MAX_QUEUE_SIZE = 1_024;
public static final int DEFAULT_FLUSH_FREQUENCY = 1_000;

/**
Expand All @@ -87,7 +82,6 @@ public static TransactionOptions temporary() {
32,
8_388_608,
1,
16,
100
);
}
Expand All @@ -113,7 +107,6 @@ public TransactionOptions() {
DEFAULT_TRANSACTION_MEMORY_REGION_COUNT,
DEFAULT_WAL_SIZE_BYTES,
DEFAULT_WAL_FILE_COUNT_KEPT,
DEFAULT_MAX_QUEUE_SIZE,
DEFAULT_FLUSH_FREQUENCY
);
}
Expand All @@ -124,15 +117,13 @@ public TransactionOptions(
int transactionMemoryRegionCount,
long walFileSizeBytes,
int walFileCountKept,
int maxQueueSize,
long flushFrequencyInMillis
) {
this.transactionWorkDirectory = Optional.ofNullable(transactionWorkDirectory).orElse(DEFAULT_TX_DIRECTORY);
this.transactionMemoryBufferLimitSizeBytes = transactionMemoryBufferLimitSizeBytes;
this.transactionMemoryRegionCount = transactionMemoryRegionCount;
this.walFileSizeBytes = walFileSizeBytes;
this.walFileCountKept = walFileCountKept;
this.maxQueueSize = maxQueueSize;
this.flushFrequencyInMillis = flushFrequencyInMillis;
}

Expand All @@ -146,7 +137,6 @@ public static class Builder {
private int transactionMemoryRegionCount = DEFAULT_TRANSACTION_MEMORY_REGION_COUNT;
private long walFileSizeBytes = DEFAULT_WAL_SIZE_BYTES;
private int walFileCountKept = DEFAULT_WAL_FILE_COUNT_KEPT;
private int maxQueueSize = DEFAULT_MAX_QUEUE_SIZE;
private long flushFrequency = DEFAULT_FLUSH_FREQUENCY;

Builder() {
Expand All @@ -158,7 +148,6 @@ public static class Builder {
this.transactionMemoryRegionCount = TransactionOptions.transactionMemoryRegionCount;
this.walFileSizeBytes = TransactionOptions.walFileSizeBytes;
this.walFileCountKept = TransactionOptions.walFileCountKept;
this.maxQueueSize = TransactionOptions.maxQueueSize;
this.flushFrequency = TransactionOptions.flushFrequencyInMillis;
}

Expand Down Expand Up @@ -192,12 +181,6 @@ public TransactionOptions.Builder walFileCountKept(int walFileCountKept) {
return this;
}

@Nonnull
public TransactionOptions.Builder maxQueueSize(int maxQueueSize) {
this.maxQueueSize = maxQueueSize;
return this;
}

@Nonnull
public TransactionOptions.Builder flushFrequency(long flushFrequency) {
this.flushFrequency = flushFrequency;
Expand All @@ -212,7 +195,6 @@ public TransactionOptions build() {
transactionMemoryRegionCount,
walFileSizeBytes,
walFileCountKept,
maxQueueSize,
flushFrequency
);
}
Expand Down
Loading

0 comments on commit 312b5e0

Please sign in to comment.