Permalink
Browse files

merged with master

  • Loading branch information...
Maysam Yabandeh
Maysam Yabandeh committed May 17, 2012
2 parents e1d3012 + 1d7c6e8 commit 39a11284107fda4e19a00eaff4ab668047c5a567
Showing with 1,951 additions and 368 deletions.
  1. +1 −1 bin/omid.sh
  2. +45 −0 conf/log4j.properties
  3. +33 −0 conf/omid-site.xml
  4. +19 −14 pom.xml
  5. +7 −0 src/main/java/com/yahoo/omid/client/TransactionManager.java
  6. +1 −10 src/main/java/com/yahoo/omid/client/TransactionalTable.java
  7. +66 −35 src/main/java/com/yahoo/omid/tso/TSOHandler.java
  8. +34 −81 src/main/java/com/yahoo/omid/tso/TSOServer.java
  9. +118 −0 src/main/java/com/yahoo/omid/tso/TSOServerConfig.java
  10. +109 −18 src/main/java/com/yahoo/omid/tso/TSOState.java
  11. +44 −12 src/main/java/com/yahoo/omid/tso/TimestampOracle.java
  12. +369 −0 src/main/java/com/yahoo/omid/tso/persistence/BookKeeperStateBuilder.java
  13. +268 −0 src/main/java/com/yahoo/omid/tso/persistence/BookKeeperStateLogger.java
  14. +33 −0 src/main/java/com/yahoo/omid/tso/persistence/LoggerAsyncCallback.java
  15. +24 −0 src/main/java/com/yahoo/omid/tso/persistence/LoggerConstants.java
  16. +127 −0 src/main/java/com/yahoo/omid/tso/persistence/LoggerException.java
  17. +99 −0 src/main/java/com/yahoo/omid/tso/persistence/LoggerProtocol.java
  18. +54 −0 src/main/java/com/yahoo/omid/tso/persistence/StateBuilder.java
  19. +49 −0 src/main/java/com/yahoo/omid/tso/persistence/StateLogger.java
  20. +7 −6 src/test/java/com/yahoo/omid/OmidTestBase.java
  21. +0 −5 src/test/java/com/yahoo/omid/TestAbortTransaction.java
  22. +0 −5 src/test/java/com/yahoo/omid/TestBasicTransaction.java
  23. +95 −5 src/test/java/com/yahoo/omid/TestCompaction.java
  24. +0 −5 src/test/java/com/yahoo/omid/TestSingleColumnFamily.java
  25. +227 −162 src/test/java/com/yahoo/omid/TestTransactionConflict.java
  26. +10 −6 src/test/java/com/yahoo/omid/tso/TSOTestBase.java
  27. +0 −2 src/test/java/com/yahoo/omid/tso/TestCommitReport.java
  28. +112 −0 src/test/java/com/yahoo/omid/tso/TestPersistence.java
  29. +0 −1 src/test/java/com/yahoo/omid/tso/TestTimestamps.java
