[ARVADOS] created: bd1580a11a377270a5a7eed5abc8a6dfe6f9547d

git at public.curoverse.com git at public.curoverse.com
Tue Oct 6 13:55:45 EDT 2015


        at  bd1580a11a377270a5a7eed5abc8a6dfe6f9547d (commit)


commit bd1580a11a377270a5a7eed5abc8a6dfe6f9547d
Author: radhika <radhika at curoverse.com>
Date:   Tue Oct 6 13:54:41 2015 -0400

    7167: get index from src and dst and copy any missing blocks from src to dst.

diff --git a/tools/keep-rsync/keep-rsync.go b/tools/keep-rsync/keep-rsync.go
index 3761cc7..c06fb8a 100644
--- a/tools/keep-rsync/keep-rsync.go
+++ b/tools/keep-rsync/keep-rsync.go
@@ -1,6 +1,7 @@
 package main
 
 import (
+	"bytes"
 	"flag"
 	"git.curoverse.com/arvados.git/sdk/go/arvadosclient"
 	"git.curoverse.com/arvados.git/sdk/go/keepclient"
@@ -69,6 +70,7 @@ func main() {
 
 	var err error
 
+	// Load config
 	if srcConfigFile == "" {
 		log.Fatal("-src-config-file must be specified.")
 	}
@@ -85,10 +87,14 @@ func main() {
 		log.Fatal("Error reading destination configuration: %s", err.Error())
 	}
 
+	// Initialize keep-rsync
 	err = initializeKeepRsync()
 	if err != nil {
 		log.Fatal("Error configurating keep-rsync: %s", err.Error())
 	}
+
+	// Copy blocks not found in dst from src
+	performKeepRsync()
 }
 
 // Reads config from file
@@ -157,6 +163,123 @@ func initializeKeepRsync() (err error) {
 			return
 		}
 	}
+	kcDst.Want_replicas = replications
 
 	return
 }
