[GitHub] incubator-omid pull request #39: [OMID-105] When a tentative family deletion...
Github user yonigottesman commented on a diff in the pull request: https://github.com/apache/incubator-omid/pull/39#discussion_r206463065 --- Diff: hbase-client/src/main/java/org/apache/omid/transaction/SnapshotFilterImpl.java --- @@ -298,26 +291,62 @@ public CommitTimestamp locateCellCommitTimestamp(long cellStartTimestamp, long e return commitCache; } -private void buildFamilyDeletionCache(List rawCells, Map> familyDeletionCache) { - +private void buildFamilyDeletionCache(HBaseTransaction transaction, List rawCells, Map familyDeletionCache, Map commitCache, Map attributeMap) throws IOException { for (Cell cell : rawCells) { if (CellUtil.matchingQualifier(cell, CellUtils.FAMILY_DELETE_QUALIFIER) && CellUtil.matchingValue(cell, HConstants.EMPTY_BYTE_ARRAY)) { - String row = Bytes.toString(cell.getRow()); -List cells = familyDeletionCache.get(row); -if (cells == null) { -cells = new ArrayList<>(); -familyDeletionCache.put(row, cells); +String family = Bytes.toString(cell.getFamily()); +String key = row + ":" + family; + +if (familyDeletionCache.containsKey(key)) +return; + +Optional commitTimeStamp = isCellInSnapshot(cell, transaction, commitCache); + +if (!commitTimeStamp.isPresent()) { +commitTimeStamp = isCellInTransaction(cell, transaction, commitCache); } -cells.add(cell); +if (commitTimeStamp.isPresent()) { +familyDeletionCache.put(key, commitTimeStamp.get()); +} else { +Cell lastCell = cell; +Map cmtCache; +boolean foundCommitttedFamilyDeletion = false; +while (!foundCommitttedFamilyDeletion) { + +Get g = createPendingGet(lastCell, 3); +for (Map.Entry entry : attributeMap.entrySet()) { --- End diff -- But we know exactly what we want, a delete cell which is something to do only with omid. you are adding attributes that where aimed for the get of a cell by the user, to a delete cell of omid ---
[GitHub] incubator-omid pull request #39: [OMID-105] When a tentative family deletion...
Github user yonigottesman commented on a diff in the pull request: https://github.com/apache/incubator-omid/pull/39#discussion_r206463988 --- Diff: hbase-client/src/main/java/org/apache/omid/transaction/SnapshotFilterImpl.java --- @@ -298,26 +295,58 @@ public CommitTimestamp locateCellCommitTimestamp(long cellStartTimestamp, long e return commitCache; } -private void buildFamilyDeletionCache(List rawCells, Map> familyDeletionCache) { - +private void buildFamilyDeletionCache(HBaseTransaction transaction, List rawCells, Map familyDeletionCache, Map commitCache, Map attributeMap) throws IOException { for (Cell cell : rawCells) { -if (CellUtil.matchingQualifier(cell, CellUtils.FAMILY_DELETE_QUALIFIER) && -CellUtil.matchingValue(cell, HConstants.EMPTY_BYTE_ARRAY)) { - -String row = Bytes.toString(cell.getRow()); -List cells = familyDeletionCache.get(row); -if (cells == null) { -cells = new ArrayList<>(); -familyDeletionCache.put(row, cells); +if (CellUtils.isFamilyDeleteCell(cell)) { +String key = getRowFamilyString(cell); + +if (familyDeletionCache.containsKey(key)) +return; + +Optional commitTimeStamp = getTSIfInSnapshot(cell, transaction, commitCache); + +if (!commitTimeStamp.isPresent()) { +commitTimeStamp = getTSIfInTransaction(cell, transaction, commitCache); } -cells.add(cell); +if (commitTimeStamp.isPresent()) { +familyDeletionCache.put(key, commitTimeStamp.get()); +} else { +Cell lastCell = cell; +Map cmtCache; +boolean foundCommitttedFamilyDeletion = false; +while (!foundCommitttedFamilyDeletion) { + +Get g = createPendingGet(lastCell, 3); +for (Map.Entry entry : attributeMap.entrySet()) { +g.setAttribute(entry.getKey(), entry.getValue()); +} + +Result result = tableAccessWrapper.get(g); +List resultCells = result.listCells(); +if (resultCells == null) { +break; +} + +cmtCache = buildCommitCache(resultCells); +for (Cell c : resultCells) { +if (CellUtils.isFamilyDeleteCell(c)) { +commitTimeStamp = getTSIfInSnapshot(c, transaction, cmtCache); --- End diff -- Must check if cell is in snapshot. ---
[GitHub] incubator-omid pull request #39: [OMID-105] When a tentative family deletion...
Github user ohadshacham commented on a diff in the pull request: https://github.com/apache/incubator-omid/pull/39#discussion_r206422618 --- Diff: hbase-client/src/main/java/org/apache/omid/transaction/SnapshotFilterImpl.java --- @@ -395,8 +427,8 @@ private Get createPendingGet(Cell cell, int versionCount) throws IOException { } } -if (isCellInTransaction(cell, transaction, commitCache) || -isCellInSnapshot(cell, transaction, commitCache)) { +if (isCellInTransaction(cell, transaction, commitCache).isPresent() || +isCellInSnapshot(cell, transaction, commitCache).isPresent()) { --- End diff -- Same as before ---
[GitHub] incubator-omid pull request #39: [OMID-105] When a tentative family deletion...
Github user ohadshacham commented on a diff in the pull request: https://github.com/apache/incubator-omid/pull/39#discussion_r206422025 --- Diff: hbase-client/src/main/java/org/apache/omid/transaction/SnapshotFilterImpl.java --- @@ -298,26 +291,62 @@ public CommitTimestamp locateCellCommitTimestamp(long cellStartTimestamp, long e return commitCache; } -private void buildFamilyDeletionCache(List rawCells, Map> familyDeletionCache) { - +private void buildFamilyDeletionCache(HBaseTransaction transaction, List rawCells, Map familyDeletionCache, Map commitCache, Map attributeMap) throws IOException { for (Cell cell : rawCells) { if (CellUtil.matchingQualifier(cell, CellUtils.FAMILY_DELETE_QUALIFIER) && CellUtil.matchingValue(cell, HConstants.EMPTY_BYTE_ARRAY)) { - String row = Bytes.toString(cell.getRow()); -List cells = familyDeletionCache.get(row); -if (cells == null) { -cells = new ArrayList<>(); -familyDeletionCache.put(row, cells); +String family = Bytes.toString(cell.getFamily()); +String key = row + ":" + family; + +if (familyDeletionCache.containsKey(key)) +return; + +Optional commitTimeStamp = isCellInSnapshot(cell, transaction, commitCache); + +if (!commitTimeStamp.isPresent()) { +commitTimeStamp = isCellInTransaction(cell, transaction, commitCache); } -cells.add(cell); +if (commitTimeStamp.isPresent()) { +familyDeletionCache.put(key, commitTimeStamp.get()); +} else { +Cell lastCell = cell; +Map cmtCache; +boolean foundCommitttedFamilyDeletion = false; +while (!foundCommitttedFamilyDeletion) { + +Get g = createPendingGet(lastCell, 3); +for (Map.Entry entry : attributeMap.entrySet()) { --- End diff -- I don't know which attribute the user wrote and whether he/she wrote a coprocessor that looks on these attributes and do something. ---
[GitHub] incubator-omid pull request #39: [OMID-105] When a tentative family deletion...
Github user yonigottesman commented on a diff in the pull request: https://github.com/apache/incubator-omid/pull/39#discussion_r206462235 --- Diff: hbase-client/src/main/java/org/apache/omid/transaction/SnapshotFilterImpl.java --- @@ -298,26 +295,58 @@ public CommitTimestamp locateCellCommitTimestamp(long cellStartTimestamp, long e return commitCache; } -private void buildFamilyDeletionCache(List rawCells, Map> familyDeletionCache) { - +private void buildFamilyDeletionCache(HBaseTransaction transaction, List rawCells, Map familyDeletionCache, Map commitCache, Map attributeMap) throws IOException { for (Cell cell : rawCells) { -if (CellUtil.matchingQualifier(cell, CellUtils.FAMILY_DELETE_QUALIFIER) && -CellUtil.matchingValue(cell, HConstants.EMPTY_BYTE_ARRAY)) { - -String row = Bytes.toString(cell.getRow()); -List cells = familyDeletionCache.get(row); -if (cells == null) { -cells = new ArrayList<>(); -familyDeletionCache.put(row, cells); +if (CellUtils.isFamilyDeleteCell(cell)) { +String key = getRowFamilyString(cell); + +if (familyDeletionCache.containsKey(key)) +return; + +Optional commitTimeStamp = getTSIfInSnapshot(cell, transaction, commitCache); --- End diff -- maybe first call getTSIfInTransaction because its faster and doesnt go through commit table and stuff ---
[GitHub] incubator-omid pull request #39: [OMID-105] When a tentative family deletion...
Github user yonigottesman commented on a diff in the pull request: https://github.com/apache/incubator-omid/pull/39#discussion_r205961642 --- Diff: hbase-client/src/main/java/org/apache/omid/transaction/SnapshotFilterImpl.java --- @@ -298,26 +291,62 @@ public CommitTimestamp locateCellCommitTimestamp(long cellStartTimestamp, long e return commitCache; } -private void buildFamilyDeletionCache(List rawCells, Map> familyDeletionCache) { - +private void buildFamilyDeletionCache(HBaseTransaction transaction, List rawCells, Map familyDeletionCache, Map commitCache, Map attributeMap) throws IOException { for (Cell cell : rawCells) { if (CellUtil.matchingQualifier(cell, CellUtils.FAMILY_DELETE_QUALIFIER) && CellUtil.matchingValue(cell, HConstants.EMPTY_BYTE_ARRAY)) { - String row = Bytes.toString(cell.getRow()); -List cells = familyDeletionCache.get(row); -if (cells == null) { -cells = new ArrayList<>(); -familyDeletionCache.put(row, cells); +String family = Bytes.toString(cell.getFamily()); +String key = row + ":" + family; --- End diff -- use getRowFamilyString(Cell) ---
[GitHub] incubator-omid pull request #39: [OMID-105] When a tentative family deletion...
Github user yonigottesman commented on a diff in the pull request: https://github.com/apache/incubator-omid/pull/39#discussion_r205962016 --- Diff: hbase-client/src/main/java/org/apache/omid/transaction/SnapshotFilterImpl.java --- @@ -326,18 +355,21 @@ private boolean isCellInTransaction(Cell kv, HBaseTransaction transaction, Map= startTimestamp && kv.getTimestamp() <= readTimestamp) { -return true; +return Optional.of(kv.getTimestamp()); } -return false; +return Optional.absent(); } -private boolean isCellInSnapshot(Cell kv, HBaseTransaction transaction, Map commitCache) +private Optional isCellInSnapshot(Cell kv, HBaseTransaction transaction, Map commitCache) --- End diff -- rename function we dont return boolean ---
[GitHub] incubator-omid pull request #39: [OMID-105] When a tentative family deletion...
Github user yonigottesman commented on a diff in the pull request: https://github.com/apache/incubator-omid/pull/39#discussion_r205961668 --- Diff: hbase-client/src/main/java/org/apache/omid/transaction/SnapshotFilterImpl.java --- @@ -298,26 +291,62 @@ public CommitTimestamp locateCellCommitTimestamp(long cellStartTimestamp, long e return commitCache; } -private void buildFamilyDeletionCache(List rawCells, Map> familyDeletionCache) { - +private void buildFamilyDeletionCache(HBaseTransaction transaction, List rawCells, Map familyDeletionCache, Map commitCache, Map attributeMap) throws IOException { for (Cell cell : rawCells) { if (CellUtil.matchingQualifier(cell, CellUtils.FAMILY_DELETE_QUALIFIER) && CellUtil.matchingValue(cell, HConstants.EMPTY_BYTE_ARRAY)) { - String row = Bytes.toString(cell.getRow()); -List cells = familyDeletionCache.get(row); -if (cells == null) { -cells = new ArrayList<>(); -familyDeletionCache.put(row, cells); +String family = Bytes.toString(cell.getFamily()); +String key = row + ":" + family; + +if (familyDeletionCache.containsKey(key)) +return; + +Optional commitTimeStamp = isCellInSnapshot(cell, transaction, commitCache); + +if (!commitTimeStamp.isPresent()) { --- End diff -- why call this twice? ---
[GitHub] incubator-omid pull request #39: [OMID-105] When a tentative family deletion...
Github user yonigottesman commented on a diff in the pull request: https://github.com/apache/incubator-omid/pull/39#discussion_r205961880 --- Diff: hbase-client/src/main/java/org/apache/omid/transaction/SnapshotFilterImpl.java --- @@ -298,26 +291,62 @@ public CommitTimestamp locateCellCommitTimestamp(long cellStartTimestamp, long e return commitCache; } -private void buildFamilyDeletionCache(List rawCells, Map> familyDeletionCache) { - +private void buildFamilyDeletionCache(HBaseTransaction transaction, List rawCells, Map familyDeletionCache, Map commitCache, Map attributeMap) throws IOException { for (Cell cell : rawCells) { if (CellUtil.matchingQualifier(cell, CellUtils.FAMILY_DELETE_QUALIFIER) && CellUtil.matchingValue(cell, HConstants.EMPTY_BYTE_ARRAY)) { - String row = Bytes.toString(cell.getRow()); -List cells = familyDeletionCache.get(row); -if (cells == null) { -cells = new ArrayList<>(); -familyDeletionCache.put(row, cells); +String family = Bytes.toString(cell.getFamily()); +String key = row + ":" + family; + +if (familyDeletionCache.containsKey(key)) +return; + +Optional commitTimeStamp = isCellInSnapshot(cell, transaction, commitCache); + +if (!commitTimeStamp.isPresent()) { +commitTimeStamp = isCellInTransaction(cell, transaction, commitCache); } -cells.add(cell); +if (commitTimeStamp.isPresent()) { +familyDeletionCache.put(key, commitTimeStamp.get()); +} else { +Cell lastCell = cell; +Map cmtCache; +boolean foundCommitttedFamilyDeletion = false; +while (!foundCommitttedFamilyDeletion) { + +Get g = createPendingGet(lastCell, 3); +for (Map.Entry entry : attributeMap.entrySet()) { --- End diff -- Why do we need to update attributes? Its just a simple get we know exactly what we want and dont want server to filter anything ---
[GitHub] incubator-omid pull request #39: [OMID-105] When a tentative family deletion...
Github user yonigottesman commented on a diff in the pull request: https://github.com/apache/incubator-omid/pull/39#discussion_r205962069 --- Diff: hbase-client/src/main/java/org/apache/omid/transaction/SnapshotFilterImpl.java --- @@ -395,8 +427,8 @@ private Get createPendingGet(Cell cell, int versionCount) throws IOException { } } -if (isCellInTransaction(cell, transaction, commitCache) || -isCellInSnapshot(cell, transaction, commitCache)) { +if (isCellInTransaction(cell, transaction, commitCache).isPresent() || +isCellInSnapshot(cell, transaction, commitCache).isPresent()) { --- End diff -- Isnt isCellInTransaction a subgroup of isCellInSnapshot ? why call both? ---
[GitHub] incubator-omid pull request #39: [OMID-105] When a tentative family deletion...
Github user yonigottesman commented on a diff in the pull request: https://github.com/apache/incubator-omid/pull/39#discussion_r205961605 --- Diff: hbase-client/src/main/java/org/apache/omid/transaction/SnapshotFilterImpl.java --- @@ -98,20 +98,13 @@ void setCommitTableClient(CommitTable.Client commitTableClient) { * @param commitCache Holds shadow cells information * @return Whether the cell was deleted */ -private boolean checkFamilyDeletionCache(Cell cell, HBaseTransaction transaction, Map> familyDeletionCache, Map commitCache) throws IOException { -List familyDeletionCells = familyDeletionCache.get(Bytes.toString((cell.getRow(; -if (familyDeletionCells != null) { -for(Cell familyDeletionCell : familyDeletionCells) { -String family = Bytes.toString(cell.getFamily()); -String familyDeletion = Bytes.toString(familyDeletionCell.getFamily()); -if (family.equals(familyDeletion)) { -Optional familyDeletionCommitTimestamp = getCommitTimestamp(familyDeletionCell, transaction, commitCache); -if (familyDeletionCommitTimestamp.isPresent() && familyDeletionCommitTimestamp.get() >= cell.getTimestamp()) { -return true; -} -} -} +private boolean checkFamilyDeletionCache(Cell cell, HBaseTransaction transaction, Map familyDeletionCache, Map commitCache) throws IOException { +String key = Bytes.toString((cell.getRow())) + ":" + Bytes.toString(cell.getFamily()); --- End diff -- change getFamily to CellUtil.cloneFamily From hbase documentation: "WARNING do not use, expensive. This gets an arraycopy of the cell's value." ---