Skip to content

Commit 513d7ff

Browse files
committed
tablets: remove unused tabletid
It is unused and not going to be used, only occupy memory and eats CPU on hash calculation
1 parent ad4ff1c commit 513d7ff

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

driver-core/src/main/java/com/datastax/driver/core/TabletMap.java

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ void processTabletsRoutingV1Payload(String keyspace, String table, ByteBuffer pa
141141
HostShardPair hostShardPair = new HostShardPair(tuple.getUUID(0), tuple.getInt(1));
142142
replicas.add(hostShardPair);
143143
}
144-
Tablet newTablet = new Tablet(keyspace, null, table, firstToken, lastToken, replicas);
144+
Tablet newTablet = new Tablet(keyspace, table, firstToken, lastToken, replicas);
145145

146146
TabletSet tabletSet = mapping.computeIfAbsent(ktPair, k -> new TabletSet());
147147
Lock writeLock = tabletSet.lock.writeLock();
@@ -316,21 +316,18 @@ public TabletSet() {
316316
*/
317317
public static class Tablet implements Comparable<Tablet> {
318318
private final String keyspaceName;
319-
private final UUID tableId; // currently null almost everywhere
320319
private final String tableName;
321320
private final long firstToken;
322321
private final long lastToken;
323322
private final List<HostShardPair> replicas;
324323

325324
private Tablet(
326325
String keyspaceName,
327-
UUID tableId,
328326
String tableName,
329327
long firstToken,
330328
long lastToken,
331329
List<HostShardPair> replicas) {
332330
this.keyspaceName = keyspaceName;
333-
this.tableId = tableId;
334331
this.tableName = tableName;
335332
this.firstToken = firstToken;
336333
this.lastToken = lastToken;
@@ -345,17 +342,13 @@ private Tablet(
345342
* @return New {@link Tablet} object
346343
*/
347344
public static Tablet malformedTablet(long lastToken) {
348-
return new Tablet(null, null, null, lastToken, lastToken, null);
345+
return new Tablet(null, null, lastToken, lastToken, null);
349346
}
350347

351348
public String getKeyspaceName() {
352349
return keyspaceName;
353350
}
354351

355-
public UUID getTableId() {
356-
return tableId;
357-
}
358-
359352
public String getTableName() {
360353
return tableName;
361354
}
@@ -378,8 +371,6 @@ public String toString() {
378371
+ "keyspaceName='"
379372
+ keyspaceName
380373
+ '\''
381-
+ ", tableId="
382-
+ tableId
383374
+ ", tableName='"
384375
+ tableName
385376
+ '\''
@@ -400,14 +391,13 @@ public boolean equals(Object o) {
400391
return firstToken == that.firstToken
401392
&& lastToken == that.lastToken
402393
&& keyspaceName.equals(that.keyspaceName)
403-
&& Objects.equals(tableId, that.tableId)
404394
&& tableName.equals(that.tableName)
405395
&& Objects.equals(replicas, that.replicas);
406396
}
407397

408398
@Override
409399
public int hashCode() {
410-
return Objects.hash(keyspaceName, tableId, tableName, firstToken, lastToken, replicas);
400+
return Objects.hash(keyspaceName, tableName, firstToken, lastToken, replicas);
411401
}
412402

413403
@Override

0 commit comments

Comments
 (0)