Skip to content

Commit 30d5afc

Browse files
author
Ole John Aske
committed
Bug#35420131 NDB: Restore will not update 'equal' PK values changed during backup
Addendum patch, removing usage of deprecated setValue() and equal() methods taking a 'length' argument. These methods seems to have been marked as deprecated since: ----------------- commit 88fbfc4 Author: [email protected] <> Date: Mon Nov 7 12:19:28 2005 +0100 Import ndb varsize ----------------- The 'length' argument is now unused. Thus using this deprecated variants provide now extra safety check, which might have been the intention with allowing it to be specified. The previous patch for Bug#35420131 introduced an extra ::setValue(). As it make no sense introducing new usage of deprecated methods, we did not use that variant of the method here. However, there are several other places where these deprecated variants are used in this code component. This is a good time to clean out the usage of these as well. Change-Id: Iee1463d9ba3315fe2055a47996e8f717afaf2001 (cherry picked from commit d0a570b14f1e1abe211d2a3fceb5195f95f09186)
1 parent a204dca commit 30d5afc

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

storage/ndb/tools/restore/consumer_restore.cpp

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1982,18 +1982,18 @@ BackupRestore::update_apply_status(const RestoreMetaData &metaData, bool snapsho
19821982
return false;
19831983
}
19841984
if (op->writeTuple() ||
1985-
op->equal(0u, (const char *)&server_id, sizeof(server_id)) ||
1986-
op->setValue(1u, (const char *)&epoch, sizeof(epoch)))
1985+
op->equal(0u, server_id) ||
1986+
op->setValue(1u, epoch))
19871987
{
19881988

19891989
restoreLogger.log_error("%s : failed to set epoch value in --restore-epoch: %u:%s",
19901990
NDB_APPLY_TABLE, op->getNdbError().code, op->getNdbError().message);
19911991
return false;
19921992
}
19931993
if ((apply_table_format == 2) &&
1994-
(op->setValue(2u, (const char *)&empty_string, 1) ||
1995-
op->setValue(3u, (const char *)&zero, sizeof(zero)) ||
1996-
op->setValue(4u, (const char *)&zero, sizeof(zero))))
1994+
(op->setValue(2u, empty_string) ||
1995+
op->setValue(3u, zero) ||
1996+
op->setValue(4u, zero)))
19971997
{
19981998

19991999
restoreLogger.log_error("%s : failed to set values in --restore-epoch: %u:%s",
@@ -3974,15 +3974,15 @@ void BackupRestore::tuple_a(restore_callback_t *cb)
39743974
if (col_pk_in_kernel)
39753975
{
39763976
if (j == 1) continue;
3977-
ret = op->equal(attr_desc->attrId, dataPtr, length);
3977+
ret = op->equal(attr_desc->attrId, dataPtr);
39783978
}
39793979
else
39803980
{
39813981
if (j == 0) continue;
39823982
if (attr_data->null)
3983-
ret = op->setValue(attr_desc->attrId, NULL, 0);
3983+
ret = op->setValue(attr_desc->attrId, (char*)NULL);
39843984
else
3985-
ret = op->setValue(attr_desc->attrId, dataPtr, length);
3985+
ret = op->setValue(attr_desc->attrId, dataPtr);
39863986
}
39873987
if (ret < 0) {
39883988
ndbout_c("Column: %d type %d %d %d %d",i,
@@ -4743,8 +4743,6 @@ BackupRestore::logEntry_a(restore_callback_t *cb)
47434743
update_next_auto_val(orig_table_id, usedAutoVal + 1);
47444744
}
47454745

4746-
const Uint32 length = (size / 8) * arraySize;
4747-
47484746
if (attr->Desc->convertFunc &&
47494747
dataPtr != NULL) // NULL will not be converted
47504748
{
@@ -4776,7 +4774,7 @@ BackupRestore::logEntry_a(restore_callback_t *cb)
47764774
if (!keys.get(attrId))
47774775
{
47784776
keys.set(attrId);
4779-
check= op->equal(keyAttrId, dataPtr, length);
4777+
check= op->equal(keyAttrId, dataPtr);
47804778
}
47814779
else if (tup.m_type == LogEntry::LE_UPDATE)
47824780
{
@@ -4791,7 +4789,7 @@ BackupRestore::logEntry_a(restore_callback_t *cb)
47914789
assert(pass == 1);
47924790
if (tup.m_type != LogEntry::LE_DELETE)
47934791
{
4794-
check= op->setValue(attrId, dataPtr, length);
4792+
check= op->setValue(attrId, dataPtr);
47954793
}
47964794
}
47974795

0 commit comments

Comments
 (0)