Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 314: Enable checkstyle on bookkeeper-server #315

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,35 +19,32 @@
*/
package org.apache.bookkeeper.benchmark;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.epoll.EpollEventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import java.io.IOException;

import org.apache.bookkeeper.client.BKException;
import org.apache.bookkeeper.client.BookKeeper;
import org.apache.bookkeeper.client.LedgerHandle;
import org.apache.bookkeeper.conf.ClientConfiguration;
import org.apache.bookkeeper.net.BookieSocketAddress;
import org.apache.bookkeeper.proto.BookieClient;
import org.apache.bookkeeper.proto.BookieProtocol;
import org.apache.bookkeeper.proto.BookkeeperInternalCallbacks.WriteCallback;
import org.apache.bookkeeper.util.OrderedSafeExecutor;
import org.apache.bookkeeper.client.BookKeeper;
import org.apache.bookkeeper.client.BKException;
import org.apache.bookkeeper.client.LedgerHandle;
import org.apache.bookkeeper.conf.ClientConfiguration;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.PosixParser;
import org.apache.commons.lang.SystemUtils;
import org.apache.commons.cli.ParseException;
import org.apache.zookeeper.KeeperException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.epoll.EpollEventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;

/**
* A utility class used for benchmarking the performance of bookies.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,34 +19,33 @@
*/
package org.apache.bookkeeper.benchmark;

import org.apache.bookkeeper.conf.ClientConfiguration;
import static com.google.common.base.Charsets.UTF_8;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.bookkeeper.client.BookKeeper;
import org.apache.bookkeeper.client.LedgerHandle;
import org.apache.bookkeeper.client.LedgerEntry;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Options;
import org.apache.bookkeeper.client.LedgerHandle;
import org.apache.bookkeeper.conf.ClientConfiguration;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.PosixParser;
import org.apache.zookeeper.ZooKeeper;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.ZooKeeper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Enumeration;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.ArrayList;
import java.util.Set;
import java.util.regex.Pattern;
import java.util.regex.Matcher;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicInteger;

import static com.google.common.base.Charsets.UTF_8;

/**
* A benchmark that benchmarks the read throughput and latency.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,24 @@
*/
package org.apache.bookkeeper.benchmark;

import static com.google.common.base.Charsets.UTF_8;

import java.io.BufferedOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Arrays;
import java.util.Random;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
import java.util.Timer;
import java.util.TimerTask;

import org.apache.bookkeeper.client.AsyncCallback.AddCallback;
import org.apache.bookkeeper.client.BKException;
import org.apache.bookkeeper.client.BookKeeper;
import org.apache.bookkeeper.client.LedgerHandle;
import org.apache.bookkeeper.client.AsyncCallback.AddCallback;
import org.apache.bookkeeper.conf.ClientConfiguration;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
Expand All @@ -47,15 +48,13 @@
import org.apache.zookeeper.KeeperException;
import org.apache.zookeeper.WatchedEvent;
import org.apache.zookeeper.Watcher;
import org.apache.zookeeper.ZooDefs;
import org.apache.zookeeper.ZooKeeper;
import org.apache.zookeeper.Watcher.Event.EventType;
import org.apache.zookeeper.Watcher.Event.KeeperState;
import org.apache.zookeeper.ZooDefs;
import org.apache.zookeeper.ZooKeeper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static com.google.common.base.Charsets.UTF_8;

/**
* A benchmark that benchmarks write throughput and latency.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
package org.apache.bookkeeper.benchmark;

/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand All @@ -17,23 +15,22 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.bookkeeper.benchmark;

import static com.google.common.base.Charsets.UTF_8;

import java.io.FileOutputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.HashMap;

import org.apache.bookkeeper.client.BookKeeper;
import org.apache.bookkeeper.client.LedgerHandle;
import org.apache.zookeeper.KeeperException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static com.google.common.base.Charsets.UTF_8;

import org.apache.zookeeper.KeeperException;

/**
* A mysql client performing writes and reads that used for benchmark comparison with BookKeeper.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
*/
package org.apache.bookkeeper.benchmark;

import static com.google.common.base.Charsets.UTF_8;

import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
Expand All @@ -34,12 +36,11 @@
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;

import org.apache.bookkeeper.client.AsyncCallback.AddCallback;
import org.apache.bookkeeper.client.BKException;
import org.apache.bookkeeper.client.BookKeeper;
import org.apache.bookkeeper.client.LedgerHandle;
import org.apache.bookkeeper.client.AsyncCallback.AddCallback;
import org.apache.bookkeeper.client.BookKeeper.DigestType;
import org.apache.bookkeeper.client.LedgerHandle;
import org.apache.bookkeeper.conf.ClientConfiguration;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
Expand All @@ -55,12 +56,9 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static com.google.common.base.Charsets.UTF_8;

