Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to support Edge Server #2202

Open
wants to merge 49 commits into
base: master
Choose a base branch
from
Open

Changes to support Edge Server #2202

wants to merge 49 commits into from

Conversation

snej
Copy link
Collaborator

@snej snej commented Jan 8, 2025

This branch contains all the LiteCore enhancements & fixes needed to implement Edge Server.

IMPORTANT: There are also changes in the EE repo: https://github.com/couchbase/couchbase-lite-core-EE/pull/47

  • Removed the REST server code, and a few support classes like RequestResponse; that's now in Edge Server.
  • Modified RESTSyncListener to avoid using RequestResponse, which simplified the code. (That's in the EE repo.)
  • Some API changes to C4Listener since it no longer supports serving the REST API.
  • The replicator now uses the new DatabasePool. By default, DBAccess will create its own pool of size 1, but an alternate Replicator constructor gives an existing shared pool for it to use. This will greatly reduce the overhead of running lots of replicators at once.
  • More stuff, described in the individual commits.

snej added 30 commits January 7, 2025 11:14
- Removed RESTListener
- Misc. internal API additions / changes / fixes
WITH_ERROR can't use Catch's UNSCOPED_INFO(), but I've amended it to
use WARN(), which will also show up in the test results.
If the pool is opened with a read-only db, then borrowWriteable()
should immediately throw NotWriteable, not wait for a db to be
returned and then throw Busy.
c4Replicator+Pool.hh defines factory functions to start a replicator
given a DatabasePool* not a C4Database*.
This shields callers from having to include c4DatabaseImpl.hh etc.,
which drag in a buttload of internal replicator headers.
Gives Task subclasses more control over when a finished task should
be removed from the listing. Needed for ChangesTask.
Return value is true if index was created or replaced,
false if nothing changed.
- clang-format
- BorrowedCollection retains its C4Collection
- Fixed warnings about out-of-order initializers
- Fixed some params that needed C4NULLABLE
- Removed unused SyncListener member variables
CBL_CORE_API shouldn't be used on the _definitions_ of data values,
only their _declarations_.
Removing changes that became unnecessary
adding some LIFETIMEBOUND
snej and others added 14 commits January 7, 2025 11:14
This occurs when EdgeServer sends an HTTP response but the client
has closed the socket.
clang-format reformats the declaration of "challengeAuth" weirdly,
with a two-line comment that has a '\' at the end of the first line.
GCC warns about this with -Wall.
Moved the doc-comment above the declaration to prevent this.
Internally, I streamlined the RecordEnumerator API by folding the
other initialization parameters into the Options struct.
- ICU is now downloaded as part of the build
- No more top level build server CMake wrapper is needed
- LiteCore and LiteCoreStatic targets can be disabled to avoid having needless install output
- Move sTempDir into LogEncoderTest.cc so it can be shared between CppTests and cbl-logtest
for EdgeServer, as part of creating Etags
It caused errors when LITECORE_BUILD_TESTS or LITECORE_BUILD_SHARED
were turned off.
It's a no-op that got left in a commit (27d3530) by accident.
- HTTPLogic::parseHeaders() rejects control characters
- Added constant for status 415
- Proper errors in TCPSocket::readHTTPBody()
@snej
Copy link
Collaborator Author

snej commented Jan 8, 2025

Jenkins builds are failing due to a CMake error:

[2025-01-08T18:54:13.724Z] CMake Error at cmake/platform_linux.cmake:75 (target_link_libraries):
[2025-01-08T18:54:13.724Z]   Target "LiteCoreObjects" links to:
[2025-01-08T18:54:13.724Z] 
[2025-01-08T18:54:13.724Z]     icu::icu4c
[2025-01-08T18:54:13.724Z] 
[2025-01-08T18:54:13.724Z]   but the target was not found.  Possible reasons include:

@snej
Copy link
Collaborator Author

snej commented Jan 8, 2025

Ubuntu in GitHub CI is failing a test due to a runtime exception:

DB Info SQLite message: statement aborts at 36: [CREATE UNIQUE INDEX IF NOT EXISTS "kv_.loopback.test_seqs" ON "kv_.loopback.test" (sequence)] attempt to write a readonly database

I know how to fix this...

snej and others added 3 commits January 8, 2025 13:21
The index is created lazily. If a collection doesn't have one, an
operation using a read-only db from the pool might trigger creating
it, which will fail because it's read-only.

To work around this, DBAccess's constructor uses the writeable db
to call call `getDocumentBySequence` on every collection, forcing the
index to be created.
The search for ICU needs to happen on Linux desktop only.  Also, ensure that the BUILD_ENTEPRISE flag is properly set now that we don't use the wrapper CMake project anymore (also on Windows this happened)
@cbl-bot
Copy link

cbl-bot commented Jan 9, 2025

Code Coverage Results:

Type Percentage
branches 66.18
functions 78.11
instantiations 70.22
lines 77.36
regions 73.22

and bump compiler version to gcc 11 (required for using cbdeps ICU)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants