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

Pr test 1 #1

Open
wants to merge 15 commits into
base: ghtest
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions bookkeeper-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@
<version>0.5.0</version>
<configuration>
<protocArtifact>com.google.protobuf:protoc:3.4.0:exe:${os.detected.classifier}</protocArtifact>
<checkStaleness>true</checkStaleness>
</configuration>
<executions>
<execution>
Expand Down Expand Up @@ -434,6 +435,58 @@
</dependency>
</dependencies>
</profile>
<profile>
<id>dev</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<argLine>-Xmx2G -Djava.net.preferIPv4Stack=true</argLine>
<redirectTestOutputToFile>false</redirectTestOutputToFile>
<reuseForks>false</reuseForks>
<forkedProcessTimeoutInSeconds>1800</forkedProcessTimeoutInSeconds>
<trimStackTrace>false</trimStackTrace>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>dev-debug</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire-plugin.version}</version>
<configuration>
<argLine>-Xmx2G -Djava.net.preferIPv4Stack=true -Dbookkeeper.root.logger=DEBUG,CONSOLE</argLine>
<redirectTestOutputToFile>false</redirectTestOutputToFile>
<reuseForks>false</reuseForks>
<forkedProcessTimeoutInSeconds>1800</forkedProcessTimeoutInSeconds>
<trimStackTrace>false</trimStackTrace>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>codahale-metrics-provider</id>
<dependencies>
Expand Down
354 changes: 96 additions & 258 deletions bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Bookie.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ public BookieException(int code, String reason) {
super(reason);
}

public BookieException(int code, String reason, Throwable t) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blah blah

super(reason, t);
}

public static BookieException create(int code) {
switch(code) {
case Code.UnauthorizedAccessException:
Expand All @@ -52,6 +56,12 @@ public static BookieException create(int code) {
return new UpgradeException();
case Code.DiskPartitionDuplicationException:
return new DiskPartitionDuplicationException();
case Code.CookieNotFoundException:
return new CookieNotFoundException();
case Code.MetadataStoreException:
return new MetadataStoreException();
case Code.UnknownBookieIdException:
return new UnknownBookieIdException();
default:
return new BookieIllegalOpException();
}
Expand All @@ -66,10 +76,12 @@ public interface Code {

int IllegalOpException = -100;
int LedgerFencedException = -101;

int InvalidCookieException = -102;
int UpgradeException = -103;
int DiskPartitionDuplicationException = -104;
int CookieNotFoundException = -105;
int MetadataStoreException = -106;
int UnknownBookieIdException = -107;
}

public void setCode(int code) {
Expand Down Expand Up @@ -101,6 +113,15 @@ public String getMessage(int code) {
case Code.DiskPartitionDuplicationException:
err = "Disk Partition Duplication is not allowed";
break;
case Code.CookieNotFoundException:
err = "Cookie not found";
break;
case Code.MetadataStoreException:
err = "Error performing metadata operations";
break;
case Code.UnknownBookieIdException:
err = "Unknown bookie id";
break;
default:
err = "Invalid operation";
break;
Expand Down Expand Up @@ -132,7 +153,15 @@ public BookieUnauthorizedAccessException() {
*/
public static class BookieIllegalOpException extends BookieException {
public BookieIllegalOpException() {
super(Code.UnauthorizedAccessException);
super(Code.IllegalOpException);
}

public BookieIllegalOpException(String reason) {
super(Code.IllegalOpException, reason);
}

public BookieIllegalOpException(Throwable cause) {
super(Code.IllegalOpException, cause);
}
}

Expand Down Expand Up @@ -164,6 +193,23 @@ public InvalidCookieException(Throwable cause) {
}
}

/**
* Signal that no cookie is found when starting a bookie.
*/
public static class CookieNotFoundException extends BookieException {
public CookieNotFoundException() {
this("");
}

public CookieNotFoundException(String reason) {
super(Code.CookieNotFoundException, reason);
}

public CookieNotFoundException(Throwable cause) {
super(Code.CookieNotFoundException, cause);
}
}

/**
* Signals that an exception occurs on upgrading a bookie.
*/
Expand Down Expand Up @@ -197,4 +243,40 @@ public DiskPartitionDuplicationException(String reason) {
super(Code.DiskPartitionDuplicationException, reason);
}
}

/**
* Signal when bookie has problems on accessing metadata store.
*/
public static class MetadataStoreException extends BookieException {

public MetadataStoreException() {
this("");
}

public MetadataStoreException(String reason) {
super(Code.MetadataStoreException, reason);
}

public MetadataStoreException(Throwable cause) {
super(Code.MetadataStoreException, cause);
}

public MetadataStoreException(String reason, Throwable cause) {
super(Code.MetadataStoreException, reason, cause);
}
}

/**
* Signal when bookie has problems on accessing metadata store.
*/
public static class UnknownBookieIdException extends BookieException {

public UnknownBookieIdException() {
super(Code.UnknownBookieIdException);
}

public UnknownBookieIdException(Throwable cause) {
super(Code.UnknownBookieIdException, cause);
}
}
}
Loading