Skip to content

Commit 8bee07c

Browse files
committed
Bug#35027961 ClusterJ hint for single character column partition key is wrong
Remove optimization for single column partitioning key since that did not work correctly for character columns. Change-Id: I4eff7ddef0262e3a801289649f65a3cf1f355d32
1 parent 53613fc commit 8bee07c

File tree

2 files changed

+8
-17
lines changed
  • storage/ndb
    • clusterj/clusterj-tie/src/main/java/com/mysql/clusterj/tie
    • include/ndbapi

2 files changed

+8
-17
lines changed

storage/ndb/clusterj/clusterj-tie/src/main/java/com/mysql/clusterj/tie/DbImpl.java

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2010, 2021, Oracle and/or its affiliates.
2+
* Copyright (c) 2010, 2023, Oracle and/or its affiliates.
33
*
44
* This program is free software; you can redistribute it and/or modify
55
* it under the terms of the GNU General Public License, version 2.0,
@@ -257,20 +257,6 @@ public NdbTransaction enlist(String tableName, List<KeyPart> keyParts) {
257257
TableConst table = ndbDictionary.getTable(tableName);
258258
handleError(table, ndbDictionary);
259259
Key_part_ptrArray key_part_ptrArray = null;
260-
if (keyPartsSize == 1) {
261-
// extract the ByteBuffer and length from the keyPart
262-
KeyPart keyPart = keyParts.get(0);
263-
ByteBuffer buffer = keyPart.buffer;
264-
int length = keyPart.length;
265-
ndbTransaction = ndb.startTransaction(table, buffer, length);
266-
if (ndbTransaction == null) {
267-
logger.warn(local.message("ERR_Transaction_Start_Failed",
268-
tableName, buffer.position(), buffer.limit(), buffer.capacity(), length));
269-
}
270-
bufferManager.returnPartitionKeyPartBuffer(length, buffer);
271-
handleError (ndbTransaction, ndb);
272-
return ndbTransaction;
273-
}
274260
key_part_ptrArray = Key_part_ptrArray.create(keyPartsSize + 1);
275261
try {
276262
// the key part pointer array has one entry for each key part

storage/ndb/include/ndbapi/Ndb.hpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2003, 2021, Oracle and/or its affiliates.
2+
Copyright (c) 2003, 2023, Oracle and/or its affiliates.
33
44
This program is free software; you can redistribute it and/or modify
55
it under the terms of the GNU General Public License, version 2.0,
@@ -1552,7 +1552,12 @@ class Ndb
15521552
* The transaction must be closed independent of its outcome, i.e.
15531553
* even if there is an error.
15541554
*
1555-
* @param table Pointer to table object used for deciding
1555+
* @note Hinting TC-selection by passing key data only works if key only
1556+
* consists of 4-byte aligned values and not using character columns.
1557+
* No failure will be returned if that is not the case, rather use the
1558+
* startTransaction function that takes Key_part_ptr.
1559+
*
1560+
* @param table Pointer to table object used for deciding
15561561
* which node to run the Transaction Coordinator on
15571562
* @param keyData Pointer to partition key corresponding to
15581563
* <var>table</var>

0 commit comments

Comments
 (0)