Browse Source

chore(release): 1.0.2

Matthias Ladkau 4 years ago
parent
commit
b3284661b4

+ 10 - 0
CHANGELOG.md

@@ -2,6 +2,16 @@
 
 
 All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
 All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
 
 
+### [1.0.2](https://devt.de///compare/v1.0.1...v1.0.2) (2020-02-22)
+
+
+### Bug Fixes
+
+* Adding more debug tools to cluster ([7ca3ae0](https://devt.de///commit/7ca3ae04cdf3816edb950be0b066c94aff87a70f))
+* Adding proper Graph Manager global values for tests ([127477f](https://devt.de///commit/127477fd541d45258bad36e36f17648bf95bd4d2))
+* Cluster Distributed Storage must assign new locations from 1 ([6c24001](https://devt.de///commit/6c240016c1414f945adb2e47c26542c3a226ef5b))
+* Small fix for debug code and better comments ([3b68724](https://devt.de///commit/3b68724d2ab936ec0c29afc6cc0d191714cd1a23))
+
 ### [1.0.1](https://devt.de///compare/v1.0.0...v1.0.1) (2019-12-15)
 ### [1.0.1](https://devt.de///compare/v1.0.0...v1.0.1) (2019-12-15)
 
 
 
 

+ 0 - 1
Jenkinsfile

@@ -55,7 +55,6 @@ pipeline {
                     sh 'git fetch --tags'
                     sh 'git fetch --tags'
                 }
                 }
 
 
-                sh 'mkdir -p .cache'
                 sh '/opt/env-go/bin/env-go make dist'
                 sh '/opt/env-go/bin/env-go make dist'
             }
             }
         }
         }

+ 4 - 1
Makefile

@@ -12,7 +12,10 @@ mod:
 	go mod tidy
 	go mod tidy
 test:
 test:
 	go test -p 1 ./...
 	go test -p 1 ./...
-
+cover:
+	go test -p 1 --coverprofile=coverage.out ./...
+	go tool cover --html=coverage.out -o coverage.html
+	sh -c "open coverage.html || xdg-open coverage.html" 2>/dev/null
 fmt:
 fmt:
 	gofmt -l -w -s .
 	gofmt -l -w -s .
 
 

+ 97 - 0
cluster/debug_test.go

@@ -0,0 +1,97 @@
+/*
+ * EliasDB
+ *
+ * Copyright 2016 Matthias Ladkau. All rights reserved.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+package cluster
+
+import (
+	"math"
+	"testing"
+	"time"
+
+	"devt.de/krotik/eliasdb/cluster/manager"
+)
+
+func TestDebugging(t *testing.T) {
+
+	// Set a low distribution range
+
+	defaultDistributionRange = 10
+	defer func() { defaultDistributionRange = math.MaxUint64 }()
+
+	// Setup a cluster
+
+	manager.FreqHousekeeping = 5
+	defer func() { manager.FreqHousekeeping = 1000 }()
+
+	// Log transfer worker runs
+
+	logTransferWorker = true
+	defer func() { logTransferWorker = false }()
+
+	// Create a cluster with 3 members and a replication factor of 2
+
+	cluster3, ms := createCluster(3, 2)
+
+	// Debug output
+
+	// manager.LogDebug = manager.LogInfo
+	// log.SetOutput(os.Stderr)
+	// defer func() { log.SetOutput(ioutil.Discard) }()
+
+	for i, dd := range cluster3 {
+		dd.Start()
+		defer dd.Close()
+
+		if i > 0 {
+			err := dd.MemberManager.JoinCluster(cluster3[0].MemberManager.Name(), cluster3[0].MemberManager.NetAddr())
+			if err != nil {
+				t.Error(err)
+				return
+			}
+		}
+	}
+
+	ClearMSMap()
+	msmap[cluster3[1]] = ms[1]
+
+	sm := cluster3[1].StorageManager("test", true)
+
+	// Insert two strings into the store
+
+	if loc, err := sm.Insert("test1"); loc != 1 || err != nil {
+		t.Error("Unexpected result:", loc, err)
+		return
+	}
+
+	if loc, err := sm.Insert("test2"); loc != 2 || err != nil {
+		t.Error("Unexpected result:", loc, err)
+		return
+	}
+
+	sm.Flush()
+
+	ms[1].transferRunning = true
+	go func() {
+		time.Sleep(10 * time.Millisecond)
+		ms[1].transferRunning = false
+	}()
+	WaitForTransfer()
+
+	if res := DumpMemoryClusterLayout("test"); res != `MemoryStorage: mgs2
+TestClusterMember-1 MemberStorageManager mgs2/ls_test
+Roots: 0=0 1=0 2=0 3=0 4=0 5=0 6=0 7=0 8=0 9=0 
+cloc: 1 (v:1) - lloc: 1 - "\b\f\x00\x05test1"
+cloc: 2 (v:1) - lloc: 2 - "\b\f\x00\x05test2"
+` {
+		t.Error("Unexpected result:", res)
+		return
+	}
+
+}

+ 2 - 2
cluster/distributedstorage_test.go

@@ -118,8 +118,8 @@ func TestMainDBDistribution(t *testing.T) {
 
 
 	// Setup a cluster
 	// Setup a cluster
 
 
-	// Housekeeping frequency is low so the test runs fast and we have it
-	// interfering - try to produce dead locks, etc ...
+	// Housekeeping frequency is high so we have it interfering - try to
+	// produce dead locks, etc ...
 
 
 	manager.FreqHousekeeping = 5
 	manager.FreqHousekeeping = 5
 	defer func() { manager.FreqHousekeeping = 1000 }()
 	defer func() { manager.FreqHousekeeping = 1000 }()

+ 1 - 1
config/config.go

@@ -25,7 +25,7 @@ import (
 /*
 /*
 ProductVersion is the current version of EliasDB
 ProductVersion is the current version of EliasDB
 */
 */
-const ProductVersion = "1.0.1"
+const ProductVersion = "1.0.2"
 
 
 /*
 /*
 DefaultConfigFile is the default config file which will be used to configure EliasDB
 DefaultConfigFile is the default config file which will be used to configure EliasDB

+ 2 - 0
console/cmd_base.go

@@ -59,6 +59,8 @@ Run executes the command.
 */
 */
 func (c *CmdVer) Run(args []string, capi CommandConsoleAPI) error {
 func (c *CmdVer) Run(args []string, capi CommandConsoleAPI) error {
 
 
+	fmt.Fprintln(capi.Out(), fmt.Sprintf("Connected to: %v", capi.Url()))
+
 	res, err := capi.Req(api.EndpointAbout, "GET", nil)
 	res, err := capi.Req(api.EndpointAbout, "GET", nil)
 
 
 	if err == nil {
 	if err == nil {

+ 12 - 0
console/console.go

@@ -108,6 +108,11 @@ type CommandConsoleAPI interface {
 	*/
 	*/
 	Authenticate(force bool)
 	Authenticate(force bool)
 
 
+	/*
+	   Url returns the current connection URL.
+	*/
+	Url() string
+
 	/*
 	/*
 	   Partition returns the current partition.
 	   Partition returns the current partition.
 	*/
 	*/
@@ -211,6 +216,13 @@ type EliasDBConsole struct {
 	GetPassword    func() string           // Ask the user for a password
 	GetPassword    func() string           // Ask the user for a password
 }
 }
 
 
+/*
+Url returns the current connected server URL.
+*/
+func (c *EliasDBConsole) Url() string {
+	return c.url
+}
+
 /*
 /*
 Out returns a writer which can be used to write to the console.
 Out returns a writer which can be used to write to the console.
 */
 */

+ 21 - 0
console/console_test.go

@@ -395,6 +395,7 @@ func TestNoAuthentication(t *testing.T) {
 	}
 	}
 
 
 	if res := out.String(); res != `
 	if res := out.String(); res != `
+Connected to: http://localhost:9090
 EliasDB `[1:]+config.ProductVersion+` (REST versions: [v1])
 EliasDB `[1:]+config.ProductVersion+` (REST versions: [v1])
 ` {
 ` {
 		t.Error("Unexpected result:", res)
 		t.Error("Unexpected result:", res)
@@ -473,6 +474,26 @@ help    Display descriptions for all available commands.
 info    Returns general database information.
 info    Returns general database information.
 part    Displays or sets the current partition.
 part    Displays or sets the current partition.
 ver     Displays server version information.
 ver     Displays server version information.
+`[1:] {
+		t.Error("Unexpected result:", res)
+		return
+	}
+
+	out.Reset()
+
+	if ok, err := c.Run("?"); !ok || err != nil {
+		t.Error(ok, err)
+		return
+	}
+
+	if res := out.String(); res != `
+Command Description
+export  Exports the last output.
+find    Do a full-text search of the database.
+help    Display descriptions for all available commands.
+info    Returns general database information.
+part    Displays or sets the current partition.
+ver     Displays server version information.
 `[1:] {
 `[1:] {
 		t.Error("Unexpected result:", res)
 		t.Error("Unexpected result:", res)
 		return
 		return

+ 1 - 1
examples/chat/doc/chat.md

@@ -4,7 +4,7 @@ This example demonstrates a simple application which uses advanced features of E
 - User Management
 - User Management
 - GraphQL subscriptions
 - GraphQL subscriptions
 
 
-The tutorial assumes you have downloaded EliasDB and extracted it. For this tutorial please execute "start.sh" or "start.bat" in the subdirectory: examples/chat
+The tutorial assumes you have downloaded EliasDB, extracted and build it. For this tutorial please execute "start.sh" or "start.bat" in the subdirectory: examples/chat
 
 
 After starting EliasDB point your browser to:
 After starting EliasDB point your browser to:
 ```
 ```