+
+// Get unique block locators from src and dst
+// Copy any blocks missing in dst
+func performKeepRsync() error {
+	// Get unique locators from src
+	srcIndex, err := getUniqueLocators(kcSrc, prefix)
+	if err != nil {
+		return err
+	}
+
+	// Get unique locators from dst
+	dstIndex, err := getUniqueLocators(kcDst, prefix)
+	if err != nil {
+		return err
+	}
+
+	// Get list of locators found in src, but missing in dst
+	toBeCopied := getMissingLocators(srcIndex, dstIndex)
+
+	// Copy each missing block to dst
+	copyBlocksToDst(toBeCopied)
+
+	return nil
+}
+
+// Get list of unique locators from the specified cluster
+func getUniqueLocators(kc *keepclient.KeepClient, prefix string) (map[string]bool, error) {
+	var indexBytes []byte
+
+	for uuid := range kc.LocalRoots() {
+		reader, err := kc.GetIndex(uuid, prefix)
+		if err != nil {
+			return nil, err
+		}
+
+		var readBytes []byte
+		readBytes, err = ioutil.ReadAll(reader)
+		if err != nil {
+			return nil, err
+		}
+
+		indexBytes = append(indexBytes, readBytes...)
+	}
+
+	// Got index; Now dedup it
+	locators := bytes.Split(indexBytes, []byte("\n"))
+
+	uniqueLocators := map[string]bool{}
+	for _, loc := range locators {
+		if len(loc) == 0 {
+			continue
+		}
+
+		locator := string(bytes.Split(loc, []byte(" "))[0])
+		if _, ok := uniqueLocators[locator]; !ok {
+			uniqueLocators[locator] = true
+		}
+	}
+	return uniqueLocators, nil
+}
+
+// Get list of locators that are in src but not in dst
+func getMissingLocators(srcLocators map[string]bool, dstLocators map[string]bool) []string {
+	var missingLocators []string
+	for locator := range srcLocators {
+		if _, ok := dstLocators[locator]; !ok {
+			missingLocators = append(missingLocators, locator)
+		}
+	}
+	return missingLocators
+}
+
+// Copy blocks from src to dst; only those that are missing in dst are copied
+func copyBlocksToDst(toBeCopied []string) {
+	done := 0
+	total := len(toBeCopied)
+	var failed []string
+
+	for _, locator := range toBeCopied {
+		log.Printf("Getting block %d of %d", done+1, total)
+
+		log.Printf("Getting block: %v", locator)
+
+		reader, _, _, err := kcSrc.Get(locator)
+		if err != nil {
+			log.Printf("Error getting block: %q %v", locator, err)
+			failed = append(failed, locator)
+			continue
+		}
+		data, err := ioutil.ReadAll(reader)
+		if err != nil {
+			log.Printf("Error reading block data: %q %v", locator, err)
+			failed = append(failed, locator)
+			continue
+		}
+
+		log.Printf("Copying block: %q", locator)
+		_, rep, err := kcDst.PutB(data)
+		if err != nil {
+			log.Printf("Error putting block data: %q %v", locator, err)
+			failed = append(failed, locator)
+			continue
+		}
+		if rep != replications {
+			log.Printf("Failed to put enough number of replicas. Wanted: %d; Put: %d", replications, rep)
+			failed = append(failed, locator)
+			continue
+		}
+
+		done++
+		log.Printf("%.2f%% done", float64(done)/float64(total)*100)
+	}
+
+	log.Printf("Successfully copied to destination %d and failed %d out of a total of %d", done, len(failed), total)
+	log.Printf("Failed blocks %v", failed)
+}
diff --git a/tools/keep-rsync/keep-rsync_test.go b/tools/keep-rsync/keep-rsync_test.go
index 97db571..37e4b20 100644
--- a/tools/keep-rsync/keep-rsync_test.go
+++ b/tools/keep-rsync/keep-rsync_test.go
@@ -55,6 +55,9 @@ func setupRsync(c *C) {
 	dstConfig["ARVADOS_API_TOKEN"] = os.Getenv("ARVADOS_API_TOKEN")
 	dstConfig["ARVADOS_API_HOST_INSECURE"] = os.Getenv("ARVADOS_API_HOST_INSECURE")
 
+	replications = 1
+
+	// Start API and Keep servers
 	arvadostest.StartAPI()
 	arvadostest.StartKeep()
 
@@ -150,7 +153,7 @@ func (s *ServerRequiredSuite) TestRsyncInitializeWithKeepServicesJSON(c *C) {
 	c.Check(localRoots != nil, Equals, true)
 
 	foundIt := false
-	for k, _ := range localRoots {
+	for k := range localRoots {
 		if k == "zzzzz-bi6l4-123456789012340" {
 			foundIt = true
 		}
@@ -158,10 +161,93 @@ func (s *ServerRequiredSuite) TestRsyncInitializeWithKeepServicesJSON(c *C) {
 	c.Check(foundIt, Equals, true)
 
 	foundIt = false
-	for k, _ := range localRoots {
+	for k := range localRoots {
 		if k == "zzzzz-bi6l4-123456789012341" {
 			foundIt = true
 		}
 	}
 	c.Check(foundIt, Equals, true)
 }
+
+// Put 5 blocks in src. Put 2 of those blocks in dst
+// Hence there are 3 additional blocks in src
+// Also, put 2 extra blocks in dts; they are hence only in dst
+// Run rsync and verify that those 7 blocks are now available in dst
+func (s *ServerRequiredSuite) TestKeepRsync(c *C) {
+	setupRsync(c)
+
+	// Put a few blocks in src using kcSrc
+	var srcLocators []string
+	for i := 0; i < 5; i++ {
+		data := []byte(fmt.Sprintf("test-data-%d", i))
+		hash := fmt.Sprintf("%x", md5.Sum(data))
+
+		hash2, rep, err := kcSrc.PutB(data)
+		c.Check(hash2, Matches, fmt.Sprintf(`^%s\+11(\+.+)?$`, hash))
+		c.Check(rep, Equals, 2)
+		c.Check(err, Equals, nil)
+
+		reader, blocklen, _, err := kcSrc.Get(hash)
+		c.Assert(err, Equals, nil)
+		c.Check(blocklen, Equals, int64(11))
+		all, err := ioutil.ReadAll(reader)
+		c.Check(all, DeepEquals, data)
+
+		srcLocators = append(srcLocators, fmt.Sprintf("%s+%d", hash, blocklen))
+	}
+
+	// Put just two of those blocks in dst using kcDst
+	var dstLocators []string
+	for i := 0; i < 2; i++ {
+		data := []byte(fmt.Sprintf("test-data-%d", i))
+		hash := fmt.Sprintf("%x", md5.Sum(data))
+
+		hash2, rep, err := kcDst.PutB(data)
+		c.Check(hash2, Matches, fmt.Sprintf(`^%s\+11(\+.+)?$`, hash))
+		c.Check(rep, Equals, 1)
+		c.Check(err, Equals, nil)
+
+		reader, blocklen, _, err := kcDst.Get(hash)
+		c.Assert(err, Equals, nil)
+		c.Check(blocklen, Equals, int64(11))
+		all, err := ioutil.ReadAll(reader)
+		c.Check(all, DeepEquals, data)
+
+		dstLocators = append(dstLocators, fmt.Sprintf("%s+%d", hash, blocklen))
+	}
+
+	// Put two more blocks in dst; they are not in src at all
+	var extraDstLocators []string
+	for i := 0; i < 2; i++ {
+		data := []byte(fmt.Sprintf("other-data-%d", i))
+		hash := fmt.Sprintf("%x", md5.Sum(data))
+
+		hash2, rep, err := kcDst.PutB(data)
+		c.Check(hash2, Matches, fmt.Sprintf(`^%s\+12(\+.+)?$`, hash))
+		c.Check(rep, Equals, 1)
+		c.Check(err, Equals, nil)
+
+		reader, blocklen, _, err := kcDst.Get(hash)
+		c.Assert(err, Equals, nil)
+		c.Check(blocklen, Equals, int64(12))
+		all, err := ioutil.ReadAll(reader)
+		c.Check(all, DeepEquals, data)
+
+		extraDstLocators = append(extraDstLocators, fmt.Sprintf("%s+%d", hash, blocklen))
+	}
+
+	err := performKeepRsync()
+	c.Check(err, Equals, nil)
+
+	// Now GetIndex from dst and verify that all 5 from src and the 2 extra blocks are found
+	dstIndex, err := getUniqueLocators(kcDst, "")
+	c.Check(err, Equals, nil)
+	for _, locator := range srcLocators {
+		_, ok := dstIndex[locator]
+		c.Assert(ok, Equals, true)
+	}
+	for _, locator := range extraDstLocators {
+		_, ok := dstIndex[locator]
+		c.Assert(ok, Equals, true)
+	}
+}

commit 290247250e0c5702a341f98dfdc380e29f1b45c7
Author: radhika <radhika at curoverse.com>
Date:   Mon Oct 5 17:22:37 2015 -0400

    7167: Update test to also put a block in dst and attempt get from src.

diff --git a/sdk/python/tests/run_test_server.py b/sdk/python/tests/run_test_server.py
index 62a2a82..fba9bb6 100644
--- a/sdk/python/tests/run_test_server.py
+++ b/sdk/python/tests/run_test_server.py
@@ -353,9 +353,11 @@ def run_keep(blob_signing_key=None, enforce_permissions=False):
         api.keep_disks().delete(uuid=d['uuid']).execute()
 
     start_index = 0
+    end_index = 2
     if keep_existing is not None:
         start_index = 2
-    for d in range(start_index, start_index+2):
+        end_index = 3
+    for d in range(start_index, end_index):
         port = _start_keep(d, keep_args)
         svc = api.keep_services().create(body={'keep_service': {
             'uuid': 'zzzzz-bi6l4-keepdisk{:07d}'.format(d),
@@ -380,9 +382,8 @@ def _stop_keep(n):
 def stop_keep():
     _stop_keep(0)
     _stop_keep(1)
-    # We may have created 2 additional keep servers when keep_existing is used
+    # We may have created an additional keep servers when keep_existing is used
     _stop_keep(2)
-    _stop_keep(3)
 
 def run_keep_proxy():
     if 'ARVADOS_TEST_PROXY_SERVICES' in os.environ:
diff --git a/tools/keep-rsync/keep-rsync_test.go b/tools/keep-rsync/keep-rsync_test.go
index 7636c2e..97db571 100644
--- a/tools/keep-rsync/keep-rsync_test.go
+++ b/tools/keep-rsync/keep-rsync_test.go
@@ -68,6 +68,7 @@ func setupRsync(c *C) {
 	// load kcDst
 	kcDst, err = keepclient.MakeKeepClient(&arvDst)
 	c.Assert(err, Equals, nil)
+	kcDst.Want_replicas = 1
 }
 
 // Test readConfigFromFile method
@@ -94,27 +95,48 @@ func (s *ServerRequiredSuite) TestReadConfigFromFile(c *C) {
 
 // Test keep-rsync initialization, with src and dst keep servers.
 // Do a Put and Get in src, both of which should succeed.
-// Do a Get in dst for the same hash, which should raise block not found error.
-func (s *ServerRequiredSuite) TestRsyncPutInSrc_GetFromDstShouldFail(c *C) {
+// Do a Put and Get in dst, both of which should succeed.
+// Do a Get in dst for the src hash, which should raise block not found error.
+// Do a Get in src for the dst hash, which should raise block not found error.
+func (s *ServerRequiredSuite) TestRsyncPutInOne_GetFromOtherShouldFail(c *C) {
 	setupRsync(c)
 
 	// Put a block in src using kcSrc and Get it
-	data := []byte("test-data")
-	hash := fmt.Sprintf("%x", md5.Sum(data))
+	srcData := []byte("test-data1")
+	locatorInSrc := fmt.Sprintf("%x", md5.Sum(srcData))
 
-	hash2, rep, err := kcSrc.PutB(data)
-	c.Check(hash2, Matches, fmt.Sprintf(`^%s\+9(\+.+)?$`, hash))
+	hash, rep, err := kcSrc.PutB(srcData)
+	c.Check(hash, Matches, fmt.Sprintf(`^%s\+10(\+.+)?$`, locatorInSrc))
 	c.Check(rep, Equals, 2)
 	c.Check(err, Equals, nil)
 
-	reader, blocklen, _, err := kcSrc.Get(hash)
+	reader, blocklen, _, err := kcSrc.Get(locatorInSrc)
 	c.Assert(err, Equals, nil)
-	c.Check(blocklen, Equals, int64(9))
+	c.Check(blocklen, Equals, int64(10))
 	all, err := ioutil.ReadAll(reader)
-	c.Check(all, DeepEquals, data)
+	c.Check(all, DeepEquals, srcData)
 
-	// Get using kcDst should fail with NotFound error
-	_, _, _, err = kcDst.Get(hash)
+	// Put a different block in src using kcSrc and Get it
+	dstData := []byte("test-data2")
+	locatorInDst := fmt.Sprintf("%x", md5.Sum(dstData))
+
+	hash, rep, err = kcDst.PutB(dstData)
+	c.Check(hash, Matches, fmt.Sprintf(`^%s\+10(\+.+)?$`, locatorInDst))
+	c.Check(rep, Equals, 1)
+	c.Check(err, Equals, nil)
+
+	reader, blocklen, _, err = kcDst.Get(locatorInDst)
+	c.Assert(err, Equals, nil)
+	c.Check(blocklen, Equals, int64(10))
+	all, err = ioutil.ReadAll(reader)
+	c.Check(all, DeepEquals, dstData)
+
+	// Get srcLocator using kcDst should fail with NotFound error
+	_, _, _, err = kcDst.Get(locatorInSrc)
+	c.Assert(err.Error(), Equals, "Block not found")
+
+	// Get dstLocator using kcSrc should fail with NotFound error
+	_, _, _, err = kcSrc.Get(locatorInDst)
 	c.Assert(err.Error(), Equals, "Block not found")
 }
 

commit f3b5ffc2a4409d4c1b676e40ba4e582ca2beeb61
Author: radhika <radhika at curoverse.com>
Date:   Mon Oct 5 11:41:39 2015 -0400

    7167: Refactor MakeKeepClient and DiscoverKeepServers to allow making KeepClient from input JSON as well.

diff --git a/sdk/go/keepclient/keepclient.go b/sdk/go/keepclient/keepclient.go
index 53dfb2b..05fad6e 100644
--- a/sdk/go/keepclient/keepclient.go
+++ b/sdk/go/keepclient/keepclient.go
@@ -54,9 +54,20 @@ type KeepClient struct {
 	replicasPerService int
 }
 
-// Create a new KeepClient.  This will contact the API server to discover Keep
-// servers.
+// MakeKeepClient creates a new KeepClient by contacting the API server to discover Keep servers.
 func MakeKeepClient(arv *arvadosclient.ArvadosClient) (*KeepClient, error) {
+	kc := initKeepClient(arv)
+	return kc, kc.DiscoverKeepServers()
+}
+
+// MakeKeepClientFromJSON creates a new KeepClient using the given json to load keep servers.
+func MakeKeepClientFromJSON(arv *arvadosclient.ArvadosClient, svcJSON string) (*KeepClient, error) {
+	kc := initKeepClient(arv)
+	return kc, kc.DiscoverKeepServersFromJSON(svcJSON)
+}
+
+// Make a new KeepClient struct.
+func initKeepClient(arv *arvadosclient.ArvadosClient) *KeepClient {
 	var matchTrue = regexp.MustCompile("^(?i:1|yes|true)$")
 	insecure := matchTrue.MatchString(os.Getenv("ARVADOS_API_HOST_INSECURE"))
 	kc := &KeepClient{
@@ -66,7 +77,7 @@ func MakeKeepClient(arv *arvadosclient.ArvadosClient) (*KeepClient, error) {
 		Client: &http.Client{Transport: &http.Transport{
 			TLSClientConfig: &tls.Config{InsecureSkipVerify: insecure}}},
 	}
-	return kc, kc.DiscoverKeepServers()
+	return kc
 }
 
 // Put a block given the block hash, a reader, and the number of bytes
diff --git a/sdk/go/keepclient/support.go b/sdk/go/keepclient/support.go
index 63800b1..8be1780 100644
--- a/sdk/go/keepclient/support.go
+++ b/sdk/go/keepclient/support.go
@@ -2,6 +2,7 @@ package keepclient
 
 import (
 	"crypto/md5"
+	"encoding/json"
 	"errors"
 	"fmt"
 	"git.curoverse.com/arvados.git/sdk/go/streamer"
@@ -76,19 +77,38 @@ func (this *KeepClient) setClientSettingsDisk() {
 	}
 }
 
+type svcList struct {
+	Items []keepService `json:"items"`
+}
+
 // DiscoverKeepServers gets list of available keep services from api server
 func (this *KeepClient) DiscoverKeepServers() error {
-	type svcList struct {
-		Items []keepService `json:"items"`
-	}
-	var m svcList
+	var list svcList
 
 	// Get keep services from api server
-	err := this.Arvados.Call("GET", "keep_services", "", "accessible", nil, &m)
+	err := this.Arvados.Call("GET", "keep_services", "", "accessible", nil, &list)
 	if err != nil {
 		return err
 	}
 
+	return this.loadKeepServers(list)
+}
+
+// DiscoverKeepServersFromJSON gets list of available keep services from given JSON
+func (this *KeepClient) DiscoverKeepServersFromJSON(services string) error {
+	var list svcList
+
+	// Load keep services from given json
+	dec := json.NewDecoder(strings.NewReader(services))
+	if err := dec.Decode(&list); err != nil {
+		return err
+	}
+
+	return this.loadKeepServers(list)
+}
+
+// loadKeepServers
+func (this *KeepClient) loadKeepServers(list svcList) error {
 	listed := make(map[string]bool)
 	localRoots := make(map[string]string)
 	gatewayRoots := make(map[string]string)
@@ -98,7 +118,7 @@ func (this *KeepClient) DiscoverKeepServers() error {
 	this.replicasPerService = 1
 	this.Using_proxy = false
 
-	for _, service := range m.Items {
+	for _, service := range list.Items {
 		scheme := "http"
 		if service.SSL {
 			scheme = "https"
diff --git a/tools/keep-rsync/keep-rsync.go b/tools/keep-rsync/keep-rsync.go
index c9fd77a..3761cc7 100644
--- a/tools/keep-rsync/keep-rsync.go
+++ b/tools/keep-rsync/keep-rsync.go
@@ -120,22 +120,43 @@ var (
 
 // Initializes keep-rsync using the config provided
 func initializeKeepRsync() (err error) {
+	// arvSrc from srcConfig
 	arvSrc, err = arvadosclient.MakeArvadosClientWithConfig(srcConfig)
 	if err != nil {
 		return
 	}
 
+	// arvDst from dstConfig
 	arvDst, err = arvadosclient.MakeArvadosClientWithConfig(dstConfig)
 	if err != nil {
 		return
 	}
 
-	kcSrc, err = keepclient.MakeKeepClient(&arvSrc)
-	if err != nil {
-		return
+	// if srcKeepServicesJSON is provided, use it to load services; else, use DiscoverKeepServers
+	if srcKeepServicesJSON == "" {
+		kcSrc, err = keepclient.MakeKeepClient(&arvSrc)
+		if err != nil {
+			return
+		}
+	} else {
+		kcSrc, err = keepclient.MakeKeepClientFromJSON(&arvSrc, srcKeepServicesJSON)
+		if err != nil {
+			return
+		}
 	}
 
-	kcDst, err = keepclient.MakeKeepClient(&arvDst)
+	// if dstKeepServicesJSON is provided, use it to load services; else, use DiscoverKeepServers
+	if dstKeepServicesJSON == "" {
+		kcDst, err = keepclient.MakeKeepClient(&arvDst)
+		if err != nil {
+			return
+		}
+	} else {
+		kcDst, err = keepclient.MakeKeepClientFromJSON(&arvDst, dstKeepServicesJSON)
+		if err != nil {
+			return
+		}
+	}
 
 	return
 }
diff --git a/tools/keep-rsync/keep-rsync_test.go b/tools/keep-rsync/keep-rsync_test.go
index c45fbf8..7636c2e 100644
--- a/tools/keep-rsync/keep-rsync_test.go
+++ b/tools/keep-rsync/keep-rsync_test.go
@@ -29,6 +29,8 @@ func (s *ServerRequiredSuite) SetUpSuite(c *C) {
 
 func (s *ServerRequiredSuite) SetUpTest(c *C) {
 	arvadostest.ResetEnv()
+	srcKeepServicesJSON = ""
+	dstKeepServicesJSON = ""
 }
 
 func (s *ServerRequiredSuite) TearDownSuite(c *C) {
@@ -115,3 +117,29 @@ func (s *ServerRequiredSuite) TestRsyncPutInSrc_GetFromDstShouldFail(c *C) {
 	_, _, _, err = kcDst.Get(hash)
 	c.Assert(err.Error(), Equals, "Block not found")
 }
+
+// Test keep-rsync initialization, with srcKeepServicesJSON
+func (s *ServerRequiredSuite) TestRsyncInitializeWithKeepServicesJSON(c *C) {
+	srcKeepServicesJSON = "{ \"kind\":\"arvados#keepServiceList\", \"etag\":\"\", \"self_link\":\"\", \"offset\":null, \"limit\":null, \"items\":[ { \"href\":\"/keep_services/zzzzz-bi6l4-123456789012340\", \"kind\":\"arvados#keepService\", \"etag\":\"641234567890enhj7hzx432e5\", \"uuid\":\"zzzzz-bi6l4-123456789012340\", \"owner_uuid\":\"zzzzz-tpzed-123456789012345\", \"service_host\":\"keep0.zzzzz.arvadosapi.com\", \"service_port\":25107, \"service_ssl_flag\":false, \"service_type\":\"disk\", \"read_only\":false }, { \"href\":\"/keep_services/zzzzz-bi6l4-123456789012341\", \"kind\":\"arvados#keepService\", \"etag\":\"641234567890enhj7hzx432e5\", \"uuid\":\"zzzzz-bi6l4-123456789012341\", \"owner_uuid\":\"zzzzz-tpzed-123456789012345\", \"service_host\":\"keep0.zzzzz.arvadosapi.com\", \"service_port\":25108, \"service_ssl_flag\":false, \"service_type\":\"disk\", \"read_only\":false } ], \"items_available\":2 }"
+
+	setupRsync(c)
+
+	localRoots := kcSrc.LocalRoots()
+	c.Check(localRoots != nil, Equals, true)
+
+	foundIt := false
+	for k, _ := range localRoots {
+		if k == "zzzzz-bi6l4-123456789012340" {
+			foundIt = true
+		}
+	}
+	c.Check(foundIt, Equals, true)
+
+	foundIt = false
+	for k, _ := range localRoots {
+		if k == "zzzzz-bi6l4-123456789012341" {
+			foundIt = true
+		}
+	}
+	c.Check(foundIt, Equals, true)
+}

commit 6823f2d65a48bc989b819b85b6428c230b223c82
Author: radhika <radhika at curoverse.com>
Date:   Mon Oct 5 09:25:34 2015 -0400

    7167: args not avaialble in all tests; hence store keep_existing argument in a variable rather than accessing it directly from args.

diff --git a/sdk/python/tests/run_test_server.py b/sdk/python/tests/run_test_server.py
index d5d1874..62a2a82 100644
--- a/sdk/python/tests/run_test_server.py
+++ b/sdk/python/tests/run_test_server.py
@@ -43,6 +43,7 @@ if not os.path.exists(TEST_TMPDIR):
 
 my_api_host = None
 _cached_config = {}
+keep_existing = None
 
 def find_server_pid(PID_PATH, wait=10):
     now = time.time()
@@ -324,7 +325,7 @@ def _start_keep(n, keep_args):
     return port
 
 def run_keep(blob_signing_key=None, enforce_permissions=False):
-    if args.keep_existing is None:
+    if keep_existing is None:
       stop_keep()
 
     keep_args = {}
@@ -352,7 +353,7 @@ def run_keep(blob_signing_key=None, enforce_permissions=False):
         api.keep_disks().delete(uuid=d['uuid']).execute()
 
     start_index = 0
-    if args.keep_existing is not None:
+    if keep_existing is not None:
         start_index = 2
     for d in range(start_index, start_index+2):
         port = _start_keep(d, keep_args)
@@ -606,6 +607,8 @@ if __name__ == "__main__":
     parser.add_argument('--keep_existing', type=str, help="Used to add additional keep servers, without terminating existing servers")
     args = parser.parse_args()
 
+    keep_existing = args.keep_existing
+
     if args.action not in actions:
         print("Unrecognized action '{}'. Actions are: {}.".format(args.action, actions), file=sys.stderr)
         sys.exit(1)
diff --git a/tools/keep-rsync/keep-rsync.go b/tools/keep-rsync/keep-rsync.go
index eff8b9c..c9fd77a 100644
--- a/tools/keep-rsync/keep-rsync.go
+++ b/tools/keep-rsync/keep-rsync.go
@@ -11,17 +11,17 @@ import (
 
 // keep-rsync arguments
 var (
-	srcConfig            map[string]string
-	destConfig           map[string]string
-	srcKeepServicesJSON  string
-	destKeepServicesJSON string
-	replications         int
-	prefix               string
+	srcConfig           map[string]string
+	dstConfig           map[string]string
+	srcKeepServicesJSON string
+	dstKeepServicesJSON string
+	replications        int
+	prefix              string
 )
 
 func main() {
 	var srcConfigFile string
-	var destConfigFile string
+	var dstConfigFile string
 
 	flag.StringVar(
 		&srcConfigFile,
@@ -32,8 +32,8 @@ func main() {
 			"ARVADOS_API_HOST, ARVADOS_API_HOST_INSECURE, and ARVADOS_BLOB_SIGNING_KEY.")
 
 	flag.StringVar(
-		&destConfigFile,
-		"dest-config-file",
+		&dstConfigFile,
+		"dst-config-file",
 		"",
 		"Destination configuration filename with full path that contains "+
 			"an ARVADOS_API_TOKEN which is a valid datamanager token recognized by the destination keep servers, "+
@@ -47,11 +47,11 @@ func main() {
 			"If not provided, this list is obtained from api server configured in src-config-file.")
 
 	flag.StringVar(
-		&destKeepServicesJSON,
-		"dest-keep-services-json",
+		&dstKeepServicesJSON,
+		"dst-keep-services-json",
 		"",
 		"An optional list of available destination keepservices. "+
-			"If not provided, this list is obtained from api server configured in dest-config-file.")
+			"If not provided, this list is obtained from api server configured in dst-config-file.")
 
 	flag.IntVar(
 		&replications,
@@ -77,10 +77,10 @@ func main() {
 		log.Fatal("Error reading source configuration: %s", err.Error())
 	}
 
-	if destConfigFile == "" {
-		log.Fatal("-dest-config-file must be specified.")
+	if dstConfigFile == "" {
+		log.Fatal("-dst-config-file must be specified.")
 	}
-	destConfig, err = readConfigFromFile(destConfigFile)
+	dstConfig, err = readConfigFromFile(dstConfigFile)
 	if err != nil {
 		log.Fatal("Error reading destination configuration: %s", err.Error())
 	}
@@ -112,10 +112,10 @@ func readConfigFromFile(filename string) (map[string]string, error) {
 
 // keep-rsync source and destination clients
 var (
-	arvSrc  arvadosclient.ArvadosClient
-	arvDest arvadosclient.ArvadosClient
-	kcSrc   *keepclient.KeepClient
-	kcDest  *keepclient.KeepClient
+	arvSrc arvadosclient.ArvadosClient
+	arvDst arvadosclient.ArvadosClient
+	kcSrc  *keepclient.KeepClient
+	kcDst  *keepclient.KeepClient
 )
 
 // Initializes keep-rsync using the config provided
@@ -125,7 +125,7 @@ func initializeKeepRsync() (err error) {
 		return
 	}
 
-	arvDest, err = arvadosclient.MakeArvadosClientWithConfig(destConfig)
+	arvDst, err = arvadosclient.MakeArvadosClientWithConfig(dstConfig)
 	if err != nil {
 		return
 	}
@@ -135,7 +135,7 @@ func initializeKeepRsync() (err error) {
 		return
 	}
 
-	kcDest, err = keepclient.MakeKeepClient(&arvDest)
+	kcDst, err = keepclient.MakeKeepClient(&arvDst)
 
 	return
 }
diff --git a/tools/keep-rsync/keep-rsync_test.go b/tools/keep-rsync/keep-rsync_test.go
index e2b1f0f..c45fbf8 100644
--- a/tools/keep-rsync/keep-rsync_test.go
+++ b/tools/keep-rsync/keep-rsync_test.go
@@ -36,7 +36,7 @@ func (s *ServerRequiredSuite) TearDownSuite(c *C) {
 	arvadostest.StopAPI()
 }
 
-// Testing keep-rsync needs two sets of keep services: src and dest.
+// Testing keep-rsync needs two sets of keep services: src and dst.
 // The test setup hence tweaks keep-rsync initialzation to achieve this.
 // First invoke initializeKeepRsync and then invoke StartKeepAdditional
 // to create the keep servers to be used as destination.
@@ -47,11 +47,11 @@ func setupRsync(c *C) {
 	srcConfig["ARVADOS_API_TOKEN"] = os.Getenv("ARVADOS_API_TOKEN")
 	srcConfig["ARVADOS_API_HOST_INSECURE"] = os.Getenv("ARVADOS_API_HOST_INSECURE")
 
-	// destConfig
-	destConfig = make(map[string]string)
-	destConfig["ARVADOS_API_HOST"] = os.Getenv("ARVADOS_API_HOST")
-	destConfig["ARVADOS_API_TOKEN"] = os.Getenv("ARVADOS_API_TOKEN")
-	destConfig["ARVADOS_API_HOST_INSECURE"] = os.Getenv("ARVADOS_API_HOST_INSECURE")
+	// dstConfig
+	dstConfig = make(map[string]string)
+	dstConfig["ARVADOS_API_HOST"] = os.Getenv("ARVADOS_API_HOST")
+	dstConfig["ARVADOS_API_TOKEN"] = os.Getenv("ARVADOS_API_TOKEN")
+	dstConfig["ARVADOS_API_HOST_INSECURE"] = os.Getenv("ARVADOS_API_HOST_INSECURE")
 
 	arvadostest.StartAPI()
 	arvadostest.StartKeep()
@@ -63,8 +63,8 @@ func setupRsync(c *C) {
 	// Create two more keep servers to be used as destination
 	arvadostest.StartKeepAdditional(true)
 
-	// load kcDest
-	kcDest, err = keepclient.MakeKeepClient(&arvDest)
+	// load kcDst
+	kcDst, err = keepclient.MakeKeepClient(&arvDst)
 	c.Assert(err, Equals, nil)
 }
 
@@ -90,10 +90,10 @@ func (s *ServerRequiredSuite) TestReadConfigFromFile(c *C) {
 	c.Assert(config["EXTERNAL_CLIENT"], Equals, "")
 }
 
-// Test keep-rsync initialization, with src and dest keep servers.
+// Test keep-rsync initialization, with src and dst keep servers.
 // Do a Put and Get in src, both of which should succeed.
-// Do a Get in dest for the same hash, which should raise block not found error.
-func (s *ServerRequiredSuite) TestRsyncPutInSrc_GetFromDestShouldFail(c *C) {
+// Do a Get in dst for the same hash, which should raise block not found error.
+func (s *ServerRequiredSuite) TestRsyncPutInSrc_GetFromDstShouldFail(c *C) {
 	setupRsync(c)
 
 	// Put a block in src using kcSrc and Get it
@@ -111,7 +111,7 @@ func (s *ServerRequiredSuite) TestRsyncPutInSrc_GetFromDestShouldFail(c *C) {
 	all, err := ioutil.ReadAll(reader)
 	c.Check(all, DeepEquals, data)
 
-	// Get using kcDest should fail with NotFound error
-	_, _, _, err = kcDest.Get(hash)
+	// Get using kcDst should fail with NotFound error
+	_, _, _, err = kcDst.Get(hash)
 	c.Assert(err.Error(), Equals, "Block not found")
 }

commit cb48eb95d516b1d4a1ffe18be34703005531117a
Merge: 86df40e f81f84e
Author: radhika <radhika at curoverse.com>
Date:   Mon Oct 5 07:48:47 2015 -0400

    Merge branch 'master' into 7167-keep-rsync-test-setup


commit 86df40e33e586ccb4dc506e00f773392d454804c
Author: radhika <radhika at curoverse.com>
Date:   Mon Oct 5 07:46:56 2015 -0400

    7167: keep-rsync parameter loading and intialization. Update test framework to allow creating two sets of keep servers, source and destination.

diff --git a/sdk/go/arvadosclient/arvadosclient.go b/sdk/go/arvadosclient/arvadosclient.go
index 1cce0a7..ab2d9b2 100644
--- a/sdk/go/arvadosclient/arvadosclient.go
+++ b/sdk/go/arvadosclient/arvadosclient.go
@@ -82,13 +82,25 @@ type ArvadosClient struct {
 // variables ARVADOS_API_HOST, ARVADOS_API_TOKEN, and (optionally)
 // ARVADOS_API_HOST_INSECURE.
 func MakeArvadosClient() (ac ArvadosClient, err error) {
+	config := make(map[string]string)
+	config["ARVADOS_API_TOKEN"] = os.Getenv("ARVADOS_API_TOKEN")
+	config["ARVADOS_API_HOST"] = os.Getenv("ARVADOS_API_HOST")
+	config["ARVADOS_API_HOST_INSECURE"] = os.Getenv("ARVADOS_API_HOST_INSECURE")
+	config["ARVADOS_EXTERNAL_CLIENT"] = os.Getenv("ARVADOS_EXTERNAL_CLIENT")
+
+	return MakeArvadosClientWithConfig(config)
+}
+
+// Create a new ArvadosClient, using the given input parameters.
+func MakeArvadosClientWithConfig(config map[string]string) (ac ArvadosClient, err error) {
 	var matchTrue = regexp.MustCompile("^(?i:1|yes|true)$")
-	insecure := matchTrue.MatchString(os.Getenv("ARVADOS_API_HOST_INSECURE"))
-	external := matchTrue.MatchString(os.Getenv("ARVADOS_EXTERNAL_CLIENT"))
+
+	insecure := matchTrue.MatchString(config["ARVADOS_API_HOST_INSECURE"])
+	external := matchTrue.MatchString(config["ARVADOS_EXTERNAL_CLIENT"])
 
 	ac = ArvadosClient{
-		ApiServer:   os.Getenv("ARVADOS_API_HOST"),
-		ApiToken:    os.Getenv("ARVADOS_API_TOKEN"),
+		ApiServer:   config["ARVADOS_API_HOST"],
+		ApiToken:    config["ARVADOS_API_TOKEN"],
 		ApiInsecure: insecure,
 		Client: &http.Client{Transport: &http.Transport{
 			TLSClientConfig: &tls.Config{InsecureSkipVerify: insecure}}},
diff --git a/sdk/go/arvadostest/run_servers.go b/sdk/go/arvadostest/run_servers.go
index cad1691..a175136 100644
--- a/sdk/go/arvadostest/run_servers.go
+++ b/sdk/go/arvadostest/run_servers.go
@@ -99,11 +99,18 @@ func StopAPI() {
 }
 
 func StartKeep() {
+	StartKeepAdditional(false)
+}
+
+func StartKeepAdditional(keepExisting bool) {
 	cwd, _ := os.Getwd()
 	defer os.Chdir(cwd)
 	chdirToPythonTests()
 
 	cmd := exec.Command("python", "run_test_server.py", "start_keep")
+	if keepExisting {
+		cmd = exec.Command("python", "run_test_server.py", "start_keep", "--keep_existing", "true")
+	}
 	stderr, err := cmd.StderrPipe()
 	if err != nil {
 		log.Fatalf("Setting up stderr pipe: %s", err)
diff --git a/sdk/python/tests/run_test_server.py b/sdk/python/tests/run_test_server.py
index 5d0c42a..d5d1874 100644
--- a/sdk/python/tests/run_test_server.py
+++ b/sdk/python/tests/run_test_server.py
@@ -324,7 +324,8 @@ def _start_keep(n, keep_args):
     return port
 
 def run_keep(blob_signing_key=None, enforce_permissions=False):
-    stop_keep()
+    if args.keep_existing is None:
+      stop_keep()
 
     keep_args = {}
     if not blob_signing_key:
@@ -344,12 +345,16 @@ def run_keep(blob_signing_key=None, enforce_permissions=False):
         host=os.environ['ARVADOS_API_HOST'],
         token=os.environ['ARVADOS_API_TOKEN'],
         insecure=True)
+
     for d in api.keep_services().list().execute()['items']:
         api.keep_services().delete(uuid=d['uuid']).execute()
     for d in api.keep_disks().list().execute()['items']:
         api.keep_disks().delete(uuid=d['uuid']).execute()
 
-    for d in range(0, 2):
+    start_index = 0
+    if args.keep_existing is not None:
+        start_index = 2
+    for d in range(start_index, start_index+2):
         port = _start_keep(d, keep_args)
         svc = api.keep_services().create(body={'keep_service': {
             'uuid': 'zzzzz-bi6l4-keepdisk{:07d}'.format(d),
@@ -374,6 +379,9 @@ def _stop_keep(n):
 def stop_keep():
     _stop_keep(0)
     _stop_keep(1)
+    # We may have created 2 additional keep servers when keep_existing is used
+    _stop_keep(2)
+    _stop_keep(3)
 
 def run_keep_proxy():
     if 'ARVADOS_TEST_PROXY_SERVICES' in os.environ:
@@ -595,6 +603,7 @@ if __name__ == "__main__":
     parser = argparse.ArgumentParser()
     parser.add_argument('action', type=str, help="one of {}".format(actions))
     parser.add_argument('--auth', type=str, metavar='FIXTURE_NAME', help='Print authorization info for given api_client_authorizations fixture')
+    parser.add_argument('--keep_existing', type=str, help="Used to add additional keep servers, without terminating existing servers")
     args = parser.parse_args()
 
     if args.action not in actions:
diff --git a/tools/keep-rsync/.gitignore b/tools/keep-rsync/.gitignore
new file mode 100644
index 0000000..5ee7f3b
--- /dev/null
+++ b/tools/keep-rsync/.gitignore
@@ -0,0 +1 @@
+keep-rsync
diff --git a/tools/keep-rsync/keep-rsync.go b/tools/keep-rsync/keep-rsync.go
new file mode 100644
index 0000000..eff8b9c
--- /dev/null
+++ b/tools/keep-rsync/keep-rsync.go
@@ -0,0 +1,141 @@
+package main
+
+import (
+	"flag"
+	"git.curoverse.com/arvados.git/sdk/go/arvadosclient"
+	"git.curoverse.com/arvados.git/sdk/go/keepclient"
+	"io/ioutil"
+	"log"
+	"strings"
+)
+
+// keep-rsync arguments
+var (
+	srcConfig            map[string]string
+	destConfig           map[string]string
+	srcKeepServicesJSON  string
+	destKeepServicesJSON string
+	replications         int
+	prefix               string
+)
+
+func main() {
+	var srcConfigFile string
+	var destConfigFile string
+
+	flag.StringVar(
+		&srcConfigFile,
+		"src-config-file",
+		"",
+		"Source configuration filename with full path that contains "+
+			"an ARVADOS_API_TOKEN which is a valid datamanager token recognized by the source keep servers, "+
+			"ARVADOS_API_HOST, ARVADOS_API_HOST_INSECURE, and ARVADOS_BLOB_SIGNING_KEY.")
+
+	flag.StringVar(
+		&destConfigFile,
+		"dest-config-file",
+		"",
+		"Destination configuration filename with full path that contains "+
+			"an ARVADOS_API_TOKEN which is a valid datamanager token recognized by the destination keep servers, "+
+			"ARVADOS_API_HOST, ARVADOS_API_HOST_INSECURE, and ARVADOS_BLOB_SIGNING_KEY.")
+
+	flag.StringVar(
+		&srcKeepServicesJSON,
+		"src-keep-services-json",
+		"",
+		"An optional list of available source keepservices. "+
+			"If not provided, this list is obtained from api server configured in src-config-file.")
+
+	flag.StringVar(
+		&destKeepServicesJSON,
+		"dest-keep-services-json",
+		"",
+		"An optional list of available destination keepservices. "+
+			"If not provided, this list is obtained from api server configured in dest-config-file.")
+
+	flag.IntVar(
+		&replications,
+		"replications",
+		3,
+		"Number of replications to write to the destination.")
+
+	flag.StringVar(
+		&prefix,
+		"prefix",
+		"",
+		"Index prefix")
+
+	flag.Parse()
+
+	var err error
+
+	if srcConfigFile == "" {
+		log.Fatal("-src-config-file must be specified.")
+	}
+	srcConfig, err = readConfigFromFile(srcConfigFile)
+	if err != nil {
+		log.Fatal("Error reading source configuration: %s", err.Error())
+	}
+
+	if destConfigFile == "" {
+		log.Fatal("-dest-config-file must be specified.")
+	}
+	destConfig, err = readConfigFromFile(destConfigFile)
+	if err != nil {
+		log.Fatal("Error reading destination configuration: %s", err.Error())
+	}
+
+	err = initializeKeepRsync()
+	if err != nil {
+		log.Fatal("Error configurating keep-rsync: %s", err.Error())
+	}
+}
+
+// Reads config from file
+func readConfigFromFile(filename string) (map[string]string, error) {
+	content, err := ioutil.ReadFile(filename)
+	if err != nil {
+		return nil, err
+	}
+
+	config := make(map[string]string)
+	lines := strings.Split(string(content), "\n")
+	for _, line := range lines {
+		if line == "" {
+			continue
+		}
+		kv := strings.Split(line, "=")
+		config[kv[0]] = kv[1]
+	}
+	return config, nil
+}
+
+// keep-rsync source and destination clients
+var (
+	arvSrc  arvadosclient.ArvadosClient
+	arvDest arvadosclient.ArvadosClient
+	kcSrc   *keepclient.KeepClient
+	kcDest  *keepclient.KeepClient
+)
+
+// Initializes keep-rsync using the config provided
+func initializeKeepRsync() (err error) {
+	arvSrc, err = arvadosclient.MakeArvadosClientWithConfig(srcConfig)
+	if err != nil {
+		return
+	}
+
+	arvDest, err = arvadosclient.MakeArvadosClientWithConfig(destConfig)
+	if err != nil {
+		return
+	}
+
+	kcSrc, err = keepclient.MakeKeepClient(&arvSrc)
+	if err != nil {
+		return
+	}
+
+	kcDest, err = keepclient.MakeKeepClient(&arvDest)
+
+	return
+}
diff --git a/tools/keep-rsync/keep-rsync_test.go b/tools/keep-rsync/keep-rsync_test.go
new file mode 100644
index 0000000..e2b1f0f
--- /dev/null
+++ b/tools/keep-rsync/keep-rsync_test.go
@@ -0,0 +1,117 @@
+package main
+
+import (
+	"crypto/md5"
+	"fmt"
+	"io/ioutil"
+	"os"
+	"testing"
+
+	"git.curoverse.com/arvados.git/sdk/go/arvadostest"
+	"git.curoverse.com/arvados.git/sdk/go/keepclient"
+
+	. "gopkg.in/check.v1"
+)
+
+// Gocheck boilerplate
+func Test(t *testing.T) {
+	TestingT(t)
+}
+
+// Gocheck boilerplate
+var _ = Suite(&ServerRequiredSuite{})
+
+// Tests that require the Keep server running
+type ServerRequiredSuite struct{}
+
+func (s *ServerRequiredSuite) SetUpSuite(c *C) {
+}
+
+func (s *ServerRequiredSuite) SetUpTest(c *C) {
+	arvadostest.ResetEnv()
+}
+
+func (s *ServerRequiredSuite) TearDownSuite(c *C) {
+	arvadostest.StopKeep()
+	arvadostest.StopAPI()
+}
+
+// Testing keep-rsync needs two sets of keep services: src and dest.
+// The test setup hence tweaks keep-rsync initialzation to achieve this.
+// First invoke initializeKeepRsync and then invoke StartKeepAdditional
+// to create the keep servers to be used as destination.
+func setupRsync(c *C) {
+	// srcConfig
+	srcConfig = make(map[string]string)
+	srcConfig["ARVADOS_API_HOST"] = os.Getenv("ARVADOS_API_HOST")
+	srcConfig["ARVADOS_API_TOKEN"] = os.Getenv("ARVADOS_API_TOKEN")
+	srcConfig["ARVADOS_API_HOST_INSECURE"] = os.Getenv("ARVADOS_API_HOST_INSECURE")
+
+	// destConfig
+	destConfig = make(map[string]string)
+	destConfig["ARVADOS_API_HOST"] = os.Getenv("ARVADOS_API_HOST")
+	destConfig["ARVADOS_API_TOKEN"] = os.Getenv("ARVADOS_API_TOKEN")
+	destConfig["ARVADOS_API_HOST_INSECURE"] = os.Getenv("ARVADOS_API_HOST_INSECURE")
+
+	arvadostest.StartAPI()
+	arvadostest.StartKeep()
+
+	// initialize keep-rsync
+	err := initializeKeepRsync()
+	c.Assert(err, Equals, nil)
+
+	// Create two more keep servers to be used as destination
+	arvadostest.StartKeepAdditional(true)
+
+	// load kcDest
+	kcDest, err = keepclient.MakeKeepClient(&arvDest)
+	c.Assert(err, Equals, nil)
+}
+
+// Test readConfigFromFile method
+func (s *ServerRequiredSuite) TestReadConfigFromFile(c *C) {
+	// Setup a test config file
+	file, err := ioutil.TempFile(os.TempDir(), "config")
+	c.Assert(err, Equals, nil)
+	defer os.Remove(file.Name())
+
+	fileContent := "ARVADOS_API_HOST=testhost\n"
+	fileContent += "ARVADOS_API_TOKEN=testtoken\n"
+	fileContent += "ARVADOS_API_HOST_INSECURE=true"
+
+	_, err = file.Write([]byte(fileContent))
+
+	// Invoke readConfigFromFile method with this test filename
+	config, err := readConfigFromFile(file.Name())
+	c.Assert(err, Equals, nil)
+	c.Assert(config["ARVADOS_API_HOST"], Equals, "testhost")
+	c.Assert(config["ARVADOS_API_TOKEN"], Equals, "testtoken")
+	c.Assert(config["ARVADOS_API_HOST_INSECURE"], Equals, "true")
+	c.Assert(config["EXTERNAL_CLIENT"], Equals, "")
+}
+
+// Test keep-rsync initialization, with src and dest keep servers.
+// Do a Put and Get in src, both of which should succeed.
+// Do a Get in dest for the same hash, which should raise block not found error.
+func (s *ServerRequiredSuite) TestRsyncPutInSrc_GetFromDestShouldFail(c *C) {
+	setupRsync(c)
+
+	// Put a block in src using kcSrc and Get it
+	data := []byte("test-data")
+	hash := fmt.Sprintf("%x", md5.Sum(data))
+
+	hash2, rep, err := kcSrc.PutB(data)
+	c.Check(hash2, Matches, fmt.Sprintf(`^%s\+9(\+.+)?$`, hash))
+	c.Check(rep, Equals, 2)
+	c.Check(err, Equals, nil)
+
+	reader, blocklen, _, err := kcSrc.Get(hash)
+	c.Assert(err, Equals, nil)
+	c.Check(blocklen, Equals, int64(9))
+	all, err := ioutil.ReadAll(reader)
+	c.Check(all, DeepEquals, data)
+
+	// Get using kcDest should fail with NotFound error
+	_, _, _, err = kcDest.Get(hash)
+	c.Assert(err.Error(), Equals, "Block not found")
+}

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list