Skip to content

Commit

Permalink
Install rdb-cli from librdb into syncd0 container
Browse files Browse the repository at this point in the history
  • Loading branch information
JunhongMao committed Aug 2, 2024
1 parent 963b958 commit f86bc06
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
SUBDIRS = meta lib vslib proxylib pyext

if SYNCD
SUBDIRS += syncd saiplayer saidump saidiscovery saisdkdump saiasiccmp tests unittest
SUBDIRS += syncd saiplayer saidump rdb saidiscovery saisdkdump saiasiccmp tests unittest
endif

ACLOCAL_AMFLAGS = -I m4
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ AC_OUTPUT(Makefile
syncd/tests/Makefile
saiplayer/Makefile
saidump/Makefile
rdb/Makefile
saisdkdump/Makefile
saidiscovery/Makefile
saiasiccmp/Makefile
Expand Down
1 change: 1 addition & 0 deletions debian/syncd.install
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
usr/bin/saidump
usr/bin/rdb-cli
usr/bin/saiplayer
usr/bin/saisdkdump
usr/bin/saidiscovery
Expand Down
23 changes: 23 additions & 0 deletions rdb/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
bin_PROGRAMS = rdb-cli$(EXEEXT)
rdb_cli_SOURCES =

clone-repo:
echo "Cloning repository..."; \
rm -rf librdb; \
git clone https://github.com/redis/librdb.git; \
cd librdb; \
git checkout b401df1e7025501c24f0c852aa32f6900fd888f7; \
cd ..

update-submodules-and-build: clone-repo
cd librdb && git submodule update --init --recursive && patch -p1 < ../format.patch && $(MAKE)
cp ./librdb/bin/rdb-cli ./
rm -rf ./librdb

rdb-cli$(EXEEXT): update-submodules-and-build

clean-local:
rm -rf ./librdb

install:
cp rdb-cli $(DESTDIR)/usr/bin/
44 changes: 44 additions & 0 deletions rdb/format.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
diff --git a/src/lib/parser.c b/src/lib/parser.c
index 01504ba..c463fb4 100644
--- a/src/lib/parser.c
+++ b/src/lib/parser.c
@@ -2166,7 +2166,7 @@ RdbStatus elementModule(RdbParser *p) {
IF_NOT_OK_RETURN(rdbLoadLen(p, NULL, &when, NULL, NULL));
if (unlikely(when_opcode != RDB_MODULE_OPCODE_UINT)) {
RDB_reportError(p, RDB_ERR_MODULE_INVALID_WHEN_OPCODE,
- "elementModule() : Invalid when opcode: %ld.", when_opcode);
+ "elementModule() : Invalid when opcode: %" PRIu64 ".", when_opcode);
return RDB_STATUS_ERROR;
}
}
diff --git a/src/lib/parserRaw.c b/src/lib/parserRaw.c
index 0e9f9c6..aa54ffc 100644
--- a/src/lib/parserRaw.c
+++ b/src/lib/parserRaw.c
@@ -729,7 +729,7 @@ RdbStatus elementRawModule(RdbParser *p) {
IF_NOT_OK_RETURN(rdbLoadLen(p, NULL, &ma->when, NULL, NULL));
if (unlikely(ma->when_opcode != RDB_MODULE_OPCODE_UINT)) {
RDB_reportError(p, RDB_ERR_MODULE_INVALID_WHEN_OPCODE,
- "elementRawModule() : Invalid when opcode: %ld.", ma->when_opcode);
+ "elementRawModule() : Invalid when opcode: %" PRIu64 ".", ma->when_opcode);
return RDB_STATUS_ERROR;
}
/*** ENTER SAFE STATE ***/
@@ -1214,7 +1214,7 @@ static RdbStatus aggMakeRoom(RdbParser *p, size_t numBytesRq) {
size_t freeRoomLeft = currBuff->len - currBuff->written;

if (unlikely(p->maxRawSize < ctx->totalSize + numBytesRq)) {
- RDB_reportError(p, RDB_ERR_MAX_RAW_LEN_EXCEEDED_FOR_KEY, "Maximum raw length exceeded for key (len=%lu)",
+ RDB_reportError(p, RDB_ERR_MAX_RAW_LEN_EXCEEDED_FOR_KEY, "Maximum raw length exceeded for key (len=%" PRIuPTR ")",
ctx->totalSize + numBytesRq);
return RDB_STATUS_ERROR;
}
@@ -1287,7 +1287,7 @@ void printAggAraryDbg(RdbParser *p) {
RawContext *ctx = &p->rawCtx;
for (int i = 0; i <= ctx->curBulkIndex ; ++i) {
BulkInfo *b = ctx->bulkArray+i;
- printf("bulkArray[%d]: bulkType=%d ref=%p len=%lu written=%lu next=%p\n",
+ printf("bulkArray[%d]: bulkType=%d ref=%p len=%" PRIuPTR " written=%" PRIuPTR " next=%p\n",
i, b->bulkType, (void *)b->ref, b->len, b->written, (void *)b->next);
}
}

0 comments on commit f86bc06

Please sign in to comment.