mirror of
https://github.com/wassname/ray.git
synced 2026-07-23 13:10:11 +08:00
Publish a notification for empty keys in the GCS (#2347)
* Publish an empty notification for empty keys * Add failure callback to Table::Subscribe, add unit test for new behavior
This commit is contained in:
committed by
Robert Nishihara
parent
b7088c1010
commit
c50f1966e0
@@ -800,6 +800,13 @@ void TableEntryToFlatbuf(RedisModuleKey *table_key,
|
||||
fbb.CreateVector(data));
|
||||
fbb.Finish(message);
|
||||
} break;
|
||||
case REDISMODULE_KEYTYPE_EMPTY: {
|
||||
auto message = CreateGcsTableEntry(
|
||||
fbb, RedisStringToFlatbuf(fbb, entry_id),
|
||||
fbb.CreateVector(
|
||||
std::vector<flatbuffers::Offset<flatbuffers::String>>()));
|
||||
fbb.Finish(message);
|
||||
} break;
|
||||
default:
|
||||
RAY_LOG(FATAL) << "Invalid Redis type during lookup: " << key_type;
|
||||
}
|
||||
@@ -889,15 +896,14 @@ int TableRequestNotifications_RedisCommand(RedisModuleCtx *ctx,
|
||||
// Lookup the current value at the key.
|
||||
RedisModuleKey *table_key =
|
||||
OpenPrefixedKey(ctx, prefix_str, id, REDISMODULE_READ);
|
||||
if (table_key != nullptr) {
|
||||
// Publish the current value at the key to the client that is requesting
|
||||
// notifications.
|
||||
flatbuffers::FlatBufferBuilder fbb;
|
||||
TableEntryToFlatbuf(table_key, id, fbb);
|
||||
RedisModule_Call(ctx, "PUBLISH", "sb", client_channel,
|
||||
reinterpret_cast<const char *>(fbb.GetBufferPointer()),
|
||||
fbb.GetSize());
|
||||
}
|
||||
// Publish the current value at the key to the client that is requesting
|
||||
// notifications. An empty notification will be published if the key is
|
||||
// empty.
|
||||
flatbuffers::FlatBufferBuilder fbb;
|
||||
TableEntryToFlatbuf(table_key, id, fbb);
|
||||
RedisModule_Call(ctx, "PUBLISH", "sb", client_channel,
|
||||
reinterpret_cast<const char *>(fbb.GetBufferPointer()),
|
||||
fbb.GetSize());
|
||||
|
||||
return RedisModule_ReplyWithNull(ctx);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user