View
@@ -40,7 +40,7 @@ fi
tso() {
export LD_LIBRARY_PATH=`$READLINK -f ../src/main/native`
- exec java -Xmx1024m -cp $CLASSPATH -Domid.maxItems=1000000 -Domid.maxCommits=30000000 -Djava.library.path=$LD_LIBRARY_PATH -Dlog4j.configuration=log4j.properties com.yahoo.omid.tso.TSOServer 1234 $BATCHSIZE 4 2 localhost:2181
+ exec java -Xmx1024m -cp $CLASSPATH -Domid.maxItems=1000000 -Domid.maxCommits=30000000 -Djava.library.path=$LD_LIBRARY_PATH -Dlog4j.configuration=log4j.properties com.yahoo.omid.tso.TSOServer -port 1234 -batch $BATCHSIZE -ensemble 4 -quorum 2 -zk localhost:2181
}
tsobench() {
View
@@ -0,0 +1,45 @@
+########################################################################
+#
+# Copyright (c) 2011 Yahoo! Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License. See accompanying LICENSE file.
+#
+########################################################################
+
+#log4j.rootCategory=TRACE, R, O
+log4j.rootCategory=WARN, R, O
+
+# Stdout
+log4j.appender.O=org.apache.log4j.ConsoleAppender
+#log4j.appender.O.Threshold=WARN
+
+# File
+log4j.appender.R=org.apache.log4j.RollingFileAppender
+log4j.appender.R.File=logs/log4j.log
+
+# Control the maximum log file size
+log4j.appender.R.MaxFileSize=100MB
+
+# Clear log file each time
+log4j.appender.R.Append=false
+
+# Archive log files (one backup file here)
+log4j.appender.R.MaxBackupIndex=5
+
+log4j.appender.R.layout=org.apache.log4j.PatternLayout
+log4j.appender.O.layout=org.apache.log4j.PatternLayout
+
+log4j.appender.R.layout.ConversionPattern=[%d{ISO8601}]%5p%6.6r[%t]%x - %C.%M(%F:%L) - %m%n
+log4j.appender.O.layout.ConversionPattern=[%d{ISO8601}]%5p%6.6r[%t]%x - %C.%M(%F:%L) - %m%n
+
+log4j.logger.com.yahoo.omid.tso.ThroughputMonitor=TRACE
View
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+/**
+ * Copyright 2010 The Apache Software Foundation
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+<configuration>
+ <property>
+ <name>tso.rwcheck</name>
+ <value>false</value>
+ </property>
+ <property>
+ <name>tso.wwcheck</name>
+ <value>true</value>
+ </property>
+</configuration>
View
33 pom.xml
@@ -25,19 +25,17 @@
<name>omid</name>
<url>http://maven.apache.org</url>
- <repositories>
- <repository>
- <id>apache.snapshots</id>
- <name>Temporary repo waiting for HBase 0.92.0 release</name>
- <url>https://repository.apache.org/content/groups/snapshots-group/</url>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- </repository>
- </repositories>
-
<build>
- <plugins>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.9</version>
+ <configuration>
+ <argLine>-Xmx1G</argLine>
+ <forkMode>pertest</forkMode>
+ </configuration>
+ </plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
@@ -113,14 +111,14 @@
<dependency>
<groupId>org.apache.hbase</groupId>
<artifactId>hbase</artifactId>
- <version>0.92.0-SNAPSHOT</version>
+ <version>0.92.0</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
- <version>3.4.0</version>
+ <version>3.4.3</version>
<scope>compile</scope>
</dependency>
<dependency>
@@ -149,5 +147,12 @@
<type>jar</type>
<scope>compile</scope>
</dependency>
+ <dependency>
+ <groupId>com.beust</groupId>
+ <artifactId>jcommander</artifactId>
+ <version>1.23</version>
+ <type>jar</type>
+ <scope>compile</scope>
+ </dependency>
</dependencies>
</project>
@@ -228,5 +228,12 @@ private void cleanup(final TransactionState transactionState)
throw new TransactionException("Could not clean up for table " + entry.getKey(), ioe);
}
}
+ AbortCompleteCallback cb = new SyncAbortCompleteCallback();
+ try {
+ tsoclient.completeAbort(transactionState.getStartTimestamp(), cb );
+ } catch (IOException ioe) {
+ throw new TransactionException("Could not notify TSO about cleanup completion for transaction " +
+ transactionState.getStartTimestamp(), ioe);
+ }
}
}
@@ -219,29 +219,20 @@ public void delete(TransactionState transactionState, Delete delete) throws IOEx
*/
public void put(TransactionState transactionState, Put put) throws IOException, IllegalArgumentException {
final long startTimestamp = transactionState.getStartTimestamp();
-// byte[] startTSBytes = Bytes.toBytes(startTimestamp);
// create put with correct ts
final Put tsput = new Put(put.getRow(), startTimestamp);
Map<byte[], List<KeyValue>> kvs = put.getFamilyMap();
for (List<KeyValue> kvl : kvs.values()) {
for (KeyValue kv : kvl) {
-// int tsOffset = kv.getTimestampOffset();
-// System.arraycopy(startTSBytes, 0, kv.getBuffer(), tsOffset, Bytes.SIZEOF_LONG);
tsput.add(new KeyValue(kv.getRow(), kv.getFamily(), kv.getQualifier(), startTimestamp, kv.getValue()));
}
}
// should add the table as well
transactionState.addWrittenRow(new RowKeyFamily(put.getRow(), getTableName(), put.getFamilyMap()));
+ transactionState.addRow(new RowKeyFamily(tsput.getRow(), getTableName(), tsput.getFamilyMap()));
put(tsput);
-// super.getConnection().getRegionServerWithRetries(
-// new ServerCallable<Boolean>(super.getConnection(), super.getTableName(), put.getRow()) {
-// public Boolean call() throws IOException {
-// server.put(location.getRegionInfo().getRegionName(), tsput);
-// return true;
-// }
-// });
}
/**
* Transactional version of {@link HTable#getScanner(Scan)}
Oops, something went wrong.

0 comments on commit 39a1128

Please sign in to comment.