Skip to content

CASSANDRA-9420 add table option for saying theres no deletes on table #4234

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

Draft
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ private TableParams build(TableParams.Builder builder)
if (hasOption(MIN_INDEX_INTERVAL))
builder.minIndexInterval(getInt(MIN_INDEX_INTERVAL));

if (hasOption(Option.NO_DELETES))
builder.noDeletes(getBoolean(Option.NO_DELETES));

if (hasOption(SPECULATIVE_RETRY))
builder.speculativeRetry(SpeculativeRetryPolicy.fromString(getString(SPECULATIVE_RETRY)));

Expand Down
31 changes: 25 additions & 6 deletions src/java/org/apache/cassandra/schema/TableParams.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ public enum Option
TRANSACTIONAL_MODE,
TRANSACTIONAL_MIGRATION_FROM,
PENDING_DROP,
AUTO_REPAIR;
AUTO_REPAIR,
NO_DELETES;

@Override
public String toString()
Expand Down Expand Up @@ -132,6 +133,7 @@ public String toString()
public final TransactionalMode transactionalMode;
public final TransactionalMigrationFromMode transactionalMigrationFrom;
public final boolean pendingDrop;
public final boolean noDeletes;

public final AutoRepairParams autoRepair;

Expand Down Expand Up @@ -164,6 +166,7 @@ private TableParams(Builder builder)
pendingDrop = builder.pendingDrop;
checkNotNull(transactionalMigrationFrom);
autoRepair = builder.autoRepair;
noDeletes = builder.noDeletes;
}

public static Builder builder()
Expand Down Expand Up @@ -196,7 +199,8 @@ public static Builder builder(TableParams params)
.transactionalMode(params.transactionalMode)
.transactionalMigrationFrom(params.transactionalMigrationFrom)
.pendingDrop(params.pendingDrop)
.automatedRepair(params.autoRepair);
.automatedRepair(params.autoRepair)
.noDeletes(params.noDeletes);
}

public Builder unbuild()
Expand Down Expand Up @@ -297,7 +301,8 @@ public boolean equals(Object o)
&& transactionalMode == p.transactionalMode
&& transactionalMigrationFrom == p.transactionalMigrationFrom
&& pendingDrop == p.pendingDrop
&& autoRepair.equals(p.autoRepair);
&& autoRepair.equals(p.autoRepair)
&& noDeletes == p.noDeletes;
}

@Override
Expand Down Expand Up @@ -326,7 +331,8 @@ public int hashCode()
transactionalMode,
transactionalMigrationFrom,
pendingDrop,
autoRepair);
autoRepair,
noDeletes);
}

@Override
Expand Down Expand Up @@ -358,6 +364,7 @@ public String toString()
.add(Option.TRANSACTIONAL_MIGRATION_FROM.toString(), transactionalMigrationFrom)
.add(PENDING_DROP.toString(), pendingDrop)
.add(Option.AUTO_REPAIR.toString(), autoRepair)
.add(Option.NO_DELETES.toString(), noDeletes)
.toString();
}

Expand Down Expand Up @@ -407,6 +414,8 @@ public void appendCqlTo(CqlBuilder builder, boolean isView)
.newLine()
.append("AND min_index_interval = ").append(minIndexInterval)
.newLine()
.append("AND no_deletes = ").append(noDeletes)
.newLine()
.append("AND read_repair = ").appendWithSingleQuotes(readRepair.toString())
.newLine();

Expand Down Expand Up @@ -454,6 +463,7 @@ public static final class Builder
public boolean pendingDrop = false;

private AutoRepairParams autoRepair = AutoRepairParams.DEFAULT;
private boolean noDeletes = false;
public Builder()
{
}
Expand Down Expand Up @@ -606,6 +616,12 @@ public Builder automatedRepair(AutoRepairParams val)
autoRepair = val;
return this;
}

public Builder noDeletes(boolean val)
{
noDeletes = val;
return this;
}
}

public static class Serializer implements MetadataSerializer<TableParams>
Expand Down Expand Up @@ -641,6 +657,7 @@ public void serialize(TableParams t, DataOutputPlus out, Version version) throws
out.writeInt(t.transactionalMode.ordinal());
out.writeInt(t.transactionalMigrationFrom.ordinal());
out.writeBoolean(t.pendingDrop);
out.writeBoolean(t.noDeletes);
}
}

Expand Down Expand Up @@ -671,7 +688,8 @@ public TableParams deserialize(DataInputPlus in, Version version) throws IOExcep
builder.fastPath(FastPathStrategy.serializer.deserialize(in, version))
.transactionalMode(TransactionalMode.fromOrdinal(in.readInt()))
.transactionalMigrationFrom(TransactionalMigrationFromMode.fromOrdinal(in.readInt()))
.pendingDrop(in.readBoolean());
.pendingDrop(in.readBoolean())
.noDeletes(in.readBoolean());
}
return builder.build();
}
Expand Down Expand Up @@ -702,7 +720,8 @@ public long serializedSize(TableParams t, Version version)
size += FastPathStrategy.serializer.serializedSize(t.fastPath, version) +
sizeof(t.transactionalMode.ordinal()) +
sizeof(t.transactionalMigrationFrom.ordinal()) +
sizeof(t.pendingDrop);
sizeof(t.pendingDrop) +
sizeof(t.noDeletes);
}
return size;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public enum Version
* - Added ConsensusMigrationState
* - Added AccordStaleReplicas
* - TableParam now has pendingDrop (accord table drop is multistep)
* - TableParam now has noDeletes
*/
V7(7),

Expand Down