From patchwork Thu Jan 21 15:53:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Noah Watkins X-Patchwork-Id: 8082671 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id B65599F440 for ; Thu, 21 Jan 2016 15:53:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B4FB6204D8 for ; Thu, 21 Jan 2016 15:53:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B889C204D6 for ; Thu, 21 Jan 2016 15:53:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759712AbcAUPxZ (ORCPT ); Thu, 21 Jan 2016 10:53:25 -0500 Received: from mail-io0-f170.google.com ([209.85.223.170]:36838 "EHLO mail-io0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752233AbcAUPxX (ORCPT ); Thu, 21 Jan 2016 10:53:23 -0500 Received: by mail-io0-f170.google.com with SMTP id g73so59701177ioe.3 for ; Thu, 21 Jan 2016 07:53:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=Bx+nDwycpdfbtJc0kvqIOb+blEMUc4lnzDov9NFa5pc=; b=mjHJHBOsZMT5pJEbO6C+/ObY8LWJlAA0GbYEKKY66j4IUSrbibDi+8OErjwNXbfGT+ 6ziP+ZSHgSAq0PVGZlbCDCRCHBDjNNb7cGSJRuyXMBXFOK3ZB1p04ScqB9fuJpUdbPl+ RO5IQTbnxG4Wwg7qCq8Zr/83LHAQPKWygbGO8pJcXdRHGauY9nDbPxzBj7iXHL3VuUF4 4k5mabDEiui4D5ayTzsnj0/fqZnrU0Y+9/C2kPjZBjchpQ+kGFGOqPHIFx/8BWvDJ8Xg zAo7Hh4mC577mo1Xb2Ql3QhHFivTuDkEqk8EG56Nh5NH81Fkq7uKajjfiQgfi67P4zwK 18uw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to :content-type; bh=Bx+nDwycpdfbtJc0kvqIOb+blEMUc4lnzDov9NFa5pc=; b=GJLwmQwOD8cbP/6bXzoOeA9+u9+4sceckpLrKAbcyxCIe5cUhOFi2VfLXpLhY/AtVi d65+O5GXrglBwBx3FPWxCsJQGfVRgYjJ8sGekFBmEJlA3cBv21V0FGZX8sY+CT8rWWul lZr2SJIiuZtFH1uhBbe2bEefkS+rBDmjYJ4KccfjXtM77Kik99RsdFm1O+CqkASe2TJh oyh9ojwbDNkttIQWuaYI9Et/kXliqJfnCA8jxEjTOfyOYmZA1jjlv8w0yuxQnQMur9qN PhKuBU57uswPRivcbD/gYwMP3pcL+YH+7yep80txLtLro1BuSIYTSlicvhiZoNMh4m5a nLgA== X-Gm-Message-State: ALoCoQnnHvLbsjzsL/Ah60VQgxZZpKjFQmhf9enQNCbPBuAB5sMO5hP4/PaZIeeS+kHp8ZPfPgBDcFMLtvwb6YHQJ80wGlHTqA== MIME-Version: 1.0 X-Received: by 10.107.137.67 with SMTP id l64mr39865713iod.102.1453391603143; Thu, 21 Jan 2016 07:53:23 -0800 (PST) Received: by 10.64.229.66 with HTTP; Thu, 21 Jan 2016 07:53:23 -0800 (PST) Date: Thu, 21 Jan 2016 07:53:23 -0800 Message-ID: Subject: inconsistent rados semantics between automake/cmake builds From: Noah Watkins To: ceph-devel Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP I'm seeing an anomaly of semantics between Ceph built with Automake and with CMake. I've not been lucky so far tracking this down so I thought I'd toss it out here. Here is the basic test description to reproduce (patch below, and available at mtime branch: github.com/noahdesu/ceph mtime): 0. create object class method to return object mtime via stat 1. from librados client, create an object with write_full 2. print mtime1 returned from ioctx.stat 3. print mtime2 returned from object class method via exec (step [0]) 4. compare mtime1,2: values should be equal (step [3] didn't modify anything) The first valid question is assertion [4] true? In either case, what is weird, is that this test works (ie both mtime values are equal) when I build with automake, and does not work when I build with cmake. The times have a large difference, and the mtime on the OSD seems to travel back in time w.r.t. to the time on the client. Tests are the same machine. Automake Steps: ./autogen.sh ./configure make cd src vstart.sh -x -n -l ./ceph_test_cls_hello --gtest_filter=ClsHello.ReturnMtime [ RUN ] ClsHello.ReturnMtime from client: 1453391360 from osd: 1453391360 (EQUAL) CMake Steps: mkdir build cd build cmake .. make ./src/vstart.sh -x -n -l ./src/test/test_cls_hello --gtest_filter=ClsHello.ReturnMtime [ RUN ] ClsHello.ReturnMtime from client: 1453528535 from osd: 1453388425 (OLDER) ----- --- To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/src/cls/hello/cls_hello.cc b/src/cls/hello/cls_hello.cc index 878130f..1c2d00c 100644 --- a/src/cls/hello/cls_hello.cc +++ b/src/cls/hello/cls_hello.cc @@ -47,6 +47,7 @@ cls_method_handle_t h_writes_dont_return_data; cls_method_handle_t h_turn_it_to_11; cls_method_handle_t h_bad_reader; cls_method_handle_t h_bad_writer; +cls_method_handle_t h_return_mtime; /** * say hello - a "read" method that does not depend on the object @@ -291,6 +292,22 @@ PGLSFilter *hello_filter() return new PGLSHelloFilter(); } +static int return_mtime(cls_method_context_t hctx, bufferlist *in, bufferlist *out) +{ + uint64_t size; + time_t mtime; + + int ret = cls_cxx_stat(hctx, &size, &mtime); + if (ret) { + CLS_ERR("ERROR: return_mtime %d", ret); + return ret; + } + + ::encode(mtime, *out); + + return 0; +} + /** * initialize class @@ -339,6 +356,11 @@ void __cls_init() cls_register_cxx_method(h_class, "bad_writer", CLS_METHOD_RD, bad_writer, &h_bad_writer); + // mtime test + cls_register_cxx_method(h_class, "return_mtime", + CLS_METHOD_RD | CLS_METHOD_WR, return_mtime, + &h_return_mtime); + // A PGLS filter cls_register_cxx_filter(h_class, "hello", hello_filter); } diff --git a/src/test/cls_hello/test_cls_hello.cc b/src/test/cls_hello/test_cls_hello.cc index efd9fc7..70364d0 100644 --- a/src/test/cls_hello/test_cls_hello.cc +++ b/src/test/cls_hello/test_cls_hello.cc @@ -183,3 +183,32 @@ TEST(ClsHello, Filter) { ASSERT_EQ(0, destroy_one_pool_pp(pool_name, cluster)); } +TEST(ClsHello, ReturnMtime) { + Rados cluster; + std::string pool_name = get_temp_pool_name(); + ASSERT_EQ("", create_one_pool_pp(pool_name, cluster)); + IoCtx ioctx; + cluster.ioctx_create(pool_name.c_str(), ioctx); + + char buf[128]; + memset(buf, 0xcc, sizeof(buf)); + bufferlist obj_content; + obj_content.append(buf, sizeof(buf)); + + ASSERT_EQ(0, ioctx.write_full("oid", obj_content)); + + uint64_t size; + time_t mtime; + + ASSERT_EQ(0, ioctx.stat("oid", &size, &mtime)); + std::cout << "from client: " << mtime << std::endl; + + bufferlist in, out; + ASSERT_EQ(0, ioctx.exec("oid", "hello", "return_mtime", in, out)); + + bufferlist::iterator it = out.begin(); + ::decode(mtime, it); + std::cout << " from osd: " << mtime << std::endl; + + ASSERT_EQ(0, destroy_one_pool_pp(pool_name, cluster)); +}