/**
* This is a simple test program to compare the performance of writing to
* BookKeeper and to the local file system.
*
*/
public class TestClient {
private static final Logger LOG = LoggerFactory.getLogger(TestClient.class);
Expand Down
33 changes: 33 additions & 0 deletions bookkeeper-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,39 @@
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${maven-checkstyle-plugin.version}</version>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>${puppycrawl.checkstyle.version}</version>
</dependency>
<dependency>
<groupId>org.apache.bookkeeper</groupId>
<artifactId>buildtools</artifactId>
<version>${project.parent.version}</version>
</dependency>
</dependencies>
<configuration>
<configLocation>bookkeeper/checkstyle.xml</configLocation>
<suppressionsLocation>bookkeeper/server-suppressions.xml</suppressionsLocation>
<encoding>UTF-8</encoding>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
</configuration>
<executions>
<execution>
<id>checkstyle</id>
<phase>validate</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,12 @@
package org.apache.bookkeeper.auth;

import java.io.IOException;

import org.apache.bookkeeper.bookie.BookieConnectionPeer;
import org.apache.bookkeeper.client.BKException;
import org.apache.bookkeeper.client.ClientConnectionPeer;
import org.apache.bookkeeper.conf.ClientConfiguration;
import org.apache.bookkeeper.conf.ServerConfiguration;
import org.apache.bookkeeper.util.ReflectionUtils;
import org.apache.bookkeeper.client.ClientConnectionPeer;
import org.apache.bookkeeper.bookie.BookieConnectionPeer;

/**
* A factory to manage the authentication provider factories.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@
package org.apache.bookkeeper.auth;

import java.io.IOException;

import org.apache.bookkeeper.conf.ServerConfiguration;
import org.apache.bookkeeper.proto.BookkeeperInternalCallbacks.GenericCallback;
import org.apache.bookkeeper.bookie.BookieConnectionPeer;
import org.apache.bookkeeper.conf.ServerConfiguration;

/**
* Bookie authentication provider interface.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@
package org.apache.bookkeeper.auth;

import java.io.IOException;

import org.apache.bookkeeper.conf.ClientConfiguration;
import org.apache.bookkeeper.client.ClientConnectionPeer;
import org.apache.bookkeeper.conf.ClientConfiguration;

/**
* Client authentication provider interface.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ public interface BookKeeperServerStats {
// Ledger Storage Stats
String STORAGE_GET_OFFSET = "STORAGE_GET_OFFSET";
String STORAGE_GET_ENTRY = "STORAGE_GET_ENTRY";
/** Ledger Cache Stats **/
// Ledger Cache Stats
String LEDGER_CACHE_READ_PAGE = "LEDGER_CACHE_READ_PAGE";
/** SkipList Stats **/
// SkipList Stats
String SKIP_LIST_GET_ENTRY = "SKIP_LIST_GET_ENTRY";
String SKIP_LIST_PUT_ENTRY = "SKIP_LIST_PUT_ENTRY";
String SKIP_LIST_SNAPSHOT = "SKIP_LIST_SNAPSHOT";
Expand All @@ -101,13 +101,13 @@ public interface BookKeeperServerStats {
String JOURNAL_QUEUE_SIZE = "JOURNAL_QUEUE_SIZE";
String READ_BYTES = "READ_BYTES";
String WRITE_BYTES = "WRITE_BYTES";
/** Ledger Cache Counters **/
// Ledger Cache Counters
String LEDGER_CACHE_HIT = "LEDGER_CACHE_HIT";
String LEDGER_CACHE_MISS = "LEDGER_CACHE_MISS";
/** Compaction/Garbage Collection Related Counters **/
// Compaction/Garbage Collection Related Counters
String NUM_MINOR_COMP = "NUM_MINOR_COMP";
String NUM_MAJOR_COMP = "NUM_MAJOR_COMP";
/** Index Related Counters **/
// Index Related Counters
String INDEX_INMEM_ILLEGAL_STATE_RESET = "INDEX_INMEM_ILLEGAL_STATE_RESET";
String INDEX_INMEM_ILLEGAL_STATE_DELETE = "INDEX_INMEM_ILLEGAL_STATE_DELETE";
String JOURNAL_FORCE_WRITE_QUEUE_SIZE = "JOURNAL_FORCE_WRITE_QUEUE_SIZE";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@
import static org.apache.bookkeeper.bookie.BookKeeperServerStats.SERVER_STATUS;
import static org.apache.bookkeeper.bookie.BookKeeperServerStats.WRITE_BYTES;

import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.google.common.util.concurrent.SettableFuture;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FilenameFilter;
Expand All @@ -61,7 +68,6 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;

import org.apache.bookkeeper.bookie.BookieException.DiskPartitionDuplicationException;
import org.apache.bookkeeper.bookie.Journal.JournalScanner;
import org.apache.bookkeeper.bookie.LedgerDirsManager.LedgerDirsListener;
Expand Down Expand Up @@ -102,18 +108,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.google.common.util.concurrent.SettableFuture;
import com.google.common.util.concurrent.ThreadFactoryBuilder;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;

/**
* Implements a bookie.
*
*/
public class Bookie extends BookieCriticalThread {

Expand Down Expand Up @@ -1313,7 +1309,7 @@ synchronized int shutdown(int exitCode) {
if (indexDirsManager != ledgerDirsManager) {
idxMonitor.shutdown();
}

// Shutdown the state service
stateService.shutdown();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
package org.apache.bookkeeper.bookie;

/*
*
* Licensed to the Apache Software Foundation (ASF) under one
Expand All @@ -20,6 +18,7 @@
* under the License.
*
*/
package org.apache.bookkeeper.bookie;

/**
* Signals that a Bookie exception of some sort has occurred. This class
Expand Down Expand Up @@ -181,7 +180,7 @@ public UpgradeException(String reason) {
super(Code.UpgradeException, reason);
}
}

/**
* Signals when multiple ledger/journal directories are mounted in same disk partition.
*/
Expand Down