Skip to content
This repository has been archived by the owner on Jul 15, 2019. It is now read-only.

Commit

Permalink
merged with master
Browse files Browse the repository at this point in the history
  • Loading branch information
Maysam Yabandeh committed May 17, 2012
2 parents e1d3012 + 1d7c6e8 commit 39a1128
Show file tree
Hide file tree
Showing 29 changed files with 1,951 additions and 368 deletions.
2 changes: 1 addition & 1 deletion bin/omid.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
45 changes: 45 additions & 0 deletions conf/log4j.properties
Original file line number Diff line number Diff line change
@@ -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
33 changes: 33 additions & 0 deletions conf/omid-site.xml
Original file line number Diff line number Diff line change
@@ -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>
33 changes: 19 additions & 14 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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>
7 changes: 7 additions & 0 deletions src/main/java/com/yahoo/omid/client/TransactionManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
11 changes: 1 addition & 10 deletions src/main/java/com/yahoo/omid/client/TransactionalTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -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)}
Expand Down
Loading

0 comments on commit 39a1128

Please sign in to comment.