Commit Graph

142 Commits

Author SHA1 Message Date
Agniva De Sarker
09d2f698cc MM-31061: Remove pointers to slice (#16631)
* MM-31061: Remove pointers to slice

This PR removes instances of pointers
to slices in the codebase. There are some other instances in app/import_functions.go
but that's necessary to prevent empty arrays from appearing in the JSON output.

```release-note
NONE
```

https://mattermost.atlassian.net/browse/MM-31061

* fix tests
2021-01-06 21:23:00 +05:30
Ibrahim Serdar Acikgoz
f9c0c1072f [MM-31360] downgrade error logs which doesn't break the flow (#16612)
* downgrade error logs which doesn't break the flow

* reflect revivew comments
2021-01-04 17:02:34 +03:00
Agniva De Sarker
c1dd23a3c8 MM-31063: Change constants to use CamelCase (#16608)
* MM-31063: Change constants to use CamelCase

* store package

* change allcaps to camel case (#16615)

* New tools.mod

Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>
2021-01-04 11:32:29 +05:30
Ibrahim Serdar Acikgoz
40e16ba07f [MM-31359] remove duplicated error logs (#16583)
* remove duplicated error logs

* reflect review comments

* add context

* add error details
2020-12-29 09:48:36 +03:00
Agniva De Sarker
c54b262351 MM-31356: Add a minimum required version check for Postgres (#16597)
* MM-31356: Add a minimum required version check for Postgres

To keep conformance with our failing fast and obvious philosophy,
we add a check to prevent Mattermost server from starting
if the postgres version is below 10.0.

This gives customers a chance to upgrade their database before upgrading
their Mattermost version, than to run into weird compatibility issues
after they have finished the upgrade.

https://mattermost.atlassian.net/browse/MM-31356

```release-note
NONE
```

* fix lint errors

* Use a function to pretty-print version string

* rectify comment
2020-12-23 22:06:13 +05:30
Agniva De Sarker
1a131b54af MM-31064: Simplify indentation (#16565)
* MM-31064: Simplify indentation

Reduce indentation where possible.

```release-note
NONE
```

Command ran to verify:
golangci-lint run --disable-all --enable golint --max-issues-per-linter=10000 --max-same-issues=100000 ./... | grep "block ends with a return state"

https://mattermost.atlassian.net/browse/MM-31064

* incorporate review comments

* enable golint for outdent rule

* fix remaining issues

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-12-21 18:50:47 +03:00
Jesús Espino
7419898449 Remove usages of AppError on filesstore service (#15841)
* Remove usages of AppError on filesstore service

* Fixing a golint error

* Fixing shadowed variable

* Adding err.Error() to the NewAppError calls

* Fixing tests

* Adding missed translations

* Fix error handling and updating the translation that affects it

* Fixing two typos
2020-12-20 12:53:07 +01:00
Florent Peterschmitt
349b83f23a implement and use striped LRU cache to lower mutex contention (#15764)
* Implement Striped LRU cache

* ci

* fix

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-12-09 19:25:14 +05:30
Scott Bishel
f548ecbee1 MM-27688-OpenId Connect (#16222)
* implement openid connect

* update error strings

* handle OpenIdSetting.Secret as FAKE SETTING

* add openid to telemetry

* update config defaults, add telemetry

* fix bug with Office365

* Retrieve Office365 AuthData from IdToken

* fix linter

* add feature flag, reset defaults for config

* fix build error

* fix unit tests

* add authentication permission to Feature
Flags

* turn off feature flag

* set default button color

* set default button color only on openid

* fix for merging FeatureFlags in config

* remove feature flag

* revert config changes

* remove debug statements

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-12-08 19:58:37 -07:00
Jesse Hallam
cd9185fa23 MM-30801: pre-package channel export plugin (#16406)
* MM-30801: pre-package channel export plugin

The [channel export plugin](https://github.com/mattermost/mattermost-plugin-channel-export) complements [incident management](https://github.com/mattermost/mattermost-plugin-incident-management).

* only enable IM/CE by default on enterprise ready builds
2020-12-04 15:09:05 -04:00
Claudio Costa
df906cad9d [MM-28422] Enable processing of import files through API (#16062)
* Implement unzip function

* Implement FileSize method

* Implement path rewriting for bulk import

* Small improvements

* Add ImportSettings to config

* Implement ListImports API endpoint

* Enable uploading import files

* Implement import process job

* Add missing license headers

* Address reviews

* Make path sanitization a bit smarter

* Clean path before calculating Dir

* [MM-30008] Add mmctl support for file imports (#16301)

* Add mmctl support for import files

* Improve test

* Remove unnecessary handlers

* Use th.TestForSystemAdminAndLocal

* Make nouser id a constant
2020-12-03 11:38:00 +01:00
Sudheer
6cebcead22 MM-27989 Remove experimental setting for data prefetch (#16306)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-12-02 11:14:30 -05:00
Jesús Espino
a74fe05695 Removing supplier concept from the sql store (#16355)
* Removing supplier concept from the sql store

* Removing other metions to supplier

* Fixing gofmt

* Fixing gofmt

* Renaming NewSqlStore to New

* Fixing tests

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-12-02 12:06:23 +01:00
John Tzikas
3fdc6cb531 Fix misspellings and enable misspell on ci (#16285)
Co-authored-by: Ben Schumacher <ben.schumacher@mattermost.com>
2020-12-01 16:27:05 +01:00
Agniva De Sarker
6a56af2a14 MM-30863: Fix race in LRU (#16382)
* MM-30863: Fix race in LRU

After shortening the critical section, we missed out the fact
that the byte slice is still accessible after the element is returned.
So the lock needs to be active until the byte slice is fully read and
unmarshaled

https://mattermost.atlassian.net/browse/MM-30863

```release-note
NONE
```

* incorporate suggestions

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-11-26 20:24:23 +05:30
Akshay Chhajed
26676953a4 MM-30140 LRU critical section optimization (#16184)
* MM-30140 LRU critical section optimization

* Remove empty line

* Renamed lru function
2020-11-20 11:29:27 +01:00
Eli Yukelzon
cf4df5fcd2 MM-30048 added thread related socket messages (#16234)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-11-20 11:00:52 +02:00
Jesse Hallam
2ac83ffac7 MM-30800: prepackage incident management 1.1 (#16323)
* prepackage incident management v1.1 (#16195)

Fixes: https://mattermost.atlassian.net/browse/MM-30800

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>

* update telemetry whitelist

* newer version!

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-11-19 16:13:53 -04:00
Ben Schumacher
4063f407a1 Use different user-agent for twitter links (#16210) 2020-11-17 14:48:51 +01:00
Miguel de la Cruz
6c857a4525 [MM-30436] Add support for configuration custom defaults (#16265)
* [MM-30436] Add support for configuration custom defaults

* Addressing review comments

* Addressing PR comments

* Soft fail if the configuration defaults cannot be read

* Directly print error in log message

* Fix linter

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-11-16 15:25:48 +01:00
Agniva De Sarker
0ca8cb36b4 MM-26425: Make URL parsing for image proxy more robust (#16197)
* MM-26425: Make URL parsing for image proxy more robust

- We don't bypass protocol relative URLs.
- We don't bypass hostnames with a similar prefix.

https: //mattermost.atlassian.net/browse/MM-26425

```release-note
NONE
```

* fix tests and incorporate review comments

* Handle opaque URLs

* Fix path tests

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-11-10 13:06:59 +05:30
Harrison Healey
dc030bebbf MM-30090 Add telemetry for ManagedResourcePaths (#16221) 2020-11-06 08:32:37 -05:00
Agniva De Sarker
66731e2740 MM-29980: Optimize profilesInChannels cache to fast path (#16116)
* MM-29980: Optimize profilesInChannels cache to fast path

We add one more message type to the fast path- profiles in channels. There
are 2 primary reasons for this:

- This is not really a new model type, but just a map of users. And users already use
the fast path. So we can get some more gains without really investing much more code.
- A more important reason is that with the upcoming striped mutex changes, we will get
a higher throughput at the cost of a bit more CPU utilization. The reason being that
since less amount of time will be spent in lock-contention, the CPU is free to do more
stuff. So this change is to counter that increase.

As usual, this gives much better performance than the original decoder.

Micro-benchmark results
```
name               old time/op    new time/op    delta
LRU/UserMap=new-8    16.6µs ± 3%     3.9µs ± 4%  -76.15%  (p=0.000 n=10+10)

name               old alloc/op   new alloc/op   delta
LRU/UserMap=new-8    4.78kB ± 0%    2.74kB ± 0%  -42.65%  (p=0.000 n=10+10)

name               old allocs/op  new allocs/op  delta
LRU/UserMap=new-8      38.0 ± 0%      30.0 ± 0%  -21.05%  (p=0.000 n=10+10)
```

https://mattermost.atlassian.net/browse/MM-29980

Here are some results from a load test. The comparison is done with a 2 node cluster; one running master
and one running with this patch so that it's easier to compare. The total users are 2000.

<See PR>

```release-note
NONE
```

* Fix gofmt

* Trigger CI
2020-11-04 10:08:10 +05:30
Christopher Speller
1aadd36644 MM-28859 Add feature flag managment system using split.io and remove viper. (#15954)
* Add feature flag managment system using split.io and remove viper.

* Fixing tests.

* Attempt to fix postgres tests.

* Fix watch filepath for advanced logging.

* Review fixes.

* Some error wrapping.

* Remove unessisary store interface.

* Desanitize SplitKey

* Simplify.

* Review feedback.

* Rename split mlog adatper to split logger.

* fsInner

* Style.

* Restore oldcfg test.

* Downgrading non-actionable feature flag errors to warnings.

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-10-29 15:54:39 -07:00
Jesús Espino
8d5be2d657 Document extractor service (#15665)
* Document extractor service

* Fixing vendor modules

* Addressing PR Review comments

* Some small simplifications

* Fixing a linter complain

* simplifying a bit the code using package variables

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-10-27 15:58:38 +01:00
Rodrigo Villablanca
96f1739f8f UserStore migration (#15563)
* Migration completed

* Fix tests

* Fix tests

* Fix tests

* Suggestions

* Trigger CI

* Suggestions

* Merge with master

* Trigger CI

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Agniva De Sarker <agnivade@yahoo.co.in>
2020-10-26 15:11:27 +05:30
Agniva De Sarker
d2730014f9 MM-29525: Strip path_prefix from ListDirectory (#15949)
* MM-29525: Strip path_prefix from ListDirectory

An AWS path prefix is meant to be an implementation detail
which the calling application should not be aware of. Hence, we should
strip the path prefix when returning objects in a directory
because they anyways get applied while using the other APIs

https://mattermost.atlassian.net/browse/MM-29525

* simplify

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-10-25 22:09:38 +05:30
Scott Bishel
f46661d7a9 MM-28882:ignore guest ldap sync (#15936)
* add ignoreGuestsLdapSync to config, update interface

* update interface

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-10-21 20:12:12 -06:00
Jesús Espino
f7854f9645 Skipping some telemetry tests on production builds (#16007) 2020-10-19 16:15:54 +02:00
Agniva De Sarker
4b57cea789 MM-29572: Add Bifrost support to codebase (#15955)
* MM-29572: Add Bifrost support to codebase

We use a custom transport for minio when an environment variable
indicates that Mattermost is running in cloud.

The transport is used to redirect the request to the S3 endpoint set
in the config. And the scheme is set depending on if S3SSL is set.

A custom credentials provider is needed to return empty credentials
which will be overridden by the service anyways. This is just to allow
the minio client library to work transparently without knowing that
there is something else in the middle intercepting requests.

https://mattermost.atlassian.net/browse/MM-29572

* incorporate review comments

* Update services/filesstore/s3_overrides.go

Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>

* Change to new env key

Co-authored-by: Ibrahim Serdar Acikgoz <serdaracikgoz86@gmail.com>
2020-10-15 22:39:23 +05:30
Agniva De Sarker
944841a237 MM-29573: Reuse s3 client amongst all requests (#15948)
* MM-29573: Reuse s3 client amongst all requests

An http.Client is meant as a long-term object to be reused between
consecutive requests. This reduces burden on HTTP servers by reusing TCP connections
and also makes things faster by avoiding the TCP handshake for every single request.

https://mattermost.atlassian.net/browse/MM-29573

* Trigger CI

* Fix i18n

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-10-15 08:54:57 +05:30
George Goldberg
5f58e3f286 MM-28540: Add missing config telemetry for 5.28 release. (#15858)
* Add missing enterprise/cloud telemetry.

* Telemetry for notices settings.
2020-10-07 16:34:03 +01:00
Rodrigo Villablanca
bb4df5a68e ChannelStore migration Part 3 (#15504)
* Migration finished

* Change error var name

* Fix imports

* Fix tests

* Merge with master

* Doing some suggestions

* More suggestions

* Fix i18n

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Co-authored-by: Agniva De Sarker <agnivade@yahoo.co.in>
2020-10-04 10:12:29 +05:30
Claudio Costa
ff42c97ab7 [MM-29229] Set part size for S3 uploads to avoid excessive allocation (#15737)
* Set part size for S3 uploads

* Include benchmark
2020-10-02 19:14:16 +02:00
Agniva De Sarker
e15308e840 MM-29033: Modify Test S3 connection to handle path prefix (#15659)
* MM-29033: Modify Test S3 connection to handle path prefix

When a IAM user is just allowed access to a specific path prefix,
the bucket exists test will fail because that is applicable to the entire bucket.

We modify that check to just list objects under that path prefix and return
on the first non-nil error.

Another consideration was to do a StatObject, but it is only applicable to actual
objects and not at a directory level. Path prefixes are entirely logical and depends
on the underlying implementation. Therefore, ListObjects is a better choice.

https://mattermost.atlassian.net/browse/MM-29033

* Improve logic

* tmp

* Only receive
2020-10-02 00:10:28 +05:30
Jesús Espino
ca145a83bd Rudder key and dataplane in Config with env vars (#15572)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-10-01 18:33:44 +02:00
Agniva De Sarker
0e90606547 MM-29011: Add feature flag for shared channels (#15585)
* MM-29011: Add feature flag for shared channels

https://mattermost.atlassian.net/browse/MM-29011

* gofmt

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-10-01 10:37:15 +05:30
catalintomai
1c0d590c81 Add AWS Metering service support (#15290) 2020-09-28 11:43:08 -07:00
Ben Schumacher
7c905b0890 [MM-28707] Fix plugin version telemetry for air gaped installations (#15509) 2020-09-25 19:13:02 +02:00
Rodrigo Villablanca
8118cac350 Poststore migration part3 (#15505)
* Migration completed

* Order in translations file

* Fix: lints

* Trigger CI

* Fix message key

* Change mlog.Error for mlog.Warn

* Fix imports

* Adding translations needed for EE

* Trigger CI

* Fix merge with master

Co-authored-by: Agniva De Sarker <agnivade@yahoo.co.in>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-09-24 10:46:36 +05:30
Ashish Bhate
cd7d68effb [MM-25647][MM-25659] Add missed config settings to telemetry (#15506)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-09-24 10:23:23 +05:30
Miguel de la Cruz
1d2220141e [MM-26420] Adds wildcard support to Bleve (#14885) 2020-09-18 10:49:56 +02:00
Claudio Costa
4c64cec948 Fix failing test (#15522)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-09-17 08:53:04 +02:00
Rodrigo Villablanca
f0fc51244c TeamStore migration Part 3 (#15397)
* Migration completed

* TODO
2020-09-16 12:12:10 -03:00
Claudio Costa
9c272f0b20 [MM-26812] Add support for resumable file uploads (#15252)
* Implement AppendFile for FileBackend

* Split test into subtests

* [MM-26812] Add support for resumable file uploads (#15252)

* Implement UploadSession

* Implement UploadSessionStore

* Add error strings

* Implement resumable file uploads

* Add UploadType

* Fix retry layer tests

* Regenerate store layers

* Fix store error handling

* Use base for filename

* Prevent concurrent uploads on the same upload session

* Fix erroneus error string

* Improve error handling

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>

* Fix translations

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-09-15 21:28:25 +02:00
Farhan Munshi
6a58834f34 [MM-28475] Add server telemetry for the new system roles (#15437)
* MM-28475 Add server telemetry for the new system roles

* Move system roles to permissions_system_scheme table

* Add testing mocks
2020-09-15 14:21:32 -04:00
Jesús Espino
473e286feb Fix telemetry initialization problem on placeholder usage (#15434) 2020-09-15 08:38:19 +01:00
George Goldberg
4ff12c2aed MM-28115: Add env var for telemetry installation type. (#15431) 2020-09-15 08:27:35 +01:00
Scott Bishel
eba38625eb Implement LDAP Certificate (#15361)
* Implement LDAP Certificate

* add diagnostics and translations

* update from code review

* pass pointer to update pict function

* pass object to first function

* remove debug log messages

* update test to add localmode test

* update lint errors

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-09-14 12:53:42 -06:00
Jesús Espino
1058090a24 Add support for rc versions in upgrader (#15424) 2020-09-10 16:30:03 +02:00