Browse Source

HPCC-13180 Locking SET - database & expire passed incorrectly

Signed-off-by: James Noss <james.noss@lexisnexis.com>
James Noss 10 years ago
parent
commit
feb2badab2

+ 3 - 3
plugins/redis/redis.cpp

@@ -827,21 +827,21 @@ void Connection::handleLockOnSet(ICodeContext * ctx, const char * key, const cha
 //-----------------------------------SET------------------------------------------
 ECL_REDIS_API void ECL_REDIS_CALL SyncLockRSetStr(ICodeContext * ctx, size32_t & returnLength, char * & returnValue, const char * key, size32_t valueLength, const char * value, const char * options, unsigned __int64 database, unsigned expire, const char * password, unsigned __int64 timeout)
 {
-    SyncLockRSet(ctx, options, key, valueLength, value, expire,  database, password, timeout);
+    SyncLockRSet(ctx, options, key, valueLength, value, database, expire, password, timeout);
     returnLength = valueLength;
     returnValue = (char*)allocateAndCopy(value, valueLength);
 }
 ECL_REDIS_API void ECL_REDIS_CALL SyncLockRSetUChar(ICodeContext * ctx, size32_t & returnLength, UChar * & returnValue, const char * key, size32_t valueLength, const UChar * value, const char * options, unsigned __int64 database, unsigned expire, const char * password, unsigned __int64 timeout)
 {
     unsigned valueSize = (valueLength)*sizeof(UChar);
-    SyncLockRSet(ctx, options, key, valueSize, (char*)value, expire, database, password, timeout);
+    SyncLockRSet(ctx, options, key, valueSize, (char*)value, database, expire, password, timeout);
     returnLength= valueLength;
     returnValue = (UChar*)allocateAndCopy(value, valueSize);
 }
 ECL_REDIS_API void ECL_REDIS_CALL SyncLockRSetUtf8(ICodeContext * ctx, size32_t & returnLength, char * & returnValue, const char * key, size32_t valueLength, const char * value, const char * options, unsigned __int64 database, unsigned expire, const char * password, unsigned __int64 timeout)
 {
     unsigned valueSize = rtlUtf8Size(valueLength, value);
-    SyncLockRSet(ctx, options, key, valueSize, value, expire, database, password, timeout);
+    SyncLockRSet(ctx, options, key, valueSize, value, database, expire, password, timeout);
     returnLength = valueLength;
     returnValue = (char*)allocateAndCopy(value, valueSize);
 }

+ 27 - 0
testing/regress/ecl/key/redislockingtest.xml

@@ -76,3 +76,30 @@
 <Dataset name='Result 26'>
  <Row><value>RedisPlugin: ERROR - GET timed out.</value></Row>
 </Dataset>
+<Dataset name='Result 27'>
+ <Row><Result_27>databaseThenExpire</Result_27></Row>
+</Dataset>
+<Dataset name='Result 28'>
+ <Row><Result_28>databaseThenExpire</Result_28></Row>
+</Dataset>
+<Dataset name='Result 29'>
+ <Row><Result_29>databaseThenExpire</Result_29></Row>
+</Dataset>
+<Dataset name='Result 30'>
+ <Row><Result_30>databaseThenExpire</Result_30></Row>
+</Dataset>
+<Dataset name='Result 31'>
+ <Row><Result_31>databaseThenExpire</Result_31></Row>
+</Dataset>
+<Dataset name='Result 32'>
+ <Row><Result_32>databaseThenExpire</Result_32></Row>
+</Dataset>
+<Dataset name='Result 33'>
+ <Row><Result_33>databaseThenExpire</Result_33></Row>
+</Dataset>
+<Dataset name='Result 34'>
+ <Row><Result_34>databaseThenExpire</Result_34></Row>
+</Dataset>
+<Dataset name='Result 35'>
+ <Row><Result_35>databaseThenExpire</Result_35></Row>
+</Dataset>

+ 26 - 0
testing/regress/ecl/redislockingtest.ecl

@@ -135,3 +135,29 @@ SEQUENTIAL(
     myRedis.SetString('channelTest2', 'redis_ecl_lock_channelTest2_0');
     OUTPUT(CATCH(ds2, ONFAIL(TRANSFORM({ STRING value }, SELF.value := FAILMESSAGE))));
     );
+
+SEQUENTIAL(
+    myRedis.FlushDB(1);
+    myRedis.SetAndPublishString('testDatabaseExpire1', 'databaseThenExpire', 1, 10000);
+    myRedis.GetString('testDatabaseExpire1', 1);
+    myRedis.GetOrLockString('testDatabaseExpire1', 1);
+    myRedis.FlushDB(1);
+    );
+
+SEQUENTIAL(
+    myRedis.FlushDB(2);
+    myRedis.SetAndPublishUnicode('testDatabaseExpire2', 'databaseThenExpire', 2, 10000);
+    myRedis.GetUnicode('testDatabaseExpire2', 2);
+    myRedis.GetOrLockUnicode('testDatabaseExpire2', 2);
+    myRedis.FlushDB(2);
+    );
+
+SEQUENTIAL(
+    myRedis.FlushDB(3);
+    myRedis.SetAndPublishUtf8('testDatabaseExpire3', 'databaseThenExpire', 3, 10000);
+    myRedis.GetUtf8('testDatabaseExpire3', 3);
+    myRedis.GetOrLockUtf8('testDatabaseExpire3', 3);
+    myRedis.FlushDB(3);
+    );
+
+myRedis.FlushDB();