Skip to content

Commit

Permalink
Merge pull request #181 from infoforcefeed/ol_database-field-buffer-l…
Browse files Browse the repository at this point in the history
…ength-fix

fixes both the liboleg and frontend builds
  • Loading branch information
kyleterry committed Apr 24, 2020
2 parents 39e9ffd + 72915f0 commit 2cab1cf
Show file tree
Hide file tree
Showing 14 changed files with 48 additions and 36 deletions.
1 change: 0 additions & 1 deletion .gitignore
@@ -1,6 +1,5 @@
*.swo
*.swp
olegdb
*.o
*.dump
data
Expand Down
42 changes: 24 additions & 18 deletions .travis.yml
@@ -1,22 +1,28 @@
language: c
compiler:
- gcc
- clang
script:
- make liboleg oleg_test
- sudo make install
- export LD_LIBRARY_PATH=./build/lib:$LD_LIBRARY_PATH
- ./build/bin/oleg_test
- LD_LIBRARY_PATH=./build/lib:/usr/local/lib:/usr/lib:$LD_LIBRARY_PATH go test ./...
before_install:
- sudo apt-get update
- sudo apt-get install golang
dist: bionic
language: go
go:
- 1.14.x

notifications:
email:
on_success: never
on_failure: change
recipients:
- "qpfiffer@gmail.com"
email:
on_success: change
on_failure: change
recipients:
- "qpfiffer@gmail.com"
- "kyle@kyleterry.com"

jobs:
include:
- stage: test
script:
- make liboleg oleg_test test
- name: build
script:
- mkdir -p build
- sudo make libinstall
- go test ./...
- make olegdb

env:
global:
- secure: "GbSMNCqnGnjiuDqJJ55/EaNifx9L7t6JQVPw6illEnGZXL3T5RiC7alrpOQl2qGJG/gwRudMpFmEyvEqs0Rlpgx3x1DvcLCMlC2Rjd/2YklD0KVW0D91Mrrkk7ERzQTO8MXB2AUTxjSAwsZtewybebQhoqr7frulM4TclDZ/Cq4="
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -69,7 +69,7 @@ uninstall:

olegdb: liboleg $(LIB_OUT) $(BIN_DIR) $(BIN_OUT)
$(BIN_OUT):
go build -o $(BIN_OUT) ./frontend/
go build -o $(BIN_OUT) ./cmd/olegdb

install: goinstall

Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -24,7 +24,7 @@ Dependencies
============

* A healthy fear of the end
* Go (>= 1.1)
* Go (>= 1.14)

Installation
============
Expand Down
3 changes: 2 additions & 1 deletion frontend/dispatcher.go → cmd/olegdb/dispatcher.go
@@ -1,10 +1,11 @@
package main

import (
"./goleg"
"io/ioutil"
"net/http"
"strings"

"github.com/infoforcefeed/olegdb/pkg/goleg"
)

