Skip to content

Commit

Permalink
[Java] Disable recording events by default.
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeb01 committed Sep 11, 2022
1 parent 9af3e44 commit 294aea6
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
9 changes: 8 additions & 1 deletion aeron-archive/src/main/java/io/aeron/archive/Archive.java
Original file line number Diff line number Diff line change
Expand Up @@ -973,6 +973,13 @@ public void conclude()
throw new ConfigurationException("Archive.Context.replicationChannel must be set");
}

if (recordingEventsEnabled() && null == recordingEventsChannel())
{
throw new ConfigurationException(
"Archive.Context.recordingEventsChannel must be set if " +
"Archive.Context.recordingEventsEnabled is true");
}

if (null == archiveDir)
{
archiveDir = new File(archiveDirectoryName);
Expand Down Expand Up @@ -1518,7 +1525,7 @@ public Context localControlStreamId(final int controlStreamId)
}

/**
* Get the channel URI on which the recording events publication will publish.
* Get the channel URI on which the recording events publication will publish. Will be null if not configured.
*
* @return the channel URI on which the recording events publication will publish.
* @see io.aeron.archive.client.AeronArchive.Configuration#RECORDING_EVENTS_CHANNEL_PROP_NAME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ private static int alignedTotalFileLength(final Archive.Context ctx)
(4 * VarAsciiEncodingEncoder.lengthEncodingLength()) +
ctx.controlChannel().length() +
ctx.localControlChannel().length() +
ctx.recordingEventsChannel().length() +
(null != ctx.recordingEventsChannel() ? ctx.recordingEventsChannel().length() : 0) +
ctx.aeronDirectoryName().length();

if (headerLength > HEADER_LENGTH)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2621,7 +2621,7 @@ public static final class Configuration
/**
* Channel enabled for recording progress events of recordings from an archive which defaults to true.
*/
public static final boolean RECORDING_EVENTS_ENABLED_DEFAULT = true;
public static final boolean RECORDING_EVENTS_ENABLED_DEFAULT = false;

/**
* Sparse term buffer indicator for control streams.
Expand Down Expand Up @@ -2774,15 +2774,13 @@ public static int controlResponseStreamId()
}

/**
* The value {@link #RECORDING_EVENTS_CHANNEL_DEFAULT} or system property
* {@link #RECORDING_EVENTS_CHANNEL_PROP_NAME} if set.
* The value of system property {@link #RECORDING_EVENTS_CHANNEL_PROP_NAME} if set, null otherwise.
*
* @return {@link #RECORDING_EVENTS_CHANNEL_DEFAULT} or system property
* {@link #RECORDING_EVENTS_CHANNEL_PROP_NAME} if set.
* @return system property {@link #RECORDING_EVENTS_CHANNEL_PROP_NAME} if set.
*/
public static String recordingEventsChannel()
{
return System.getProperty(RECORDING_EVENTS_CHANNEL_PROP_NAME, RECORDING_EVENTS_CHANNEL_DEFAULT);
return System.getProperty(RECORDING_EVENTS_CHANNEL_PROP_NAME);
}

/**
Expand All @@ -2806,7 +2804,7 @@ public static int recordingEventsStreamId()
public static boolean recordingEventsEnabled()
{
final String propValue = System.getProperty(RECORDING_EVENTS_ENABLED_PROP_NAME);
return null != propValue ? "true".equals(propValue) : RECORDING_EVENTS_ENABLED_DEFAULT;
return null != propValue ? Boolean.parseBoolean(propValue) : RECORDING_EVENTS_ENABLED_DEFAULT;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ private void before(final ThreadingMode threadingMode, final ArchiveThreadingMod
.archiveDir(new File(SystemUtil.tmpDirName(), "archive-test"))
.segmentFileLength(segmentFileLength)
.threadingMode(archiveThreadingMode)
.recordingEventsChannel("aeron:udp?control-mode=dynamic|control=localhost:8030")
.recordingEventsEnabled(true)
.idleStrategySupplier(YieldingIdleStrategy::new);
try
{
Expand Down

0 comments on commit 294aea6

Please sign in to comment.