[GitHub] incubator-omid pull request #16: [OMID-78] Identify transaction snapshot at ...

2017-12-05 Thread ohadshacham
Github user ohadshacham closed the pull request at:

https://github.com/apache/incubator-omid/pull/16


---


[GitHub] incubator-omid pull request #16: [OMID-78] Identify transaction snapshot at ...

2017-11-29 Thread yonigottesman
Github user yonigottesman commented on a diff in the pull request:

https://github.com/apache/incubator-omid/pull/16#discussion_r153424921
  
--- Diff: 
hbase-client/src/main/java/org/apache/omid/transaction/SnapshotFilter.java ---
@@ -0,0 +1,50 @@
+/*
+ * 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.
+ */
+package org.apache.omid.transaction;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.hadoop.hbase.Cell;
+import org.apache.hadoop.hbase.client.Get;
+import org.apache.hadoop.hbase.client.Result;
+import org.apache.hadoop.hbase.client.ResultScanner;
+import org.apache.hadoop.hbase.client.Scan;
+import org.apache.omid.committable.CommitTable.CommitTimestamp;
+
+import com.google.common.base.Optional;
+
+public interface SnapshotFilter {
+
+public Result get(TTable ttable, Get get, HBaseTransaction 
transaction) throws IOException;
+
+public ResultScanner getScanner(TTable ttable, Scan scan, 
HBaseTransaction transaction) throws IOException;
+
+public List filterCellsForSnapshot(List rawCells, 
HBaseTransaction transaction,
+int versionsToRequest, Map 
familyDeletionCache) throws IOException;
+
+public boolean isCommitted(HBaseCellId hBaseCellId, long epoch) throws 
TransactionException;
--- End diff --

Why do all other function throw ioexceptions and this one something else?


---


[GitHub] incubator-omid pull request #16: [OMID-78] Identify transaction snapshot at ...

2017-11-29 Thread yonigottesman
Github user yonigottesman commented on a diff in the pull request:

https://github.com/apache/incubator-omid/pull/16#discussion_r153424483
  
--- Diff: 
hbase-client/src/main/java/org/apache/omid/transaction/HBaseTransactionManager.java
 ---
@@ -292,7 +268,7 @@ public ConflictDetectionLevel 
getConflictDetectionLevel() {
 get.addColumn(family, shadowCellQualifier);
 get.setMaxVersions(1);
 get.setTimeStamp(startTimestamp);
-Result result = hBaseCellId.getTable().get(get);
+Result result = (tableAccessWrapper != null) ? 
tableAccessWrapper.get(get) : hBaseCellId.getTable().get(get);
--- End diff --

why should this be null? Maybe its better to pass 
"hBaseCellId.getTable().get(get);" to the constructor code


---


[GitHub] incubator-omid pull request #16: [OMID-78] Identify transaction snapshot at ...

2017-11-29 Thread yonigottesman
Github user yonigottesman commented on a diff in the pull request:

https://github.com/apache/incubator-omid/pull/16#discussion_r153422231
  
--- Diff: 
hbase-coprocessor/src/main/java/org/apache/hadoop/hbase/regionserver/OmidRegionScanner.java
 ---
@@ -0,0 +1,128 @@
+/*
+ * 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.
+ */
+package org.apache.hadoop.hbase.regionserver;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.hadoop.hbase.Cell;
+import org.apache.hadoop.hbase.HRegionInfo;
+import org.apache.hadoop.hbase.regionserver.RegionScanner;
+import org.apache.hadoop.hbase.regionserver.ScannerContext;
+import org.apache.omid.transaction.HBaseTransaction;
+import org.apache.omid.transaction.SnapshotFilterImpl;
+
+public class OmidRegionScanner implements RegionScanner {
+
+RegionScanner scanner;
--- End diff --

Why are these package-private and not private?



---


[GitHub] incubator-omid pull request #16: [OMID-78] Identify transaction snapshot at ...

2017-11-29 Thread yonigottesman
Github user yonigottesman commented on a diff in the pull request:

https://github.com/apache/incubator-omid/pull/16#discussion_r153421050
  
--- Diff: 
hbase-client/src/main/java/org/apache/omid/transaction/TTable.java ---
@@ -76,6 +71,10 @@
 
 private HTableInterface table;
 
+private SnapshotFilter snapshotFilter;
+
+private boolean serverSideFilter;
--- End diff --

No need to be a class field, you use it once in a function so make it local 
there.


---


[GitHub] incubator-omid pull request #16: [OMID-78] Identify transaction snapshot at ...

2017-11-14 Thread ohadshacham
Github user ohadshacham commented on a diff in the pull request:

https://github.com/apache/incubator-omid/pull/16#discussion_r150795077
  
--- Diff: 
hbase-coprocessor/src/main/java/org/apache/hadoop/hbase/regionserver/RegionAccessWrapper.java
 ---
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+package org.apache.hadoop.hbase.regionserver;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.apache.hadoop.hbase.client.Get;
+import org.apache.hadoop.hbase.client.HTableInterface;
+import org.apache.hadoop.hbase.client.Put;
+import org.apache.hadoop.hbase.client.Result;
+import org.apache.omid.transaction.TableAccessWrapper;
+
+public class RegionAccessWrapper implements TableAccessWrapper {
--- End diff --

done


---


[GitHub] incubator-omid pull request #16: [OMID-78] Identify transaction snapshot at ...

2017-11-14 Thread ohadshacham
Github user ohadshacham commented on a diff in the pull request:

https://github.com/apache/incubator-omid/pull/16#discussion_r150794291
  
--- Diff: 
hbase-coprocessor/src/main/java/org/apache/hadoop/hbase/regionserver/OmidRegionScanner.java
 ---
@@ -0,0 +1,128 @@
+/*
+ * 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.
+ */
+package org.apache.hadoop.hbase.regionserver;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.hadoop.hbase.Cell;
+import org.apache.hadoop.hbase.HRegionInfo;
+import org.apache.hadoop.hbase.regionserver.RegionScanner;
+import org.apache.hadoop.hbase.regionserver.ScannerContext;
+import org.apache.omid.transaction.HBaseTransaction;
+import org.apache.omid.transaction.SnapshotFilter;
+
+public class OmidRegionScanner implements RegionScanner {
+
+RegionScanner scanner;
+SnapshotFilter snapshotFilter;
+HBaseTransaction transaction;
+int maxVersions;
+Map familyDeletionCache;
+
+public OmidRegionScanner(SnapshotFilter snapshotFilter,
+  RegionScanner s,
+  HBaseTransaction transaction,
+  int maxVersions) {
+this.snapshotFilter = snapshotFilter;
+this.scanner = s;
+this.transaction = transaction;
+this.maxVersions = maxVersions;
+this.familyDeletionCache = new HashMap();
+}
+
+@Override
+public boolean next(List results) throws IOException {
+   return next(results, Integer.MAX_VALUE);
+}
+
+public boolean next(List result, int limit) throws IOException {
--- End diff --

The function is defined in RegionScanner interface, we are just override it.


---


[GitHub] incubator-omid pull request #16: [OMID-78] Identify transaction snapshot at ...

2017-11-14 Thread ohadshacham
Github user ohadshacham commented on a diff in the pull request:

https://github.com/apache/incubator-omid/pull/16#discussion_r150794375
  
--- Diff: 
hbase-client/src/main/java/org/apache/omid/transaction/HTableAccessWrapper.java 
---
@@ -0,0 +1,53 @@
+/*
+ * 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.
+ */
+package org.apache.omid.transaction;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.apache.hadoop.hbase.client.Get;
+import org.apache.hadoop.hbase.client.HTableInterface;
+import org.apache.hadoop.hbase.client.Put;
+import org.apache.hadoop.hbase.client.Result;
+
+public class HTableAccessWrapper implements TableAccessWrapper {
--- End diff --

RegionAccessWrapper


---


[GitHub] incubator-omid pull request #16: [OMID-78] Identify transaction snapshot at ...

2017-11-14 Thread ohadshacham
Github user ohadshacham commented on a diff in the pull request:

https://github.com/apache/incubator-omid/pull/16#discussion_r150794314
  
--- Diff: 
hbase-coprocessor/src/main/java/org/apache/hadoop/hbase/regionserver/OmidRegionScanner.java
 ---
@@ -0,0 +1,128 @@
+/*
+ * 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.
+ */
+package org.apache.hadoop.hbase.regionserver;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.hadoop.hbase.Cell;
+import org.apache.hadoop.hbase.HRegionInfo;
+import org.apache.hadoop.hbase.regionserver.RegionScanner;
+import org.apache.hadoop.hbase.regionserver.ScannerContext;
+import org.apache.omid.transaction.HBaseTransaction;
+import org.apache.omid.transaction.SnapshotFilter;
+
+public class OmidRegionScanner implements RegionScanner {
+
+RegionScanner scanner;
+SnapshotFilter snapshotFilter;
+HBaseTransaction transaction;
+int maxVersions;
+Map familyDeletionCache;
+
+public OmidRegionScanner(SnapshotFilter snapshotFilter,
+  RegionScanner s,
+  HBaseTransaction transaction,
+  int maxVersions) {
+this.snapshotFilter = snapshotFilter;
+this.scanner = s;
+this.transaction = transaction;
+this.maxVersions = maxVersions;
+this.familyDeletionCache = new HashMap();
+}
+
+@Override
+public boolean next(List results) throws IOException {
+   return next(results, Integer.MAX_VALUE);
+}
+
+public boolean next(List result, int limit) throws IOException {
+return nextRaw(result, limit);
+}
+
+@Override
+public void close() throws IOException {
+scanner.close();
+}
+
+@Override
+public HRegionInfo getRegionInfo() {
+return scanner.getRegionInfo();
+}
+
+@Override
+public boolean isFilterDone() throws IOException {
+return scanner.isFilterDone();
+}
+
+@Override
+public boolean reseek(byte[] row) throws IOException {
+throw new RuntimeException("Not implemented");
+}
+
+@Override
+public long getMaxResultSize() {
+return scanner.getMaxResultSize();
+}
+
+@Override
+public long getMvccReadPoint() {
+return scanner.getMvccReadPoint();
+}
+
+@Override
+public boolean nextRaw(List result) throws IOException {
--- End diff --

The function is defined in RegionScanner interface, we are just override it.


---