In concurrent thread,how can we avoid duplicate uri in cts:uris()? [closed] - locking

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
In a schedular ,which is running on all host at a time, right now I am using xdmp:lock-acquire to lock the collection, so that ,cts:uris will not pick the duplicate uris, but due to this scheduler is running in sequence .Is there any other alternative ,so that I avoid this lock, so that all run in parallel.

It's a bit unclear what you are trying to do, but it sounds like you have documents in the database that you are processing using a scheduled task, that runs on all hosts. Your existing query makes it possible for two tasks to attempt to process the same document.
The easiest would be to generate a list of forests on the host that the task is running on using xdmp:host-forests, and passing that list into cts:uris as $forest-ids
$forest-ids A sequence of IDs of forests to which the search will be
constrained. An empty sequence means to search all forests in the
database. The default is ().

Related

Is sharing the same database between two programming languages possible? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 11 days ago.
Improve this question
Program A is good at collecting data while Program B, in another language, is good at creating REST APIs. Is it possible to connect these two with a single database that A and B will read and write to? Performance for database operations is not really an issue in my case.
Sure this is possible. Databases typically can handle multiple connections from different programs/clients. A database does not really care which language the tool that is making the connection is written in.
Short edit:
Also most databases support "transactions". Which are used to cover that different connected clients do not break consistency of your application data while reading and writing in parallel.

How to delay all queries for a specified timespan? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
I'd like to delay all the queries I receive in my test database for a specified amount of time. My intent in doing this is to test the "loading" feature in my program. I do not want to alter my queries though! WAITFOR doesn't work for me. If possible, the ideal would be to delay all the queries of a specific connection.
Summarizing: I'd like to delay all the queries of my database via some kind of configuration.
How to do that in SQL Server?
To the best of my knowledge, this is not an out-of-the-box feature.
Most people who want to test their data access code write specific test cases to do that. Again, there are lots of different scenarios; the closest to what you describe would be to capture all the requests going to your server, and then write a harness to replay those queries under test conditions.
Is it really needed? And is there a way to put a delay on the code level? I mean do something like this before the database request.
Thread.Sleep(milliseconds);

How to protect a stored procedure file from reading - SQL Server [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I want to generate a file that contains a stored procedure query and I want to share it, but I need to protect it from reading. This query will be used by another person in his own database and server.
I want to give a SP to another person to use in a different environment but doesn't want them to be able to read the TSQL in the SP.
How can I do that?
You can use the WITH ENCRYPTION clause. However, it is known to be ineffective and easily broken, and there are third party tools available that will let your client break it.
If you want to do it anyway, a tutorial can be found here.
If you use WITH ENCRYPTION along with a thoughtfully constructed EULA, your client should not accidentally see the code, and if he purposefully goes to the trouble to crack your code encryption, you will have civil recourse (i.e. you can sue them).

SQL Server : create jobs [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I need to create a procedure which repeats itself several times. Let's say I want to change a character's position in a browser game for 3 minutes from one place to another. Its coordinates change constantly in the database. I need it to be dynamic so that I can use this code to move the character to more places in a different amount of time depending on the parameters passed to the procedure.
How can I do it?
Does jobs solve the problem? If so, how can I do it with jobs?
You could use the RAND() function to generate random coordinates, and a sql agent job to run the procedure throughout the day.
Since you mentioned that the coordinates change constantly in the database, you can have an update trigger that runs the stored procedure you have in mind instead of relying on a job. Let me know if you need more info on this.

the paxos in chubby [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
In chubby the process of each log that write to db is one instance of the paxos process, and this instance may have many proposers, so it will have a master selected process.
why it has many proposers?
Having a single leader (aka a "Distinguished Proposer") is an optimization for Paxos. The whole point of Paxos is to decide a value when there are multiple proposers proposing different things.
The whole point of having multiple proposers is in case the "Distinguished Proposer" fails; something has to pick up that new role. Paxos, when it decides a value, implicitly decides between proposers.
As in your other question, I suggest looking at the other Paxos questions, perhaps read Paxos Made Simple.