Skip to content

Commit

Permalink
Fixed build file name, fixed disk usage setting
Browse files Browse the repository at this point in the history
  • Loading branch information
brianhks committed Mar 19, 2019
1 parent 890486a commit c6ff44f
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 16 deletions.
21 changes: 9 additions & 12 deletions build.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,13 @@ println("===============================================")

saw.setProperty(Tablesaw.PROP_MULTI_THREAD_OUTPUT, Tablesaw.PROP_VALUE_ON)

programName = "kairos-kafka-monitor"
programName = "kairos-remote"
//Do not use '-' in version string, it breaks rpm uninstall.
version = "1.3.0"
release = saw.getProperty("KAIROS_RELEASE_NUMBER", "0.1beta") //package release number
summary = "KairosDB"
version = "1.0"
release = saw.getProperty("KAIROS_RELEASE_NUMBER", "1") //package release number
summary = "KairosDB Remote"
description = """\
KairosDB is a time series database that stores numeric values along
with key/value tags to a nosql data store. Currently supported
backends are Cassandra and H2. An H2 implementation is provided
for development work.
Remote plugin for KairosDB to send metrics to a remote KairosDB instance.
"""


Expand Down Expand Up @@ -133,12 +130,12 @@ def doRPM(Rule rule)

rpmBuilder.addDependencyMore("kairosdb", "1.2.0")

addFileSetToRPM(rpmBuilder, "$rpmBaseInstallDir/lib/kafka-monitor", new RegExFileSet("target", ".*\\.jar"))
addFileSetToRPM(rpmBuilder, "$rpmBaseInstallDir/lib/kafka-monitor", new RegExFileSet("target/dependency", ".*\\.jar"))
addFileSetToRPM(rpmBuilder, "$rpmBaseInstallDir/lib/kairos-remote", new RegExFileSet("target", ".*\\.jar"))
addFileSetToRPM(rpmBuilder, "$rpmBaseInstallDir/lib/kairos-remote", new RegExFileSet("target/dependency", ".*\\.jar"))


rpmBuilder.addFile("$rpmBaseInstallDir/conf/kafka-monitor.properties",
new File("src/main/resources/kafka-monitor.properties"), 0644, new Directive(Directive.RPMFILE_CONFIG | Directive.RPMFILE_NOREPLACE))
rpmBuilder.addFile("$rpmBaseInstallDir/conf/kairos-remote.properties",
new File("src/main/resources/kairos-remote.properties"), 0644, new Directive(Directive.RPMFILE_CONFIG | Directive.RPMFILE_NOREPLACE))


println("Building RPM "+rule.getTarget())
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>org.kairosdb</groupId>
<artifactId>kairos-remote</artifactId>
<version>1.0-SNAPSHOT</version>
<version>1.0</version>
<packaging>jar</packaging>

<name>kairos-remote</name>
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/kairosdb/plugin/remote/RemoteListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,8 @@ private void cleanDiskSpace()

private boolean hasSpace()
{
return m_dropPercent >= 100 || m_diskUtils.percentAvailable(m_dataDirectory) < m_dropPercent;
long usedSpace = 100 - m_diskUtils.percentAvailable(m_dataDirectory);
return m_dropPercent >= 100 || usedSpace < m_dropPercent;
}

//Rolls to a new file and zips up the current one
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/kairos-remote.properties
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ kairosdb.remote.random_delay=0
# values in this comma-separated list are forwarded on.
#kairosdb.remote.prefix_filter=""

# Drops the oldest zipped files waiting to be sent if the available disk space percent is
# Drops the oldest zipped files waiting to be sent if the used disk space percent is
# greater than the specified value. This is to prevent filling up the disk space
# if the receiving node is inaccessible. If set to 100, no files are deleted.
# The percent must be greater than 0.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void tearDown() throws IOException
@Test
public void test_cleanup() throws IOException, DatastoreException
{
when(mockDiskUtils.percentAvailable(any())).thenReturn(96L).thenReturn(96L).thenReturn(80L);
when(mockDiskUtils.percentAvailable(any())).thenReturn(4L).thenReturn(4L).thenReturn(20L);
RemoteListener remoteListener = new RemoteListener(tempDir.getAbsolutePath(), "95",
2000,"localhost", mockRemoteHost, mockEventBus, mockDiskUtils);

Expand All @@ -74,6 +74,7 @@ public void test_cleanup() throws IOException, DatastoreException
@Test
public void test_sendData() throws IOException, DatastoreException
{
when(mockDiskUtils.percentAvailable(any())).thenReturn(20L);
RemoteListener remoteListener = new RemoteListener(tempDir.getAbsolutePath(), "95",
2000,"localhost", mockRemoteHost, mockEventBus, mockDiskUtils);

Expand Down

0 comments on commit c6ff44f

Please sign in to comment.