1. 28 8月, 2019 16 次提交
    • R
      [go function] fix: go function should parse conf content first (#4746) · cb486966
      Rui Fu 提交于
      ### Motivation
      
      `pulsar-function-go/conf` package apply `instance-conf-path` with default value `HOME_PATH+github.com/apache/pulsar/pulsar-function-go/conf/conf.yaml`, once function deployed, the running node may not have the yaml conf file exist, then go function will panic with `not found conf file` error.
      
      This PR changed the logic of config parsing, parse `confContent` first, then parse `confFilePath` if `confContent` empty.
      
      (cherry picked from commit 8a3b3af6)
      cb486966
    • M
      Allow to configure ack-timeout tick time (#4760) · fe687c3c
      Matteo Merli 提交于
      ### Motivation
      
      After the changes in #3118, there has a been a sharp increase of memory utilization for the UnackedMessageTracker due to the time buckets being created.
      
      This is especially true when the acktimeout is set to a larger value (eg: 1h) where 3600 time-buckets are being created. This lead to use 20MB per partition even when no message is tracked.
      
      Allowing to configure the tick time so that application can tune it based on needs.
      
      Additionally, fixed the logic that keeps creating hash maps and throwing them away at each tick time iteration, since that creates a lot of garbage and doesn't take care of the fact that the hash maps are expanding based on the required capacity (so next time they are already of the "right" size).
      
      On a final note: the current default of 1sec seems very wasteful. Something like 10s should be more appropriate as default.
      
      (cherry picked from commit f13af487)
      fe687c3c
    • S
      [test] add getters and setters to PulsarService & BrokerService (#4709) · f14a61a4
      Sijie Guo 提交于
      *Motivation*
      
      When using PulsarService or BrokerService for testing, it might require accessing
      the components in PulsarService and BrokerService. This change is adding setters
      and getters to access the components in PulsarService & BrokerService
      (cherry picked from commit 5cff1691)
      f14a61a4
    • B
      Fix: Add kubernetes namespace to function instance url (#4701) · 34b3a947
      Boyang Jerry Peng 提交于
      ### Motivation
      
      Currently, if the kubernetes namespace set to deploy functions in is different than the one in which brokers/workers reside, get status and stats doesn't work because the url for instances does not specify the namespace.
      (cherry picked from commit 8c3445ad)
      34b3a947
    • B
      fix: add anonymous role to proxy configuration (#4733) · cdd86426
      Boyang Jerry Peng 提交于
      (cherry picked from commit 26fc4efe)
      cdd86426
    • R
      set go function executable when download to local (#4743) · b7ca1060
      Rui Fu 提交于
      ### Motivation
      
      Currently golang function needs to be compiled before deploy to pulsar, so the executable permission is required when function package is downloaded to local node from bookkeeper. This PR is intent to make golang function package executable after download from bookkeeper, to make sure the function is ok to run.
      (cherry picked from commit bf58c8eb)
      b7ca1060
    • J
      Allow to create partitioned topic with 1 partition (#4764) · 0646d274
      Jia Zhai 提交于
      **Motivation**
      when create partitioned topic, there is a check that `numPartitions > 1`, if numPartitions==1, it will fail.
      Some user may want to create partitioned topic with only 1 topic at the start time, and during using it, could update to more topics later.
      
      **Modification**
      change check of `numPartitions > 1` to `numPartitions > 0`
      
      expect all existing ut passed.
      (cherry picked from commit 5162393c)
      0646d274
    • M
      Introduce strand to C++ client for exclusive control (#4750) · 7215cd6d
      massakam 提交于
      (cherry picked from commit d8f61553)
      7215cd6d
    • C
      Add deleted schema judgment when adding schema (#4731) · 1ba26094
      congbo 提交于
      ### Motivation
      to fix #4724
      
      ### Verifying this change
      Add the tests for it
      
      (cherry picked from commit 6ec2e16b)
      1ba26094
    • Y
      add timeout to internal rest api (#4762) · 198e154e
      Yuto Furuta 提交于
      (cherry picked from commit 9605aede)
      198e154e
    • M
      Fix C++ log level names in Log4cxxLogger (#4735) · d2a4ca4f
      massakam 提交于
      ### Motivation
      
      If trying to build master C++ code with the `USE_LOG4CXX` flag turned ON, compilation errors occur:
      ```
      /tmp/pulsar/pulsar-client-cpp/lib/Log4cxxLogger.cc: In static member function ‘static log4cxx::LevelPtr pulsar::Log4CxxLogger::getLevel(pulsar::Logger::Level)’:
      /tmp/pulsar/pulsar-client-cpp/lib/Log4cxxLogger.cc:53:18: error: ‘DEBUG’ was not declared in this scope
                   case DEBUG:
                        ^
      /tmp/pulsar/pulsar-client-cpp/lib/Log4cxxLogger.cc:55:18: error: ‘INFO’ was not declared in this scope
                   case INFO:
                        ^
      /tmp/pulsar/pulsar-client-cpp/lib/Log4cxxLogger.cc:57:18: error: ‘WARN’ was not declared in this scope
                   case WARN:
                        ^
      /tmp/pulsar/pulsar-client-cpp/lib/Log4cxxLogger.cc:59:18: error: ‘ERROR’ was not declared in this scope
                   case ERROR:
                        ^
      /tmp/pulsar/pulsar-client-cpp/lib/Log4cxxLogger.cc:52:16: error: enumeration value ‘LEVEL_DEBUG’ not handled in switch [-Werror=switch]
               switch (level) {
                      ^
      /tmp/pulsar/pulsar-client-cpp/lib/Log4cxxLogger.cc:52:16: error: enumeration value ‘LEVEL_INFO’ not handled in switch [-Werror=switch]
      /tmp/pulsar/pulsar-client-cpp/lib/Log4cxxLogger.cc:52:16: error: enumeration value ‘LEVEL_WARN’ not handled in switch [-Werror=switch]
      /tmp/pulsar/pulsar-client-cpp/lib/Log4cxxLogger.cc:52:16: error: enumeration value ‘LEVEL_ERROR’ not handled in switch [-Werror=switch]
      cc1plus: some warnings being treated as errors
      make[2]: *** [lib/CMakeFiles/pulsarStatic.dir/Log4cxxLogger.cc.o] Error 1
      make[2]: *** Waiting for unfinished jobs....
      ```
      
      This is because the enum values renamed in https://github.com/apache/pulsar/pull/4664 are still used in `Log4cxxLogger.cc`.
      
      ### Modifications
      
      Fixed the enum values used in `Log4cxxLogger.cc` by adding the prefix `LEVEL_`.
      
      (cherry picked from commit af8ea71a)
      d2a4ca4f
    • [issue 4589] Fix redelivered message logic of partition topic (#4653) · 04e11bb4
      冉小龙 提交于
      Fixes #4589
      
      Motivation
      When using Partition-topic, the logic of redeliver messages will not be triggered when the time of ackTimeout arrives.
      
      This is because the unAckedMessageTrackerPtr_->add(msg.getMessageId()) is not call in the listener handling of partitioned topic in cpp code
      (cherry picked from commit cc5f25bf)
      04e11bb4
    • L
      Change type of publish_time to timestamp (#4757) · 522f715f
      lipenghui 提交于
      Fixes #4734
      
      ### Motivation
      
      "publish_time" is Pulsar SQL internal column, as Pulsar only stores timestamps, it doesn’t store the timezone information. Use timestamp as "publish_time" type is more correct way in Pulsar SQL.
      
      ### Modifications
      
      Change type of publish_time to timestamp.
      
      ### Verifying this change
      
      predicate of publish_time is pushdown
      
      Use `__publish_time__` to trim messages:
      ```
      SELECT COUNT(*)
      FROM "sql-test-1"
      WHERE "__publish_time__" >= TIMESTAMP '2019-07-18 17:26:50.119'
      AND  "__publish_time__" < TIMESTAMP '2019-07-18 17:26:51.119';
      ```
      ![image](https://user-images.githubusercontent.com/12592133/61447301-43835080-a983-11e9-814b-bc2b378f02b9.png)
      
      Without `__publish_time__` predicate:
      ```
      SELECT COUNT(*)
      FROM "sql-test-1";
      ```
      ![image](https://user-images.githubusercontent.com/12592133/61447427-82190b00-a983-11e9-8d3f-3bf2a4798047.png)
      
      (cherry picked from commit 6f5416ee)
      522f715f
    • Y
      Remove fixed server type check in kerberos client (#4758) · a5df26b9
      Yong Zhang 提交于
      ## Motivation
      
      Currently, In Pulsar Kerberos authentication, The server type part of pulsar node principle is hard coded as "broker" and "proxy". The expected principle for pulsar nodes would be like "broker/brokera.host.name@your.com" or "proxy/proxyb.host.name@your.com".
      
      But some times, user may want to re-use existing principle like "u-service/host.name@some.com", to test and play around, then "u-service" will not match service type of "broker" or "proxy", and the authentication will be rejected.
      This change is to remove the check of "broker" or "proxy" service type check.
      
      ## Modifaction
      
      Remove the check of "broker" or "proxy" service type check.
      (cherry picked from commit f5b20cd3)
      a5df26b9
    • B
      Fix: predicate pushdown for Pulsar SQL NPE (#4744) · 99c36cf9
      Boyang Jerry Peng 提交于
      * Fix: predicate pushdown for Pulsar SQL NPE
      
      * fix unit test
      
      (cherry picked from commit ac10b006)
      99c36cf9
    • Fix the problem that the log folder in pulsa-function-go is ignored by (#4736) · 88ddc066
      冉小龙 提交于
      Signed-off-by: xiaolong.ran <ranxiaolong716@gmail.com>(cherry picked from commit 23dd38f3)
      88ddc066
  2. 27 8月, 2019 24 次提交
    • M
      Upgrade to Mockito 2.x (#4671) · 786e2b95
      Matteo Merli 提交于
      Upgrading to Mockito 2.28 and PowerMock 2.0. This a pre-step to be able to run CI with Java 11 / 12
      
      (cherry picked from commit 108780c7)
      786e2b95
    • T
      Support Pulsar schema for pulsar kafka client wrapper (#4534) · 6c67f948
      tuteng 提交于
      Fixes https://github.com/apache/pulsar/issues/4228
      
      Master Issue: https://github.com/apache/pulsar/issues/4228
      
      ### Motivation
      
      Use Pulsar schema in pulsar kafka client.
      
      ### Modifications
      
      Support schema of pulsar for pulsar kafka client
      
      ### Verifying this change
      
      Add Unit test
      (cherry picked from commit 99d3c11e)
      6c67f948
    • S
      [client] Provide a clock for generating publish timestamp for producers (#4562) · 60475dd1
      Sijie Guo 提交于
      *Motivation*
      
      Currently producers uses `System.currentTimeMillis()` as publish timestamp by default.
      However at some use cases, producers would like to a different way for generating publish timestamp.
      E.g. in a database use case, a producer might be use HLC (Hybrid Logic Clock) as publish timestamp;
      in integration tests, it might require the producer to use a deterministic way to generate publish timestamp.
      
      *Changes*
      
      This PR introduces a `clock` in building the client. This allows applications to override the system clock
      with its own implementation.
      
      *Verify the change*
      
      Add unit test to test customized clock in both batch and non-batch cases.
      
      (cherry picked from commit 7397b960)
      60475dd1
    • V
      Cleanup tests in the presto module (#4683) · 2c97da5e
      vzhikserg 提交于
      * Add static import statements for Assert to simplify the test in the presto module
      
      * Use the preferred way of the schema's creation. The predicates and functions were converted to lambda
      
      (cherry picked from commit c421ca6e)
      2c97da5e
    • T
      [Integeration-test]Fix integration-test failed when execute pip3 install pulsar_client (#4754) · eceb2c97
      tuteng 提交于
      * ### Motivation
      When installing the pulsar-client-2.5.0 using the image openjdk:8-jdk-slim, for debian 10 systems, python3.7 will be installed when apt-get install python3 is executed. When installing the client using pip3, the following exception will be thrown
      ```
      cat /etc/issue
      Debian GNU/Linux 10 \n \l
      
      root@40fdedf3f3c3:/# python3
      Python 3.7.3 (default, Apr  3 2019, 05:39:12)
      [GCC 8.3.0] on linux
      Type "help", "copyright", "credits" or "license" for more information.
      >>>
      
      root@40fdedf3f3c3:/# pip3 install pulsar_client-2.5.0-cp35-cp35m-manylinux1_x86_64.whl
      ERROR: pulsar_client-2.5.0-cp35-cp35m-manylinux1_x86_64.whl is not a supported wheel on this platform.
      ```
      
      ### Modifications
      
      Install Use pip3.5 instead of pip3.
      
      * Deleute no used tools
      
      * Fix Docker command
      
      (cherry picked from commit 0a59b4ce)
      eceb2c97
    • S
      [build] `docker/publish.sh` doesn't work for pulsar-all and pulsar-standalone images (#4705) · ed1dfa47
      Sijie Guo 提交于
      *Motivation*
      
      pulsar-all and pulsar-standalone dont tag correct as pulsar image.
      so it fails `docker/publish.sh`
      
      *Modifications*
      
      Tag no-repo for both latest and the release version for both pulsar-all and pulsar-standalone
      
      *Verify this change*
      
      After patching this change, `docker/publish.sh` works as expected.
      (cherry picked from commit d2164ebf)
      ed1dfa47
    • L
      Add allowAutoTopicCreation to broker.conf and reference configuration. (#4694) · 0c630e7a
      lipenghui 提交于
      (cherry picked from commit a0ec11ac)
      0c630e7a
    • I
      Don't consider deleted schema when checking compatibility (#4669) · 8b4ff2ba
      Ivan Kelly 提交于
      feca5bbb changed topic delete logic to delete the schema when the
      topic is deleted (though this only seems to be enabled for idle topic
      GC). This exposed a bug in compatibility checking whereby if the a
      subscription tries to attach to the topic, even if using the same
      schema as had been used previously, a compatibility exception will be
      thrown.
      
      This is because the topic still appears to have a schema, even though
      there is no actual schema data, just a tombstone. I've changed the logic
      to return no schema if the schema read back is a tombstone.
      
      The issue doesn't affect producers because the check was already
      correct there.
      
      I've also updated the check for transitive compatibility to remove the
      prefix of schemas before the deleted schema. Previously this was
      throwing an NPE on the broker as it couldn't decode the deleted
      schema.
      
      This issue was discovered by failures in the healthcheck. The check
      period (5 minutes) was longer than the GC period (60 seconds). I would
      expect it to hit quite often in other scenarios also.
      (cherry picked from commit d77980d2)
      8b4ff2ba
    • M
      Fixed the default port for https and http in admin client (#4623) · 87d1ddd2
      Matteo Merli 提交于
      * Fixed the default port for https and http in admin client
      
      * Fixed test expectation
      
      * Removed space added by mistake
      
      (cherry picked from commit c15c867c)
      87d1ddd2
    • L
      Add pulsar-io-influxdb to distribution. (#4678) · a91cfc45
      lipenghui 提交于
      (cherry picked from commit 1b64a6e1)
      a91cfc45
    • M
      Renamed C++ logger enum names to avoid conflicts with compiler macros (#4664) · e5be2291
      Matteo Merli 提交于
      ### Motivation
      
      Fixes #4655
      
      Some compiler will have defined a macro for `DEBUG` and it will clash with the enum value name. Adding prefix to avoid the macro replacement.
      (cherry picked from commit da4e9323)
      e5be2291
    • B
      fix issue when submitting NAR via file url (#4577) · 75683678
      Boyang Jerry Peng 提交于
      * fix issue when submitting NAR via file url
      
      * fix unit tests
      
      * add more specific errors
      
      * fix test
      
      (cherry picked from commit e8025d50)
      75683678
    • E
      C++ client producer sendAsync() method will be blocked forever, if enough... · c9d5b4a8
      Easyfan Zheng 提交于
      C++ client producer sendAsync() method will be blocked forever, if enough batched messages sent timeout. (#4569) (#4657)
      
      (cherry picked from commit 2f686157)
      c9d5b4a8
    • M
      Add perPartition parameter to partitioned-stats API (#4639) · f0c18c99
      massakam 提交于
      ### Motivation
      
      Currently, the partitioned-stats API response includes stats for each partition. However, if the number of partitions and clients is large, the size of the response will be very large. In such cases, it is useful to have a query parameter to get a response that does not include stats for each partition.
      
      ```sh
      $ curl -s http://localhost:8080/admin/persistent/sample/standalone/ns1/pt1/partitioned-stats | jq .
      
      {
        "msgRateIn": 0,
        "msgThroughputIn": 0,
        "msgRateOut": 0,
        "msgThroughputOut": 0,
        "averageMsgSize": 0,
        "storageSize": 0,
        "publishers": [],
        "subscriptions": {
          "sub1": {
            "msgRateOut": 0,
            "msgThroughputOut": 0,
            "msgRateRedeliver": 0,
            "msgBacklog": 0,
            "blockedSubscriptionOnUnackedMsgs": false,
            "msgDelayed": 0,
            "unackedMessages": 0,
            "msgRateExpired": 0,
            "consumers": [],
            "isReplicated": false
          }
        },
        "replication": {},
        "metadata": {
          "partitions": 2
        },
        "partitions": {
          "persistent://sample/standalone/ns1/pt1-partition-1": {
            "msgRateIn": 0,
            "msgThroughputIn": 0,
            "msgRateOut": 0,
            "msgThroughputOut": 0,
            "averageMsgSize": 0,
            "storageSize": 0,
            "publishers": [],
            "subscriptions": {
              "sub1": {
                "msgRateOut": 0,
                "msgThroughputOut": 0,
                "msgRateRedeliver": 0,
                "msgBacklog": 0,
                "blockedSubscriptionOnUnackedMsgs": false,
                "msgDelayed": 0,
                "unackedMessages": 0,
                "msgRateExpired": 0,
                "consumers": [],
                "isReplicated": false
              }
            },
            "replication": {},
            "deduplicationStatus": "Disabled"
          },
          "persistent://sample/standalone/ns1/pt1-partition-0": {
            "msgRateIn": 0,
            "msgThroughputIn": 0,
            "msgRateOut": 0,
            "msgThroughputOut": 0,
            "averageMsgSize": 0,
            "storageSize": 0,
            "publishers": [],
            "subscriptions": {
              "sub1": {
                "msgRateOut": 0,
                "msgThroughputOut": 0,
                "msgRateRedeliver": 0,
                "msgBacklog": 0,
                "blockedSubscriptionOnUnackedMsgs": false,
                "msgDelayed": 0,
                "unackedMessages": 0,
                "msgRateExpired": 0,
                "consumers": [],
                "isReplicated": false
              }
            },
            "replication": {},
            "deduplicationStatus": "Disabled"
          }
        }
      }
      ```
      
      ### Modifications
      
      Added query parameter named `perPartition` to the partitioned-stats API. The default value is true.
      
      (cherry picked from commit 977b1a85)
      f0c18c99
    • R
      [pulsar-broker] fix NPE at managed-ledger when fetch reader internal-stats (#4615) · 48f18cda
      Rajan Dhabalia 提交于
      ### Motivation
      
      Broker throws NPE when pulsar-admin tries to fetch stats-internal for topic with reader.
      
      ```
      Caused by: java.lang.NullPointerException
      	at org.apache.bookkeeper.mledger.impl.ManagedCursorImpl.getProperties(ManagedCursorImpl.java:234) ~[classes/:?]
      	at org.apache.pulsar.broker.service.persistent.PersistentTopic.lambda$getInternalStats$48(PersistentTopic.java:1461) ~[classes/:?]
      	at java.lang.Iterable.forEach(Iterable.java:75) ~[?:1.8.0_92]
      	at org.apache.pulsar.broker.service.persistent.PersistentTopic.getInternalStats(PersistentTopic.java:1446) ~[classes/:?]
      	at org.apache.pulsar.broker.admin.impl.PersistentTopicsBase.internalGetInternalStats(PersistentTopicsBase.java:621) ~[classes/:?]
      	at org.apache.pulsar.broker.admin.v2.PersistentTopics.getInternalStats(PersistentTopics.java:430) ~[classes/:?]
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_92]
      ```
      (cherry picked from commit b306552f)
      48f18cda
    • M
      Fixed C++ client lookup over HTTP on standalone (#4625) · 14de7213
      Matteo Merli 提交于
      (cherry picked from commit eea53b7b)
      14de7213
    • L
      Allows consumer retrieve the sequence id that the producer set. (#4645) · ab3fd598
      lipenghui 提交于
      * Allows consumer retrieve the sequence id that the producer set.
      
      * fix comments.
      
      (cherry picked from commit d107f676)
      ab3fd598
    • B
      Improve and add authorization to function download and upload (#4644) · ea6e604b
      Boyang Jerry Peng 提交于
      * Improve and add authorization to function download and upload
      
      * cleaning up
      
      * fix bug
      
      (cherry picked from commit 20cf7393)
      ea6e604b
    • L
      fix cause deadlock while use subscribeAsync demo in java client doc. (#4649) · 89c51740
      lipenghui 提交于
      (cherry picked from commit bbaf2d9e)
      89c51740
    • R
      [pulsar-broker] fix deadlock on get-status rest-api call (#4616) · 71b6e92f
      Rajan Dhabalia 提交于
      ### Motivation
      
      due to some issue if broker fails to complete topic-loading then getting stats of that topic blocks web-thread.
      
      ```
      "pulsar-web-30-13" #242 prio=5 os_prio=0 tid=0x00002b0b3c001000 nid=0x2540 waiting on condition [0x00002b0aa7d0a000]
         java.lang.Thread.State: WAITING (parking)
              at sun.misc.Unsafe.park(Native Method)
              - parking to wait for  <0x000000072560a180> (a java.util.concurrent.CompletableFuture$Signaller)
              at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
              at java.util.concurrent.CompletableFuture$Signaller.block(CompletableFuture.java:1693)
              at java.util.concurrent.ForkJoinPool.managedBlock(ForkJoinPool.java:3323)
              at java.util.concurrent.CompletableFuture.waitingGet(CompletableFuture.java:1729)
              at java.util.concurrent.CompletableFuture.join(CompletableFuture.java:1934)
              at org.apache.pulsar.broker.admin.impl.PersistentTopicsBase.getTopicReference(PersistentTopicsBase.java:1253)
              at org.apache.pulsar.broker.admin.impl.PersistentTopicsBase.internalGetStats(PersistentTopicsBase.java:592)
              at org.apache.pulsar.broker.admin.v1.PersistentTopics.getStats(PersistentTopics.java:240)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
              at java.lang.reflect.Method.invoke(Method.java:498)
      ```
      (cherry picked from commit f272df92)
      71b6e92f
    • B
      Add authorization to function worker REST endpoints (#4628) · 3b0c3ecb
      Boyang Jerry Peng 提交于
      (cherry picked from commit c0a57d0e)
      3b0c3ecb
    • Y
      [Client] Consumer for a single partition of a PartitionedTopic should be set... · e7d4f29a
      Yijie Shen 提交于
      [Client] Consumer for a single partition of a PartitionedTopic should be set with correct partitionIndex (#4591)
      
      This PR fixes #4586 by getting `partitionIndex` from topic name.
      (cherry picked from commit 5de6e6ba)
      e7d4f29a
    • R
      [pulsar-broker] make replication mtls configuration dynamic (#4609) · 145dd884
      Rajan Dhabalia 提交于
      (cherry picked from commit fd5d5c2f)
      145dd884
    • R
      [pulsar-broker] add Delete dynamic config api (#4614) · c1aa6457
      Rajan Dhabalia 提交于
      (cherry picked from commit 20d24996)
      c1aa6457