-
Notifications
You must be signed in to change notification settings - Fork 9
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
[ASTS] Preliminaries I: deleteFromAtomicTable #7197
Open
jeremyk-91
wants to merge
13
commits into
develop
Choose a base branch
from
jkong/asts-atomica
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
f94b85e
eat some tests
jeremyk-91 ab45ad2
one thing at a time
jeremyk-91 9ed2f7c
fix
jeremyk-91 1d37d06
have a few more tests, why not
jeremyk-91 554d997
lethologica
jeremyk-91 75cc3d2
wakawaka
jeremyk-91 fe956f3
bla
jeremyk-91 ac45dc0
fix
jeremyk-91 db3daa1
polish
jeremyk-91 fb1aece
this is probably less weird
jeremyk-91 0b39d2f
spotty spot spot
jeremyk-91 7cfd2ee
Add generated changelog entries
svc-changelog b25b451
it go
jeremyk-91 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -231,7 +231,7 @@ public void testCfEqualityChecker() throws TException { | |
.collect(Collectors.toList())); | ||
|
||
assertThat(ColumnFamilyDefinitions.isMatchingCf( | ||
kvs.getCfForTable(NEVER_SEEN, getMetadata(), FOUR_DAYS_IN_SECONDS), clusterSideCf)) | ||
kvs.getCfForTable(NEVER_SEEN, getMetadata(), FOUR_DAYS_IN_SECONDS), clusterSideCf)) | ||
.as("After serialization and deserialization to database, Cf metadata did not match.") | ||
.isTrue(); | ||
} | ||
|
@@ -256,8 +256,10 @@ private static String getInternalTestTableName() { | |
@SuppressWarnings("CompileTimeConstant") | ||
public void shouldNotErrorForTimestampTableWhenCreatingCassandraKvs() { | ||
verify(logger, atLeast(0)) | ||
.error(startsWith("Found a table {} that did not have persisted"), | ||
assertArg((Arg<String> arg) -> assertThat(arg.getValue()).doesNotContain("timestamp"))); | ||
.error( | ||
startsWith("Found a table {} that did not have persisted"), | ||
assertArg( | ||
(Arg<String> arg) -> assertThat(arg.getValue()).doesNotContain("timestamp"))); | ||
} | ||
|
||
@Test | ||
|
@@ -492,20 +494,20 @@ public void setOnceTest() { | |
|
||
keyValueService.putUnlessExists(userTable, ImmutableMap.of(CELL, sad)); | ||
assertThat(keyValueService | ||
.get(userTable, ImmutableMap.of(CELL, Long.MAX_VALUE)) | ||
.get(CELL) | ||
.getContents()) | ||
.get(userTable, ImmutableMap.of(CELL, Long.MAX_VALUE)) | ||
.get(CELL) | ||
.getContents()) | ||
.containsExactly(sad); | ||
|
||
keyValueService.setOnce(userTable, ImmutableMap.of(CELL, happy)); | ||
assertThat(keyValueService | ||
.get(userTable, ImmutableMap.of(CELL, Long.MAX_VALUE)) | ||
.get(CELL) | ||
.getContents()) | ||
.get(userTable, ImmutableMap.of(CELL, Long.MAX_VALUE)) | ||
.get(CELL) | ||
.getContents()) | ||
.containsExactly(happy); | ||
assertThat(keyValueService | ||
.getAllTimestamps(userTable, ImmutableSet.of(CELL), Long.MAX_VALUE) | ||
.size()) | ||
.getAllTimestamps(userTable, ImmutableSet.of(CELL), Long.MAX_VALUE) | ||
.size()) | ||
.isEqualTo(1); | ||
keyValueService.truncateTable(userTable); | ||
} | ||
|
@@ -665,9 +667,9 @@ public void testMultiCheckAndSetCannotUpdateAcrossMultipleRows() { | |
Cell nextTestCell = Cell.create(row(1), column(1)); | ||
|
||
assertThatThrownBy(() -> keyValueService.multiCheckAndSet(MultiCheckAndSetRequest.newCells( | ||
TEST_TABLE, | ||
firstTestCell.getRowName(), | ||
ImmutableMap.of(firstTestCell, val(0, 0), nextTestCell, val(0, 1))))) | ||
TEST_TABLE, | ||
firstTestCell.getRowName(), | ||
ImmutableMap.of(firstTestCell, val(0, 0), nextTestCell, val(0, 1))))) | ||
.isInstanceOf(SafeIllegalStateException.class) | ||
.hasMessageContaining("Can only update cells in one row."); | ||
} | ||
|
@@ -683,7 +685,7 @@ public void testMultiCheckAndSetIndependentlyFails() { | |
TEST_TABLE, nextTestCell.getRowName(), ImmutableMap.of(nextTestCell, val(0, 1)))); | ||
|
||
assertThatThrownBy(() -> keyValueService.multiCheckAndSet(MultiCheckAndSetRequest.newCells( | ||
TEST_TABLE, nextTestCell.getRowName(), ImmutableMap.of(nextTestCell, val(0, 2))))) | ||
TEST_TABLE, nextTestCell.getRowName(), ImmutableMap.of(nextTestCell, val(0, 2))))) | ||
.isInstanceOf(MultiCheckAndSetException.class); | ||
|
||
MultiCheckAndSetException ex = catchThrowableOfType( | ||
|
@@ -808,7 +810,7 @@ private CfDef createDefaultCfDef(String namespace, String tableName) { | |
.setComment("") | ||
.setColumn_metadata(new ArrayList<>()) | ||
.setTriggers(new ArrayList<>()) | ||
.setKey_alias(new byte[]{0x6B, 0x65, 0x79}) | ||
.setKey_alias(new byte[] {0x6B, 0x65, 0x79}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for some reason, Spotless applied these manipulations - I believe they don't have any semantic changes. |
||
.setComparator_type("org.apache.cassandra.db.marshal.CompositeType" | ||
+ "(org.apache.cassandra.db.marshal.BytesType,org.apache.cassandra.db.marshal.LongType)") | ||
.setCompaction_strategy_options(new HashMap<>()) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
atlasdb-cassandra/src/main/java/com/palantir/atlasdb/keyvalue/cassandra/CqlUtilities.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* (c) Copyright 2024 Palantir Technologies 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. | ||
*/ | ||
|
||
package com.palantir.atlasdb.keyvalue.cassandra; | ||
|
||
import com.google.common.io.BaseEncoding; | ||
import com.palantir.atlasdb.encoding.PtBytes; | ||
|
||
public final class CqlUtilities { | ||
public static final long CASSANDRA_REPRESENTATION_OF_ATLASDB_ATOMIC_TABLE_TIMESTAMP = -1; | ||
|
||
private CqlUtilities() { | ||
// Utility class | ||
} | ||
|
||
public static String encodeCassandraHexString(String string) { | ||
return encodeCassandraHexBytes(PtBytes.toBytes(string)); | ||
} | ||
|
||
public static String encodeCassandraHexBytes(byte[] bytes) { | ||
return "0x" + BaseEncoding.base16().upperCase().encode(bytes); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thought: having
TransactionKeyValueService
is nice here, because user transactions don't get to call this without doing scary stuff