[ARVADOS] updated: 7575c3c5cdd9874505669b5aac86959a5231a0d5

Git user git at public.curoverse.com
Fri Jun 24 10:11:59 EDT 2016


Summary of changes:
 sdk/go/arvados/keep_service.go    |  8 ++++++++
 services/datamanager/keep/keep.go | 18 ++++++++++++++----
 2 files changed, 22 insertions(+), 4 deletions(-)

       via  7575c3c5cdd9874505669b5aac86959a5231a0d5 (commit)
      from  e686d4f07446cc0af28e74039282e6d1e75179db (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 7575c3c5cdd9874505669b5aac86959a5231a0d5
Author: Tom Clegg <tom at curoverse.com>
Date:   Fri Jun 24 10:08:45 2016 -0400

    9437: Accept 1-second timestamps from old keepstore servers.
    
    Running a new keep-balance/datamanager with old keepstore servers will
    interpret timestamps correctly.
    
    Running an old keep-balance/datamanager with new keepstore servers
    will not perform any garbage collection: interpreting the new
    nanosecond timestamps as 1-second timestamps will result in all blocks
    appearing to come from the future, making them ineligible for
    trash/delete.

diff --git a/sdk/go/arvados/keep_service.go b/sdk/go/arvados/keep_service.go
index 87dbd2a..b29748a 100644
--- a/sdk/go/arvados/keep_service.go
+++ b/sdk/go/arvados/keep_service.go
@@ -109,6 +109,14 @@ func (s *KeepService) Index(c *Client, prefix string) ([]KeepServiceIndexEntry,
 		if err != nil {
 			return nil, fmt.Errorf("Malformed index line %q: mtime: %v", line, err)
 		}
+		if mtime < 1e12 {
+			// An old version of keepstore is giving us
+			// timestamps in seconds instead of
+			// nanoseconds. (This threshold correctly
+			// handles all times between 1970-01-02 and
+			// 33658-09-27.)
+			mtime = mtime * 1e9
+		}
 		entries = append(entries, KeepServiceIndexEntry{
 			SizedDigest: SizedDigest(fields[0]),
 			Mtime:       mtime,
diff --git a/services/datamanager/keep/keep.go b/services/datamanager/keep/keep.go
index e7843ea..651c869 100644
--- a/services/datamanager/keep/keep.go
+++ b/services/datamanager/keep/keep.go
@@ -430,13 +430,23 @@ func parseBlockInfoFromIndexLine(indexLine string) (blockInfo BlockInfo, err err
 		return
 	}
 
-	blockInfo.Mtime, err = strconv.ParseInt(tokens[1], 10, 64)
+	var ns int64
+	ns, err = strconv.ParseInt(tokens[1], 10, 64)
 	if err != nil {
 		return
 	}
-	blockInfo.Digest =
-		blockdigest.DigestWithSize{Digest: locator.Digest,
-			Size: uint32(locator.Size)}
+	if ns < 1e12 {
+		// An old version of keepstore is giving us timestamps
+		// in seconds instead of nanoseconds. (This threshold
+		// correctly handles all times between 1970-01-02 and
+		// 33658-09-27.)
+		ns = ns * 1e9
+	}
+	blockInfo.Mtime = ns
+	blockInfo.Digest = blockdigest.DigestWithSize{
+		Digest: locator.Digest,
+		Size:   uint32(locator.Size),
+	}
 	return
 }
 

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list