type Operation struct {
Expand Down
3 changes: 2 additions & 1 deletion frontend/main.go → cmd/olegdb/main.go
@@ -1,7 +1,6 @@
package main

import (
"./goleg"
"encoding/json"
"flag"
"fmt"
Expand All @@ -10,6 +9,8 @@ import (
"net/http"
"os"
"os/signal"

"github.com/infoforcefeed/olegdb/pkg/goleg"
)

type Config struct {
Expand Down
2 changes: 1 addition & 1 deletion frontend/operations.go → cmd/olegdb/operations.go
Expand Up @@ -23,7 +23,7 @@ const (
OpCursorPrev = "._prev"
OpPrefixMatch = "._match"
OpBulkUnjar = "_bulk_unjar"
OpSquish = "_squish"
OpSquish = "_squish"
)

func httpGet(w http.ResponseWriter, op Operation) *HTTPError {
Expand Down
3 changes: 3 additions & 0 deletions go.mod
@@ -0,0 +1,3 @@
module github.com/infoforcefeed/olegdb

go 1.14
2 changes: 2 additions & 0 deletions go.sum
@@ -0,0 +1,2 @@
github.com/infoforcefeed/olegdb v0.0.0-20190920231543-39e9ffd04c30 h1:O+Siihon2HK9O8K3siG/42HU2UvnxCu69mq3ktlIQCQ=
github.com/infoforcefeed/olegdb v0.0.0-20190920231543-39e9ffd04c30/go.mod h1:H5+5XDNE+DncxwND9HIRshDQ5JP8rkoHkNBkbpDD/GM=
6 changes: 3 additions & 3 deletions include/oleg.h
Expand Up @@ -126,9 +126,9 @@ typedef struct ol_database {
void (*enable)(int, int*);
void (*disable)(int, int*);
bool (*is_enabled)(const int, const int*);
char name[DB_NAME_SIZE];
char path[PATH_LENGTH];
char aol_file[AOL_FILENAME_ALLOC];
char name[DB_NAME_SIZE+1];
char path[PATH_LENGTH+1];
char aol_file[AOL_FILENAME_ALLOC+1];
FILE *aolfd;
int feature_set;
short int state;
Expand Down
2 changes: 1 addition & 1 deletion frontend/goleg/goleg_test.go → pkg/goleg/goleg_test.go
Expand Up @@ -141,7 +141,7 @@ func TestBulkUnjarOnlyReturnsKeysWeGiveIt(t *testing.T) {

for i, value := range values {
if subset[i][3] != string(value)[5] {
t.Fatalf("Expected %s, got %s", subset[i][3], string(value)[5])
t.Fatalf("Expected %b, got %b", subset[i][3], string(value)[5])
}
}
}
File renamed without changes.
File renamed without changes.
16 changes: 8 additions & 8 deletions src/test.c
Expand Up @@ -45,12 +45,12 @@ static int _test_db_close(ol_database *db) {
char values_filename[DB_NAME_SIZE] = { 0 };
db->get_db_file_name(db, VALUES_FILENAME, values_filename);

char aol_filename[DB_NAME_SIZE] = { 0 };
strncpy(aol_filename, db->aol_file, DB_NAME_SIZE);
char aol_filename[sizeof(db->aol_file) + 1] = { 0 };
strncpy(aol_filename, db->aol_file, sizeof(aol_filename));
int should_delete_aol = db->is_enabled(OL_F_APPENDONLY, &db->feature_set);

char DB_PATH[DB_NAME_SIZE] = {0};
strncpy(DB_PATH, db->path, DB_NAME_SIZE);
char DB_PATH[sizeof(db->path) + 1] = { 0 };
strncpy(DB_PATH, db->path, sizeof(DB_PATH));

int ret = ol_close(db);

Expand Down Expand Up @@ -670,8 +670,8 @@ int _test_aol(const ol_feature_flags features, ol_database **db) {
return 4;
}

char DB_PATH[DB_NAME_SIZE + 1] = {0};
strncpy(DB_PATH, (*db)->path, DB_NAME_SIZE);
char DB_PATH[sizeof((*db)->path) + 1] = {0};
strncpy(DB_PATH, (*db)->path, sizeof(DB_PATH));

/* We don't want to use test_db_close here because we want to retrieve
* values again. */
Expand Down Expand Up @@ -714,8 +714,8 @@ int test_aol_and_compaction(const ol_feature_flags features) {
ol_log_msg(LOG_INFO, "Squishing database.");
ol_squish(db);

char DB_PATH[DB_NAME_SIZE + 1] = {0};
strncpy(DB_PATH, db->path, DB_NAME_SIZE);
char DB_PATH[sizeof(db->path)+1] = {0};
strncpy(DB_PATH, db->path, sizeof(DB_PATH));

ol_close(db);

Expand Down

0 comments on commit 2cab1cf

Please sign in to comment.